-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/install-root-dependencies
- Loading branch information
Showing
10 changed files
with
233 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
const Hoek = require('hoek'); | ||
const Hoek = require('hoek') | ||
|
||
const Build = require('./build'); | ||
const Install = require('./install'); | ||
const CopyDependencies = require('./copy-dependencies'); | ||
const UpdatePackage = require('./update-package'); | ||
const Build = require('./build') | ||
const Install = require('./install') | ||
const CopyDependencies = require('./copy-dependencies') | ||
const UpdatePackage = require('./update-package') | ||
|
||
module.exports = function (options, done) { | ||
Hoek.assert(options !== undefined, 'You must provide a valid options object'); | ||
Hoek.assert(options !== undefined, 'You must provide a valid options object') | ||
|
||
Install(options, function (err) { | ||
if (err) return done(err); | ||
if (err) return done(err) | ||
|
||
Build(options, function (err) { | ||
if (err) return done(err); | ||
if (err) return done(err) | ||
|
||
CopyDependencies(options, function (err) { | ||
if (err) return done(err); | ||
if (err) return done(err) | ||
|
||
UpdatePackage(options, done); | ||
}); | ||
}); | ||
}); | ||
}; | ||
UpdatePackage(options, done) | ||
}) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
exports.spawn = require('cross-spawn'); | ||
exports.spawn = require('cross-spawn') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
const Fs = require('fs'); | ||
const Path = require('path'); | ||
const Fs = require('fs') | ||
const Path = require('path') | ||
|
||
const Hoek = require('hoek'); | ||
const Hoek = require('hoek') | ||
|
||
const DEFAULT_NODE_VERSION = '0.10.33'; | ||
const DEFAULT_NODE_VERSION = '0.10.33' | ||
|
||
module.exports = function (options) { | ||
var version, bootPath; | ||
var version, bootPath | ||
|
||
Hoek.assert(options !== undefined, 'options is required'); | ||
Hoek.assert(Fs.existsSync(options.directory), 'Output directory not found'); | ||
Hoek.assert(options !== undefined, 'options is required') | ||
Hoek.assert(Fs.existsSync(options.directory), 'Output directory not found') | ||
|
||
if (typeof options.nodeVersion !== 'undefined') return options.nodeVersion; | ||
if (typeof options.nodeVersion !== 'undefined') return options.nodeVersion | ||
|
||
bootPath = Path.resolve( | ||
options.directory, | ||
'bundle', | ||
'programs', | ||
'server', | ||
'boot.js'); | ||
'boot.js') | ||
|
||
try { | ||
// Read boot.js to find the MIN_NODE_VERSION; use that version as the node | ||
// version of the project. | ||
Fs.readFileSync(bootPath).toString().split('\n').some(function (line) { | ||
if (line.indexOf('MIN_NODE_VERSION') >= 0) { | ||
/* eslint-disable no-magic-numbers */ | ||
version = line.split(' ')[3].replace(/[v;']/g, ''); | ||
version = line.split(' ')[3].replace(/[v;']/g, '') | ||
/* eslint-enable no-magic-numbers */ | ||
|
||
return true; | ||
return true | ||
} | ||
}); | ||
}) | ||
} catch (err) { | ||
version = DEFAULT_NODE_VERSION; | ||
version = DEFAULT_NODE_VERSION | ||
} | ||
|
||
return version || DEFAULT_NODE_VERSION; | ||
}; | ||
return version || DEFAULT_NODE_VERSION | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
const Fs = require('fs'); | ||
const Path = require('path'); | ||
const Fs = require('fs') | ||
const Path = require('path') | ||
|
||
const Hoek = require('hoek'); | ||
const Hoek = require('hoek') | ||
|
||
const FindNodeVersion = require('./find-node-version'); | ||
const FindNodeVersion = require('./find-node-version') | ||
|
||
module.exports = function (options, done) { | ||
var packagePath, packageContents; | ||
var packagePath, packageContents | ||
|
||
Hoek.assert(options !== undefined, 'options is required'); | ||
Hoek.assert(Fs.existsSync(options.directory), 'Output directory not found'); | ||
Hoek.assert(options !== undefined, 'options is required') | ||
Hoek.assert(Fs.existsSync(options.directory), 'Output directory not found') | ||
|
||
packagePath = Path.resolve( | ||
options.directory, | ||
'bundle', | ||
'programs', | ||
'server', | ||
'package.json'); | ||
'package.json') | ||
|
||
// | ||
// Manual parsing of the package.json allows mocking of the read. | ||
// | ||
packageContents = JSON.parse(Fs.readFileSync(packagePath)); | ||
packageContents = JSON.parse(Fs.readFileSync(packagePath)) | ||
|
||
packageContents.engines = { | ||
node: FindNodeVersion(options), | ||
npm: options.npmVersion || 'latest' | ||
}; | ||
} | ||
|
||
packageContents.main = '../../main.js'; | ||
packageContents.scripts = { start: 'node ../../main' }; | ||
packageContents.main = '../../main.js' | ||
packageContents.scripts = { start: 'node ../../main' } | ||
|
||
Hoek.merge(packageContents, options.json || {}); | ||
Hoek.merge(packageContents, options.json || {}) | ||
|
||
Fs.chmodSync(packagePath, '0644'); | ||
Fs.writeFile(packagePath, JSON.stringify(packageContents, null, 2), done); | ||
}; | ||
Fs.chmodSync(packagePath, '0644') | ||
Fs.writeFile(packagePath, JSON.stringify(packageContents, null, 2), done) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.