generator-code 1.6.2 → 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.
- package/generators/app/generate-command-ts .js +14 -1
- package/generators/app/generate-command-web.js +9 -0
- package/generators/app/index.js +46 -8
- package/generators/app/package.json +7 -7
- package/generators/app/templates/ext-command-ts/vscode-webpack/vsc-extension-quickstart.md +47 -0
- package/generators/app/templates/ext-command-ts/vscode-webpack/vscode/extensions.json +3 -6
- package/generators/app/templates/ext-command-ts/vscode-webpack/webpack.config.js +5 -2
- package/generators/app/templates/ext-command-web/vsc-extension-quickstart.md +8 -8
- package/generators/app/templates/ext-command-web/vscode/extensions.json +3 -6
- package/generators/app/templates/ext-command-web/webpack.config.js +4 -1
- package/generators/app/templates/ext-notebook-renderer/vscode/extensions.json +1 -4
- package/generators/app/templates/ext-notebook-renderer/webpack.config.js +3 -0
- package/package.json +6 -5
|
@@ -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 = {
|
|
@@ -33,11 +34,13 @@ module.exports = {
|
|
|
33
34
|
generator.fs.copyTpl(generator.templatePath('vscode-webpack/tsconfig.json'), generator.destinationPath('tsconfig.json'), extensionConfig);
|
|
34
35
|
generator.fs.copyTpl(generator.templatePath('vscode-webpack/vscodeignore'), generator.destinationPath('.vscodeignore'), extensionConfig);
|
|
35
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);
|
|
36
38
|
} else {
|
|
37
39
|
generator.fs.copy(generator.templatePath('vscode'), generator.destinationPath('.vscode'));
|
|
38
40
|
generator.fs.copyTpl(generator.templatePath('package.json'), generator.destinationPath('package.json'), extensionConfig);
|
|
39
41
|
generator.fs.copyTpl(generator.templatePath('tsconfig.json'), generator.destinationPath('tsconfig.json'), extensionConfig);
|
|
40
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);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
if (extensionConfig.gitInit) {
|
|
@@ -45,7 +48,6 @@ module.exports = {
|
|
|
45
48
|
}
|
|
46
49
|
generator.fs.copyTpl(generator.templatePath('README.md'), generator.destinationPath('README.md'), extensionConfig);
|
|
47
50
|
generator.fs.copyTpl(generator.templatePath('CHANGELOG.md'), generator.destinationPath('CHANGELOG.md'), extensionConfig);
|
|
48
|
-
generator.fs.copyTpl(generator.templatePath('vsc-extension-quickstart.md'), generator.destinationPath('vsc-extension-quickstart.md'), extensionConfig);
|
|
49
51
|
generator.fs.copyTpl(generator.templatePath('src/extension.ts'), generator.destinationPath('src/extension.ts'), extensionConfig);
|
|
50
52
|
generator.fs.copy(generator.templatePath('src/test'), generator.destinationPath('src/test'));
|
|
51
53
|
generator.fs.copy(generator.templatePath('.eslintrc.json'), generator.destinationPath('.eslintrc.json'));
|
|
@@ -56,5 +58,16 @@ module.exports = {
|
|
|
56
58
|
|
|
57
59
|
extensionConfig.installDependencies = true;
|
|
58
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
|
+
}
|
|
59
72
|
}
|
|
60
73
|
}
|
|
@@ -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 = {
|
|
@@ -50,5 +51,13 @@ module.exports = {
|
|
|
50
51
|
|
|
51
52
|
extensionConfig.installDependencies = true;
|
|
52
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('');
|
|
53
62
|
}
|
|
54
63
|
}
|
package/generators/app/index.js
CHANGED
|
@@ -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.
|
|
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[
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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
|
}
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@types/glob": "^7.1.4",
|
|
4
4
|
"@types/mocha": "^9.0.0",
|
|
5
|
-
"@types/node": "14.
|
|
6
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
7
|
-
"@typescript-eslint/parser": "^
|
|
8
|
-
"eslint": "^
|
|
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
9
|
"glob": "^7.1.7",
|
|
10
|
-
"mocha": "^9.1.
|
|
11
|
-
"typescript": "^4.4.
|
|
10
|
+
"mocha": "^9.1.3",
|
|
11
|
+
"typescript": "^4.4.4",
|
|
12
12
|
"@vscode/test-electron": "^1.6.2",
|
|
13
13
|
"@vscode/test-web": "^0.0.13",
|
|
14
14
|
"@types/webpack-env": "^1.16.2",
|
|
15
15
|
"@types/vscode-notebook-renderer": "^1.57.8",
|
|
16
|
-
"concurrently": "
|
|
16
|
+
"concurrently": "^5.3.0",
|
|
17
17
|
"css-loader": "^4.2.0",
|
|
18
18
|
"fork-ts-checker-webpack-plugin": "^5.0.14",
|
|
19
19
|
"style-loader": "^1.2.1",
|
|
@@ -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).
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
}
|
|
@@ -21,7 +21,7 @@ const extensionConfig = {
|
|
|
21
21
|
},
|
|
22
22
|
externals: {
|
|
23
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/
|
|
24
|
-
// modules added here also need to be added in the .
|
|
24
|
+
// modules added here also need to be added in the .vscodeignore file
|
|
25
25
|
},
|
|
26
26
|
resolve: {
|
|
27
27
|
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
|
|
@@ -40,6 +40,9 @@ const extensionConfig = {
|
|
|
40
40
|
}
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
|
-
devtool: 'nosources-source-map'
|
|
43
|
+
devtool: 'nosources-source-map',
|
|
44
|
+
infrastructureLogging: {
|
|
45
|
+
level: "log", // enables logging required for problem matchers
|
|
46
|
+
},
|
|
44
47
|
};
|
|
45
48
|
module.exports = [ extensionConfig ];
|
|
@@ -3,13 +3,13 @@
|
|
|
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`
|
|
7
|
-
* `src/web/extension.ts`
|
|
8
|
-
* `webpack.config.js`
|
|
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
9
|
|
|
10
10
|
## Setup
|
|
11
11
|
|
|
12
|
-
* install the recommended extensions (
|
|
12
|
+
* install the recommended extensions (amodio.tsl-problem-matcher and dbaeumer.vscode-eslint)
|
|
13
13
|
|
|
14
14
|
## Get up and running the Web Extension
|
|
15
15
|
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* You can relaunch the extension from the debug toolbar after changing code in `src/web/extension.ts`.
|
|
24
24
|
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
## Explore the API
|
|
28
27
|
|
|
29
28
|
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
* You can create folders inside the `test` folder to structure your tests any way you want.
|
|
39
38
|
|
|
40
39
|
## Go further
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
}
|
|
@@ -59,7 +59,10 @@ const webExtensionConfig = {
|
|
|
59
59
|
performance: {
|
|
60
60
|
hints: false
|
|
61
61
|
},
|
|
62
|
-
devtool: 'nosources-source-map' // create a source map that points to the original source file
|
|
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
|
|
65
|
+
},
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
module.exports = [ webExtensionConfig ];
|
|
@@ -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.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": "^
|
|
47
|
-
"@types/yeoman-generator": "^5.2.
|
|
48
|
-
"@types/yeoman-test": "^4.0.
|
|
49
|
-
"mocha": "^9.1.
|
|
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
|
}
|