Skip to content

Commit

Permalink
Add a way to diff the new tarball content with previously published v…
Browse files Browse the repository at this point in the history
…ersion

This is intended to be used as part of our release process before publishing to NPM
--dry-run is a useful step, but can be fairly noisy, yarn run v1.21.1
to go along the fake deploy and more clearly shows what would be added and deleted
  • Loading branch information
karimnaaji committed Apr 14, 2020
1 parent dc3ea68 commit 4379e8f
Show file tree
Hide file tree
Showing 3 changed files with 371 additions and 29 deletions.
18 changes: 18 additions & 0 deletions build/diff-tarball.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const packlist = require('npm-packlist')
const npmContent = require('list-npm-contents');

npmContent('mapbox-gl').then(function(last_version_files) {
packlist({ path: '.' }).then(function(new_version_files) {
new_version_files = new_version_files.map(file => file.replace(/\/\/+/g, '/'));
let diff_new = new_version_files.filter(x => !last_version_files.includes(x));
let diff_last = last_version_files.filter(x => !new_version_files.includes(x));
console.log(`${diff_new.length} files are about to be added in the new tarball`)
diff_new.forEach(file => {
console.log('+', file);
});
console.log(`${diff_last.length} files are about to be deleted in the new tarball`)
diff_last.forEach(file => {
console.log('-', file);
});
});
});
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@
"jsdom": "^13.0.0",
"json-stringify-pretty-compact": "^2.0.0",
"jsonwebtoken": "^8.3.0",
"list-npm-contents": "^1.0.2",
"lodash.template": "^4.5.0",
"mapbox-gl-styles": "^2.0.2",
"mock-geolocation": "^1.0.11",
"node-notifier": "^5.4.3",
"npm-font-open-sans": "^1.1.0",
"npm-packlist": "^2.1.1",
"npm-run-all": "^4.1.5",
"nyc": "^13.3.0",
"pirates": "^4.0.1",
Expand Down Expand Up @@ -138,6 +140,7 @@
"start-tests": "run-p build-token watch-css watch-query start-server",
"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",
"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'",
Expand Down
Loading

0 comments on commit 4379e8f

Please sign in to comment.