Skip to content

Commit 8bd6e77

Browse files
committed
Update extension to build to dist/extension.js
This updates all the NPM tasks to be consistent with what a new-from-template extension uses, and uses an allow-list for the published VSIX.
1 parent 4423a98 commit 8bd6e77

14 files changed

+52
-85
lines changed

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
**.js
2+
**.js.map
13
.vscode-test/
2-
logs/
4+
*.vsix
5+
dist/
36
modules
47
modules/
58
node_modules/
6-
obj/
7-
bin/
89
out/
9-
sessions/
10+
test/mocks/BinaryModule/bin/
11+
test/mocks/BinaryModule/obj/
1012
test-results.xml
11-
*.vsix
12-
*.DS_Store
13+
tsconfig.tsbuildinfo

.mocharc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"require": "source-map-support/register",
99
"timeout": 600000,
1010
"slow": 2000,
11-
"spec": "out/test/**/*.test.js"
11+
"spec": "test/**/*.test.js"
1212
}

.vscode/launch.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"sourceMaps": true,
1818
// This speeds up source map detection and makes smartStep work correctly
1919
"outFiles": [
20-
"${workspaceFolder}/out/**/*.js",
20+
"${workspaceFolder}/**/*.js",
2121
"!**/node_modules/**",
2222
"!**/.vscode-test/**"
2323
],
@@ -47,7 +47,7 @@
4747
"sourceMaps": true,
4848
// This speeds up source map detection and makes smartStep work correctly
4949
"outFiles": [
50-
"${workspaceFolder}/out/**/*.js",
50+
"${workspaceFolder}/**/*.js",
5151
"!**/node_modules/**",
5252
"!**/.vscode-test/**"
5353
],
@@ -77,7 +77,7 @@
7777
"sourceMaps": true,
7878
// This speeds up source map detection and makes smartStep work correctly
7979
"outFiles": [
80-
"${workspaceFolder}/out/**/*.js",
80+
"${workspaceFolder}/**/*.js",
8181
"!**/node_modules/**",
8282
"!**/.vscode-test/**"
8383
],
@@ -96,13 +96,13 @@
9696
"name": "Test Extension",
9797
"type": "node",
9898
"request": "launch",
99-
"program": "${workspaceFolder}/out/test/runTests.js",
99+
"program": "${workspaceFolder}/test/runTests.js",
100100
"cascadeTerminateToConfigurations": [
101101
"ExtensionTests",
102102
],
103103
// This speeds up source map detection and makes smartStep work correctly
104104
"outFiles": [
105-
"${workspaceFolder}/out/**/*.js",
105+
"${workspaceFolder}/**/*.js",
106106
"!**/node_modules/**",
107107
"!**/.vscode-test/**"
108108
],
@@ -111,7 +111,7 @@
111111
"**/node_modules/**",
112112
"**/.vscode-test/**"
113113
],
114-
"attachSimplePort": 59229, // THe default is 9229 but we want to avoid conflicts because we will have two vscode instances running.
114+
"attachSimplePort": 59229, // The default is 9229 but we want to avoid conflicts because we will have two Code instances running.
115115
"env": {
116116
"__TEST_DEBUG_INSPECT_PORT": "59229" // Needs to match attachSimplePort
117117
},
@@ -121,7 +121,7 @@
121121
"internalConsoleOptions": "neverOpen",
122122
"console": "integratedTerminal",
123123
"autoAttachChildProcesses": false,
124-
"preLaunchTask": "test-watch"
124+
"preLaunchTask": "watch-tests"
125125
}
126126
]
127127
}

.vscode/tasks.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "test-watch",
5+
"label": "watch-tests",
66
"icon": {
77
"color": "terminal.ansiCyan",
88
"id": "sync"
99
},
1010
"type": "npm",
11-
"script": "build-test-watch",
11+
"script": "watch-tests",
1212
"group": "test",
1313
"problemMatcher": "$tsc-watch",
1414
"isBackground": true,
15-
"dependsOn": "build-watch" // We need to also build main.js extension for testing or it leads to sourcemap errors
15+
"dependsOn": "watch"
1616
},
1717
{
18-
"label": "build-watch",
18+
"label": "watch",
1919
"icon": {
2020
"color": "terminal.ansiCyan",
2121
"id": "sync"
2222
},
2323
"type": "npm",
24-
"script": "build-watch",
24+
"script": "watch",
2525
"group": "build",
2626
"problemMatcher": "$esbuild-watch",
27-
"isBackground": true,
27+
"isBackground": true
2828
}
2929
]
3030
}

