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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"start-image_viewer": "node devtools/image_viewer/server.js",
"start": "npm run start-test_dashboard",
"baseline": "node tasks/baseline.js",
"preversion": "npm-link-check && npm dedupe",
"preversion": "npm-link-check && && npm dedupe && npm ls",
"version": "npm run build && git add -A dist src build",
"postversion": "git push && git push --tags"
},
Expand Down
20 changes: 16 additions & 4 deletions tasks/stats.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path');
var fs = require('fs');
var spawn = require('child_process').spawn;

var falafel = require('falafel');
var gzipSize = require('gzip-size');
Expand All @@ -10,6 +11,7 @@ var constants = require('./util/constants');
var pkg = require('../package.json');

var pathDistREADME = path.join(constants.pathToDist, 'README.md');
var pathDistNpmLs = path.join(constants.pathToDist, 'npm-ls.json');
var cdnRoot = 'https://cdn.plot.ly/plotly-';
var coreModules = ['scatter'];

Expand All @@ -18,15 +20,25 @@ var JS = '.js';
var MINJS = '.min.js';

// main
var content = getContent();
common.writeFile(pathDistREADME, content.join('\n'));
writeNpmLs();
common.writeFile(pathDistREADME, getReadMeContent());

function getContent() {
function writeNpmLs() {
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.


proc.stdout.pipe(ws);
}

function getReadMeContent() {
return []
.concat(getInfoContent())
.concat(getMainBundleInfo())
.concat(getPartialBundleInfo())
.concat(getFooter());
.concat(getFooter())
.join('\n');
}

// general info about distributed files
Expand Down