Skip to content

Commit b95e858

Browse files
committed
bump version and refactor release process
1 parent 8b62cc4 commit b95e858

File tree

4 files changed

+46
-34
lines changed

4 files changed

+46
-34
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ jobs:
77
matrix:
88
node-version: [10.x, 12.x, 14.x]
99
steps:
10-
- uses: actions/checkout@v2
11-
- name: Use Node.js ${{ matrix.node-version }}
12-
uses: actions/setup-node@v1
13-
with:
14-
node-version: ${{ matrix.node-version }}
15-
- run: |
16-
npm i -g codecov
17-
npm i
18-
codecov
10+
- uses: actions/checkout@v2
11+
- name: Use Node.js ${{ matrix.node-version }}
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: ${{ matrix.node-version }}
15+
- run: |
16+
npm i -g codecov
17+
npm i
18+
npm run check
19+
codecov

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hyperapp-fx",
3-
"version": "2.0.0-beta.1",
3+
"version": "2.0.0-beta.2",
44
"description": "Effects for use with Hyperapp",
55
"main": "dist/hyperappFx.js",
66
"module": "src/index.js",
@@ -19,7 +19,7 @@
1919
"uglify-js": "=3.5.2"
2020
},
2121
"scripts": {
22-
"clean": "npx rimraf coverage dist node_modules",
22+
"clean": "npx --ignore-existing --quiet rimraf coverage dist node_modules",
2323
"format": "prettier --write '{src,test}/**/*.js'",
2424
"format:check": "prettier --list-different {src,test}/**/*.js",
2525
"lint": "eslint {src,test}/**/*.js",
@@ -29,8 +29,8 @@
2929
"minify": "uglifyjs dist/hyperappFx.js -o dist/hyperappFx.js -mc pure_funcs=['Object.defineProperty'] --source-map includeSources,url=hyperappFx.js.map",
3030
"check": "npm run format:check && npm run lint && npm t",
3131
"build": "npm run check && npm run bundle && npm run minify",
32-
"prepare": "npm run build && npm run doc",
33-
"release": "./pre-flight-tests && npm run clean && npm i && ./pre-flight-tests && git tag $npm_package_version && git push && git push --tags && npm publish --tag next"
32+
"release:dry": "npm run clean && npm i && npm run check && npm run build && npm run doc",
33+
"release": "node release"
3434
},
3535
"prettier": {
3636
"semi": false

pre-flight-tests

Lines changed: 0 additions & 21 deletions
This file was deleted.

release.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const { execSync } = require("child_process");
2+
const { version } = require("./package");
3+
const exec = command => execSync(command, { encoding: "utf8" }).trim();
4+
5+
const exitWithError = error => {
6+
process.stderr.write(`\x1b[1;31m${error}\x1b[0m\n\n`);
7+
process.exit(1);
8+
};
9+
10+
const gitBranchName = exec("git rev-parse --abbrev-ref HEAD");
11+
if (gitBranchName !== "master") {
12+
exitWithError("please checkout the master branch to make a release!");
13+
}
14+
15+
const workingCopyChanges = exec("git status --porcelain");
16+
if (workingCopyChanges) {
17+
exitWithError("please commit your changes before making a release!");
18+
}
19+
20+
const tagExists = exec(`git tag -l "${version}"`);
21+
if (tagExists) {
22+
exitWithError(`${version} has already been released!`);
23+
}
24+
25+
execSync(
26+
`npm run release:dry && git tag ${version} && git push && git push --tags && npm publish`,
27+
{
28+
shell: true,
29+
stdio: "inherit",
30+
cwd: __dirname
31+
}
32+
);

0 commit comments

Comments
 (0)