.vscodeignore

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
1-
.github/
2-
.poshchan/
3-
.vscode/
4-
.vscode-test/
5-
.vsts-ci/
6-
logs/
7-
node_modules/
8-
out/
9-
scripts/
10-
sessions/
11-
src/
12-
test/
13-
tools/
14-
15-
!out/main.js
16-
17-
.editorconfig
18-
.eslintrc.json
19-
.gitattributes
20-
.gitignore
21-
.markdownlint.json
22-
.vscodeignore
23-
build.ps1
24-
extension-dev.code-workspace
25-
*.vsix
26-
test-results.xml
27-
tsconfig.json
28-
vscode-powershell.build.ps1
1+
**
2+
!*.md
3+
!dist/extension.js
4+
!docs/
5+
!examples/
6+
!media/
7+
!modules/
8+
!snippets/
9+
!themes/
10+
!LICENSE.txt

Third Party Notices.txt

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

extension-dev.code-workspace

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"markdownlint.config": {
3838
"MD024": false // no-duplicate-header
3939
},
40+
"powershell.cwd": "Client",
4041
"powershell.codeFormatting.autoCorrectAliases": true,
4142
"powershell.codeFormatting.avoidSemicolonsAsLineTerminators": true,
4243
"powershell.codeFormatting.newLineAfterCloseBrace": false,
@@ -55,7 +56,7 @@
5556
"editor.formatOnSaveMode": "modificationsIfAvailable"
5657
},
5758
"mochaExplorer.configFile": ".mocharc.json",
58-
"mochaExplorer.launcherScript": "out/test/runTests",
59+
"mochaExplorer.launcherScript": "test/runTests",
5960
"mochaExplorer.autoload": false, // The test instance pops up every time discovery or run is done, this could be annoying on startup.
6061
"mochaExplorer.debuggerPort": 59229, // Matches the launch config, we dont want to use the default port as we are launching a duplicate instance of vscode and it might conflict.
6162
"mochaExplorer.ipcRole": "server",
@@ -64,8 +65,7 @@
6465
"mochaExplorer.env": {
6566
"VSCODE_VERSION": "insiders",
6667
"ELECTRON_RUN_AS_NODE": null
67-
},
68-
"powershell.cwd": "Client",
68+
}
6969
},
7070
"tasks": {
7171
"version": "2.0.0",

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,16 @@
115115
"extensionDependencies": [
116116
"vscode.powershell"
117117
],
118-
"main": "./out/main.js",
118+
"main": "./dist/extension.js",
119119
"scripts": {
120-
"lint": "eslint . --ext .ts",
121-
"build": "esbuild ./src/main.ts --outdir=out --sourcemap --bundle --external:vscode --platform=node",
122-
"build-watch": "npm run build -- --watch",
123-
"build-test": "tsc --incremental",
124-
"build-test-watch": "npm run build-test -- --watch",
125-
"test": "npm run build-test && node ./out/test/runTests.js",
120+
"compile": "esbuild ./src/extension.ts --outdir=dist --sourcemap --bundle --external:vscode --platform=node",
121+
"watch": "npm run compile -- --watch",
122+
"lint": "eslint src test --ext .ts",
126123
"package": "vsce package --no-gitHubIssueLinking",
127-
"publish": "vsce publish"
124+
"publish": "vsce publish",
125+
"compile-test": "npm run compile && tsc --incremental",
126+
"watch-tests": "npm run compile-test -- --watch",
127+
"test": "npm run compile-test && node ./test/runTests.js"
128128
},
129129
"contributes": {
130130
"breakpoints": [
File renamed without changes.

test/features/DebugSession.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ describe("DebugSessionFeature E2E", function() {
480480
let binaryModulePath: Uri;
481481

482482
before(async function binarySetup() {
483-
if (process.env.BUILD_SOURCEBRANCHNAME === "release") {
483+
if (process.env.TF_BUILD) {
484484
// The binary modules tests won't work in the release pipeline
485485
// due to dependency requirements.
486486
this.skip();

0 commit comments

Comments
 (0)