[Pkg-javascript-commits] [node-acorn-jsx] 279/484: Add a prepublish step to package.json

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:43 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit 0322beb0aa5d170e427d76f668afaf3088fc5e29
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Fri Sep 12 16:54:28 2014 +0200

    Add a prepublish step to package.json
---
 README.md        | 3 ++-
 bin/without_eval | 7 ++-----
 package.json     | 5 ++++-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index 82ecd6b..531f380 100644
--- a/README.md
+++ b/README.md
@@ -188,7 +188,8 @@ in a context with such a
 
 The `bin/without_eval` script can be used to generate a version of
 `acorn.js` that has the generated code inlined, and can thus run
-without evaluating anything.
+without evaluating anything. In versions of this library downloaded
+from NPM, this script will be available as `acorn_csp.js`.
 
 ### acorn_loose.js ###
 
diff --git a/bin/without_eval b/bin/without_eval
index fd8befb..e9ef18f 100755
--- a/bin/without_eval
+++ b/bin/without_eval
@@ -6,15 +6,12 @@ var acornSrc = fs.readFileSync(require.resolve("../acorn"), "utf8");
 var acorn = require("../acorn"), walk = require("../util/walk");
 
 var ast = acorn.parse(acornSrc);
-var touchups = [];
-var uses = [], declaration;
+var touchups = [], uses = [];
 
 walk.simple(ast, {
   FunctionDeclaration: function(node) {
-    if (node.id.name == "makePredicate") {
+    if (node.id.name == "makePredicate")
       touchups.push({text: "// Removed to create an eval-free library", from: node.start, to: node.end});
-      declaration = node;
-    }
   },
   VariableDeclaration: function(node) {
     node.declarations.forEach(function(decl) {
diff --git a/package.json b/package.json
index 8f029de..808e0a8 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,10 @@
                    "url": "http://marijnhaverbeke.nl/git/acorn"},
     "licenses": [{"type": "MIT",
                   "url": "http://marijnhaverbeke.nl/acorn/LICENSE"}],
-    "scripts": {"test": "node test/run.js"},
+    "scripts": {
+      "test": "node test/run.js",
+      "prepublish": "bin/without_eval > acorn_csp.js"
+    },
     "bin": {"acorn": "./bin/acorn"},
     "devDependencies": {"regenerate": "~0.6.2",
                         "unicode-7.0.0": "~0.1.5"}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list