UNPKG

1.32 kBJavaScriptView Raw
1var MetaScript = require("metascript"),
2 path = require("path"),
3 fs = require("fs");
4
5var rootDir = path.join(__dirname, ".."),
6 srcDir = path.join(rootDir, "src"),
7 distDir = path.join(rootDir, "dist"),
8 pkg = require(path.join(rootDir, "package.json")),
9 filename;
10
11var scope = {
12 VERSION: pkg.version,
13 ISAAC: false
14};
15
16// Make standard build
17console.log("Building bcrypt.js with scope", JSON.stringify(scope, null, 2));
18fs.writeFileSync(
19 path.join(distDir, "bcrypt.js"),
20 MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "wrap.js")), filename, scope, srcDir)
21);
22
23// Make isaac build - see: https://github.com/dcodeIO/bcrypt.js/issues/16
24/* scope.ISAAC = true;
25console.log("Building bcrypt-isaac.js with scope", JSON.stringify(scope, null, 2));
26fs.writeFileSync(
27 path.join(distDir, "bcrypt-isaac.js"),
28 MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "bcrypt.js")), filename, scope, srcDir)
29); */
30
31// Update bower.json
32scope = { VERSION: pkg.version };
33console.log("Updating bower.json with scope", JSON.stringify(scope, null, 2));
34fs.writeFileSync(
35 path.join(rootDir, "bower.json"),
36 MetaScript.transform(fs.readFileSync(filename = path.join(srcDir, "bower.json")), filename, scope, srcDir)
37);