[Pkg-javascript-commits] [node-browser-pack] 55/141: move uglify to a prepublish step, faster init time
Bastien Roucariès
rouca at moszumanska.debian.org
Thu May 4 10:23:24 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-browser-pack.
commit af12fe3f641786e9364a298e7525d66e4a3bf367
Author: James Halliday <mail at substack.net>
Date: Sat Jun 8 20:10:59 2013 -0700
move uglify to a prepublish step, faster init time
---
cmd.js => bin/cmd.js | 0
bin/prepublish.js | 8 ++++++++
index.js | 6 +-----
package.json | 7 ++++---
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/cmd.js b/bin/cmd.js
similarity index 100%
rename from cmd.js
rename to bin/cmd.js
diff --git a/bin/prepublish.js b/bin/prepublish.js
new file mode 100755
index 0000000..f5dcfb6
--- /dev/null
+++ b/bin/prepublish.js
@@ -0,0 +1,8 @@
+#!/usr/bin/env node
+
+var uglify = require('uglify-js');
+var fs = require('fs');
+var path = require('path');
+
+var src = fs.readFileSync(path.join(__dirname, '..', 'prelude.js'), 'utf8');
+fs.writeFileSync(path.join(__dirname, '..', '_prelude.js'), uglify(src));
diff --git a/index.js b/index.js
index fd947cc..ec1e47a 100644
--- a/index.js
+++ b/index.js
@@ -1,17 +1,13 @@
var JSONStream = require('JSONStream');
var duplexer = require('duplexer');
var through = require('through');
-var uglify = require('uglify-js');
var fs = require('fs');
var path = require('path');
var combineSourceMap = require('combine-source-map');
-var prelude = (function () {
- var src = fs.readFileSync(path.join(__dirname, 'prelude.js'), 'utf8');
- return uglify(src);
-})();
+var prelude = fs.readFileSync(path.join(__dirname, '_prelude.js'), 'utf8');
function newlinesIn(src) {
if (!src) return 0;
diff --git a/package.json b/package.json
index b16951c..0e69b6b 100644
--- a/package.json
+++ b/package.json
@@ -4,24 +4,25 @@
"description": "pack node-style source files from a json stream into a browser bundle",
"main": "index.js",
"bin": {
- "browser-pack": "cmd.js"
+ "browser-pack": "bin/cmd.js"
},
"dependencies": {
"JSONStream": "~0.4.3",
"duplexer": "~0.0.3",
"through": "~2.2.0",
- "uglify-js": "1.3.5",
"combine-source-map": "~0.1.1"
},
"devDependencies": {
"tap": "~0.4.0",
"tape": "~0.2.2",
+ "uglify-js": "1.3.5",
"convert-source-map": "~0.2.3",
"parse-base64vlq-mappings": "~0.1.1"
},
"scripts": {
- "test": "tap test/*.js"
+ "test": "tap test/*.js",
+ "prepublish": "node bin/prepublish.js"
},
"testling" : {
"files" : "test/*.js",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-browser-pack.git
More information about the Pkg-javascript-commits
mailing list