Skip to content

Commit

Permalink
ci: fix npm and release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
norskeld committed Nov 15, 2021
1 parent 372897f commit 665b5b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
"scripts": {
"build": "npm run build:types && npm run build:rollup",
"build:types": "tsc -p tsconfig.types.json",
"build:rollup": "tsm scripts/compile.ts",
"build:rollup": "npx tsm scripts/compile.ts",
"fmt:prettier": "prettier --write \"**/*.{js,ts,json}\"",
"fmt:style": "eslint --fix --ext .js,.ts .",
"postbuild": "rimraf dist/types",
"postversion": "tsm scripts/release.ts restore",
"postversion": "npx tsm ../scripts/release.ts restore",
"prebuild": "rimraf dist",
"prepack": "tsm scripts/release.ts prepare",
"prerelease": "npx tsm scripts/release.ts prepare",
"prepare": "husky install",
"release": "npx semantic-release",
"release:dry": "npx semantic-release --dry-run",
Expand Down
7 changes: 4 additions & 3 deletions scripts/release.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { access, copyFile } from 'fs/promises'
import { constants } from 'fs'
import { resolve } from 'path'

interface Success {
kind: 'success'
Expand Down Expand Up @@ -71,15 +72,15 @@ async function main() {
}
},

/** This should be called in `postversion`. */
/** This should be called in `postversion`. Here we actually are inside the `dist`. */
async restore() {
try {
// Copy back.
await copyFile(`${cwd}/dist/package.json`, `${cwd}/package.json`)
await copyFile(`${cwd}/package.json`, resolve(cwd, '..', 'package.json'))

return {
kind: 'success',
message: 'Successfully prepared files for a release.'
message: 'Successfully restored `package.json`.'
}
} catch (error) {
return {
Expand Down

0 comments on commit 665b5b1

Please sign in to comment.