Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose generateManifest as reusable function #2411

Merged
merged 43 commits into from
Jul 15, 2024
Merged

Expose generateManifest as reusable function #2411

merged 43 commits into from
Jul 15, 2024

Conversation

PKief
Copy link
Member

@PKief PKief commented Jul 13, 2024

Changes

A comprehensive refactoring of the files and modules of this extension to be able to differentiate better between code which is related to the vscode library.

📦 src
 ┣ 📂 core         <-- Logic for generating icon manifest, icon associations, translation logic, models, tests
 ┣ 📂 extension    <-- Code which uses VS Code extension API (get user config, providing commands etc)
 ┣ 📂 module       <-- Control which part of the core is exposed to the npm module
 ┗ 📂 scripts      <-- Scripts which are executed during build time (in the package.json)

By using the sheriff library dependencies between the modules can be verified. The command bun run verify checks if the imports between the modules are allowed. For instance it's not allowed, that any of the other modules imports something from the extension module because of it's dependency to vscode. But the extension module itself is allowed to import from core.

This is realized by using the dependency rules in the sheriff.config.ts file:

depRules: {
  root: ['core'],
  extension: ['core'],
  module: ['core'],
}

If a file inside of the core module references something from the extension module the following error is thrown:

import { setConfig } from './../../extension/shared/config';
Verification Report

Issues found:
  Total Invalid Files: 1
  Total Deep Imports: 1
  Total Dependency Rule Violations: 0
----------------------------------

|-- src\core\helpers\customIconPaths.ts
|   |-- Deep Imports
|   |   |-- ./../../extension/shared/config

Additional changes

In addition, the library lodash-es has been added as dependency to remove some code. It replaces the dependency lodash.merge and some get and set functions which have been written manually before. The bundle size is similar to before as lodash-es can be tree-shaked.

With the "tsconfig.declarations.json" the type definitions for the npm module are generated.

@PKief PKief merged commit 528f950 into main Jul 15, 2024
2 checks passed
@PKief PKief deleted the chore/expose-module branch July 15, 2024 06:25
Copy link

Merge Successful

Thanks for your contribution! 🎉

The changes will be part of the upcoming update on the marketplace.

@PKief PKief mentioned this pull request Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant