脚手架
# 脚手架
安装的yo
可以直接生成一个Hello World
版本的插件目录。执行
yo code
1
根据提示生成样板代码:
.
CHANGELOG.md
README.md
node_modules
package-lock.json
package.json
src
tsconfig.json
vsc-extension-quickstart.md
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
其中的quickstart.md
是新手引导,里面包含了对文件的作用解析、如何运行插件、测试插等等,推荐去看一看,我们在下面也会介绍一些。除此之外在package.json
里也包含了很多非常重要的信息:
{
"name": "hello-world",
"displayName": "hello-world",
"description": "hello-world",
"version": "0.0.1",
"engines": {
"vscode": "^1.61.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:hello-world.helloWorld"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "hello-world.helloWorld",
"title": "Hello World"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/vscode": "^1.61.0",
"@types/glob": "^7.1.4",
"@types/mocha": "^9.0.0",
"@types/node": "14.x",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"eslint": "^7.32.0",
"glob": "^7.1.7",
"mocha": "^9.1.1",
"typescript": "^4.4.3",
"@vscode/test-electron": "^1.6.2"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
上次更新: 2023/10/17, 16:50:29 访问次数: 0