Skip to content

Add npm ls check and dist log file #1095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 2, 2016
Merged

Add npm ls check and dist log file #1095

merged 2 commits into from
Nov 2, 2016

Conversation

etpinard
Copy link
Contributor

The most recent minor version bump (v1.19.0) featured many dependency bumps. To make sure that I had the correct node_modules tree I ran npm ls. That's when I realised that npm ls completes with exit code 1 whenever unmet dependencies are present in the local node_module. So, why not use this as a preversion check? That way we'll enforce whoever bumps the version to have the correct node_modules tree.

Moreover, I'm thinking that we should log the node_modules tree structure in dist/ whenever for produce new dist bundles. That way troubleshooting possible master and dist bundle mismatch should be a lot easier. This is especially important with the recent and planned short-term gl2d development where a lot of gl-vis module were patched.

- npm ls exits with code 1 (i.e. errors out) when a unmet
  dependencies are present in node_modules/
- use this to as a sanity check before versioning and bundling
- to log exactly what package version used when bundling
  dist files
- output file is dist/npm-ls.json and will be checked in
  during `npm version`
if(common.doesFileExist(pathDistNpmLs)) fs.unlinkSync(pathDistNpmLs);

var ws = fs.createWriteStream(pathDistNpmLs, { flags: 'a' });
var proc = spawn('npm', ['ls', '--json', '--only', 'prod']);
Copy link
Contributor Author

@etpinard etpinard Oct 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that npm ls --json essentially logs an npm-shrinkwrap json file.

@etpinard
Copy link
Contributor Author

etpinard commented Oct 27, 2016

TODO

  • update dev docs once merged

@mdtusz
Copy link
Contributor

mdtusz commented Nov 2, 2016

Interesting behaviour of npm ls - definitely good to know! Seems like a sensible preversion step to me though.

💃

@etpinard etpinard merged commit 90d0e9f into master Nov 2, 2016
@etpinard etpinard deleted the npm-ls-check branch November 2, 2016 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants