Skip to content

Commit

Permalink
Add libPath variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Chrusciel committed Feb 10, 2017
1 parent 9272083 commit 628a532
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions build-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var uglify = require('uglify-js');
var pack = require('./package.json');
var version = 'v' + pack.version;
var license = pack.license + '-License';
var libPath = __dirname + '/lib';
// Parse arguments:
var argv = require('yargs')
.usage('node build.js [--minify] [--ignore=<modules>...|--only=<modules>...]')
Expand Down Expand Up @@ -42,7 +43,7 @@ if (argv.only && argv.ignore) {
}

// Get a list of all modules:
var allModules = fs.readdirSync('lib/V4').filter(item => /-native\.js$/.test(item));
var allModules = fs.readdirSync(`${libPath}/V4`).filter(item => /-native\.js$/.test(item));

// Get a list of modules to include:
var modules = [];
Expand Down Expand Up @@ -85,7 +86,7 @@ console.warn(`Included modules:
var promises = [];
modules.forEach(function (name, i) {
promises[i] = new Promise(function (resolve, reject) {
fs.readFile(`lib/V4/${name.toLowerCase()}-native.js`, 'utf8', function (err, contents) {
fs.readFile(`${libPath}/V4/${name.toLowerCase()}-native.js`, 'utf8', function (err, contents) {
if (err) reject(err);
resolve(contents);
});
Expand All @@ -108,7 +109,7 @@ Promise.all(promises)
.catch(error);

function wrap(main) {
var utils = fs.readFileSync('lib/V4/utils.js', 'utf8').split('\n').join('\n '); // Indentation
var utils = fs.readFileSync(`${libPath}/V4/utils.js`, 'utf8').split('\n').join('\n '); // Indentation
main = main.split('\n').join('\n '); // Indentation
// Initialize arrays:
// Arrays will be used in the template literal below
Expand Down
7 changes: 4 additions & 3 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var uglify = require('uglify-js');
var pack = require('./package.json');
var version = 'v' + pack.version;
var license = pack.license + '-License';
var libPath = __dirname + '/lib';
// Parse arguments:
var argv = require('yargs')
.usage('node build.js [--minify] [--ignore=<modules>...|--only=<modules>...]')
Expand Down Expand Up @@ -42,7 +43,7 @@ if (argv.only && argv.ignore) {
}

// Get a list of all modules:
var allModules = fs.readdirSync('lib/V3/').filter(item => /-native\.js$/.test(item));
var allModules = fs.readdirSync(`${libPath}/V3/`).filter(item => /-native\.js$/.test(item));

// Get a list of modules to include:
var modules = [];
Expand Down Expand Up @@ -85,7 +86,7 @@ console.warn(`Included modules:
var promises = [];
modules.forEach(function (name, i) {
promises[i] = new Promise(function (resolve, reject) {
fs.readFile(`lib/V3/${name.toLowerCase()}-native.js`, 'utf8', function (err, contents) {
fs.readFile(`${libPath}/V3/${name.toLowerCase()}-native.js`, 'utf8', function (err, contents) {
if (err) reject(err);
resolve(contents);
});
Expand All @@ -108,7 +109,7 @@ Promise.all(promises)
.catch(error);

function wrap(main) {
var utils = fs.readFileSync('lib/V3/utils.js', 'utf8').split('\n').join('\n '); // Indentation
var utils = fs.readFileSync(`${libPath}/V3/utils.js`, 'utf8').split('\n').join('\n '); // Indentation
main = main.split('\n').join('\n '); // Indentation
// Initialize arrays:
// Arrays will be used in the template literal below
Expand Down

0 comments on commit 628a532

Please sign in to comment.