From 2d9c225d28603b12e7ea7bf70780bbcbf6975f4f Mon Sep 17 00:00:00 2001 From: PhilKunz Date: Tue, 2 Aug 2016 16:20:32 +0200 Subject: [PATCH] start shift to making bare bash obsolete --- dist/npmci.bash.d.ts | 1 + dist/npmci.bash.js | 16 ++++++++++++---- dist/npmci.build.d.ts | 4 +++- dist/npmci.build.docker.d.ts | 22 ++++++++++++---------- dist/npmci.clean.d.ts | 4 +++- dist/npmci.command.d.ts | 4 +++- dist/npmci.install.d.ts | 4 +++- dist/npmci.plugins.d.ts | 4 ++-- dist/npmci.plugins.js | 2 +- dist/npmci.prepare.d.ts | 4 +++- dist/npmci.publish.d.ts | 4 +++- dist/npmci.ssh.d.ts | 4 +++- dist/npmci.test.d.ts | 4 +++- dist/npmci.trigger.d.ts | 4 +++- package.json | 19 ++++++++++++------- ts/npmci.bash.ts | 18 ++++++++++++++---- ts/npmci.plugins.ts | 4 ++-- 17 files changed, 83 insertions(+), 39 deletions(-) diff --git a/dist/npmci.bash.d.ts b/dist/npmci.bash.d.ts index 49937e8..a40a79c 100644 --- a/dist/npmci.bash.d.ts +++ b/dist/npmci.bash.d.ts @@ -1,3 +1,4 @@ import "typings-global"; +export declare let nvmAvailable: boolean; export declare let bash: (commandArg: string, retryArg?: number, bareArg?: boolean) => string; export declare let bashBare: (commandArg: any, retryArg?: number) => string; diff --git a/dist/npmci.bash.js b/dist/npmci.bash.js index 2aa6ae4..a30e2c1 100644 --- a/dist/npmci.bash.js +++ b/dist/npmci.bash.js @@ -1,6 +1,16 @@ "use strict"; require("typings-global"); const plugins = require("./npmci.plugins"); +let nvmSourceString = ""; +exports.nvmAvailable = false; +let checkNvm = () => { + let nvmExecCode = plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`).code; + if (nvmExecCode === 0) { + nvmSourceString = `source /usr/local/nvm/nvm.sh && `; + exports.nvmAvailable = true; + } +}; +checkNvm(); exports.bash = (commandArg, retryArg = 2, bareArg = false) => { let exitCode; let stdOut; @@ -8,9 +18,7 @@ exports.bash = (commandArg, retryArg = 2, bareArg = false) => { if (!process.env.NPMTS_TEST) { for (let i = 0; i <= retryArg; i++) { if (!bareArg) { - execResult = plugins.shelljs.exec("bash -c \"source /usr/local/nvm/nvm.sh &&" + - commandArg + - "\""); + execResult = plugins.shelljs.exec(`bash -c "${nvmSourceString} ${commandArg}"`); } else { execResult = plugins.shelljs.exec(commandArg); @@ -37,4 +45,4 @@ exports.bash = (commandArg, retryArg = 2, bareArg = false) => { exports.bashBare = (commandArg, retryArg = 2) => { return exports.bash(commandArg, retryArg, true); }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYmFzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmJhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRWhDLFlBQUksR0FBRyxDQUFDLFVBQWlCLEVBQUMsUUFBUSxHQUFHLENBQUMsRUFBQyxPQUFPLEdBQUcsS0FBSztJQUM3RCxJQUFJLFFBQWUsQ0FBQztJQUNwQixJQUFJLE1BQWEsQ0FBQztJQUNsQixJQUFJLFVBQVUsQ0FBQztJQUNmLEVBQUUsQ0FBQSxDQUFDLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLENBQUMsQ0FBQSxDQUFDO1FBQ3hCLEdBQUcsQ0FBQyxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLElBQUksUUFBUSxFQUFFLENBQUMsRUFBRSxFQUFDLENBQUM7WUFDaEMsRUFBRSxDQUFBLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQSxDQUFDO2dCQUNULFVBQVUsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFD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xDQUFDLENBQUM7Z0JBQ0osT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsbUNBQW1DLEdBQUcsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7Z0JBQ2xGLE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLFFBQVEsR0FBRyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxRQUFRLEVBQUUsR0FBRyxNQUFNLEdBQUksUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7WUFDMUYsQ0FBQztRQUNMLENBQUM7SUFDTCxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxzQkFBc0IsR0FBRyxVQUFVLENBQUMsSUFBSSxDQUFDLENBQUE7SUFDbkUsQ0FBQztJQUNELE1BQU0sQ0FBQyxNQUFNLENBQUM7QUFDbEIsQ0FBQyxDQUFBO0FBRVUsZ0JBQVEsR0FBRyxDQUFDLFVBQVUsRUFBQyxRQUFRLEdBQUcsQ0FBQztJQUMxQyxNQUFNLENBQUMsWUFBSSxDQUFDLFVBQVUsRUFBQyxRQUFRLEVBQUMsSUFBSSxDQUFDLENBQUM7QUFDMUMsQ0FBQyxDQUFBIn0= \ No newline at end of file diff --git a/dist/npmci.build.d.ts b/dist/npmci.build.d.ts index 595c721..92afb4d 100644 --- a/dist/npmci.build.d.ts +++ b/dist/npmci.build.d.ts @@ -1,2 +1,4 @@ +/// import "typings-global"; -export declare let build: (commandArg: any) => any; +import * as plugins from "./npmci.plugins"; +export declare let build: (commandArg: any) => plugins.q.Promise<{}>; diff --git a/dist/npmci.build.docker.d.ts b/dist/npmci.build.docker.d.ts index 7ef584e..064a765 100644 --- a/dist/npmci.build.docker.d.ts +++ b/dist/npmci.build.docker.d.ts @@ -1,12 +1,14 @@ +/// /// -export declare let build: () => any; -export declare let readDockerfiles: () => any; -export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => any; -export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => any; -export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => any; -export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[]) => any; -export declare let pullDockerfileImages: (sortableArrayArg: Dockerfile[], registryArg?: string) => any; -export declare let testDockerfiles: (sortedArrayArg: Dockerfile[]) => any; +import * as plugins from "./npmci.plugins"; +export declare let build: () => plugins.q.Promise<{}>; +export declare let readDockerfiles: () => plugins.q.Promise<{}>; +export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => plugins.q.Promise<{}>; +export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => plugins.q.Promise<{}>; +export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => plugins.q.Promise<{}>; +export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[]) => plugins.q.Promise<{}>; +export declare let pullDockerfileImages: (sortableArrayArg: Dockerfile[], registryArg?: string) => plugins.q.Promise<{}>; +export declare let testDockerfiles: (sortedArrayArg: Dockerfile[]) => plugins.q.Promise<{}>; export declare class Dockerfile { filePath: string; repo: string; @@ -25,8 +27,8 @@ export declare class Dockerfile { fileContents?: string | Buffer; read?: boolean; }); - build(): any; - push(stageArg: any): any; + build(): plugins.q.Promise<{}>; + push(stageArg: any): plugins.q.Promise<{}>; pull(registryArg: string): void; test(): void; getId(): string; diff --git a/dist/npmci.clean.d.ts b/dist/npmci.clean.d.ts index d1deeeb..1fff12e 100644 --- a/dist/npmci.clean.d.ts +++ b/dist/npmci.clean.d.ts @@ -1,5 +1,7 @@ +/// import "typings-global"; +import * as plugins from "./npmci.plugins"; /** * cleans npmci config files */ -export declare let clean: () => any; +export declare let clean: () => plugins.q.Promise<{}>; diff --git a/dist/npmci.command.d.ts b/dist/npmci.command.d.ts index 3a4abff..8954903 100644 --- a/dist/npmci.command.d.ts +++ b/dist/npmci.command.d.ts @@ -1,2 +1,4 @@ +/// import "typings-global"; -export declare let command: () => any; +import * as plugins from "./npmci.plugins"; +export declare let command: () => plugins.q.Promise<{}>; diff --git a/dist/npmci.install.d.ts b/dist/npmci.install.d.ts index 8592128..d656c66 100644 --- a/dist/npmci.install.d.ts +++ b/dist/npmci.install.d.ts @@ -1,2 +1,4 @@ +/// import "typings-global"; -export declare let install: (versionArg: any) => any; +import * as plugins from "./npmci.plugins"; +export declare let install: (versionArg: any) => plugins.q.Promise<{}>; diff --git a/dist/npmci.plugins.d.ts b/dist/npmci.plugins.d.ts index b01a68a..b3070b2 100644 --- a/dist/npmci.plugins.d.ts +++ b/dist/npmci.plugins.d.ts @@ -5,9 +5,9 @@ export declare let gulpFunction: any; export declare let lodash: any; export import path = require("path"); export import projectinfo = require("projectinfo"); -export declare let q: any; +export import q = require("q"); export declare let request: any; -export declare let shelljs: any; +export import shelljs = require("shelljs"); export import smartcli = require("smartcli"); export import smartfile = require("smartfile"); export import smartparam = require("smartparam"); diff --git a/dist/npmci.plugins.js b/dist/npmci.plugins.js index 5e20576..61b6311 100644 --- a/dist/npmci.plugins.js +++ b/dist/npmci.plugins.js @@ -15,4 +15,4 @@ exports.smartparam = require("smartparam"); exports.smartssh = require("smartssh"); exports.smartstring = require("smartstring"); exports.through2 = require("through2"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNWLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDcEMsWUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUN2QixvQkFBWSxHQUFHLE9BQU8sQ0FBQyxlQUFlLENBQUMsQ0FBQztBQUN4QyxjQUFNLEdBQ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FBVyxXQUFXLGFBQWEsQ0FBQyxDQUFDO0FBQ3JDLFNBQUMsV0FBVyxHQUFHLENBQUMsQ0FBQztBQUNwQixlQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzFCLGVBQU8sV0FBVyxTQUFTLENBQUMsQ0FBQztBQUM3QixnQkFBUSxXQUFXLFVBQVUsQ0FBQyxDQUFDO0FBQy9CLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsa0JBQVUsV0FBVyxZQUFZLENBQUMsQ0FBQztBQUNuQyxnQkFBUSxXQUFXLFVBQVUsQ0FBQyxDQUFDO0FBQy9CLG1CQUFXLFdBQVcsYUFBYSxDQUFDLENBQUM7QUFDeEMsZ0JBQVEsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/dist/npmci.prepare.d.ts b/dist/npmci.prepare.d.ts index 01f991e..ada6a7e 100644 --- a/dist/npmci.prepare.d.ts +++ b/dist/npmci.prepare.d.ts @@ -1,2 +1,4 @@ +/// import "typings-global"; -export declare let prepare: (serviceArg: string) => any; +import * as plugins from "./npmci.plugins"; +export declare let prepare: (serviceArg: string) => plugins.q.Promise<{}>; diff --git a/dist/npmci.publish.d.ts b/dist/npmci.publish.d.ts index 0711b5b..e85ed35 100644 --- a/dist/npmci.publish.d.ts +++ b/dist/npmci.publish.d.ts @@ -1,2 +1,4 @@ +/// import "typings-global"; -export declare let publish: (serviceArg?: string) => any; +import * as plugins from "./npmci.plugins"; +export declare let publish: (serviceArg?: string) => plugins.q.Promise<{}>; diff --git a/dist/npmci.ssh.d.ts b/dist/npmci.ssh.d.ts index b095860..1a3dc86 100644 --- a/dist/npmci.ssh.d.ts +++ b/dist/npmci.ssh.d.ts @@ -1,2 +1,4 @@ +/// import "typings-global"; -export declare let ssh: () => any; +import * as plugins from "./npmci.plugins"; +export declare let ssh: () => plugins.q.Promise<{}>; diff --git a/dist/npmci.test.d.ts b/dist/npmci.test.d.ts index e0bd0d0..8b2b2e8 100644 --- a/dist/npmci.test.d.ts +++ b/dist/npmci.test.d.ts @@ -1,2 +1,4 @@ +/// import "typings-global"; -export declare let test: (versionArg: any) => any; +import * as plugins from "./npmci.plugins"; +export declare let test: (versionArg: any) => plugins.q.Promise<{}>; diff --git a/dist/npmci.trigger.d.ts b/dist/npmci.trigger.d.ts index 24304d0..41db310 100644 --- a/dist/npmci.trigger.d.ts +++ b/dist/npmci.trigger.d.ts @@ -1,2 +1,4 @@ +/// import "typings-global"; -export declare let trigger: () => any; +import * as plugins from "./npmci.plugins"; +export declare let trigger: () => plugins.q.Promise<{}>; diff --git a/package.json b/package.json index 688acbf..da5fcf3 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "2.3.12", "description": "", "main": "dist/index.js", + "typings": "dist/index.d.ts", "bin": { "npmci": "dist/index.js" }, @@ -21,25 +22,29 @@ }, "homepage": "https://gitlab.com/pushrocks/npmci#README", "devDependencies": { - "npmts-g": "^5.2.6", + "npmts-g": "^5.2.8", "should": "^10.0.0", "typings-test": "^1.0.1" }, "dependencies": { - "beautylog": "^5.0.14", + "@types/lodash": "^0.0.28", + "@types/q": "^0.0.27", + "@types/request": "^0.0.27", + "@types/shelljs": "^0.3.27", + "beautylog": "^5.0.18", "gulp": "^3.9.1", "gulp-function": "^1.3.6", - "lodash": "^4.13.1", + "lodash": "^4.14.1", "projectinfo": "^1.0.3", "q": "^1.4.1", - "request": "^2.73.0", - "shelljs": "^0.7.0", + "request": "^2.74.0", + "shelljs": "^0.7.3", "smartcli": "^1.0.4", - "smartfile": "^4.0.11", + "smartfile": "^4.0.12", "smartparam": "^0.1.1", "smartssh": "^1.1.5", "smartstring": "^2.0.15", "through2": "^2.0.1", "typings-global": "^1.0.6" } -} +} \ No newline at end of file diff --git a/ts/npmci.bash.ts b/ts/npmci.bash.ts index 7e75000..2c94fda 100644 --- a/ts/npmci.bash.ts +++ b/ts/npmci.bash.ts @@ -1,17 +1,27 @@ import "typings-global"; import * as plugins from "./npmci.plugins"; + +let nvmSourceString:string = ""; +export let nvmAvailable:boolean = false; +let checkNvm = () => { + let nvmExecCode = plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`).code; + if(nvmExecCode === 0){ + nvmSourceString = `source /usr/local/nvm/nvm.sh && ` + nvmAvailable = true; + } +}; +checkNvm(); + export let bash = (commandArg:string,retryArg = 2,bareArg = false) => { let exitCode:number; let stdOut:string; let execResult; - if(!process.env.NPMTS_TEST){ + if(!process.env.NPMTS_TEST){ // NPMTS_TEST is used during testing for (let i = 0; i <= retryArg; i++){ if(!bareArg){ execResult = plugins.shelljs.exec( - "bash -c \"source /usr/local/nvm/nvm.sh &&" + - commandArg + - "\"" + `bash -c "${nvmSourceString} ${commandArg}"` ); } else { execResult = plugins.shelljs.exec(commandArg); diff --git a/ts/npmci.plugins.ts b/ts/npmci.plugins.ts index dd32f14..2411429 100644 --- a/ts/npmci.plugins.ts +++ b/ts/npmci.plugins.ts @@ -5,9 +5,9 @@ export let gulpFunction = require("gulp-function"); export let lodash = require("lodash"); export import path = require("path"); export import projectinfo = require("projectinfo"); -export let q = require("q"); +export import q = require("q"); export let request = require("request"); -export let shelljs = require("shelljs"); +export import shelljs = require("shelljs"); export import smartcli = require("smartcli"); export import smartfile = require("smartfile"); export import smartparam = require("smartparam");