Compare commits
	
		
			25 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 5d468fc840 | |||
| e2ac6cdcc9 | |||
| fcd04415be | |||
| 1fd1899099 | |||
| 7df7f882d1 | |||
| 348b4d60fd | |||
| 37589fb5e5 | |||
| 3dd115fe42 | |||
| 01c88a6a6c | |||
| f5cacb7400 | |||
| 887da51d78 | |||
| 585703fc55 | |||
| ec3e296d73 | |||
| 33f234cf73 | |||
| e7ec765ed5 | |||
| 2f46197864 | |||
| da44233263 | |||
| cb2430f7b2 | |||
| 5fe9134f4a | |||
| 7681f09d38 | |||
| d55c77560a | |||
| 0e337a3574 | |||
| 94c5567b75 | |||
| 7b37506d4e | |||
| a401633b73 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -4,3 +4,4 @@ coverage/ | ||||
| public/ | ||||
| config.json | ||||
| .yarn/ | ||||
| .npmci_cache | ||||
|   | ||||
| @@ -3,16 +3,18 @@ image: hosttoday/ht-docker-node:npmci | ||||
|  | ||||
| cache: | ||||
|   paths: | ||||
|   - .yarn/ | ||||
|   - .npmci_cache/ | ||||
|   key: "$CI_BUILD_STAGE" | ||||
|  | ||||
| stages: | ||||
| - security | ||||
| - test | ||||
| - release | ||||
| - trigger | ||||
| - pages | ||||
| - metadata | ||||
|  | ||||
| # ==================== | ||||
| # security stage | ||||
| # ==================== | ||||
| mirror: | ||||
|   stage: security | ||||
|   script: | ||||
| @@ -24,32 +26,16 @@ mirror: | ||||
| snyk: | ||||
|   stage: security | ||||
|   script: | ||||
|     - npmci command yarn global add snyk | ||||
|     - npmci command yarn install --ignore-scripts | ||||
|     - npmci command npm install -g snyk | ||||
|     - npmci command npm install --ignore-scripts | ||||
|     - npmci command snyk test | ||||
|   tags: | ||||
|   - docker | ||||
|   - notpriv | ||||
|  | ||||
| codequality: | ||||
|   stage: security | ||||
|   image: docker:stable | ||||
|   allow_failure: true | ||||
|   services: | ||||
|     - docker:stable-dind | ||||
|   script: | ||||
|     - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') | ||||
|     - docker run | ||||
|         --env SOURCE_CODE="$PWD" | ||||
|         --volume "$PWD":/code | ||||
|         --volume /var/run/docker.sock:/var/run/docker.sock | ||||
|         "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code | ||||
|   artifacts: | ||||
|     paths: [codeclimate.json] | ||||
|   tags: | ||||
|   - docker | ||||
|   - priv | ||||
|  | ||||
| # ==================== | ||||
| # test stage | ||||
| # ==================== | ||||
| testLEGACY: | ||||
|   stage: test | ||||
|   script: | ||||
| @@ -88,7 +74,6 @@ release: | ||||
|   stage: release | ||||
|   script: | ||||
|   - npmci node install stable | ||||
|   - npmci npm prepare | ||||
|   - npmci npm publish | ||||
|   only: | ||||
|   - tags | ||||
| @@ -96,8 +81,30 @@ release: | ||||
|   - docker | ||||
|   - notpriv | ||||
|  | ||||
| # ==================== | ||||
| # metadata stage | ||||
| # ==================== | ||||
| codequality: | ||||
|   stage: metadata | ||||
|   image: docker:stable | ||||
|   allow_failure: true | ||||
|   services: | ||||
|     - docker:stable-dind | ||||
|   script: | ||||
|     - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') | ||||
|     - docker run | ||||
|         --env SOURCE_CODE="$PWD" | ||||
|         --volume "$PWD":/code | ||||
|         --volume /var/run/docker.sock:/var/run/docker.sock | ||||
|         "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code | ||||
|   artifacts: | ||||
|     paths: [codeclimate.json] | ||||
|   tags: | ||||
|   - docker | ||||
|   - priv | ||||
|  | ||||
| trigger: | ||||
|   stage: trigger | ||||
|   stage: metadata | ||||
|   script: | ||||
|   - npmci trigger | ||||
|   only: | ||||
| @@ -108,10 +115,11 @@ trigger: | ||||
|  | ||||
| pages: | ||||
|   image: hosttoday/ht-docker-node:npmci | ||||
|   stage: pages | ||||
|   stage: metadata | ||||
|   script: | ||||
|     - npmci command yarn global add npmpage | ||||
|     - npmci command npmpage | ||||
|     - npmci command npm install -g typedoc typescript | ||||
|     - npmci npm install | ||||
|     - npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/ | ||||
|   tags: | ||||
|     - docker | ||||
|     - notpriv | ||||
| @@ -121,3 +129,14 @@ pages: | ||||
|     expire_in: 1 week | ||||
|     paths: | ||||
|     - public | ||||
|   allow_failure: true | ||||
|  | ||||
| windowsCompatibility: | ||||
|   image: stefanscherer/node-windows:10-build-tools | ||||
|   stage: metadata | ||||
|   script: | ||||
|   - npm install & npm test | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
|   tags: | ||||
|   - windows | ||||
|   allow_failure: true | ||||
|   | ||||
							
								
								
									
										13
									
								
								.snyk
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								.snyk
									
									
									
									
									
								
							| @@ -12,4 +12,17 @@ ignore: | ||||
