Skip to content

Commit bcfb050

Browse files
committed
feat(gpt-runner-vscode): add build visx script
1 parent d204c94 commit bcfb050

File tree

5 files changed

+187
-40
lines changed

5 files changed

+187
-40
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
"tagify",
4444
"tanstack",
4545
"tiktoken",
46+
"tsup",
4647
"unconfig",
4748
"uuidv",
49+
"vsix",
4850
"zustand"
4951
],
5052
"workbench.colorCustomizations": {

packages/gpt-runner-cli/src/cli-start.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export async function startCli(cwd = PathUtils.resolve(process.cwd()), argv = pr
2222
.option('-p, --port [port number]', 'Server port', {
2323
default: 3003,
2424
})
25-
.option('-c, --config [file]', 'Config file path')
26-
.option('-w, --watch', 'Watch for file changes')
25+
// .option('-c, --config [file]', 'Config file path')
26+
// .option('-w, --watch', 'Watch for file changes')
2727
.option('--no-open', 'Open in browser')
2828
.option('--debug', 'Debug mode')
2929
.action(async (rootPaths: Array<string>, flags) => {

packages/gpt-runner-vscode/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
},
8484
"scripts": {
8585
"build": "tsup",
86+
"build:vsix": "pnpm esno ./scripts/build.ts",
8687
"dev": "tsup --watch src",
8788
"publish": "esno ./scripts/publish.ts"
8889
},
@@ -95,6 +96,7 @@
9596
},
9697
"devDependencies": {
9798
"@types/vscode": "^1.71.0",
99+
"@vscode/vsce": "^2.19.0",
98100
"esno": "^0.16.3",
99101
"execa": "^7.1.1",
100102
"fs-extra": "^11.1.1"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { dirname, join } from 'path'
2+
import fs from 'fs-extra'
3+
import { execa } from 'execa'
4+
import { PathUtils } from '@nicepkg/gpt-runner-shared/node'
5+
6+
const dir = PathUtils.getCurrentDirName(import.meta.url)
7+
const root = dirname(dir)
8+
9+
async function buildVsix() {
10+
const pkgPath = join(root, 'package.json')
11+
const rawJSON = await fs.readFile(pkgPath, 'utf-8')
12+
const pkg = JSON.parse(rawJSON)
13+
pkg.name = 'gpt-runner'
14+
15+
await fs.writeJSON(pkgPath, pkg, { spaces: 2 })
16+
await execa('pnpm', ['run', 'build'], { cwd: root, stdio: 'inherit' })
17+
18+
try {
19+
console.log('\nBuild Vsix...\n')
20+
await execa('vsce', ['package', '-o', 'dist/gpt-runner.vsix', '--no-dependencies'], { cwd: root, stdio: 'inherit' })
21+
}
22+
finally {
23+
await fs.writeFile(pkgPath, rawJSON, 'utf-8')
24+
}
25+
}
26+
27+
buildVsix()

0 commit comments

Comments
 (0)