Skip to content

Commit 97f67c7

Browse files
committed
feat(creator): update README content and add publisher field
1 parent d52dea5 commit 97f67c7

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

packages/creator/index.ts

+13-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ async function main() {
2626
const cwd = process.cwd()
2727

2828
let displayName = process.argv.slice(2).filter(s => /^[\w\- ]+$/.test(s)).map(s => s.trim()).join(' ') || 'Your Extension'
29+
let publisher = ''
2930
let identifier = ''
3031
let targetDir = ''
3132

@@ -34,18 +35,26 @@ async function main() {
3435
{
3536
name: 'displayName',
3637
type: 'text',
37-
message: 'What\'s the name of your extension?',
38+
message: 'What\'s the display name of your extension?',
3839
initial: displayName,
3940
onState: state => displayName = state.value || displayName,
4041
},
4142
{
4243
name: 'identifier',
4344
type: 'text',
44-
message: 'What\'s the identifier of your extension?',
45+
message: 'What\'s the package name of your extension?',
4546
initial: () => identifier = toValidPackageName(displayName),
4647
validate: id => isValidPackageName(id) || 'Invalid package.json name',
4748
onState: state => identifier = state.value || identifier,
4849
},
50+
{
51+
name: 'publisher',
52+
type: 'text',
53+
message: 'What\'s your publisher name?',
54+
initial: publisher,
55+
validate: pub => isValidPackageName(pub) || 'Invalid publisher name',
56+
onState: state => publisher = state.value || publisher,
57+
},
4958
{
5059
name: 'targetDir',
5160
type: 'text',
@@ -75,12 +84,12 @@ async function main() {
7584
fs.mkdirSync(root, { recursive: true })
7685
process.chdir(root)
7786

78-
fs.writeFileSync('package.json', tPackage(identifier, displayName, `^${corePackage.version}`))
87+
fs.writeFileSync('package.json', tPackage(publisher, identifier, displayName, `^${corePackage.version}`))
7988
fs.writeFileSync('tsconfig.json', tTsconfig)
8089
fs.writeFileSync('.gitignore', tGitignore)
8190
fs.writeFileSync('.vscodeignore', tVscodeignore)
8291
fs.writeFileSync('tsup.config.ts', tTsupConfig)
83-
fs.writeFileSync('README.md', tReadme(displayName))
92+
fs.writeFileSync('README.md', tReadme(publisher, identifier, displayName))
8493

8594
fs.mkdirSync('src')
8695
const srcCode = tSrc(identifier, displayName)

packages/creator/templates/package.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
export default (identifier: string, displayName: string, coreVersion: string) => `{
1+
export default (publisher: string, identifier: string, displayName: string, coreVersion: string) => `{
2+
"publisher": "${publisher}",
23
"name": "${identifier}",
34
"displayName": "${displayName}",
45
"type": "module",

packages/creator/templates/readme.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
export default (displayName: string) => `# ${displayName}
1+
export default (publisher: string, identifier: string, displayName: string) => `# ${displayName}
22
3-
An VS Code extension created with [Reactive VS Code](https://kermanx.github.io/reactive-vscode/).
3+
[![Version](https://img.shields.io/visual-studio-marketplace/v/${publisher}.${identifier})](https://marketplace.visualstudio.com/items?itemName=${publisher}.${identifier}) [![Installs](https://img.shields.io/visual-studio-marketplace/i/${publisher}.${identifier}](https://marketplace.visualstudio.com/items?itemName=${publisher}.${identifier}) [![Reactive VSCode](https://img.shields.io/badge/Reactive-VSCode-%23007ACC?style=flat&labelColor=%23229863)](https://kermanx.github.io/reactive-vscode/)
44
5-
## What's in the folder
5+
A VS Code extension created with [Reactive VS Code](https://kermanx.github.io/reactive-vscode/).
6+
7+
## Directory Structure
68
79
* \`package.json\` - this is the manifest file in which you declare your extension and command.
810
* \`src/extension.ts\` - this is the main file where you write your extension.
911
10-
## Get up and running straight away
12+
## Get started
1113
12-
* Run \`npm run dev\` in a terminal to compile the extension.
14+
* Open this repository in VS Code.
15+
* Run \`pnpm install\` to install the dependencies.
16+
* Run \`pnpm dev\` to compile the extension and watch for changes.
1317
* Press \`F5\` to open a new window with your extension loaded.
1418
* Run your command from the command palette by pressing (\`Ctrl+Shift+P\` or \`Cmd+Shift+P\` on Mac) and typing \`Hello World\`.
1519
* Set breakpoints in your code inside \`src/extension.ts\` to debug your extension.
@@ -23,7 +27,6 @@ An VS Code extension created with [Reactive VS Code](https://kermanx.github.io/r
2327
## Go further
2428
2529
* [Follow UX guidelines](https://code.visualstudio.com/api/ux-guidelines/overview) to create extensions that seamlessly integrate with VS Code's native interface and patterns.
26-
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
27-
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
28-
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
30+
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
31+
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
2932
`

0 commit comments

Comments
 (0)