|     - smartssh > shelljs: | ||||
|         reason: None given | ||||
|         expires: '2018-06-02T22:48:10.660Z' | ||||
|     - smartshell > shelljs: | ||||
|         reason: None given | ||||
|         expires: '2018-08-14T21:49:25.248Z' | ||||
|     - smartssh > shelljs: | ||||
|         reason: None given | ||||
|         expires: '2018-08-14T21:49:25.248Z' | ||||
|     - shelljs: | ||||
|         reason: None given | ||||
|         expires: '2018-08-14T21:49:25.248Z' | ||||
|   'npm:stringstream:20180511': | ||||
|     - request > stringstream: | ||||
|         reason: None given | ||||
|         expires: '2018-08-14T21:49:25.248Z' | ||||
| patch: {} | ||||
|   | ||||
							
								
								
									
										2149
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										2149
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										51
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "@shipzone/npmci", | ||||
|   "version": "3.0.44", | ||||
|   "version": "3.0.57", | ||||
|   "description": "node and docker in gitlab ci on steroids", | ||||
|   "main": "dist/index.js", | ||||
|   "typings": "dist/index.d.ts", | ||||
| @@ -8,8 +8,8 @@ | ||||
|     "npmci": "dist/cli.js" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "test": "(rm -f config.json) && (npmts) && (npm run testVersion)", | ||||
|     "build": "(rm -f config.json) && (npmts) && (npm run testVersion)", | ||||
|     "test": "(rm -f config.json) && tstest test/", | ||||
|     "build": "(rm -f config.json) && tsbuild && (npm run testVersion)", | ||||
|     "testVersion": "(cd test/assets/ && node ../../dist/cli.js -v)" | ||||
|   }, | ||||
|   "repository": { | ||||
| @@ -23,31 +23,34 @@ | ||||
|   }, | ||||
|   "homepage": "https://gitlab.com/gitzone/npmci#README", | ||||
|   "devDependencies": { | ||||
|     "tapbundle": "^2.0.0" | ||||
|     "@gitzone/tsbuild": "^2.0.22", | ||||
|     "@gitzone/tsrun": "^1.1.12", | ||||
|     "@gitzone/tstest": "^1.0.15", | ||||
|     "@pushrocks/tapbundle": "^3.0.7", | ||||
|     "@types/node": "^10.10.3" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@pushrocks/smartcli": "^3.0.1", | ||||
|     "@types/lodash": "^4.14.74", | ||||
|     "@types/shelljs": "^0.7.4", | ||||
|     "@types/through2": "^2.0.33", | ||||
|     "@pushrocks/lik": "^3.0.1", | ||||
|     "@pushrocks/npmextra": "^3.0.1", | ||||
|     "@pushrocks/projectinfo": "^4.0.2", | ||||
|     "@pushrocks/smartcli": "^3.0.4", | ||||
|     "@pushrocks/smartdelay": "^2.0.2", | ||||
|     "@pushrocks/smartfile": "^6.0.8", | ||||
|     "@pushrocks/smartparam": "^1.0.4", | ||||
|     "@pushrocks/smartpromise": "^2.0.5", | ||||
|     "@pushrocks/smartrequest": "^1.1.14", | ||||
|     "@pushrocks/smartshell": "^2.0.6", | ||||
|     "@pushrocks/smartssh": "^1.2.3", | ||||
|     "@pushrocks/smartstring": "^3.0.4", | ||||
|     "@types/lodash": "^4.14.116", | ||||
|     "@types/shelljs": "^0.8.0", | ||||
|     "@types/through2": "^2.0.34", | ||||
|     "beautylog": "^6.1.10", | ||||
|     "cflare": "^1.0.5", | ||||
|     "lik": "^2.0.5", | ||||
|     "lodash": "^4.17.4", | ||||
|     "npmextra": "^2.0.9", | ||||
|     "projectinfo": "^3.0.2", | ||||
|     "request": "^2.81.0", | ||||
|     "shelljs": "^0.8.1", | ||||
|     "lodash": "^4.17.11", | ||||
|     "smartanalytics": "^2.0.9", | ||||
|     "smartdelay": "^1.0.3", | ||||
|     "smartfile": "^4.2.20", | ||||
|     "smartparam": "^1.0.2", | ||||
|     "smartq": "^1.1.6", | ||||
|     "smartshell": "^1.0.18", | ||||
|     "smartsocket": "^1.1.10", | ||||
|     "smartssh": "^1.2.2", | ||||
|     "smartstring": "^2.0.24", | ||||
|     "smartsystem": "^2.0.2", | ||||
|     "smartsocket": "^1.1.19", | ||||
|     "through2": "^2.0.3" | ||||
|   } | ||||
|   }, | ||||
|   "private": false | ||||
| } | ||||
|   | ||||
| @@ -29,9 +29,9 @@ npmci is designed to work in docker CI environments. The following docker images | ||||
|  | ||||
| Docker Hub: | ||||
|  | ||||
| * [hosttoday/ht-docker-node:npmci](https://hub.docker.com/r/hosttoday/ht-docker-node/)   | ||||
| - [hosttoday/ht-docker-node:npmci](https://hub.docker.com/r/hosttoday/ht-docker-node/)   | ||||
|   has LTS node version and npmci preinstalled. | ||||
| * [hosttoday/ht-docker-dbase](https://hub.docker.com/r/hosttoday/ht-docker-dbase/)   | ||||
| - [hosttoday/ht-docker-dbase](https://hub.docker.com/r/hosttoday/ht-docker-dbase/)   | ||||
|   based on docker:git, can be used to build docker images in conjunction with docker:dind | ||||
|  | ||||
| npmci can be called from commandline and handle a lot of tasks durug ci: | ||||
| @@ -71,7 +71,7 @@ npmci publish npm # will look vor $NPMCI_TOKEN_NPM env var and push any module i | ||||
| npmci publish docker | ||||
|  | ||||
| # trigger webhooks | ||||
| npmci trigger # will look for NPMCI_TRIGGER_1 to NPMCI_TRIGGER_100 in form domain|id|token|ref|name   | ||||
| npmci trigger # will look for NPMCI_TRIGGER_1 to NPMCI_TRIGGER_100 in form domain|id|token|ref|name | ||||
| ``` | ||||
|  | ||||
| ## Configuration | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { tap, expect } from 'tapbundle'; | ||||
| import { tap, expect } from '@pushrocks/tapbundle'; | ||||
| import * as path from 'path'; | ||||
|  | ||||
| // Setup test | ||||
|   | ||||
| @@ -1,31 +0,0 @@ | ||||
| import * as plugins from './mod.plugins'; | ||||
|  | ||||
| let npmciCflare = new plugins.cflare.CflareAccount(); | ||||
|  | ||||
| /** | ||||
|  * handle cli input | ||||
|  * @param argvArg | ||||
|  */ | ||||
| export let handleCli = async argvArg => { | ||||
|   if (argvArg._.length >= 2) { | ||||
|     let action: string = argvArg._[1]; | ||||
|     switch (action) { | ||||
|       default: | ||||
|         plugins.beautylog.error(`>>npmci cloudflare ...<< action >>${action}<< not supported`); | ||||
|         process.exit(1); | ||||
|     } | ||||
|   } else { | ||||
|     plugins.beautylog.log( | ||||
|       `>>npmci cloudflare ...<< cli arguments invalid... Please read the documentation.` | ||||
|     ); | ||||
|     process.exit(1); | ||||
|   } | ||||
| }; | ||||
|  | ||||
| export let purge = async argvArg => { | ||||
|   npmciCflare.auth({ | ||||
|     email: '', | ||||
|     key: '' | ||||
|   }); | ||||
|   npmciCflare.purgeZone(argvArg._[1]); | ||||
| }; | ||||
| @@ -1,5 +0,0 @@ | ||||
| export * from '../npmci.plugins'; | ||||
|  | ||||
| import * as cflare from 'cflare'; | ||||
|  | ||||
| export { cflare }; | ||||
| @@ -34,7 +34,7 @@ export let readDockerfiles = async (): Promise<Dockerfile[]> => { | ||||
|  * @returns Promise<Dockerfile[]> | ||||
|  */ | ||||
| export let sortDockerfiles = (sortableArrayArg: Dockerfile[]): Promise<Dockerfile[]> => { | ||||
|   let done = plugins.q.defer<Dockerfile[]>(); | ||||
|   let done = plugins.smartpromise.defer<Dockerfile[]>(); | ||||
|   plugins.beautylog.info('sorting Dockerfiles:'); | ||||
|   let sortedArray: Dockerfile[] = []; | ||||
|   let cleanTagsOriginal = cleanTagsArrayFunction(sortableArrayArg, sortedArray); | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| import * as plugins from '../npmci.plugins'; | ||||
| import * as paths from '../npmci.paths'; | ||||
| import * as npmciConfig from '../npmci.config'; | ||||
| import { bash, bashNoError, nvmAvailable, yarnAvailable } from '../npmci.bash'; | ||||
| import { bash, bashNoError, nvmAvailable } from '../npmci.bash'; | ||||
|  | ||||
| /** | ||||
|  * handle cli input | ||||
| @@ -33,11 +34,11 @@ export let install = async versionArg => { | ||||
|   plugins.beautylog.log(`now installing node version ${versionArg}`); | ||||
|   let version: string; | ||||
|   if (versionArg === 'stable') { | ||||
|     version = '9'; | ||||
|     version = '10'; | ||||
|   } else if (versionArg === 'lts') { | ||||
|     version = '8'; | ||||
|   } else if (versionArg === 'legacy') { | ||||
|     version = '8'; | ||||
|     version = '9'; | ||||
|   } else { | ||||
|     version = versionArg; | ||||
|   } | ||||
| @@ -49,6 +50,7 @@ export let install = async versionArg => { | ||||
|   } | ||||
|   await bash('node -v'); | ||||
|   await bash('npm -v'); | ||||
|   await bash(`npm config set cache ${paths.NpmciCacheDir}  --global `); | ||||
|   // lets look for further config | ||||
|   await npmciConfig.getConfig().then(async configArg => { | ||||
|     plugins.beautylog.log('Now checking for needed global npm tools...'); | ||||
| @@ -60,11 +62,7 @@ export let install = async versionArg => { | ||||
|         plugins.beautylog.log(`Tool ${npmTool} is available`); | ||||
|       } else { | ||||
|         plugins.beautylog.info(`globally installing ${npmTool} from npm`); | ||||
|         if (await yarnAvailable.promise) { | ||||
|           await bash(`yarn global add ${npmTool}`); | ||||
|         } else { | ||||
|           await bash(`npm install ${npmTool} -q -g`); | ||||
|         } | ||||
|         await bash(`npm install ${npmTool} -q -g`); | ||||
|       } | ||||
|     } | ||||
|     plugins.beautylog.success('all global npm tools specified in npmextra.json are now available!'); | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import * as plugins from './mod.plugins'; | ||||
| import * as configModule from '../npmci.config'; | ||||
| import { bash, bashNoError, nvmAvailable, yarnAvailable } from '../npmci.bash'; | ||||
| import { bash, bashNoError, nvmAvailable } from '../npmci.bash'; | ||||
|  | ||||
| /** | ||||
|  * handle cli input | ||||
| @@ -72,14 +72,14 @@ let publish = async () => { | ||||
|   await bash(`npm -v`); | ||||
|  | ||||
|   // -> build it | ||||
|   await bash(`yarn install`); | ||||
|   await bash(`yarn run build`); | ||||
|   await bash(`npm install`); | ||||
|   await bash(`npm run build`); | ||||
|  | ||||
|   plugins.beautylog.success(`Nice!!! The build for the publication was successfull!`); | ||||
|   plugins.beautylog.log(`Lets clean up so we don't publish any packages that don't belong to us:`); | ||||
|   // -> clean up before we publish stuff | ||||
|   await bash(`rm -r .yarn`); | ||||
|   await bash(`rm -r node_modules`); | ||||
|   await bashNoError(`rm -r ./.npmci_cache`); | ||||
|   await bash(`rm -r ./node_modules`); | ||||
|  | ||||
|   plugins.beautylog.success(`Cleaned up!:`); | ||||
|  | ||||
| @@ -91,14 +91,10 @@ let publish = async () => { | ||||
|  | ||||
| let install = async (): Promise<void> => { | ||||
|   plugins.beautylog.info('now installing dependencies:'); | ||||
|   if (await yarnAvailable.promise) { | ||||
|     await bash('yarn install'); | ||||
|   } else { | ||||
|     await bash('npm install'); | ||||
|   } | ||||
|   await bash('npm install'); | ||||
| }; | ||||
|  | ||||
| export let test = async (): Promise<void> => { | ||||
|   plugins.beautylog.info('now starting tests:'); | ||||
|   await bash('yarn test'); | ||||
|   await bash('npm test'); | ||||
| }; | ||||
|   | ||||
| @@ -1,13 +1,12 @@ | ||||
| import * as plugins from './npmci.plugins'; | ||||
| import * as paths from './npmci.paths'; | ||||
|  | ||||
| import * as smartq from 'smartq'; | ||||
| import * as smartpromise from '@pushrocks/smartpromise'; | ||||
|  | ||||
| /** | ||||
|  * wether nvm is available or not | ||||
|  */ | ||||
| export let nvmAvailable = smartq.defer<boolean>(); | ||||
| export let yarnAvailable = smartq.defer<boolean>(); | ||||
| export let nvmAvailable = smartpromise.defer<boolean>(); | ||||
| /** | ||||
|  * the smartshell instance for npmci | ||||
|  */ | ||||
| @@ -23,34 +22,20 @@ let checkToolsAvailable = async () => { | ||||
|   // check for nvm | ||||
|   if (!process.env.NPMTS_TEST) { | ||||
|     if ( | ||||
|       (await plugins.smartshell.execSilent(`bash -c "source /usr/local/nvm/nvm.sh"`)).exitCode === 0 | ||||
|       (await npmciSmartshell.execSilent(`bash -c "source /usr/local/nvm/nvm.sh"`)).exitCode === 0 | ||||
|     ) { | ||||
|       npmciSmartshell.addSourceFiles([`/usr/local/nvm/nvm.sh`]); | ||||
|       npmciSmartshell.shellEnv.addSourceFiles([`/usr/local/nvm/nvm.sh`]); | ||||
|       nvmAvailable.resolve(true); | ||||
|     } else if ( | ||||
|       (await plugins.smartshell.execSilent(`bash -c "source ~/.nvm/nvm.sh"`)).exitCode === 0 | ||||
|       (await npmciSmartshell.execSilent(`bash -c "source ~/.nvm/nvm.sh"`)).exitCode === 0 | ||||
|     ) { | ||||
|       npmciSmartshell.addSourceFiles([`~/.nvm/nvm.sh`]); | ||||
|       npmciSmartshell.shellEnv.addSourceFiles([`~/.nvm/nvm.sh`]); | ||||
|       nvmAvailable.resolve(true); | ||||
|     } else { | ||||
|       nvmAvailable.resolve(false); | ||||
|     } | ||||
|  | ||||
|     // check for yarn | ||||
|     await plugins.smartshell.which('yarn').then( | ||||
|       async () => { | ||||
|         await plugins.smartshell.exec( | ||||
|           `yarn config set cache-folder ${plugins.path.join(paths.cwd, '.yarn')}` | ||||
|         ); | ||||
|         yarnAvailable.resolve(true); | ||||
|       }, | ||||
|       () => { | ||||
|         yarnAvailable.resolve(false); | ||||
|       } | ||||
|     ); | ||||
|   } else { | ||||
|     nvmAvailable.resolve(true); | ||||
|     yarnAvailable.resolve(true); | ||||
|   } | ||||
| }; | ||||
| checkToolsAvailable(); | ||||
|   | ||||
							
								
								
									
										116
									
								
								ts/npmci.cli.ts
									
									
									
									
									
								
							
							
						
						
									
										116
									
								
								ts/npmci.cli.ts
									
									
									
									
									
								
							| @@ -9,106 +9,102 @@ plugins.beautylog.log('npmci version: ' + npmciInfo.version); | ||||
|  | ||||
| import * as NpmciEnv from './npmci.env'; | ||||
|  | ||||
| import * as npmciMods from './npmci.mods'; | ||||
|  | ||||
| const npmciSmartcli = new plugins.smartcli.Smartcli(); | ||||
| npmciSmartcli.addVersion(npmciInfo.version); | ||||
|  | ||||
| // clean | ||||
| npmciSmartcli | ||||
|   .addCommand('clean') | ||||
|   .subscribe(async argv => { | ||||
|     let modClean = await npmciMods.modClean.load(); | ||||
| npmciSmartcli.addCommand('clean').subscribe( | ||||
|   async argv => { | ||||
|     let modClean = await import('./mod_clean/index'); | ||||
|     await modClean.clean(); | ||||
|   }, err => { | ||||
|   }, | ||||
|   err => { | ||||
|     console.log(err); | ||||
|     process.exit(1); | ||||
|   }); | ||||
|  | ||||
| // cloudflare | ||||
| npmciSmartcli | ||||
|   .addCommand('cloudflare') | ||||
|   .subscribe(async argvArg => { | ||||
|     let modPurge = await npmciMods.modCloudflare.load(); | ||||
|     await modPurge.handleCli(argvArg); | ||||
|   }, err => { | ||||
|     console.log(err); | ||||
|   }); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| // command | ||||
| npmciSmartcli | ||||
|   .addCommand('command') | ||||
|   .subscribe(async argv => { | ||||
|     let modCommand = await npmciMods.modCommand.load(); | ||||
| npmciSmartcli.addCommand('command').subscribe( | ||||
|   async argv => { | ||||
|     let modCommand = await import('./mod_command/index'); | ||||
|     await modCommand.command(); | ||||
|   }, err => { | ||||
|   }, | ||||
|   err => { | ||||
|     console.log(err); | ||||
|     process.exit(1); | ||||
|   }); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| // command | ||||
| npmciSmartcli | ||||
|   .addCommand('git') | ||||
|   .subscribe(async argvArg => { | ||||
|     let modGit = await npmciMods.modGit.load(); | ||||
| npmciSmartcli.addCommand('git').subscribe( | ||||
|   async argvArg => { | ||||
|     let modGit = await import('./mod_git/index'); | ||||
|     await modGit.handleCli(argvArg); | ||||
|   }, err => { | ||||
|   }, | ||||
|   err => { | ||||
|     console.log(err); | ||||
|     process.exit(1); | ||||
|   }); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| // build | ||||
| npmciSmartcli | ||||
|   .addCommand('docker') | ||||
|   .subscribe(async argvArg => { | ||||
|     let modDocker = await npmciMods.modDocker.load(); | ||||
| npmciSmartcli.addCommand('docker').subscribe( | ||||
|   async argvArg => { | ||||
|     let modDocker = await import('./mod_docker/index'); | ||||
|     await modDocker.handleCli(argvArg); | ||||
|   }, err => { | ||||
|   }, | ||||
|   err => { | ||||
|     console.log(err); | ||||
|     process.exit(1); | ||||
|   }); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| // node | ||||
| npmciSmartcli | ||||
|   .addCommand('node') | ||||
|   .subscribe(async argvArg => { | ||||
|     let modNode = await npmciMods.modNode.load(); | ||||
| npmciSmartcli.addCommand('node').subscribe( | ||||
|   async argvArg => { | ||||
|     let modNode = await import('./mod_node/index'); | ||||
|     await modNode.handleCli(argvArg); | ||||
|   }, err => { | ||||
|   }, | ||||
|   err => { | ||||
|     console.log(err); | ||||
|     process.exit(1); | ||||
|   }); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| // npm | ||||
| npmciSmartcli | ||||
|   .addCommand('npm') | ||||
|   .subscribe(async argvArg => { | ||||
|     let modNpm = await npmciMods.modNpm.load(); | ||||
| npmciSmartcli.addCommand('npm').subscribe( | ||||
|   async argvArg => { | ||||
|     let modNpm = await import('./mod_npm/index'); | ||||
|     await modNpm.handleCli(argvArg); | ||||
|   }, err => { | ||||
|   }, | ||||
|   err => { | ||||
|     console.log(err); | ||||
|   }); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| // trigger | ||||
| npmciSmartcli | ||||
|   .addCommand('ssh') | ||||
|   .subscribe(async argvArg => { | ||||
|     let modSsh = await npmciMods.modSsh.load(); | ||||
| npmciSmartcli.addCommand('ssh').subscribe( | ||||
|   async argvArg => { | ||||
|     let modSsh = await import('./mod_ssh/index'); | ||||
|     await modSsh.handleCli(argvArg); | ||||
|   }, err => { | ||||
|   }, | ||||
|   err => { | ||||
|     console.log(err); | ||||
|     process.exit(1); | ||||
|   }); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| // trigger | ||||
| npmciSmartcli | ||||
|   .addCommand('trigger') | ||||
|   .subscribe(async argv => { | ||||
|     let modTrigger = await npmciMods.modTrigger.load(); | ||||
| npmciSmartcli.addCommand('trigger').subscribe( | ||||
|   async argv => { | ||||
|     let modTrigger = await import('./mod_trigger/index'); | ||||
|     await modTrigger.trigger(); | ||||
|   }, err => { | ||||
|   }, | ||||
|   err => { | ||||
|     console.log(err); | ||||
|     process.exit(1); | ||||
|   }); | ||||
|   } | ||||
| ); | ||||
|  | ||||
| npmciSmartcli.startParse(); | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import * as paths from './npmci.paths'; | ||||
|  | ||||
| import { repo } from './npmci.env'; | ||||
|  | ||||
| import { KeyValueStore } from 'npmextra'; | ||||
| import { KeyValueStore } from '@pushrocks/npmextra'; | ||||
|  | ||||
| export interface INpmciOptions { | ||||
|   npmGlobalTools: string[]; | ||||
|   | ||||
| @@ -1,24 +0,0 @@ | ||||
| import * as _modClean from './mod_clean/index'; | ||||
| import * as _modCloudflare from './mod_cloudflare/index'; | ||||
| import * as _modCommand from './mod_command/index'; | ||||
| import * as _modDocker from './mod_docker/index'; | ||||
| import * as _modGit from './mod_git/index'; | ||||
| import * as _modNpm from './mod_npm/index'; | ||||
| import * as _modNode from './mod_node/index'; | ||||
| import * as _modSsh from './mod_ssh/index'; | ||||
| import * as _modTrigger from './mod_trigger/index'; | ||||
|  | ||||
| import { LazyModule } from 'smartsystem'; | ||||
|  | ||||
| export let modClean = new LazyModule<typeof _modClean>('./mod_clean/index', __dirname); | ||||
| export let modCloudflare = new LazyModule<typeof _modCloudflare>( | ||||
|   './mod_cloudflare/index', | ||||
|   __dirname | ||||
| ); | ||||
| export let modCommand = new LazyModule<typeof _modCommand>('./mod_command/index', __dirname); | ||||
| export let modGit = new LazyModule<typeof _modGit>('./mod_git/index', __dirname); | ||||
| export let modDocker = new LazyModule<typeof _modDocker>('./mod_docker/index', __dirname); | ||||
| export let modNode = new LazyModule<typeof _modNode>('./mod_node/index', __dirname); | ||||
| export let modNpm = new LazyModule<typeof _modNpm>('./mod_npm/index', __dirname); | ||||
| export let modSsh = new LazyModule<typeof _modSsh>('./mod_ssh/index', __dirname); | ||||
| export let modTrigger = new LazyModule<typeof _modTrigger>('./mod_trigger/index', __dirname); | ||||
| @@ -6,3 +6,4 @@ export let NpmciPackageRoot = plugins.path.join(__dirname, '../'); | ||||
| export let NpmciPackageConfig = plugins.path.join(NpmciPackageRoot, './config.json'); | ||||
| export let NpmciProjectDir = cwd; | ||||
| export let NpmciTestDir = plugins.path.join(cwd, './test'); | ||||
| export let NpmciCacheDir = plugins.path.join(cwd, './.npmci_cache'); | ||||
|   | ||||
| @@ -1,19 +1,21 @@ | ||||
| export import beautylog = require('beautylog'); | ||||
| export import lodash = require('lodash'); | ||||
| export import npmextra = require('npmextra'); | ||||
| // node native | ||||
| export import path = require('path'); | ||||
| export import projectinfo = require('projectinfo'); | ||||
| export import q = require('smartq'); | ||||
| export let request = require('request'); | ||||
|  | ||||
| // @pushrocks | ||||
| export import beautylog = require('beautylog'); | ||||
| export import projectinfo = require('@pushrocks/projectinfo'); | ||||
| export import npmextra = require('@pushrocks/npmextra'); | ||||
| export import smartdelay = require('@pushrocks/smartdelay'); | ||||
| export import smartfile = require('@pushrocks/smartfile'); | ||||
| export import smartcli = require('@pushrocks/smartcli'); | ||||
| export import smartdelay = require('smartdelay'); | ||||
| export import smartfile = require('smartfile'); | ||||
| export import shelljs = require('shelljs'); | ||||
| export import smartparam = require('smartparam'); | ||||
| export import smartq = require('smartq'); | ||||
| export import smartshell = require('smartshell'); | ||||
| export import smartpromise = require('@pushrocks/smartpromise'); | ||||
| export import smartshell = require('@pushrocks/smartshell'); | ||||
| export import smartsocket = require('smartsocket'); | ||||
| export import smartsystem = require('smartsystem'); | ||||
| export import smartssh = require('smartssh'); | ||||
| export import smartstring = require('smartstring'); | ||||
| export import smartssh = require('@pushrocks/smartssh'); | ||||
| export import smartstring = require('@pushrocks/smartstring'); | ||||
|  | ||||
| // third party | ||||
| export import lodash = require('lodash'); | ||||
| export import through2 = require('through2'); | ||||
| export import request = require('@pushrocks/smartrequest'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user