now checking if tool already installed
This commit is contained in:
parent
9822a9c867
commit
77a4cd7a12
3
dist/npmci.config.js
vendored
3
dist/npmci.config.js
vendored
@ -3,7 +3,6 @@ const q = require("q");
|
|||||||
const plugins = require("./npmci.plugins");
|
const plugins = require("./npmci.plugins");
|
||||||
const paths = require("./npmci.paths");
|
const paths = require("./npmci.paths");
|
||||||
exports.getConfig = () => {
|
exports.getConfig = () => {
|
||||||
console.log('getting config');
|
|
||||||
let done = q.defer();
|
let done = q.defer();
|
||||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
||||||
let defaultConfig = {
|
let defaultConfig = {
|
||||||
@ -13,4 +12,4 @@ exports.getConfig = () => {
|
|||||||
done.resolve(npmciConfig);
|
done.resolve(npmciConfig);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx1QkFBc0I7QUFFdEIsMkNBQTBDO0FBQzFDLHVDQUFzQztBQU0zQixRQUFBLFNBQVMsR0FBRztJQUNuQixPQUFPLENBQUMsR0FBRyxDQUFDLGdCQUFnQixDQUFDLENBQUE7SUFDN0IsSUFBSSxJQUFJLEdBQUcsQ0FBQyxDQUFDLEtBQUssRUFBaUIsQ0FBQTtJQUNuQyxJQUFJLGFBQWEsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUM1RCxJQUFJLGFBQWEsR0FBa0I7UUFDL0IsY0FBYyxFQUFFLEVBQUU7S0FDckIsQ0FBQTtJQUNELElBQUksV0FBVyxHQUFHLGFBQWEsQ0FBQyxPQUFPLENBQWdCLE9BQU8sRUFBRSxhQUFhLENBQUMsQ0FBQTtJQUM5RSxJQUFJLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFBO0lBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0FBQ3ZCLENBQUMsQ0FBQSJ9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx1QkFBc0I7QUFFdEIsMkNBQTBDO0FBQzFDLHVDQUFzQztBQU0zQixRQUFBLFNBQVMsR0FBRztJQUNuQixJQUFJLElBQUksR0FBRyxDQUFDLENBQUMsS0FBSyxFQUFpQixDQUFBO0lBQ25DLElBQUksYUFBYSxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0lBQzVELElBQUksYUFBYSxHQUFrQjtRQUMvQixjQUFjLEVBQUUsRUFBRTtLQUNyQixDQUFBO0lBQ0QsSUFBSSxXQUFXLEdBQUcsYUFBYSxDQUFDLE9BQU8sQ0FBZ0IsT0FBTyxFQUFFLGFBQWEsQ0FBQyxDQUFBO0lBQzlFLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDekIsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7QUFDdkIsQ0FBQyxDQUFBIn0=
|
9
dist/npmci.install.js
vendored
9
dist/npmci.install.js
vendored
@ -34,11 +34,18 @@ exports.install = (versionArg) => {
|
|||||||
configModule.getConfig()
|
configModule.getConfig()
|
||||||
.then(config => {
|
.then(config => {
|
||||||
for (let npmTool of config.globalNpmTools) {
|
for (let npmTool of config.globalNpmTools) {
|
||||||
|
let whichOutput = npmci_bash_1.bash(`which ${npmTool}`);
|
||||||
|
let toolAvailable = !(/not found/.test(whichOutput));
|
||||||
|
if (toolAvailable) {
|
||||||
|
plugins.beautylog.log(`Tool ${npmTool} is available`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
plugins.beautylog.info(`globally installing ${npmTool} from npm`);
|
plugins.beautylog.info(`globally installing ${npmTool} from npm`);
|
||||||
npmci_bash_1.bash(`npm install -q -g ${npmTool}`);
|
npmci_bash_1.bash(`npm install -q -g ${npmTool}`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
done.resolve();
|
done.resolve();
|
||||||
});
|
});
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuaW5zdGFsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmluc3RhbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDJDQUEwQztBQUMxQywrQ0FBOEM7QUFDOUMsNkNBQW1DO0FBQ25DLDZDQUEyQztBQUNoQyxRQUFBLE9BQU8sR0FBRyxDQUFDLFVBQVU7SUFDNUIsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtJQUM1QixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQywrQkFBK0IsVUFBVSxFQUFFLENBQUMsQ0FBQTtJQUNsRSxJQUFJLE9BQWUsQ0FBQTtJQUNuQixFQUFFLENBQUMsQ0FBQyxVQUFVLEtBQUssUUFBUSxDQUFDLENBQUMsQ0FBQztRQUMxQixPQUFPLEdBQUcsUUFBUSxDQUFBO0lBQ3RCLENBQUM7SUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsVUFBVSxLQU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Q0FBQyx1QkFBdUIsT0FBTyxXQUFXLENBQUMsQ0FBQTtnQkFDakUsaUJBQUksQ0FBQyxxQkFBcUIsT0FBTyxFQUFFLENBQUMsQ0FBQTtZQUN4QyxDQUFDO1FBQ0wsQ0FBQztRQUNELElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQTtJQUNsQixDQUFDLENBQUMsQ0FBQTtJQUNOLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0FBQ3ZCLENBQUMsQ0FBQSJ9
|
@ -13,7 +13,7 @@ let checkNvm = () => {
|
|||||||
}
|
}
|
||||||
checkNvm()
|
checkNvm()
|
||||||
|
|
||||||
export let bash = (commandArg: string, retryArg = 2, bareArg = false) => {
|
export let bash = (commandArg: string, retryArg = 2, bareArg = false): string => {
|
||||||
let exitCode: number
|
let exitCode: number
|
||||||
let stdOut: string
|
let stdOut: string
|
||||||
let execResult
|
let execResult
|
||||||
|
@ -8,7 +8,6 @@ export interface INpmciOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export let getConfig = () => {
|
export let getConfig = () => {
|
||||||
console.log('getting config')
|
|
||||||
let done = q.defer<INpmciOptions>()
|
let done = q.defer<INpmciOptions>()
|
||||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
|
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
|
||||||
let defaultConfig: INpmciOptions = {
|
let defaultConfig: INpmciOptions = {
|
||||||
|
@ -28,9 +28,15 @@ export let install = (versionArg) => {
|
|||||||
configModule.getConfig()
|
configModule.getConfig()
|
||||||
.then(config => {
|
.then(config => {
|
||||||
for (let npmTool of config.globalNpmTools) {
|
for (let npmTool of config.globalNpmTools) {
|
||||||
|
let whichOutput = bash(`which ${npmTool}`)
|
||||||
|
let toolAvailable: boolean = !(/not found/.test(whichOutput))
|
||||||
|
if (toolAvailable) {
|
||||||
|
plugins.beautylog.log(`Tool ${npmTool} is available`)
|
||||||
|
} else {
|
||||||
plugins.beautylog.info(`globally installing ${npmTool} from npm`)
|
plugins.beautylog.info(`globally installing ${npmTool} from npm`)
|
||||||
bash(`npm install -q -g ${npmTool}`)
|
bash(`npm install -q -g ${npmTool}`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
done.resolve()
|
done.resolve()
|
||||||
})
|
})
|
||||||
return done.promise
|
return done.promise
|
||||||
|
Loading…
Reference in New Issue
Block a user