generator-code 1.5.6 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/generators/app/env.js +6 -30
  2. package/generators/app/generate-command-ts .js +23 -12
  3. package/generators/app/generate-command-web.js +15 -2
  4. package/generators/app/index.js +46 -8
  5. package/generators/app/package.json +29 -0
  6. package/generators/app/templates/ext-command-js/jsconfig.json +2 -2
  7. package/generators/app/templates/ext-command-js/package.json +1 -1
  8. package/generators/app/templates/ext-command-js/test/runTest.js +1 -1
  9. package/generators/app/templates/ext-command-ts/package.json +6 -16
  10. package/generators/app/templates/ext-command-ts/src/test/runTest.ts +1 -1
  11. package/generators/app/templates/ext-command-ts/tsconfig.json +2 -2
  12. package/generators/app/templates/ext-command-ts/vscode-webpack/package.json +54 -0
  13. package/generators/app/templates/ext-command-ts/vscode-webpack/tsconfig.json +20 -0
  14. package/generators/app/templates/ext-command-ts/vscode-webpack/vsc-extension-quickstart.md +47 -0
  15. package/generators/app/templates/ext-command-ts/vscode-webpack/vscode/extensions.json +5 -0
  16. package/generators/app/templates/ext-command-ts/vscode-webpack/{launch.json → vscode/launch.json} +3 -2
  17. package/generators/app/templates/ext-command-ts/vscode-webpack/{settings.json → vscode/settings.json} +0 -0
  18. package/generators/app/templates/ext-command-ts/vscode-webpack/{tasks.json → vscode/tasks.json} +15 -5
  19. package/generators/app/templates/ext-command-ts/vscode-webpack/vscodeignore +13 -0
  20. package/generators/app/templates/ext-command-ts/{webpack.config.js → vscode-webpack/webpack.config.js} +12 -6
  21. package/generators/app/templates/ext-command-ts/vscodeignore +0 -2
  22. package/generators/app/templates/ext-command-web/.yarnrc +1 -0
  23. package/generators/app/templates/ext-command-web/package.json +5 -4
  24. package/generators/app/templates/ext-command-web/vsc-extension-quickstart.md +12 -9
  25. package/generators/app/templates/ext-command-web/vscode/extensions.json +3 -6
  26. package/generators/app/templates/ext-command-web/vscode/launch.json +2 -2
  27. package/generators/app/templates/ext-command-web/vscodeignore +2 -1
  28. package/generators/app/templates/ext-command-web/{build/web-extension.webpack.config.js → webpack.config.js} +14 -8
  29. package/generators/app/templates/ext-notebook-renderer/package.json +4 -1
  30. package/generators/app/templates/ext-notebook-renderer/src/test/runTest.ts +1 -1
  31. package/generators/app/templates/ext-notebook-renderer/vscode/extensions.json +1 -4
  32. package/generators/app/templates/ext-notebook-renderer/webpack.config.js +3 -0
  33. package/package.json +6 -5
  34. package/generators/app/templates/ext-command-ts/vscode-webpack/extensions.json +0 -8
@@ -3,6 +3,8 @@
3
3
  *--------------------------------------------------------*/
4
4
  'use strict';
5
5
  const request = require('request-light');
6
+ const fs = require('fs');
7
+ const path = require('path');
6
8
 
7
9
  const fallbackVersion = '^1.54.0';
8
10
  let versionPromise = undefined;
@@ -39,33 +41,7 @@ module.exports.getLatestVSCodeVersion = getLatestVSCodeVersion;
39
41
 
40
42
  module.exports.getDependencyVersions = async function () {
41
43
  const vscodeVersion = await getLatestVSCodeVersion();
42
- return {
43
- "@types/vscode": vscodeVersion,
44
- "@types/glob": "^7.1.3",
45
- "@types/mocha": "^8.2.2",
46
- "@types/node": "14.x",
47
- "@typescript-eslint/eslint-plugin": "^4.26.0",
48
- "@typescript-eslint/parser": "^4.26.0",
49
- "eslint": "^7.27.0",
50
- "glob": "^7.1.7",
51
- "mocha": "^8.4.0",
52
- "typescript": "^4.3.2",
53
- "vscode-test": "^1.5.2",
54
- "@vscode/test-web": "^0.0.8",
55
- "@types/webpack-env": "^1.16.0",
56
- "@types/vscode-notebook-renderer": "^1.57.8",
57
- "concurrently": "^5.3.0",
58
- "css-loader": "^4.2.0",
59
- "fork-ts-checker-webpack-plugin": "^5.0.14",
60
- "style-loader": "^1.2.1",
61
- "ts-loader": "^9.2.2",
62
- "vscode-dts": "^0.3.1",
63
- "vscode-notebook-error-overlay": "^1.0.1",
64
- "webpack": "^5.38.1",
65
- "webpack-cli": "^4.7.0",
66
- "webpack-dev-server": "^3.11.2",
67
- "assert": "^2.0.0",
68
- "process": "^0.11.10"
69
- }
70
- }
71
-
44
+ const versions = JSON.parse((await fs.promises.readFile(path.join(__dirname, 'package.json'))).toString()).dependencies;
45
+ versions["@types/vscode"] = vscodeVersion
46
+ return versions;
47
+ }
@@ -2,6 +2,7 @@
2
2
  * Copyright (C) Microsoft Corporation. All rights reserved.
