diff --git a/package.json b/package.json index 0c364c6..a501a7d 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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", diff --git a/pre-flight-tests b/release.js old mode 100755 new mode 100644 similarity index 62% rename from pre-flight-tests rename to release.js index 5eb10a9..1a42a19 --- a/pre-flight-tests +++ b/release.js @@ -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") { @@ -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 + } +); diff --git a/template/src/App.js b/template/src/App.js index 83ac2a9..310a0fa 100644 --- a/template/src/App.js +++ b/template/src/App.js @@ -1,4 +1,3 @@ -import { h } from "hyperapp"; import logo from "./logo.svg"; import "./App.css"; diff --git a/template/src/index.css b/template/src/index.css index ec2585e..4a1df4d 100644 --- a/template/src/index.css +++ b/template/src/index.css @@ -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; } diff --git a/template/src/index.js b/template/src/index.js index dadc458..0786007 100644 --- a/template/src/index.js +++ b/template/src/index.js @@ -1,5 +1,5 @@ -import { h, app } from "hyperapp"; +import { app } from "hyperapp"; import "./index.css"; import App from "./App"; -app({ view: () => , node: document.getElementById("app") }); +app({ init: {}, view: () => , node: document.getElementById("app") });