Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #157 from Financial-Times/specify-npm-registry
Browse files Browse the repository at this point in the history
Support custom npm registries
  • Loading branch information
Alberto Elias committed Dec 12, 2014
2 parents 6f203b1 + c7aff79 commit 77a6d62
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/origami-build-tools-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function printUsage(commands) {
console.log(' [--scssLintPath=<path>] Custom scss-lint configuration');
console.log(' [--jsHintPath=<path>] Custom JS Hint configuration');
console.log(' [--editorconfigPath=<path>] Custom .editorconfig');
console.log(' [--npmRegistry=<url>] Custom npm registry');

console.log('');
console.log('Full documentation: http://git.io/bBjMNw');
Expand Down
17 changes: 13 additions & 4 deletions lib/tasks/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,20 @@ function cliFailed(output) {
log.primaryError(output.stderr);
}

module.exports = function() {
module.exports = function(gulp, config) {
module.exports.installSass();
module.exports.installScssLint();
module.exports.installBower()
.then(function() {
module.exports.runBowerInstall();
});
module.exports.installJshint();
module.exports.runNpmInstall();

var npmConfig = {};
if (config.npmRegistry) {
npmConfig.registry = config.npmRegistry;
}
module.exports.runNpmInstall(npmConfig);
};

module.exports.installSass = function() {
Expand Down Expand Up @@ -212,13 +217,17 @@ module.exports.installJshint = function() {
});
};

module.exports.runNpmInstall = function() {
module.exports.runNpmInstall = function(config) {
function outputInstalling() {
log.primary('npm install...');
}
var args = ['install'];
if (config.registry) {
args.push(['--registry '+config.registry]);
}

if (files.packageJsonExists()) {
commandLine.run('npm', ['install'], { stderr: 'pipe', stdout: 'pipe' })
commandLine.run('npm', args, { stderr: 'pipe', stdout: 'pipe' })
.then(function() {
outputInstalling();
cliSuccess();
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = function() {
console.log("v"+require(__dirname + '/../../package.json').version);
};
Expand Down

0 comments on commit 77a6d62

Please sign in to comment.