Skip to content

Commit 90d0e9f

Browse files
authored
Merge pull request #1095 from plotly/npm-ls-check
Add npm ls check and dist log file
2 parents 401f00f + c60b265 commit 90d0e9f

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"start-image_viewer": "node devtools/image_viewer/server.js",
4545
"start": "npm run start-test_dashboard",
4646
"baseline": "node tasks/baseline.js",
47-
"preversion": "npm-link-check && npm dedupe",
47+
"preversion": "npm-link-check && && npm dedupe && npm ls",
4848
"version": "npm run build && git add -A dist src build",
4949
"postversion": "git push && git push --tags"
5050
},

tasks/stats.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var path = require('path');
22
var fs = require('fs');
3+
var spawn = require('child_process').spawn;
34

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

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

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

2022
// main
21-
var content = getContent();
22-
common.writeFile(pathDistREADME, content.join('\n'));
23+
writeNpmLs();
24+
common.writeFile(pathDistREADME, getReadMeContent());
2325

24-
function getContent() {
26+
function writeNpmLs() {
27+
if(common.doesFileExist(pathDistNpmLs)) fs.unlinkSync(pathDistNpmLs);
28+
29+
var ws = fs.createWriteStream(pathDistNpmLs, { flags: 'a' });
30+
var proc = spawn('npm', ['ls', '--json', '--only', 'prod']);
31+
32+
proc.stdout.pipe(ws);
33+
}
34+
35+
function getReadMeContent() {
2536
return []
2637
.concat(getInfoContent())
2738
.concat(getMainBundleInfo())
2839
.concat(getPartialBundleInfo())
29-
.concat(getFooter());
40+
.concat(getFooter())
41+
.join('\n');
3042
}
3143

3244
// general info about distributed files

0 commit comments

Comments
 (0)