3
3
  *--------------------------------------------------------*/
4
4
 
5
+ const chalk = require("chalk");
5
6
  const prompts = require("./prompts");
6
7
 
7
8
  module.exports = {
@@ -28,35 +29,45 @@ module.exports = {
28
29
  */
29
30
  writing: (generator, extensionConfig) => {
30
31
  if (extensionConfig.webpack) {
31
- generator.fs.copy(generator.templatePath('vscode-webpack'), generator.destinationPath('.vscode'));
32
+ generator.fs.copy(generator.templatePath('vscode-webpack/vscode'), generator.destinationPath('.vscode'));
33
+ generator.fs.copyTpl(generator.templatePath('vscode-webpack/package.json'), generator.destinationPath('package.json'), extensionConfig);
34
+ generator.fs.copyTpl(generator.templatePath('vscode-webpack/tsconfig.json'), generator.destinationPath('tsconfig.json'), extensionConfig);
35
+ generator.fs.copyTpl(generator.templatePath('vscode-webpack/vscodeignore'), generator.destinationPath('.vscodeignore'), extensionConfig);
36
+ generator.fs.copyTpl(generator.templatePath('vscode-webpack/webpack.config.js'), generator.destinationPath('webpack.config.js'), extensionConfig);
37
+ generator.fs.copyTpl(generator.templatePath('vscode-webpack/vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig);
32
38
  } else {
33
39
  generator.fs.copy(generator.templatePath('vscode'), generator.destinationPath('.vscode'));
40
+ generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig);
41
+ generator.fs.copyTpl(generator.templatePath('tsconfig.json'), generator.destinationPath('tsconfig.json'), extensionConfig);
42
+ generator.fs.copyTpl(generator.templatePath('vscodeignore'), generator.destinationPath('.vscodeignore'), extensionConfig);
43
+ generator.fs.copyTpl(generator.templatePath('vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig);
34
44
  }
35
- generator.fs.copy(generator.templatePath('src/test'), generator.destinationPath('src/test'));
36
45
 
37
- generator.fs.copyTpl(generator.templatePath('vscodeignore'), generator.destinationPath('.vscodeignore'), extensionConfig);
38
46
  if (extensionConfig.gitInit) {
39
47
  generator.fs.copy(generator.templatePath('gitignore'), generator.destinationPath('.gitignore'));
40
48
  }
41
49
  generator.fs.copyTpl(generator.templatePath('README.md'), generator.destinationPath('README.md'), extensionConfig);
42
50
  generator.fs.copyTpl(generator.templatePath('CHANGELOG.md'), generator.destinationPath('CHANGELOG.md'), extensionConfig);
43
- generator.fs.copyTpl(generator.templatePath('vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig);
44
- generator.fs.copyTpl(generator.templatePath('tsconfig.json'), generator.destinationPath('tsconfig.json'), extensionConfig);
45
-
46
51
  generator.fs.copyTpl(generator.templatePath('src/extension.ts'), generator.destinationPath('src/extension.ts'), extensionConfig);
47
- generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig);
48
-
52
+ generator.fs.copy(generator.templatePath('src/test'), generator.destinationPath('src/test'));
49
53
  generator.fs.copy(generator.templatePath('.eslintrc.json'), generator.destinationPath('.eslintrc.json'));
50
54
 
51
55
  if (extensionConfig.pkgManager === 'yarn') {
52
56
  generator.fs.copyTpl(generator.templatePath('.yarnrc'), generator.destinationPath('.yarnrc'), extensionConfig);
53
57
  }
54
58
 
55
- if (extensionConfig.webpack) {
56
- generator.fs.copyTpl(generator.templatePath('webpack.config.js'), generator.destinationPath('webpack.config.js'), extensionConfig);
57
- }
58
-
59
59
  extensionConfig.installDependencies = true;
60
60
  extensionConfig.proposedAPI = extensionConfig.insiders;
61
+ },
62
+
63
+ /**
64
+ * @param {import('yeoman-generator')} generator
65
+ * @param {Object} extensionConfig
66
+ */
67
+ endMessage: (generator, extensionConfig) => {
68
+ if (extensionConfig.webpack) {
69
+ generator.log(chalk.yellow(`To run the extension you need to install the recommended extension 'amodio.tsl-problem-matcher'.`));
70
+ generator.log('');
71
+ }
61
72
  }
62
73
  }
@@ -2,12 +2,13 @@
2
2
  * Copyright (C) Microsoft Corporation. All rights reserved.
3
3
  *--------------------------------------------------------*/
4
4
 
5
+ const chalk = require("chalk");
5
6
  const prompts = require("./prompts");
6
7
 
7
8
  module.exports = {
8
9
  id: 'ext-command-web',
9
10
  aliases: ['web', 'command-web'],
10
- insidersName: 'New Web Extension (TypeScript)',
11
+ name: 'New Web Extension (TypeScript)',
11
12
  /**
12
13
  * @param {import('yeoman-generator')} generator
13
14
  * @param {Object} extensionConfig
@@ -39,12 +40,24 @@ module.exports = {
39
40
 
40
41
  generator.fs.copyTpl(generator.templatePath('src/web/extension.ts'), generator.destinationPath('src/web/extension.ts'), extensionConfig);
41
42
 
42
- generator.fs.copyTpl(generator.templatePath('build/web-extension.webpack.config.js'), generator.destinationPath('build/web-extension.webpack.config.js'), extensionConfig);
43
+ generator.fs.copyTpl(generator.templatePath('webpack.config.js'), generator.destinationPath('webpack.config.js'), extensionConfig);
43
44
  generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig);
44
45
 
45
46
  generator.fs.copy(generator.templatePath('.eslintrc.json'), generator.destinationPath('.eslintrc.json'));
46
47
 
48
+ if (extensionConfig.pkgManager === 'yarn') {
49
+ generator.fs.copyTpl(generator.templatePath('.yarnrc'), generator.destinationPath('.yarnrc'), extensionConfig);
50
+ }
51
+
47
52
  extensionConfig.installDependencies = true;
48
53
  extensionConfig.proposedAPI = false;
54
+ },
55
+ /**
56
+ * @param {import('yeoman-generator')} generator
57
+ * @param {Object} extensionConfig
58
+ */
59
+ endMessage: (generator, extensionConfig) => {
60
+ generator.log(chalk.yellow(`To run the extension you need to install the recommended extension 'amodio.tsl-problem-matcher'.`));
61
+ generator.log('');
49
62
  }
50
63
  }
@@ -8,6 +8,7 @@ const yosay = require('yosay');
8
8
 
9
9
  const path = require('path');
10
10
  const env = require('./env');
11
+ const witch = require('which');
11
12
 
12
13
  const colortheme = require('./generate-colortheme');
13
14
  const commandjs = require('./generate-command-js');
@@ -161,7 +162,7 @@ module.exports = class extends Generator {
161
162
  }
162
163
 
163
164
  // End
164
- end() {
165
+ async end() {
165
166
  if (this.abort) {
166
167
  return;
167
168
  }
@@ -195,6 +196,8 @@ module.exports = class extends Generator {
195
196
  this.log('Your extension ' + this.extensionConfig.name + ' has been created!');
196
197
  this.log('');
197
198
 
199
+ const [codeStableLocation, codeInsidersLocation] = await Promise.all([witch('code').catch(() => undefined), witch('code-insiders').catch(() => undefined)]);
200
+
198
201
  if (!this.extensionConfig.insiders && !this.options['open'] && !this.options['openInInsiders'] && !this.options['quick']) {
199
202
  const cdLocation = this.options['destination'] || this.extensionConfig.name;
200
203
 
@@ -203,7 +206,11 @@ module.exports = class extends Generator {
203
206
  if (cdLocation !== '.') {
204
207
  this.log(' cd ' + cdLocation);
205
208
  }
206
- this.log(' code-insiders .');
209
+ if (!this.extensionConfig.insiders) {
210
+ this.log(' code .');
211
+ } else {
212
+ this.log(' code-insiders .');
213
+ }
207
214
  this.log('');
208
215
  }
209
216
  this.log('Open vsc-extension-quickstart.md inside the new extension for further instructions');
@@ -217,12 +224,43 @@ module.exports = class extends Generator {
217
224
  this.log('For more information, also visit http://code.visualstudio.com and follow us @code.');
218
225
  this.log('\r\n');
219
226
 
220
- if (this.options['open']) {
221
- this.log(`Opening ${this.destinationPath()} in Visual Studio Code...`);
222
- this.spawnCommand('code', [this.destinationPath()]);
223
- } else if (this.extensionConfig.insiders || this.options['openInInsiders'] || this.options['quick']) {
224
- this.log(`Opening ${this.destinationPath()} with Visual Studio Code Insiders...`);
225
- this.spawnCommand('code-insiders', [this.destinationPath()]);
227
+ if (this.options["open"]) {
228
+ if (codeStableLocation) {
229
+ this.log(`Opening ${this.destinationPath()} in Visual Studio Code...`);
230
+ this.spawnCommand(codeStableLocation, [this.destinationPath()]);
231
+ } else {
232
+ this.log(`'code' command not found.`);
233
+ }
234
+ } else if (this.options["openInInsiders"]) {
235
+ if (codeInsidersLocation) {
236
+ this.log(`Opening ${this.destinationPath()} with Visual Studio Code Insiders...`);
237
+ this.spawnCommand(codeInsidersLocation, [this.destinationPath()]);
238
+ } else {
239
+ this.log(`'code-insiders' command not found.`);
240
+ }
241
+ } else if (codeInsidersLocation || codeStableLocation) {
242
+ if (this.options["quick"]) {
243
+ this.spawnCommand(codeInsidersLocation || codeStableLocation, [this.destinationPath()]);
244
+ } else {
245
+ const choices = [];
246
+ if (codeInsidersLocation) {
247
+ choices.push({ name: "Open with `code-insiders`", value: codeInsidersLocation });
248
+ }
249
+ if (codeStableLocation) {
250
+ choices.push({ name: "Open with `code`", value: codeStableLocation });
251
+ }
252
+ choices.push({ name: "Skip", value: 'skip' });
253
+
254
+ const answer = await this.prompt({
255
+ type: "list",
256
+ name: "openWith",
257
+ message: "Do you want to open the new folder with Visual Studio Code?",
258
+ choices
259
+ });
260
+ if (answer && answer.openWith && answer.openWith !== 'skip') {
261
+ this.spawnCommand(answer.openWith, [this.destinationPath()]);
262
+ }
263
+ }
226
264
  }
227
265
  }
228
266
  }
@@ -0,0 +1,29 @@
1
+ {
2
+ "dependencies": {
3
+ "@types/glob": "^7.1.4",
4
+ "@types/mocha": "^9.0.0",
5
+ "@types/node": "14.17.27",
6
+ "@typescript-eslint/eslint-plugin": "^5.1.0",
7
+ "@typescript-eslint/parser": "^5.1.0",
8
+ "eslint": "^8.1.0",
9
+ "glob": "^7.1.7",
10
+ "mocha": "^9.1.3",
11
+ "typescript": "^4.4.4",
12
+ "@vscode/test-electron": "^1.6.2",
13
+ "@vscode/test-web": "^0.0.13",
14
+ "@types/webpack-env": "^1.16.2",
15
+ "@types/vscode-notebook-renderer": "^1.57.8",
16
+ "concurrently": "^5.3.0",
17
+ "css-loader": "^4.2.0",
18
+ "fork-ts-checker-webpack-plugin": "^5.0.14",
19
+ "style-loader": "^1.2.1",
20
+ "ts-loader": "^9.2.5",
21
+ "vscode-dts": "^0.3.1",
22
+ "vscode-notebook-error-overlay": "^1.0.1",
23
+ "webpack": "^5.52.1",
24
+ "webpack-cli": "^4.8.0",
25
+ "webpack-dev-server": "^3.11.2",
26
+ "assert": "^2.0.0",
27
+ "process": "^0.11.10"
28
+ }
29
+ }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "module": "commonjs",
4
- "target": "es6",
4
+ "target": "ES2020",
5
5
  "checkJs": <%- JSON.stringify(checkJavaScript) %>, /* Typecheck .js files. */
6
6
  "lib": [
7
- "es6"
7
+ "ES2020"
8
8
  ]
9
9
  },
10
10
  "exclude": [
@@ -34,7 +34,7 @@
34
34
  <%- dep("glob") %>,
35
35
  <%- dep("mocha") %>,
36
36
  <%- dep("typescript") %>,
37
- <%- dep("vscode-test") %>
37
+ <%- dep("@vscode/test-electron") %>
38
38
  }
39
39
 
40
40
  }
@@ -1,6 +1,6 @@
1
1
  const path = require('path');
2
2
 
3
- const { runTests } = require('vscode-test');
3
+ const { runTests } = require('@vscode/test-electron');
4
4
 
5
5
  async function main() {
6
6
  try {
@@ -12,7 +12,7 @@
12
12
  "activationEvents": [
13
13
  <%- JSON.stringify(`onCommand:${name}.helloWorld`) %>
14
14
  ],
15
- "main": <%- JSON.stringify(webpack ? './dist/extension.js' : './out/extension.js') %>,<% if (insiders) { %>
15
+ "main": "./out/extension.js",<% if (insiders) { %>
16
16
  "enableProposedApi": true,<% } %>
17
17
  "contributes": {
18
18
  "commands": [
@@ -22,18 +22,11 @@
22
22
  }
23
23
  ]
24
24
  },
25
- "scripts": {<% if (webpack) { %>
26
- "vscode:prepublish": "<%= pkgManager %> run package",
27
- "compile": "webpack",
28
- "watch": "webpack --watch",
29
- "package": "webpack --mode production --devtool hidden-source-map",
30
- "test-compile": "tsc -p ./",
31
- "test-watch": "tsc -watch -p ./",
32
- "pretest": "<%= pkgManager %> run test-compile && <%= pkgManager %> run lint",<% } else { %>
25
+ "scripts": {
33
26
  "vscode:prepublish": "<%= pkgManager %> run compile",
34
27
  "compile": "tsc -p ./",
35
28
  "watch": "tsc -watch -p ./",
36
- "pretest": "<%= pkgManager %> run compile && <%= pkgManager %> run lint",<% } %>
29
+ "pretest": "<%= pkgManager %> run compile && <%= pkgManager %> run lint",
37
30
  "lint": "eslint src --ext ts",
38
31
  "test": "node ./out/test/runTest.js"<% if (insiders) { %>,
39
32
  "update-proposed-api": "vscode-dts dev"<% } %>
@@ -43,16 +36,13 @@
43
36
  <%- dep("@types/glob") %>,
44
37
  <%- dep("@types/mocha") %>,
45
38
  <%- dep("@types/node") %>,
46
- <%- dep("eslint") %>,
47
39
  <%- dep("@typescript-eslint/eslint-plugin") %>,
48
40
  <%- dep("@typescript-eslint/parser") %>,
41
+ <%- dep("eslint") %>,
49
42
  <%- dep("glob") %>,
50
43
  <%- dep("mocha") %>,
51
44
  <%- dep("typescript") %>,
52
- <%- dep("vscode-test") %><% if (insiders) { %>,
53
- <%- dep("vscode-dts") %><% } if (webpack) { %>,
54
- <%- dep("ts-loader") %>,
55
- <%- dep("webpack") %>,
56
- <%- dep("webpack-cli") %><% } %>
45
+ <%- dep("@vscode/test-electron") %><% if (insiders) { %>,
46
+ <%- dep("vscode-dts") %><% } %>
57
47
  }
58
48
  }
@@ -1,6 +1,6 @@
1
1
  import * as path from 'path';
2
2
 
3
- import { runTests } from 'vscode-test';
3
+ import { runTests } from '@vscode/test-electron';
4
4
 
5
5
  async function main() {
6
6
  try {
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "module": "commonjs",
4
- "target": "es6",
4
+ "target": "ES2020",
5
5
  "outDir": "out",
6
6
  "lib": [
7
- "es6"
7
+ "ES2020"
8
8
  ],
9
9
  "sourceMap": true,
10
10
  "rootDir": "src",
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": <%- JSON.stringify(name) %>,
3
+ "displayName": <%- JSON.stringify(displayName) %>,
4
+ "description": <%- JSON.stringify(description) %>,
5
+ "version": "0.0.1",
6
+ "engines": {
7
+ "vscode": <%- JSON.stringify(vsCodeEngine) %>
8
+ },
9
+ "categories": [
10
+ "Other"
11
+ ],
12
+ "activationEvents": [
13
+ <%- JSON.stringify(`onCommand:${name}.helloWorld`) %>
14
+ ],
15
+ "main": "./dist/extension.js",<% if (insiders) { %>
16
+ "enableProposedApi": true,<% } %>
17
+ "contributes": {
18
+ "commands": [
19
+ {
20
+ "command": <%- JSON.stringify(`${name}.helloWorld`) %>,
21
+ "title": "Hello World"
22
+ }
23
+ ]
24
+ },
25
+ "scripts": {
26
+ "vscode:prepublish": "<%= pkgManager %> run package",
27
+ "compile": "webpack",
28
+ "watch": "webpack --watch",
29
+ "package": "webpack --mode production --devtool hidden-source-map",
30
+ "compile-tests": "tsc -p . --outDir out",
31
+ "watch-tests": "tsc -p -w . --outDir out",
32
+ "pretest": "<%= pkgManager %> run compile-tests && <%= pkgManager %> run compile && <%= pkgManager %> run lint",
33
+ "lint": "eslint src --ext ts",
34
+ "test": "node ./out/test/runTest.js"<% if (insiders) { %>,
35
+ "update-proposed-api": "vscode-dts dev"<% } %>
36
+ },
37
+ "devDependencies": {
38
+ <%- dep("@types/vscode") %>,
39
+ <%- dep("@types/glob") %>,
40
+ <%- dep("@types/mocha") %>,
41
+ <%- dep("@types/node") %>,
42
+ <%- dep("@typescript-eslint/eslint-plugin") %>,
43
+ <%- dep("@typescript-eslint/parser") %>,
44
+ <%- dep("eslint") %>,
45
+ <%- dep("glob") %>,
46
+ <%- dep("mocha") %>,
47
+ <%- dep("typescript") %>,
48
+ <%- dep("ts-loader") %>,
49
+ <%- dep("webpack") %>,
50
+ <%- dep("webpack-cli") %>,
51
+ <%- dep("@vscode/test-electron") %><% if (insiders) { %>,
52
+ <%- dep("vscode-dts") %><% } %>
53
+ }
54
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "target": "ES2020",
5
+ "lib": [
6
+ "ES2020"
7
+ ],
8
+ "sourceMap": true,
9
+ "rootDir": "src",
10
+ "strict": true /* enable all strict type-checking options */
11
+ /* Additional Checks */
12
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
13
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
14
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
15
+ },
16
+ "exclude": [
17
+ "node_modules",
18
+ ".vscode-test"
19
+ ]
20
+ }
@@ -0,0 +1,47 @@
1
+ # Welcome to your VS Code Extension
2
+
3
+ ## What's in the folder
4
+
5
+ * This folder contains all of the files necessary for your extension.
6
+ * `package.json` - this is the manifest file in which you declare your extension and command.
7
+ * The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
8
+ * `src/extension.ts` - this is the main file where you will provide the implementation of your command.
9
+ * The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
10
+ * We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
11
+
12
+ ## Setup
13
+
14
+ - install the recommended extensions (amodio.tsl-problem-matcher and dbaeumer.vscode-eslint)
15
+
16
+
17
+ ## Get up and running straight away
18
+
19
+ * Press `F5` to open a new window with your extension loaded.
20
+ * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
21
+ * Set breakpoints in your code inside `src/extension.ts` to debug your extension.
22
+ * Find output from your extension in the debug console.
23
+
24
+ ## Make changes
25
+
26
+ * You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
27
+ * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
28
+
29
+
30
+ ## Explore the API
31
+
32
+ * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
33
+
34
+ ## Run tests
35
+
36
+ * Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
37
+ * Press `F5` to run the tests in a new window with your extension loaded.
38
+ * See the output of the test result in the debug console.
39
+ * Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
40
+ * The provided test runner will only consider files matching the name pattern `**.test.ts`.
41
+ * You can create folders inside the `test` folder to structure your tests any way you want.
42
+
43
+ ## Go further
44
+
45
+ * Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
46
+ * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
47
+ * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
@@ -0,0 +1,5 @@
1
+ {
2
+ // See http://go.microsoft.com/fwlink/?LinkId=827846
3
+ // for the documentation about the extensions.json format
4
+ "recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
5
+ }
@@ -26,9 +26,10 @@
26
26
  "--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
27
27
  ],
28
28
  "outFiles": [
29
- "${workspaceFolder}/out/test/**/*.js"
29
+ "${workspaceFolder}/out/**/*.js",
30
+ "${workspaceFolder}/dist/**/*.js"
30
31
  ],
31
- "preLaunchTask": "npm: test-watch"
32
+ "preLaunchTask": "tasks: watch-tests"
32
33
  }
33
34
  ]
34
35
  }
@@ -7,12 +7,13 @@
7
7
  "type": "npm",
8
8
  "script": "watch",
9
9
  "problemMatcher": [
10
- "$ts-webpack-watch",
11
- "$tslint-webpack-watch"
10
+ "$ts-webpack-watch",
11
+ "$tslint-webpack-watch"
12
12
  ],
13
13
  "isBackground": true,
14
14
  "presentation": {
15
- "reveal": "never"
15
+ "reveal": "never",
16
+ "group": "watchers"
16
17
  },
17
18
  "group": {
18
19
  "kind": "build",
@@ -21,13 +22,22 @@
21
22
  },
22
23
  {
23
24
  "type": "npm",
24
- "script": "test-watch",
25
+ "script": "watch-tests",
25
26
  "problemMatcher": "$tsc-watch",
26
27
  "isBackground": true,
27
28
  "presentation": {
28
- "reveal": "never"
29
+ "reveal": "never",
30
+ "group": "watchers"
29
31
  },
30
32
  "group": "build"
33
+ },
34
+ {
35
+ "label": "tasks: watch-tests",
36
+ "dependsOn": [
37
+ "npm: watch",
38
+ "npm: watch-tests"
39
+ ],
40
+ "problemMatcher": []
31
41
  }
32
42
  ]
33
43
  }
@@ -0,0 +1,13 @@
1
+ .vscode/**
2
+ .vscode-test/**
3
+ out/**
4
+ node_modules/**
5
+ src/**
6
+ .gitignore
7
+ .yarnrc
8
+ webpack.config.js
9
+ vsc-extension-quickstart.md
10
+ **/tsconfig.json
11
+ **/.eslintrc.json
12
+ **/*.map
13
+ **/*.ts
@@ -4,8 +4,11 @@
4
4
 
5
5
  const path = require('path');
6
6
 
7
- /**@type {import('webpack').Configuration}*/
8
- const config = {
7
+ //@ts-check
8
+ /** @typedef {import('webpack').Configuration} WebpackConfig **/
9
+
10
+ /** @type WebpackConfig */
11
+ const extensionConfig = {
9
12
  target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
10
13
  mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
11
14
 
@@ -16,10 +19,9 @@ const config = {
16
19
  filename: 'extension.js',
17
20
  libraryTarget: 'commonjs2'
18
21
  },
19
- devtool: 'nosources-source-map',
20
22
  externals: {
21
23
  vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
22
- // modules added here also need to be added in the .vsceignore file
24
+ // modules added here also need to be added in the .vscodeignore file
23
25
  },
24
26
  resolve: {
25
27
  // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
@@ -37,6 +39,10 @@ const config = {
37
39
  ]
38
40
  }
39
41
  ]
40
- }
42
+ },
43
+ devtool: 'nosources-source-map',
44
+ infrastructureLogging: {
45
+ level: "log", // enables logging required for problem matchers
46
+ },
41
47
  };
42
- module.exports = config;
48
+ module.exports = [ extensionConfig ];
@@ -1,7 +1,5 @@
1
1
  .vscode/**
2
2
  .vscode-test/**
3
- <% if (webpack) { %>out/**<% } else { %>out/test/**<% } %>
4
- <% if (webpack) { %>node_modules/**<% } %>
5
3
  src/**
6
4
  .gitignore
7
5
  .yarnrc
@@ -0,0 +1 @@
1
+ --ignore-engines true
@@ -27,10 +27,11 @@
27
27
  "test": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. --extensionTestsPath=dist/web/test/suite/index.js",
28
28
  "pretest": "<%= pkgManager %> run compile-web",
29
29
  "vscode:prepublish": "<%= pkgManager %> run package-web",
30
- "compile-web": "webpack --config ./build/web-extension.webpack.config.js",
31
- "watch-web": "webpack --watch --config ./build/web-extension.webpack.config.js",
32
- "package-web": "webpack --mode production --devtool hidden-source-map --config ./build/web-extension.webpack.config.js",
33
- "lint": "eslint src --ext ts"
30
+ "compile-web": "webpack",
31
+ "watch-web": "webpack --watch",
32
+ "package-web": "webpack --mode production --devtool hidden-source-map",
33
+ "lint": "eslint src --ext ts",
34
+ "run-in-browser": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. ."
34
35
  },
35
36
  "devDependencies": {
36
37
  <%- dep("@types/vscode") %>,
@@ -3,16 +3,19 @@
3
3
  ## What's in the folder
4
4
 
5
5
  * This folder contains all of the files necessary for your web extension.
6
- * `package.json` - this is the manifest file in which you declare your extension and command.
7
- * `src/web/extension.ts` - this is the main file for the browser
8
- * `build/web-extension.webpack.config.js` - the webpack config file for the web main
6
+ * `package.json` * this is the manifest file in which you declare your extension and command.
7
+ * `src/web/extension.ts` * this is the main file for the browser
8
+ * `webpack.config.js` * the webpack config file for the web main
9
+
10
+ ## Setup
11
+
12
+ * install the recommended extensions (amodio.tsl-problem-matcher and dbaeumer.vscode-eslint)
9
13
 
10
14
  ## Get up and running the Web Extension
11
15
 
12
- * ⚠️ configure in vscode: `"extensions.webWorker": true`
13
16
  * `npm install`
14
17
  * place breakpoints in `src/web/extension.ts`
15
- * debug via F5 (Run Extension)
18
+ * debug via F5 (Run Web Extension)
16
19
  * execute extension code via `F1 > Hello world`
17
20
 
18
21
  ## Make changes
@@ -20,7 +23,6 @@
20
23
  * You can relaunch the extension from the debug toolbar after changing code in `src/web/extension.ts`.
21
24
  * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
22
25
 
23
-
24
26
  ## Explore the API
25
27
 
26
28
  * You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
@@ -30,11 +32,12 @@
30
32
  * Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
31
33
  * Press `F5` to run the tests in a new window with your extension loaded.
32
34
  * See the output of the test result in the debug console.
33
- * Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
35
+ * Make changes to `src/web/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
34
36
  * The provided test runner will only consider files matching the name pattern `**.test.ts`.
35
37
  * You can create folders inside the `test` folder to structure your tests any way you want.
36
38
 
37
39
  ## Go further
38
40
 
39
- * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
40
- * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
41
+ * Check out the [Web Extension Guide](https://code.visualstudio.com/api/extension-guides/web-extensions)
42
+ * [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
43
+ * Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
@@ -1,8 +1,5 @@
1
1
  {
2
- // See http://go.microsoft.com/fwlink/?LinkId=827846
3
- // for the documentation about the extensions.json format
4
- "recommendations": [
5
- "dbaeumer.vscode-eslint",
6
- "eamodio.tsl-problem-matcher"
7
- ]
2
+ // See http://go.microsoft.com/fwlink/?LinkId=827846
3
+ // for the documentation about the extensions.json format
4
+ "recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
8
5
  }
@@ -6,7 +6,7 @@
6
6
  "version": "0.2.0",
7
7
  "configurations": [
8
8
  {
9
- "name": "Run Web Extension in VS Code",
9
+ "name": "Run Web Extension ",
10
10
  "type": "pwa-extensionHost",
11
11
  "debugWebWorkerHost": true,
12
12
  "request": "launch",
@@ -20,7 +20,7 @@
20
20
  "preLaunchTask": "npm: watch-web"
21
21
  },
22
22
  {
23
- "name": "Extension Tests in VS Code",
23
+ "name": "Extension Tests",
24
24
  "type": "extensionHost",
25
25
  "debugWebWorkerHost": true,
26
26
  "request": "launch",
@@ -3,9 +3,10 @@
3
3
  src/**
4
4
  out/**
5
5
  node_modules/**
6
- build/**
7
6
  .gitignore
8
7
  vsc-extension-quickstart.md
8
+ webpack.config.js
9
+ .yarnrc
9
10
  **/tsconfig.json
10
11
  **/.eslintrc.json
11
12
  **/*.map
@@ -12,14 +12,20 @@
12
12
  const path = require('path');
13
13
  const webpack = require('webpack');
14
14
 
15
- module.exports = /** @type WebpackConfig */ {
16
- context: path.dirname(__dirname),
15
+ /** @type WebpackConfig */
16
+ const webExtensionConfig = {
17
17
  mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
18
18
  target: 'webworker', // extensions run in a webworker context
19
19
  entry: {
20
20
  'extension': './src/web/extension.ts',
21
21
  'test/suite/index': './src/web/test/suite/index.ts'
22
22
  },
23
+ output: {
24
+ filename: '[name].js',
25
+ path: path.join(__dirname, './dist/web'),
26
+ libraryTarget: 'commonjs',
27
+ devtoolModuleFilenameTemplate: '../../[resource-path]'
28
+ },
23
29
  resolve: {
24
30
  mainFields: ['browser', 'module', 'main'], // look for `browser` entry point in imported node modules
25
31
  extensions: ['.ts', '.js'], // support ts-files and js-files
@@ -53,10 +59,10 @@ module.exports = /** @type WebpackConfig */ {
53
59
  performance: {
54
60
  hints: false
55
61
  },
56
- output: {
57
- filename: '[name].js',
58
- path: path.join(__dirname, '../dist/web'),
59
- libraryTarget: 'commonjs'
62
+ devtool: 'nosources-source-map', // create a source map that points to the original source file
63
+ infrastructureLogging: {
64
+ level: "log", // enables logging required for problem matchers
60
65
  },
61
- devtool: 'nosources-source-map' // create a source map that points to the original source file
62
- };
66
+ };
67
+
68
+ module.exports = [ webExtensionConfig ];
@@ -6,6 +6,9 @@
6
6
  "engines": {
7
7
  "vscode": <%- JSON.stringify(vsCodeEngine) %>
8
8
  },
9
+ "keywords": [
10
+ "notebookRenderer"
11
+ ],
9
12
  "categories": [
10
13
  "Other"
11
14
  ],
@@ -48,7 +51,7 @@
48
51
  <%- dep("ts-loader") %>,
49
52
  <%- dep("typescript") %>,
50
53
  <%- dep("vscode-notebook-error-overlay") %>,
51
- <%- dep("vscode-test") %>,
54
+ <%- dep("@vscode/test-electron") %>,
52
55
  <%- dep("webpack") %>,
53
56
  <%- dep("webpack-cli") %>
54
57
  }
@@ -1,6 +1,6 @@
1
1
  import * as path from 'path';
2
2
 
3
- import { runTests } from 'vscode-test';
3
+ import { runTests } from '@vscode/test-electron';
4
4
 
5
5
  async function main() {
6
6
  try {
@@ -1,8 +1,5 @@
1
1
  {
2
2
  // See http://go.microsoft.com/fwlink/?LinkId=827846
3
3
  // for the documentation about the extensions.json format
4
- "recommendations": [
5
- "dbaeumer.vscode-eslint",
6
- "eamodio.tsl-problem-matcher"
7
- ]
4
+ "recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
8
5
  }
@@ -66,6 +66,9 @@ const makeConfig = (argv, { entry, out, target, library = 'commonjs' }) => ({
66
66
  scriptUrl: 'import.meta.url',
67
67
  }),
68
68
  ],
69
+ infrastructureLogging: {
70
+ level: "log", // enables logging required for problem matchers
71
+ },
69
72
  });
70
73
 
71
74
  module.exports = (env, argv) => [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-code",
3
- "version": "1.5.6",
3
+ "version": "1.6.3",
4
4
  "description": "Yeoman generator for Visual Studio Code Extensions",
5
5
  "keywords": [
6
6
  "yeoman-generator",
@@ -38,15 +38,16 @@
38
38
  "fast-plist": "^0.1.2",
39
39
  "request-light": "^0.5.4",
40
40
  "sanitize-filename": "^1.6.3",
41
+ "which": "^2.0.2",
41
42
  "yeoman-generator": "^5.4.2",
42
43
  "yosay": "^2.0.2"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@types/mocha": "^9.0.0",
46
- "@types/node": "^15.12.0",
47
- "@types/yeoman-generator": "^5.2.2",
48
- "@types/yeoman-test": "^4.0.2",
49
- "mocha": "^9.1.0",
47
+ "@types/node": "^16.11.6",
48
+ "@types/yeoman-generator": "^5.2.7",
49
+ "@types/yeoman-test": "^4.0.3",
50
+ "mocha": "^9.1.3",
50
51
  "yeoman-test": "^6.2.0",
51
52
  "yeoman-environment": "^3.6.0"
52
53
  }
@@ -1,8 +0,0 @@
1
- {
2
- // See http://go.microsoft.com/fwlink/?LinkId=827846
3
- // for the documentation about the extensions.json format
4
- "recommendations": [
5
- "dbaeumer.vscode-eslint",
6
- "eamodio.tsl-problem-matcher"
7
- ]
8
- }