Skip to content

Commit 528f950

Browse files
authored
Expose generateManifest as reusable function (#2411)
* Expose as module * Update typescript version * Make typescript compilation a prebuild command * Update package.json scripts * Add config for declarations * Refacor code * Refactor project * Format code * Refactor project * Update project structure * Update imports * Update comment * Update dependency to extension module * Adjust imports * Update import * Enable minification * Fix issue with hash * Update exposed core modules * Minor improvements * Update comment * Update ignore files * Update imports * Update module structure * Move tests into core * Update prepublish script * Update npm scripts * Update prepublish script * Update version * Update version * Fix unit tests * Update hash generation * Update sheriff config * Update types * Update custom file paths * Update IconPack types * Update project * Update types * Update reference to readme * Update customIconPaths * Format code
1 parent be9dc3a commit 528f950

File tree

129 files changed

+1923
-1750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1923
-1750
lines changed

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"tasks": [
44
{
55
"type": "bun",
6-
"script": "bun run build; bun run postcompile",
6+
"script": "bun run build",
77
"problemMatcher": [],
88
"label": "bun: build",
99
"detail": "bun run build",

.vscodeignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ scripts/**
88
**/*.map
99
.gitignore
1010
tsconfig.json
11+
tsconfig.**.json
1112
biome.jsonc
1213
images/**
1314
vsc-extension-quickstart.md
@@ -17,9 +18,13 @@ package-lock.json
1718
bun.lockb
1819
yarn.lock
1920
bunfig.toml
20-
devcontainer/**
21+
.devcontainer/**
22+
sheriff.config.ts
2123
build/**
2224
svgo.config.js
2325
.eslintignore
2426
material-colors.yml
2527
changelog.config.json
28+
dist/types/**
29+
dist/module.cjs
30+

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,4 @@ Take a look at the [contribution guidelines](https://github.com/material-extensi
252252
## Related extensions
253253

254254
- [Material Icons for GitHub](https://github.com/Claudiohbsantos/github-material-icons-extension)
255+
- [Material Product Icons](https://github.com/material-extensions/vscode-material-product-icons)

biome.jsonc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@
1414
"enabled": true,
1515
"rules": {
1616
"recommended": false,
17-
"complexity": { "useArrowFunction": "off" },
18-
"correctness": { "noUnsafeFinally": "error" },
17+
"complexity": { "useArrowFunction": "error" },
18+
"correctness": {
19+
"noUnsafeFinally": "error",
20+
"noUnusedVariables": "error",
21+
"noUnusedImports": "error"
22+
},
1923
"security": { "noGlobalEval": "error" },
2024
"style": {
2125
"noVar": "error",
@@ -28,6 +32,7 @@
2832
},
2933
"suspicious": {
3034
"noDoubleEquals": "error",
35+
"noExplicitAny": "error",
3136
"useNamespaceKeyword": "error"
3237
}
3338
}

build/build-with-esbuild.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import esbuild from "esbuild";
2-
import config from "./esbuild.config";
1+
import esbuild from 'esbuild';
2+
import config from './esbuild.config';
33

44
esbuild.build(config).catch(() => process.exit(1));

build/esbuild.config.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
import type { BuildOptions } from "esbuild";
1+
import type { BuildOptions } from 'esbuild';
22

33
const config: BuildOptions = {
4-
entryPoints: ["./src/extension.ts", "./src/web/extension.ts"],
4+
entryPoints: [
5+
'./src/extension/desktop/extension.ts',
6+
'./src/extension/web/extension.ts',
7+
'./src/module/index.ts',
8+
],
9+
minify: false,
510
bundle: true,
6-
platform: "node",
7-
target: "node12",
8-
outdir: "./dist",
9-
outbase: "./src",
11+
platform: 'node',
12+
target: 'node12',
13+
outdir: './dist',
14+
outbase: './src',
1015
outExtension: {
11-
".js": ".cjs",
16+
'.js': '.cjs',
1217
},
13-
format: "cjs",
14-
external: ["vscode"],
18+
format: 'cjs',
19+
external: ['vscode'],
1520
loader: {
16-
".ts": "ts",
17-
".js": "js",
21+
'.ts': 'ts',
22+
'.js': 'js',
1823
},
19-
logLevel: "info",
24+
logLevel: 'info',
2025
};
2126

2227
export default config;

build/watch-with-esbuild.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import esbuild from "esbuild";
2-
import config from "./esbuild.config";
1+
import esbuild from 'esbuild';
2+
import config from './esbuild.config';
33

44
try {
55
const context = await esbuild.context(config);
66
await context.watch();
77
} catch (e) {
8+
console.error(e);
89
process.exit(1);
910
}

bun.lockb

8.73 KB
Binary file not shown.

bunfig.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[test]
22
# Load these modules before running tests.
3-
preload = ["./src/tests/mocks"]
3+
preload = ["./src/core/tests/mocks"]

package.json

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,29 @@
44
"description": "Material Design Icons for Visual Studio Code",
55
"version": "5.4.2",
66
"scripts": {
7-
"build": "bun run ./build/build-with-esbuild.ts",
7+
"precompile": "rimraf dist && bun run verify",
8+
"compile": "tsc -p ./",
9+
"compile:declarations": "tsc -p ./tsconfig.declarations.json",
10+
"postcompile": "bun run compile:declarations && bun run generateJson && bun run generateClones && bun run check",
11+
"build": "bun run compile && bun run ./build/build-with-esbuild.ts",
812
"watch": "bun run ./build/watch-with-esbuild.ts",
913
"changelog": "changelog-machine --config changelog.config.json",
1014
"check-colors": "bun run ./src/scripts/svg/checkSvgColors.ts",
11-
"check": "bun ./src/scripts/icons/checks",
12-
"contributors": "bun ./src/scripts/contributors/index.ts",
13-
"generateJson": "bun ./src/scripts/icons/generateJson.ts",
15+
"check": "bun ./src/scripts/icons/checks/run.ts",
16+
"contributors": "bun ./src/scripts/contributors/contributors.ts",
17+
"generateJson": "bun ./src/scripts/icons/generateJson.ts > dist/material-icons.json",
18+
"generateClones": "bun ./src/scripts/icons/generateClones.ts",
1419
"lint": "bunx @biomejs/biome check --write ./src",
1520
"format": "bunx @biomejs/biome format --write ./src",
16-
"postcompile": "bun run generateJson && bun run check",
17-
"pretest": "bun run build && tsc -p ./",
1821
"preversion": "bun run contributors && git add images/contributors.png && bun run preview && git add images/fileIcons.png && git add images/folderIcons.png && bun run svgo && git add icons/*.svg",
19-
"preview": "bun ./src/scripts/preview",
22+
"preview": "bun ./src/scripts/preview/run.ts",
2023
"svgo": "svgo -i icons -o icons -q",
21-
"test-compile": "tsc -p ./",
22-
"test": "bun ./out/test/runTest.js",
24+
"test": "bun test",
2325
"version": "bun run changelog && git add CHANGELOG.md",
24-
"vscode:prepublish": "bun run lint && bun run build && bun run postcompile"
26+
"vscode:prepublish": "bun run lint && bun run build",
27+
"verify": "bunx sheriff verify",
28+
"prepublishOnly": "bun run ./src/scripts/module/prepare.ts",
29+
"postpublish": "git checkout package.json && git checkout README.md"
2530
},
2631
"publisher": "PKief",
2732
"author": {
@@ -39,7 +44,7 @@
3944
"homepage": "https://github.com/material-extensions/vscode-material-icon-theme/blob/main/README.md",
4045
"repository": {
4146
"type": "git",
42-
"url": "https://github.com/material-extensions/vscode-material-icon-theme.git"
47+
"url": "git+https://github.com/material-extensions/vscode-material-icon-theme.git"
4348
},
4449
"bugs": {
4550
"url": "https://github.com/material-extensions/vscode-material-icon-theme/issues"
@@ -59,10 +64,17 @@
5964
"virtualWorkspaces": true
6065
},
6166
"activationEvents": ["onStartupFinished"],
62-
"main": "./dist/extension.cjs",
63-
"browser": "./dist/web/extension.cjs",
67+
"main": "./dist/extension/desktop/extension.cjs",
68+
"browser": "./dist/extension/web/extension.cjs",
69+
"module": "./dist/module/index.cjs",
70+
"types": "./dist/types/module/index.d.ts",
6471
"sideEffects": false,
65-
"files": ["icons", "dist/material-icons.json"],
72+
"files": [
73+
"icons",
74+
"dist/material-icons.json",
75+
"dist/module/index.cjs",
76+
"dist/types"
77+
],
6678
"contributes": {
6779
"iconThemes": [
6880
{
@@ -292,14 +304,15 @@
292304
},
293305
"dependencies": {
294306
"chroma-js": "^2.4.2",
295-
"lodash.merge": "4.6.2",
307+
"lodash-es": "^4.17.21",
296308
"svgson": "^5.3.1"
297309
},
298310
"devDependencies": {
299311
"@biomejs/biome": "1.8.2",
312+
"@softarc/sheriff-core": "^0.15.1",
300313
"@types/chroma-js": "^2.4.4",
301314
"@types/glob": "^7.2.0",
302-
"@types/lodash.merge": "^4.6.7",
315+
"@types/lodash-es": "^4.17.12",
303316
"@types/puppeteer": "^5.4.6",
304317
"@types/vscode": "~1.51.0",
305318
"@vscode/test-electron": "^2.3.9",
@@ -309,9 +322,9 @@
309322
"esbuild": "^0.21.4",
310323
"glob": "^8.0.3",
311324
"puppeteer": "^22.11.0",
312-
"rimraf": "^3.0.2",
325+
"rimraf": "^6.0.0",
313326
"svg-color-linter": "^1.3.0",
314327
"svgo": "^2.8.0",
315-
"typescript": "^4.7.2"
328+
"typescript": "^5.5.3"
316329
}
317330
}

0 commit comments

Comments
 (0)