feat(gpt-runner-cli): add alias publish to gptr
This commit is contained in:
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -33,6 +33,9 @@ jobs:
|
||||
- name: Install Dependencies And Build
|
||||
run: pnpm i
|
||||
|
||||
- name: Package Alias Copy
|
||||
run: pnpm pkg:alias
|
||||
|
||||
- name: Publish to NPM
|
||||
run: pnpm -r publish --access public --no-git-checks
|
||||
env:
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"play": "npm -C playground run dev",
|
||||
"lint": "eslint --cache .",
|
||||
"lint:fix": "pnpm lint --fix",
|
||||
"pkg:alias": "esno ./scripts/cli-pkg-alias.ts",
|
||||
"postinstall": "pnpm build",
|
||||
"release": "bumpp -r",
|
||||
"stub": "pnpm -r --filter=./packages/* --parallel run stub",
|
||||
@@ -75,4 +76,4 @@
|
||||
"eslint --cache --fix"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
23
scripts/cli-pkg-alias.ts
Normal file
23
scripts/cli-pkg-alias.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import fs from 'fs-extra'
|
||||
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const root = path.join(dirname, '..')
|
||||
const gptRunnerCliPkgPath = path.join(root, './packages/gpt-runner-cli')
|
||||
const gptrPkgPath = path.join(root, './packages/gptr')
|
||||
|
||||
async function cloneToGptrAliasPkg() {
|
||||
const pkgJsonPath = path.join(gptRunnerCliPkgPath, 'package.json')
|
||||
const gptrPkgJsonPath = path.join(gptrPkgPath, 'package.json')
|
||||
const rawJSON = await fs.readFile(pkgJsonPath, 'utf-8')
|
||||
const pkg = JSON.parse(rawJSON)
|
||||
pkg.name = 'gptr'
|
||||
|
||||
await fs.ensureDir(gptrPkgPath)
|
||||
await fs.copy(gptRunnerCliPkgPath, gptrPkgPath)
|
||||
|
||||
await fs.writeJSON(gptrPkgJsonPath, pkg, { spaces: 2 })
|
||||
}
|
||||
|
||||
cloneToGptrAliasPkg()
|
||||
Reference in New Issue
Block a user