Skip to content

Commit 6c1af45

Browse files
authored
feat: remove extension titles (#40)
sourcegraph/sourcegraph#1613 eliminates extension titles; the extension ID is used instead. This commit makes the extension creator not ask for or write a title.
1 parent 898daae commit 6c1af45

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

src/cli.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,16 @@ async function getHttpsGitRemoteUrl(): Promise<string | undefined> {
2828
async function main(): Promise<void> {
2929
console.log(['', 'Welcome to the Sourcegraph extension creator!', ''].join('\n'))
3030

31-
const schema = 'https://raw.githubusercontent.com/sourcegraph/sourcegraph/master/shared/src/schema/extension.schema.json'
31+
const schema =
32+
'https://raw.githubusercontent.com/sourcegraph/sourcegraph/master/shared/src/schema/extension.schema.json'
3233
let name: string | undefined
3334
let repository: Repository | undefined
34-
let title: string | undefined
3535
let description: string | undefined
3636
let publisher: string | undefined
3737
let license: string | undefined
3838

3939
try {
40-
;({ name, title, description, publisher, repository, license } = JSON.parse(
41-
await readFile('package.json', 'utf-8')
42-
))
40+
;({ name, description, publisher, repository, license } = JSON.parse(await readFile('package.json', 'utf-8')))
4341
} catch (err) {
4442
if (err.code !== 'ENOENT') {
4543
throw err
@@ -76,16 +74,6 @@ async function main(): Promise<void> {
7674
})
7775
}
7876

79-
if (title) {
80-
console.log(`Extension title is "${title}"`)
81-
} else {
82-
title =
83-
'WIP: ' +
84-
(await prompt.input({
85-
message: 'What should the title of the extension be (Sentence case)?',
86-
}))
87-
}
88-
8977
if (description) {
9078
console.log(`Description is "${description}"`)
9179
} else {
@@ -175,10 +163,12 @@ async function main(): Promise<void> {
175163
const packageJson: JsonSchemaForNpmPackageJsonFiles = {
176164
$schema: schema,
177165
name,
178-
title,
179166
description,
180167
publisher,
181168
activationEvents: ['*'],
169+
wip: true,
170+
categories: [],
171+
tags: [],
182172
contributes: {
183173
actions: [],
184174
menus: {
@@ -223,7 +213,7 @@ async function main(): Promise<void> {
223213
" sourcegraph.languages.registerHoverProvider(['*'], {",
224214
' provideHover: () => ({',
225215
' contents: {',
226-
` value: 'Hello world from ${title}! 🎉🎉🎉',`,
216+
` value: 'Hello world from ${name}! 🎉🎉🎉',`,
227217
' kind: sourcegraph.MarkupKind.Markdown',
228218
' }',
229219
' }),',
@@ -262,15 +252,15 @@ async function main(): Promise<void> {
262252
} else {
263253
console.log('📄 Adding README')
264254
const readme = [
265-
`# ${title} Sourcegraph extension`,
255+
`# ${name} (Sourcegraph extension)`,
266256
'',
267257
description[description.length - 1] === '.' ? description : description + '.',
268258
'',
269259
].join('\n')
270260
await writeFile('README.md', readme)
271261
}
272262

273-
console.log('⚠️ Remove "WIP:" from the title when this extension is ready for use.')
263+
console.log('⚠️ Remove `"wip": true` from the package.json when this extension is ready for use.')
274264

275265
setTimeout(() => process.exit(0), 100)
276266
}

0 commit comments

Comments
 (0)