Skip to content

Commit 7b9b857

Browse files
committed
feat(publish): add one-step publish process
Closes #15
1 parent 1dfe830 commit 7b9b857

File tree

3 files changed

+51
-30
lines changed

3 files changed

+51
-30
lines changed

README.md

+35-15
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,44 @@ For more advanced documentation generation, you can provide your own [typedoc th
103103
yarn docs:json
104104
```
105105

106-
## Generate/update changelog & release
106+
## Generate/update changelog & tag release
107107

108108
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.
109109

110110
```bash
111111
# bump package.json version, update CHANGELOG.md, git tag the release
112+
yarn changelog
113+
```
114+
115+
## One-step publish preparation script
116+
117+
Bringing together many of the steps above, this repo includes a one-step release command.
118+
119+
```bash
120+
# Standard release
112121
yarn release
113122
# Release without bumping package.json version
114-
yarn release -- --first-release
123+
yarn changelog -- --first-release
115124
# PGP sign the release
116-
yarn release -- --sign
125+
yarn changelog -- --sign
126+
```
127+
128+
This command runs:
129+
- `yarn reset`: cleans the repo by removing all untracked files and resetting `--hard` to the latest commit. (**Note: this could be destructive.**)
130+
- `yarn test`: build and fully test the project
131+
- `yarn docs:publish`: generate and publish the latest version of the documentation to GitHub Pages
132+
- `yarn changelog`: bump package.json version, update CHANGELOG.md, and git tag the release
133+
134+
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:
135+
136+
```
137+
git push --follow-tags origin master; npm publish
117138
```
139+
Look over the release if you'd like, then execute the command to publish everything.
118140

119141
## All package scripts
120142

121-
You can run the `info` script for information on each available package script.
143+
You can run the `info` script for information on each script intended to be individually run.
122144

123145
```
124146
yarn run info
@@ -130,27 +152,25 @@ yarn run info
130152
lint:
131153
Lint all typescript source files
132154
unit:
133-
Run unit tests
155+
Build the library and run unit tests
134156
test:
135-
Lint and test the library
157+
Lint, build, and test the library
136158
watch:
137159
Watch source files, rebuild library on changes, rerun relevant tests
138-
watch:build:
139-
Watch source files, rebuild library on changes
140-
watch:unit:
141-
Watch the build, rerun relevant tests on changes
142160
cov:
143161
Run tests, generate the HTML coverage report, and open it in a browser
144-
html-coverage:
145-
Output HTML test coverage report
146-
send-coverage:
147-
Output lcov test coverage report and send it to codecov
148162
docs:
149-
Generate API documentation and open it in a browser
163+
Generate HTML API documentation and open it in a browser
164+
docs:publish:
165+
Generate HTML API documentation and push it to GitHub Pages
150166
docs:json:
151167
Generate API documentation in typedoc JSON format
152168
release:
153169
Bump package.json version, update CHANGELOG.md, tag a release
170+
reset:
171+
Delete all untracked files and reset the repo to the last commit
172+
publish:
173+
Reset, build, test, publish docs, and prepare release (a one-step publish process)
154174
```
155175
## Notes
156176

package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,24 @@
3131
"docs:html": "typedoc src/index.ts --excludePrivate --mode file --theme minimal --out build/docs",
3232
"docs:json": "typedoc --mode file --json build/docs/typedoc.json src/index.ts",
3333
"docs:publish": "yarn docs:html && gh-pages -d build/docs",
34-
"release": "standard-version"
34+
"changelog": "standard-version",
35+
"release": "yarn reset && yarn test && yarn docs:publish && yarn changelog",
36+
"reset": "git clean -dfx && git reset --hard && yarn"
3537
},
3638
"scripts-info": {
3739
"info": "Display information about the scripts",
3840
"build": "(Trash and re)build the library",
3941
"lint": "Lint all typescript source files",
40-
"unit": "Run unit tests",
41-
"test": "Lint and test the library",
42+
"unit": "Build the library and run unit tests",
43+
"test": "Lint, build, and test the library",
4244
"watch": "Watch source files, rebuild library on changes, rerun relevant tests",
43-
"watch:build": "Watch source files, rebuild library on changes",
44-
"watch:unit": "Watch the build, rerun relevant tests on changes",
4545
"cov": "Run tests, generate the HTML coverage report, and open it in a browser",
46-
"html-coverage": "Output HTML test coverage report",
47-
"send-coverage": "Output lcov test coverage report and send it to codecov",
48-
"docs": "Generate API documentation and open it in a browser",
46+
"docs": "Generate HTML API documentation and open it in a browser",
47+
"docs:publish": "Generate HTML API documentation and push it to GitHub Pages",
4948
"docs:json": "Generate API documentation in typedoc JSON format",
50-
"release": "Bump package.json version, update CHANGELOG.md, tag a release"
49+
"changelog": "Bump package.json version, update CHANGELOG.md, tag a release",
50+
"reset": "Delete all untracked files and reset the repo to the last commit",
51+
"release": "Clean, build, test, publish docs, and prepare release (a one-step publish process)"
5152
},
5253
"engines": {
5354
"node": ">=4"
@@ -57,7 +58,7 @@
5758
"ava": "^0.18.2",
5859
"browserify": "^14.1.0",
5960
"codecov": "^1.0.1",
60-
"concurrently": "^3.3.0",
61+
"concurrently": "^3.4.0",
6162
"cpx": "^1.5.0",
6263
"gh-pages": "^0.12.0",
6364
"hash.js": "^1.0.3",

yarn.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -1158,9 +1158,9 @@ concat-stream@^1.4.10, concat-stream@~1.5.0, concat-stream@~1.5.1:
11581158
readable-stream "~2.0.0"
11591159
typedarray "~0.0.5"
11601160

1161-
concurrently@^3.3.0:
1162-
version "3.3.0"
1163-
resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.3.0.tgz#d8eb7a9765fdf0b28d12220dc058e14d03c7dd4f"
1161+
concurrently@^3.4.0:
1162+
version "3.4.0"
1163+
resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.4.0.tgz#60662b3defde07375bae19aac0ab780ec748ba79"
11641164
dependencies:
11651165
chalk "0.5.1"
11661166
commander "2.6.0"
@@ -2130,11 +2130,11 @@ got@^6.7.1:
21302130
unzip-response "^2.0.1"
21312131
url-parse-lax "^1.0.0"
21322132

2133-
2133+
[email protected], graceful-fs@^4.1.2, graceful-fs@^4.1.3:
21342134
version "4.1.10"
21352135
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.10.tgz#f2d720c22092f743228775c75e3612632501f131"
21362136

2137-
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:
2137+
graceful-fs@^4.1.11, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
21382138
version "4.1.11"
21392139
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
21402140

0 commit comments

Comments
 (0)