Skip to content

Commit a12d1a9

Browse files
committed
workflow: add prepublish script to build and push to the playground submodule
1 parent 6c87c3a commit a12d1a9

File tree

3 files changed

+217
-2
lines changed

3 files changed

+217
-2
lines changed

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"snapshot": "node snapshot.js",
2121
"pretest": "run-s build snapshot",
2222
"test": "node test.js",
23-
"prepublishOnly": "run-s build snapshot"
23+
"prepublishOnly": "zx ./scripts/prepublish.mjs"
2424
},
2525
"repository": {
2626
"type": "git",
@@ -41,7 +41,8 @@
4141
"minimist": "^1.2.5",
4242
"npm-run-all": "^4.1.5",
4343
"prettier": "^2.5.1",
44-
"prompts": "^2.4.2"
44+
"prompts": "^2.4.2",
45+
"zx": "^4.2.0"
4546
},
4647
"lint-staged": {
4748
"*.{js,ts,vue,json}": [

pnpm-lock.yaml

+193
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/prepublish.mjs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env zx
2+
import 'zx/globals'
3+
4+
await $`pnpm build`
5+
await $`pnpm snapshot`
6+
7+
let { version } = JSON.parse(await fs.readFile('./package.json'))
8+
9+
cd('./playground')
10+
11+
await $`git add -A .`
12+
try {
13+
await $`git commit -m "version ${version} snapshot"`
14+
} catch (e) {
15+
if (!e.message.includes('nothing to commit')) {
16+
throw e
17+
}
18+
}
19+
20+
await $`git tag -m "v${version}" v${version}`
21+
await $`git push --follow-tags`

0 commit comments

Comments
 (0)