Skip to content

Commit 719067a

Browse files
committed
feat(gpt-runner-cli): add alias publish to gptr
1 parent ef532c6 commit 719067a

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
- name: Install Dependencies And Build
3434
run: pnpm i
3535

36+
- name: Package Alias Copy
37+
run: pnpm pkg:alias
38+
3639
- name: Publish to NPM
3740
run: pnpm -r publish --access public --no-git-checks
3841
env:

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"play": "npm -C playground run dev",
1515
"lint": "eslint --cache .",
1616
"lint:fix": "pnpm lint --fix",
17+
"pkg:alias": "esno ./scripts/cli-pkg-alias.ts",
1718
"postinstall": "pnpm build",
1819
"release": "bumpp -r",
1920
"stub": "pnpm -r --filter=./packages/* --parallel run stub",
@@ -75,4 +76,4 @@
7576
"eslint --cache --fix"
7677
]
7778
}
78-
}
79+
}

scripts/cli-pkg-alias.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import path from 'node:path'
2+
import { fileURLToPath } from 'node:url'
3+
import fs from 'fs-extra'
4+
5+
const dirname = path.dirname(fileURLToPath(import.meta.url))
6+
const root = path.join(dirname, '..')
7+
const gptRunnerCliPkgPath = path.join(root, './packages/gpt-runner-cli')
8+
const gptrPkgPath = path.join(root, './packages/gptr')
9+
10+
async function cloneToGptrAliasPkg() {
11+
const pkgJsonPath = path.join(gptRunnerCliPkgPath, 'package.json')
12+
const gptrPkgJsonPath = path.join(gptrPkgPath, 'package.json')
13+
const rawJSON = await fs.readFile(pkgJsonPath, 'utf-8')
14+
const pkg = JSON.parse(rawJSON)
15+
pkg.name = 'gptr'
16+
17+
await fs.ensureDir(gptrPkgPath)
18+
await fs.copy(gptRunnerCliPkgPath, gptrPkgPath)
19+
20+
await fs.writeJSON(gptrPkgJsonPath, pkg, { spaces: 2 })
21+
}
22+
23+
cloneToGptrAliasPkg()

0 commit comments

Comments
 (0)