From f8708f37d12bc5e1e0e2016a16843f7a2ad8a8d0 Mon Sep 17 00:00:00 2001 From: Karim Naaji Date: Fri, 17 Apr 2020 12:15:52 -0700 Subject: [PATCH 1/2] Clean check in prepublishOnly Runs clean check as a first step in prepublishOnly. This ensures a clean directory before building the build content and before the manual diffing with previously published tarball. --- package.json | 5 +++-- src/style-spec/package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3593663a6e5..0b501b4349c 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "build-prod-min": "rollup -c --environment BUILD:production,MINIFY:true", "build-csp": "rollup -c rollup.config.csp.js", "build-query-suite": "rollup -c test/integration/rollup.config.test.js", - "build-flow-types": "cp build/mapbox-gl.js.flow dist/mapbox-gl.js.flow && cp build/mapbox-gl.js.flow dist/mapbox-gl-dev.js.flow", + "build-flow-types": "mkdir -p dist && cp build/mapbox-gl.js.flow dist/mapbox-gl.js.flow && cp build/mapbox-gl.js.flow dist/mapbox-gl-dev.js.flow", "build-css": "postcss -o dist/mapbox-gl.css src/css/mapbox-gl.css", "build-style-spec": "cd src/style-spec && npm run build && cd ../.. && mkdir -p dist/style-spec && cp src/style-spec/dist/* dist/style-spec", "watch-css": "postcss --watch -o dist/mapbox-gl.css src/css/mapbox-gl.css", @@ -141,6 +141,7 @@ "start-bench": "run-p build-token watch-benchmarks start-server", "start-release": "run-s build-token build-prod-min build-css print-release-url start-server", "diff-tarball": "build/run-node build/diff-tarball && echo \"Please confirm the above is correct [y/n]? \"; read answer; if [ \"$answer\" = \"${answer#[Yy]}\" ]; then false; fi", + "publish-clean-check": "git clean -fdx && yarn install", "lint": "eslint --cache --ignore-path .gitignore src test bench debug/*.html", "lint-docs": "documentation lint src/index.js", "lint-css": "stylelint 'src/css/mapbox-gl.css'", @@ -157,7 +158,7 @@ "test-expressions": "build/run-node test/expression.test.js", "test-flow": "build/run-node build/generate-flow-typed-style-spec && flow .", "test-cov": "nyc --require=@mapbox/flow-remove-types/register --reporter=text-summary --reporter=lcov --cache run-s test-unit test-expressions test-query test-render", - "prepublishOnly": "run-s build-flow-types build-dev build-prod-min build-prod build-csp build-css build-style-spec test-build diff-tarball", + "prepublishOnly": "run-s publish-clean-check build-flow-types build-dev build-prod-min build-prod build-csp build-css build-style-spec test-build diff-tarball", "print-release-url": "node build/print-release-url.js", "codegen": "build/run-node build/generate-style-code.js && build/run-node build/generate-struct-arrays.js" }, diff --git a/src/style-spec/package.json b/src/style-spec/package.json index 6cc58c1b784..0ee3833018a 100644 --- a/src/style-spec/package.json +++ b/src/style-spec/package.json @@ -14,7 +14,7 @@ "scripts": { "copy-flow-typed": "cp -R ../../flow-typed .", "build": "../../node_modules/.bin/rollup -c && ../../node_modules/.bin/rollup -c --environment esm", - "prepublish": "yarn copy-flow-typed && yarn build", + "prepublish": "git clean -fdx && yarn copy-flow-typed && yarn build", "postpublish": "rm -r flow-typed dist/index.js" }, "repository": { From 69b4df144c110dcef7cf1570f3140e0bd3f78d86 Mon Sep 17 00:00:00 2001 From: Karim Naaji Date: Mon, 20 Apr 2020 12:42:57 -0700 Subject: [PATCH 2/2] Address comments --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0b501b4349c..c0530b568b7 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ "start-bench": "run-p build-token watch-benchmarks start-server", "start-release": "run-s build-token build-prod-min build-css print-release-url start-server", "diff-tarball": "build/run-node build/diff-tarball && echo \"Please confirm the above is correct [y/n]? \"; read answer; if [ \"$answer\" = \"${answer#[Yy]}\" ]; then false; fi", - "publish-clean-check": "git clean -fdx && yarn install", + "prepare-publish": "git clean -fdx && yarn install", "lint": "eslint --cache --ignore-path .gitignore src test bench debug/*.html", "lint-docs": "documentation lint src/index.js", "lint-css": "stylelint 'src/css/mapbox-gl.css'", @@ -158,7 +158,7 @@ "test-expressions": "build/run-node test/expression.test.js", "test-flow": "build/run-node build/generate-flow-typed-style-spec && flow .", "test-cov": "nyc --require=@mapbox/flow-remove-types/register --reporter=text-summary --reporter=lcov --cache run-s test-unit test-expressions test-query test-render", - "prepublishOnly": "run-s publish-clean-check build-flow-types build-dev build-prod-min build-prod build-csp build-css build-style-spec test-build diff-tarball", + "prepublishOnly": "run-s prepare-publish build-flow-types build-dev build-prod-min build-prod build-csp build-css build-style-spec test-build diff-tarball", "print-release-url": "node build/print-release-url.js", "codegen": "build/run-node build/generate-style-code.js && build/run-node build/generate-struct-arrays.js" },