-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathpublish.ts
28 lines (23 loc) · 998 Bytes
/
publish.ts
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
import fs from 'fs-extra'
import { execa } from 'execa'
import { PathUtils } from '@nicepkg/gpt-runner-shared/node'
const dirname = PathUtils.getCurrentDirName(import.meta.url, () => __dirname)
const root = PathUtils.join(dirname, '..')
async function publish() {
const pkgPath = PathUtils.join(root, 'package.json')
const rawJSON = await fs.readFile(pkgPath, 'utf-8')
const pkg = JSON.parse(rawJSON)
pkg.name = 'gpt-runner'
await fs.writeJSON(pkgPath, pkg, { spaces: 2 })
await execa('npm', ['run', 'build'], { cwd: root, stdio: 'inherit' })
try {
console.log('\nPublish to VSCE...\n')
await execa('npx', ['vsce', 'publish', '--no-dependencies', '-p', process.env.VSCE_TOKEN!], { cwd: root, stdio: 'inherit' })
// console.log('\nPublish to OVSE...\n')
// await execa('npx', ['ovsx', 'publish', '--no-dependencies', '-p', process.env.OVSX_TOKEN!], { cwd: root, stdio: 'inherit' })
}
finally {
await fs.writeFile(pkgPath, rawJSON, 'utf-8')
}
}
publish()