Skip to content

Commit

Permalink
fix(release-automation): fix issues uncovered by 1st release
Browse files Browse the repository at this point in the history
Remove NPM  prepare scripts, which run before npm publish but break because we are setup w/
lerna.
Add publishConfig so lerna publishes the scoped packages as public, otherwise scoped packages
are private by default and will fail to publish.
lerna bootstrap and npm test will now be run before
npm run release:prepare to build and test all the libraries.
Some small tweaks were made to the
publish script to pick up the package.json versioning and the remove the ZIP archive after it is
published.
  • Loading branch information
patrickarlt committed Dec 21, 2017
1 parent 4eca6da commit a73b76f
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 17 deletions.
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@
"tslib": "^1.7.1"
},
"lint-staged": {
"*.ts": [
"prettier --write --parser typescript",
"tslint",
"git add"
]
"*.ts": ["prettier --write --parser typescript", "tslint", "git add"]
},
"scripts": {
"build": "lerna run build",
Expand All @@ -94,6 +90,7 @@
"precommit": "lint-staged",
"bootstrap": "lerna bootstrap",
"postinstall": "npm run bootstrap",
"prerelease:prepare": "lerna bootstrap && npm test",
"release:prepare": "lerna publish --skip-git --skip-npm --yes && node ./support/changelog.js",
"release:review": "git --no-pager diff --word-diff",
"release:publish": "./support/publish.sh",
Expand Down
4 changes: 3 additions & 1 deletion packages/arcgis-rest-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
"@esri/arcgis-rest-request": "^1.0.0"
},
"scripts": {
"prepublish": "npm run build",
"prebuild": "rimraf dist",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:node": "tsc --module commonjs --outDir ./dist/node"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Esri/arcgis-rest-js.git"
Expand Down
4 changes: 3 additions & 1 deletion packages/arcgis-rest-common-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
"author": "",
"license": "Apache-2.0",
"scripts": {
"prepublish": "npm run build",
"build": "npm run build:esm",
"build:esm": "tsc --module es2015 --outDir ./dist/esm --sourceMap --declaration --declarationDir ./dist/types",
"postbuild": "rimraf dist/esm"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Esri/arcgis-rest-js.git"
Expand Down
4 changes: 3 additions & 1 deletion packages/arcgis-rest-geocoder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
"@esri/arcgis-rest-request": "^1.0.0"
},
"scripts": {
"prepublish": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc -p ./tsconfig.json --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:node": "tsc -p ./tsconfig.json --module commonjs --outDir ./dist/node"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Esri/arcgis-rest-js.git"
Expand Down
4 changes: 3 additions & 1 deletion packages/arcgis-rest-groups/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
"@esri/arcgis-rest-request": "^1.0.0"
},
"scripts": {
"prepublish": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc -p ./tsconfig.json --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:node": "tsc -p ./tsconfig.json --module commonjs --outDir ./dist/node"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Esri/arcgis-rest-js.git"
Expand Down
4 changes: 3 additions & 1 deletion packages/arcgis-rest-items/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
"@esri/arcgis-rest-request": "^1.0.0"
},
"scripts": {
"prepublish": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc -p ./tsconfig.json --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:node": "tsc -p ./tsconfig.json --module commonjs --outDir ./dist/node"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Esri/arcgis-rest-js.git"
Expand Down
4 changes: 3 additions & 1 deletion packages/arcgis-rest-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
"tslib": "^1.7.1"
},
"scripts": {
"prepublish": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:node": "tsc --module commonjs --outDir ./dist/node"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Esri/arcgis-rest-js.git"
Expand Down
16 changes: 10 additions & 6 deletions support/publish.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
#!/bin/bash

# Extract the version from lerna.json (this was updated by `npm run release:prepare`)
VERSION=$(node --eval "console.log(require('./lerna.json').version);")
TEMP_FOLDER=arcgis-rest-js-v$VERSION;

# commit the changes from npm run release:prepare
# incriment the package.json version to the lerna version so gh-release works
npm version $VERSION --allow-same-version

# commit the changes from `npm run release:prepare` and our new package.json version
git add --all
git commit -am "Prepare v$VERSION" --no-verify

# incriment the package.json version to the lerna version so gh-release works
npm version $VERSION

# push the changes and tag to github
git push https://github.com/Esri/arcgis-rest-js.git master
git push --tags

# publish each package on npm
lerna exec -- npm publish
lerna publish --skip-git --yes --repo-version $VERSION

# create a ZIP archive of the dist files
TEMP_FOLDER=arcgis-rest-js-v$VERSION;
mkdir $TEMP_FOLDER
cp packages/*/dist/umd/* $TEMP_FOLDER
zip -r $TEMP_FOLDER.zip $TEMP_FOLDER
rm -rf $TEMP_FOLDER

# Run gh-release to create a new release with our changelog changes and ZIP archive
gh-release --t v$VERSION --repo arcgis-rest-js --owner Esri -a $TEMP_FOLDER.zip

# Delete the ZIP archive
rm $TEMP_FOLDER.zip

0 comments on commit a73b76f

Please sign in to comment.