Skip to content

Commit

Permalink
Merge pull request #539 from js-cookie/releasing
Browse files Browse the repository at this point in the history
Automate releasing
  • Loading branch information
carhartl committed Sep 13, 2019
2 parents 7207115 + a6f7b23 commit 47568ec
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 28 deletions.
20 changes: 20 additions & 0 deletions .release-it.json
@@ -0,0 +1,20 @@
{
"git": {
"changelog": null,
"commitMessage": "Craft v${version} release",
"requireCleanWorkingDir": false,
"tagAnnotation": "Release v${version}",
"tagName": "v${version}"
},
"github": {
"assets": ["dist/*.mjs", "dist/*.js"],
"draft": true,
"release": true,
"releaseName": "v${version}"
},
"hooks": {
"after:bump": "npm run dist",
"after:release": "echo Successfully created a release draft v${version} for ${repo.repository}. Please add release notes when necessary and publish it!",
"before:init": "npm test"
}
}
31 changes: 18 additions & 13 deletions README.md
Expand Up @@ -328,19 +328,24 @@ Check out the [Contributing Guidelines](CONTRIBUTING.md)

For vulnerability reports, send an e-mail to `jscookieproject at gmail dot com`

## Manual release steps

- Increment the "version" attribute of `package.json`
- Increment the version number in the `src/js.cookie.mjs` file
- If `major` bump, update jsDelivr CDN major version link on README
- Commit with the message "Release version x.x.x"
- Create version tag in git
- Create a github release and upload the minified file
- Change the `latest` tag pointer to the latest commit
- `git tag -f latest`
- `git push <remote> :refs/tags/latest`
- `git push origin master --tags`
- Release on npm
## Releasing

We are using [release-it](https://www.npmjs.com/package/release-it) for automated releasing.

Start a dry run to see what would happen:

```
$ npm run release minor -- --dry-run
```

Do a real release (publishes both to npm as well as create a new release on GitHub):

```
$ npm run release minor
```

_GitHub releases are created as a draft and need to be published manually!
(This is so we are able to craft suitable release notes before publishing.)_

## Supporters

Expand Down
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -19,7 +19,9 @@
],
"scripts": {
"test": "grunt test",
"format": "standard --fix && prettier -l --write --single-quote --no-semi '**/*.{html,json,md}' && eslint '**/*.{html,md}' --fix"
"format": "standard --fix && prettier -l --write --single-quote --no-semi '**/*.{html,json,md}' && eslint '**/*.{html,md}' --fix",
"dist": "rm -rf dist/* && rollup -c",
"release": "release-it"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,6 +50,7 @@
"gzip-js": "0.3.2",
"prettier": "1.18.2",
"qunit": "2.9.2",
"release-it": "^12.3.6",
"rollup": "^1.20.3",
"rollup-plugin-filesize": "^6.2.0",
"rollup-plugin-license": "^0.12.1",
Expand Down
19 changes: 12 additions & 7 deletions rollup.config.js
Expand Up @@ -2,6 +2,14 @@ import { terser } from 'rollup-plugin-terser'
import filesize from 'rollup-plugin-filesize'
import license from 'rollup-plugin-license'

const licenseBanner = license({
banner: {
content:
'/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */',
commentStyle: 'none'
}
})

export default [
{
input: 'src/js.cookie.mjs',
Expand All @@ -21,6 +29,9 @@ export default [
noConflict: true,
banner: ';'
}
],
plugins: [
licenseBanner
]
},
{
Expand All @@ -43,13 +54,7 @@ export default [
],
plugins: [
terser(),
license({
banner: {
content:
'/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */',
commentStyle: 'none'
}
}),
licenseBanner, // must be applied after terser, otherwise it's being stripped away...
filesize()
]
}
Expand Down
7 changes: 0 additions & 7 deletions src/js.cookie.mjs
@@ -1,10 +1,3 @@
/*!
* JavaScript Cookie v2.2.1
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
function extend () {
var i = 0
var result = {}
Expand Down

0 comments on commit 47568ec

Please sign in to comment.