diff --git a/README.md b/README.md index 70e6f94..83529c2 100644 --- a/README.md +++ b/README.md @@ -103,22 +103,44 @@ For more advanced documentation generation, you can provide your own [typedoc th yarn docs:json ``` -## Generate/update changelog & release +## Generate/update changelog & tag release This project is tooled for [Conventional Changelog](https://github.com/conventional-changelog/conventional-changelog) to make managing releases easier. See the [standard-version](https://github.com/conventional-changelog/standard-version) documentation for more information on the workflow, or [`CHANGELOG.md`](CHANGELOG.md) for an example. ```bash # bump package.json version, update CHANGELOG.md, git tag the release +yarn changelog +``` + +## One-step publish preparation script + +Bringing together many of the steps above, this repo includes a one-step release command. + +```bash +# Standard release yarn release # Release without bumping package.json version -yarn release -- --first-release +yarn changelog -- --first-release # PGP sign the release -yarn release -- --sign +yarn changelog -- --sign ``` +This command runs: +- `yarn reset`: cleans the repo by removing all untracked files and resetting `--hard` to the latest commit. (**Note: this could be destructive.**) +- `yarn test`: build and fully test the project +- `yarn docs:publish`: generate and publish the latest version of the documentation to GitHub Pages +- `yarn changelog`: bump package.json version, update CHANGELOG.md, and git tag the release + +When the script finishes, it will log the final command needed to push the release commit to the repo and publish the package on the `npm` registry: + +``` +git push --follow-tags origin master; npm publish +``` +Look over the release if you'd like, then execute the command to publish everything. + ## All package scripts -You can run the `info` script for information on each available package script. +You can run the `info` script for information on each script intended to be individually run. ``` yarn run info @@ -130,27 +152,25 @@ yarn run info lint: Lint all typescript source files unit: - Run unit tests + Build the library and run unit tests test: - Lint and test the library + Lint, build, and test the library watch: Watch source files, rebuild library on changes, rerun relevant tests - watch:build: - Watch source files, rebuild library on changes - watch:unit: - Watch the build, rerun relevant tests on changes cov: Run tests, generate the HTML coverage report, and open it in a browser - html-coverage: - Output HTML test coverage report - send-coverage: - Output lcov test coverage report and send it to codecov docs: - Generate API documentation and open it in a browser + Generate HTML API documentation and open it in a browser + docs:publish: + Generate HTML API documentation and push it to GitHub Pages docs:json: Generate API documentation in typedoc JSON format release: Bump package.json version, update CHANGELOG.md, tag a release + reset: + Delete all untracked files and reset the repo to the last commit + publish: + Reset, build, test, publish docs, and prepare release (a one-step publish process) ``` ## Notes diff --git a/package.json b/package.json index ac98632..3887bb1 100644 --- a/package.json +++ b/package.json @@ -31,23 +31,24 @@ "docs:html": "typedoc src/index.ts --excludePrivate --mode file --theme minimal --out build/docs", "docs:json": "typedoc --mode file --json build/docs/typedoc.json src/index.ts", "docs:publish": "yarn docs:html && gh-pages -d build/docs", - "release": "standard-version" + "changelog": "standard-version", + "release": "yarn reset && yarn test && yarn docs:publish && yarn changelog", + "reset": "git clean -dfx && git reset --hard && yarn" }, "scripts-info": { "info": "Display information about the scripts", "build": "(Trash and re)build the library", "lint": "Lint all typescript source files", - "unit": "Run unit tests", - "test": "Lint and test the library", + "unit": "Build the library and run unit tests", + "test": "Lint, build, and test the library", "watch": "Watch source files, rebuild library on changes, rerun relevant tests", - "watch:build": "Watch source files, rebuild library on changes", - "watch:unit": "Watch the build, rerun relevant tests on changes", "cov": "Run tests, generate the HTML coverage report, and open it in a browser", - "html-coverage": "Output HTML test coverage report", - "send-coverage": "Output lcov test coverage report and send it to codecov", - "docs": "Generate API documentation and open it in a browser", + "docs": "Generate HTML API documentation and open it in a browser", + "docs:publish": "Generate HTML API documentation and push it to GitHub Pages", "docs:json": "Generate API documentation in typedoc JSON format", - "release": "Bump package.json version, update CHANGELOG.md, tag a release" + "changelog": "Bump package.json version, update CHANGELOG.md, tag a release", + "reset": "Delete all untracked files and reset the repo to the last commit", + "release": "Clean, build, test, publish docs, and prepare release (a one-step publish process)" }, "engines": { "node": ">=4" @@ -57,7 +58,7 @@ "ava": "^0.18.2", "browserify": "^14.1.0", "codecov": "^1.0.1", - "concurrently": "^3.3.0", + "concurrently": "^3.4.0", "cpx": "^1.5.0", "gh-pages": "^0.12.0", "hash.js": "^1.0.3", diff --git a/yarn.lock b/yarn.lock index 708f626..bea64c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1158,9 +1158,9 @@ concat-stream@^1.4.10, concat-stream@~1.5.0, concat-stream@~1.5.1: readable-stream "~2.0.0" typedarray "~0.0.5" -concurrently@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.3.0.tgz#d8eb7a9765fdf0b28d12220dc058e14d03c7dd4f" +concurrently@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.4.0.tgz#60662b3defde07375bae19aac0ab780ec748ba79" dependencies: chalk "0.5.1" commander "2.6.0" @@ -2130,11 +2130,11 @@ got@^6.7.1: unzip-response "^2.0.1" url-parse-lax "^1.0.0" -graceful-fs@4.1.10: +graceful-fs@4.1.10, graceful-fs@^4.1.2, graceful-fs@^4.1.3: version "4.1.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.10.tgz#f2d720c22092f743228775c75e3612632501f131" -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9: +graceful-fs@^4.1.11, graceful-fs@^4.1.6, graceful-fs@^4.1.9: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"