Skip to content

Commit

Permalink
Construct packfile name from package
Browse files Browse the repository at this point in the history
The approach of using the `npm pack` output assumes that there is no
other output from npm, which isn't true when there are build scripts.
  • Loading branch information
sam-github committed Jul 7, 2015
1 parent 3221b91 commit dd1193d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
@@ -1,10 +1,11 @@
var Parser = require('posix-getopt').BasicParser;
var assert = require('assert');
var debug = require('debug')('strong-build');
var fmt = require('util').format;
var fs = require('fs');
var git = require('./lib/git');
var json = require('json-file-plus');
var lodash = require('lodash');
var Parser = require('posix-getopt').BasicParser;
var path = require('path');
var shell = require('shelljs');
var vasync = require('vasync');
Expand Down Expand Up @@ -286,8 +287,8 @@ exports.build = function build(argv, callback) {
runWait('npm --quiet pack', function(er, output) {
if (er) return callback(er);

// npm pack output is a single line with the pack file name
var src = output.split('\n')[0];
var pkg = JSON.parse(fs.readFileSync('package.json'));
var src = fmt('%s-%s.tgz', pkg.name, pkg.version);
var dst = path.join('..', src);

console.log('Running `mv -f %s %s`', src, dst);
Expand Down

0 comments on commit dd1193d

Please sign in to comment.