Skip to content

Commit dc420f1

Browse files
authored
Bundle extension & add publish workflow (#124)
* Setup esbuild * Add more files to .vscodeignore * Set up esbuild & running built extension * Find more occurrences in logger method matching * Always ship sourcemaps to get readable logs from users * Use extension.js instead of extension * Improve run config & change entrypoint during `npm test` * Add way to package vsce * Init GitHub publish workflow * Update one npm package
1 parent 0de567b commit dc420f1

18 files changed

+4256
-1277
lines changed

.config/tsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,10 @@
99
"strict": true,
1010
"noFallthroughCasesInSwitch": true,
1111
"removeComments": true,
12+
"outDir": "../out/",
13+
"rootDir": "../"
1214
},
15+
"include": [
16+
"../src/**/*.ts",
17+
],
1318
}

.config/tsconfig.paths.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

.config/tsconfig.tests.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": [
4+
"../tests/**/*.ts",
5+
],
6+
}

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
release:
3+
types:
4+
- created
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Install Node.js
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: 22
17+
18+
- name: Install dependencies
19+
run: npm install
20+
21+
- name: Package extension
22+
run: npm run package-vsce
23+
24+
- name: Upload VSIX artifact to
25+
if: startsWith(github.ref, 'refs/tags/')
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: manim-notebook.vsix
29+
path: manim-notebook-*.vsix
30+
if-no-files-found: error
31+
32+
- name: Publish
33+
if: startsWith(github.ref, 'refs/tags/')
34+
run: npm run deploy
35+
env:
36+
VSCE_PAT: ${{ secrets.VSCE_PAT }}

.github/workflows/tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ jobs:
102102
if [ "$RUNNER_OS" == "Linux" ]; then
103103
# Start an X virtual framebuffer (Xvfb) server, which emulates a
104104
# display server without requiring a physical display.
105-
xvfb-run -a npm run testInGithubActions
105+
xvfb-run -a npm run test-without-pre-or-posttest
106106
else
107-
npm run testInGithubActions
107+
npm run test-without-pre-or-posttest
108108
fi
109109
shell: bash
110+
111+
- name: Run posttest
112+
run: npm run posttest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ tmp/
33
*.mp4
44
.DS_Store
55
out
6+
out-test
67
dist
78
node_modules
89
_debug_scenes/

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// for the documentation about the extensions.json format
44
"recommendations": [
55
"dbaeumer.vscode-eslint",
6-
"streetsidesoftware.code-spell-checker"
6+
"streetsidesoftware.code-spell-checker",
7+
"connor4312.esbuild-problem-matchers"
78
]
89
}

.vscode/launch.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"--extensionDevelopmentPath=${workspaceFolder}"
1414
],
1515
"outFiles": [
16-
"${workspaceFolder}/out/src/**/*.js"
16+
"${workspaceFolder}/dist/**/*.js"
1717
],
18-
"preLaunchTask": "Watch Files",
18+
"preLaunchTask": "Watch (Default)",
1919
"sourceMaps": true
2020
},
2121
{
@@ -27,10 +27,10 @@
2727
"${workspaceFolder}/tests/fixtures",
2828
"--disable-extensions",
2929
"--extensionDevelopmentPath=${workspaceFolder}",
30-
"--extensionTestsPath=${workspaceFolder}/out/tests/utils/testRunner.js"
30+
"--extensionTestsPath=${workspaceFolder}/out-test/tests/utils/testRunner.js"
3131
],
3232
"outFiles": [
33-
"${workspaceFolder}/out/test/**/*.js"
33+
"${workspaceFolder}/out-test/tests/**/*.js"
3434
],
3535
"preLaunchTask": "Prepare For Tests",
3636
"sourceMaps": true,

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"nodenext",
109109
"opengl",
110110
"Pango",
111+
"posttest",
111112
"prerun",
112113
"pycache",
113114
"Pyglet",

.vscode/tasks.json

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"version": "2.0.0",
55
"tasks": [
66
{
7-
"label": "Watch Files",
8-
"type": "npm",
9-
"script": "watch",
10-
"problemMatcher": "$tsc-watch",
11-
"isBackground": true,
7+
"label": "Watch (Default)",
8+
"dependsOn": [
9+
"npm: watch:tsc",
10+
"npm: watch:esbuild"
11+
],
1212
"presentation": {
1313
"reveal": "never"
1414
},
@@ -17,11 +17,46 @@
1717
"isDefault": true
1818
}
1919
},
20+
{
21+
"type": "npm",
22+
"script": "watch:tsc",
23+
"group": "build",
24+
"problemMatcher": "$tsc-watch",
25+
"isBackground": true,
26+
"label": "npm: watch:tsc",
27+
"presentation": {
28+
"group": "watch",
29+
"reveal": "never"
30+
}
31+
},
32+
{
33+
"type": "npm",
34+
"script": "watch:esbuild",
35+
"group": "build",
36+
"problemMatcher": "$esbuild-watch",
37+
"isBackground": true,
38+
"label": "npm: watch:esbuild",
39+
"presentation": {
40+
"group": "watch",
41+
"reveal": "never"
42+
}
43+
},
44+
{
45+
"type": "npm",
46+
"script": "watch:tests",
47+
"group": "build",
48+
"problemMatcher": "$tsc-watch",
49+
"isBackground": true,
50+
"label": "npm: watch:tests",
51+
"presentation": {
52+
"group": "watch",
53+
"reveal": "never"
54+
}
55+
},
2056
{
2157
"label": "Install Manim",
2258
"type": "npm",
2359
"script": "install-manim",
24-
"cwd": "${workspaceFolder}",
2560
"presentation": {
2661
"reveal": "always"
2762
},
@@ -33,9 +68,18 @@
3368
"label": "Prepare For Tests",
3469
"dependsOrder": "sequence",
3570
"dependsOn": [
36-
"Watch Files",
71+
"npm: watch:tsc",
72+
"npm: watch:esbuild",
73+
"npm: watch:tests",
3774
"Install Manim"
38-
]
39-
}
75+
],
76+
"presentation": {
77+
"reveal": "never"
78+
},
79+
"group": {
80+
"kind": "build",
81+
"isDefault": true
82+
}
83+
},
4084
]
4185
}

0 commit comments

Comments
 (0)