Skip to content

Commit

Permalink
updating for latest hyperapp-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
okwolf committed Oct 31, 2020
1 parent 7294bdc commit da0d29a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-hyperapp",
"version": "0.3.0",
"version": "0.4.0",
"description": "Create Hyperapps with no build configuration",
"bin": {
"create-hyperapp": "./bin/index.js"
Expand All @@ -13,13 +13,13 @@
"cross-env": "=7.0.2"
},
"scripts": {
"clean": "npx rimraf node_modules example",
"format": "npx prettier --write bin/*.js example/src/**/*.js",
"format:check": "npx prettier --list-different bin/*.js example/src/**/*.js",
"clean": "npx --ignore-existing --quiet rimraf node_modules example",
"format": "npx prettier --write *.js bin/*.js template/src/**/*.{css,js}",
"format:check": "npx prettier --list-different *.js bin/*.js template/src/**/*.{css,js}",
"create": "npm i && node bin/index.js example",
"test": "npm run clean && npm run create && cd example && npm run build && cross-env CI=1 npm test",
"check": "npm run format:check && npm test",
"release": "node pre-flight-tests && npm run check && git tag $npm_package_version && git push && git push --tags && npm publish"
"release": "node release"
},
"prettier": {
"trailingComma": "none",
Expand Down
19 changes: 15 additions & 4 deletions pre-flight-tests → release.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env node

/* eslint-disable no-undef */
const { execSync } = require("child_process");
const { version } = require("./package");
const exec = command => execSync(command, { encoding: "utf8" }).trim();

const exitWithError = error => {
process.stderr.write(`\x1b[1;31m${error}\x1b[0m\n\n`);
process.exit(1);
};
/* eslint-enable no-undef */

const gitBranchName = exec("git rev-parse --abbrev-ref HEAD");
if (gitBranchName !== "master") {
Expand All @@ -19,3 +16,17 @@ const workingCopyChanges = exec("git status --porcelain");
if (workingCopyChanges) {
exitWithError("please commit your changes before making a release!");
}

const tagExists = exec(`git tag -l "${version}"`);
if (tagExists) {
exitWithError(`${version} has already been released!`);
}

execSync(
`npm run check && git tag ${version} && git push && git push --tags && npm publish`,
{
shell: true,
stdio: "inherit",
cwd: __dirname
}
);
1 change: 0 additions & 1 deletion template/src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { h } from "hyperapp";
import logo from "./logo.svg";
import "./App.css";

Expand Down
6 changes: 3 additions & 3 deletions template/src/index.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
4 changes: 2 additions & 2 deletions template/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { h, app } from "hyperapp";
import { app } from "hyperapp";
import "./index.css";
import App from "./App";

app({ view: () => <App />, node: document.getElementById("app") });
app({ init: {}, view: () => <App />, node: document.getElementById("app") });

0 comments on commit da0d29a

Please sign in to comment.