Compare commits
	
		
			55 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0dea101c07 | |||
| 380a49c59f | |||
| 5133651e34 | |||
| c8f26c7c48 | |||
| 3bb5912046 | |||
| d75258d9dd | |||
| b1577e7542 | |||
| d5cdeffd17 | |||
| c62ce415e9 | |||
| 99014da1e8 | |||
| 0b5dada524 | |||
| 40bddba3b5 | |||
| 6f6ee6d799 | |||
| e30cc3f5a0 | |||
| a4562d4d1b | |||
| 524b405773 | |||
| 0d19c1c68d | |||
| cff79bc3b4 | |||
| 28541a838d | |||
| c3ab527341 | |||
| 52cc249098 | |||
| 2e189b0660 | |||
| f876c7414b | |||
| 08b7585cfc | |||
| 76311fab72 | |||
| 1b73df64f5 | |||
| 701cee573b | |||
| 3dd086f711 | |||
| 67ff5d09d4 | |||
| 5cb8a79b6a | |||
| 2dcbca2362 | |||
| bd63194f4b | |||
| 2763fdef5f | |||
| bbedde01b9 | |||
| f26606f757 | |||
| 99b03aa796 | |||
| f30dd3da65 | |||
| d4decddb4b | |||
| 5c2880da1a | |||
| bfffc5b130 | |||
| 8900a13c6b | |||
| d42acf737f | |||
| 77e3b2912d | |||
| 103e470eb4 | |||
| 74c1324e55 | |||
| a1876963a8 | |||
| 5d88e25c99 | |||
| b3c47546e2 | |||
| 6316e81958 | |||
| ff10afbee4 | |||
| 9dbfa77084 | |||
| 46dbd61d89 | |||
| 713df1867a | |||
| 23886c1ed3 | |||
| 0c46b627be | 
							
								
								
									
										20
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,19 @@ | |||||||
| dist/ | .nogit/ | ||||||
| node_modules/ |  | ||||||
|  | # artifacts | ||||||
| coverage/ | coverage/ | ||||||
| public/ | public/ | ||||||
| config.json | pages/ | ||||||
|  |  | ||||||
|  | # installs | ||||||
|  | node_modules/ | ||||||
|  |  | ||||||
|  | # caches and builds | ||||||
| .yarn/ | .yarn/ | ||||||
| .npmci_cache | .cache/ | ||||||
|  | dist/ | ||||||
|  | dist_web/ | ||||||
|  | dist_serve/ | ||||||
|  | dist_ts_web/ | ||||||
|  |  | ||||||
|  | # custom | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| # gitzone standard | # gitzone ci_default | ||||||
| image: hosttoday/ht-docker-node:npmci | image: hosttoday/ht-docker-node:npmci | ||||||
|  |  | ||||||
| cache: | cache: | ||||||
| @@ -37,18 +37,6 @@ snyk: | |||||||
| # ==================== | # ==================== | ||||||
| # test stage | # test stage | ||||||
| # ==================== | # ==================== | ||||||
| testLEGACY: |  | ||||||
|   stage: test |  | ||||||
|   script: |  | ||||||
|   - npmci npm prepare |  | ||||||
|   - npmci node install legacy |  | ||||||
|   - npmci npm install |  | ||||||
|   - npmci npm test |  | ||||||
|   coverage: /\d+.?\d+?\%\s*coverage/ |  | ||||||
|   tags: |  | ||||||
|   - docker |  | ||||||
|   - notpriv |  | ||||||
|   allow_failure: true |  | ||||||
|  |  | ||||||
| testLTS: | testLTS: | ||||||
|   stage: test |   stage: test | ||||||
|   | |||||||
							
								
								
									
										28
									
								
								.snyk
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								.snyk
									
									
									
									
									
								
							| @@ -1,28 +1,4 @@ | |||||||
| # Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. | # Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. | ||||||
| version: v1.12.0 | version: v1.13.1 | ||||||
| # ignores vulnerabilities until expiry date; change duration by modifying expiry date | ignore: {} | ||||||
| ignore: |  | ||||||
|   'npm:shelljs:20140723': |  | ||||||
|     - shelljs: |  | ||||||
|         reason: None given |  | ||||||
|         expires: '2018-06-02T22:48:10.660Z' |  | ||||||
|     - smartshell > shelljs: |  | ||||||
|         reason: None given |  | ||||||
|         expires: '2018-06-02T22:48:10.660Z' |  | ||||||
|     - 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: {} | patch: {} | ||||||
|   | |||||||
| @@ -5,13 +5,22 @@ | |||||||
|     "cli": true |     "cli": true | ||||||
|   }, |   }, | ||||||
|   "npmci": { |   "npmci": { | ||||||
|         "npmGlobalTools": [ |     "npmGlobalTools": [], | ||||||
|             "@gitzone/npmts" |     "npmAccessLevel": "public", | ||||||
|         ], |     "npmRegistryUrl": "registry.npmjs.org" | ||||||
|         "npmAccessLevel": "public" |  | ||||||
|   }, |   }, | ||||||
|   "npmdocker": { |   "npmdocker": { | ||||||
|     "baseImage": "hosttoday/ht-docker-node:npmci", |     "baseImage": "hosttoday/ht-docker-node:npmci", | ||||||
|     "command": "npmci test stable" |     "command": "npmci test stable" | ||||||
|  |   }, | ||||||
|  |   "gitzone": { | ||||||
|  |     "module": { | ||||||
|  |       "githost": "gitlab.com", | ||||||
|  |       "gitscope": "shipzone", | ||||||
|  |       "gitrepo": "npmci", | ||||||
|  |       "shortDescription": "node and docker in gitlab ci on steroids", | ||||||
|  |       "npmPackagename": "@shipzone/npmci", | ||||||
|  |       "license": "MIT" | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
							
								
								
									
										2488
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2488
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										61
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										61
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "name": "@shipzone/npmci", |   "name": "@shipzone/npmci", | ||||||
|   "version": "3.1.0", |   "version": "3.1.28", | ||||||
|  |   "private": false, | ||||||
|   "description": "node and docker in gitlab ci on steroids", |   "description": "node and docker in gitlab ci on steroids", | ||||||
|   "main": "dist/index.js", |   "main": "dist/index.js", | ||||||
|   "typings": "dist/index.d.ts", |   "typings": "dist/index.d.ts", | ||||||
| @@ -23,37 +24,43 @@ | |||||||
|   }, |   }, | ||||||
|   "homepage": "https://gitlab.com/gitzone/npmci#README", |   "homepage": "https://gitlab.com/gitzone/npmci#README", | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "@gitzone/tsbuild": "^2.0.22", |     "@gitzone/tsbuild": "^2.1.11", | ||||||
|     "@gitzone/tsrun": "^1.1.13", |     "@gitzone/tsrun": "^1.2.6", | ||||||
|     "@gitzone/tstest": "^1.0.15", |     "@gitzone/tstest": "^1.0.24", | ||||||
|     "@pushrocks/tapbundle": "^3.0.7", |     "@pushrocks/tapbundle": "^3.0.9", | ||||||
|     "@types/node": "^10.12.10", |     "@types/node": "^12.0.8", | ||||||
|     "tslint": "^5.11.0", |     "tslint": "^5.17.0", | ||||||
|     "tslint-config-prettier": "^1.16.0" |     "tslint-config-prettier": "^1.18.0" | ||||||
|   }, |   }, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@pushrocks/lik": "^3.0.2", |     "@pushrocks/lik": "^3.0.5", | ||||||
|     "@pushrocks/npmextra": "^3.0.1", |     "@pushrocks/npmextra": "^3.0.5", | ||||||
|     "@pushrocks/projectinfo": "^4.0.2", |     "@pushrocks/projectinfo": "^4.0.2", | ||||||
|     "@pushrocks/smartcli": "^3.0.6", |     "@pushrocks/smartanalytics": "^2.0.15", | ||||||
|     "@pushrocks/smartdelay": "^2.0.2", |     "@pushrocks/smartcli": "^3.0.7", | ||||||
|     "@pushrocks/smartfile": "^6.0.11", |     "@pushrocks/smartdelay": "^2.0.3", | ||||||
|     "@pushrocks/smartlog": "^2.0.9", |     "@pushrocks/smartfile": "^7.0.2", | ||||||
|     "@pushrocks/smartlog-destination-local": "^7.0.5", |     "@pushrocks/smartlog": "^2.0.19", | ||||||
|  |     "@pushrocks/smartlog-destination-local": "^8.0.2", | ||||||
|     "@pushrocks/smartparam": "^1.0.4", |     "@pushrocks/smartparam": "^1.0.4", | ||||||
|     "@pushrocks/smartpromise": "^2.0.5", |     "@pushrocks/smartpromise": "^3.0.2", | ||||||
|     "@pushrocks/smartrequest": "^1.1.14", |     "@pushrocks/smartrequest": "^1.1.16", | ||||||
|     "@pushrocks/smartshell": "^2.0.8", |     "@pushrocks/smartshell": "^2.0.23", | ||||||
|  |     "@pushrocks/smartsocket": "^1.1.38", | ||||||
|     "@pushrocks/smartssh": "^1.2.3", |     "@pushrocks/smartssh": "^1.2.3", | ||||||
|     "@pushrocks/smartstring": "^3.0.4", |     "@pushrocks/smartstring": "^3.0.10", | ||||||
|     "@types/lodash": "^4.14.118", |     "@types/shelljs": "^0.8.5", | ||||||
|     "@types/shelljs": "^0.8.0", |  | ||||||
|     "@types/through2": "^2.0.34", |     "@types/through2": "^2.0.34", | ||||||
|     "cflare": "^1.0.5", |     "through2": "^3.0.1" | ||||||
|     "lodash": "^4.17.11", |  | ||||||
|     "smartanalytics": "^2.0.9", |  | ||||||
|     "smartsocket": "^1.1.19", |  | ||||||
|     "through2": "^3.0.0" |  | ||||||
|   }, |   }, | ||||||
|   "private": false |   "files": [ | ||||||
|  |     "ts/*", | ||||||
|  |     "ts_web/*", | ||||||
|  |     "dist/*", | ||||||
|  |     "dist_web/*", | ||||||
|  |     "assets/*", | ||||||
|  |     "cli.js", | ||||||
|  |     "npmextra.json", | ||||||
|  |     "readme.md" | ||||||
|  |   ] | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										37
									
								
								readme.md
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								readme.md
									
									
									
									
									
								
							| @@ -1,25 +1,20 @@ | |||||||
| # npmci | # @shipzone/npmci | ||||||
|  |  | ||||||
| node and docker in gitlab ci on steroids | node and docker in gitlab ci on steroids | ||||||
|  |  | ||||||
| ## Availabililty | ## Availabililty and Links | ||||||
|  | * [npmjs.org (npm package)](https://www.npmjs.com/package/@shipzone/npmci) | ||||||
| [](https://www.npmjs.com/package/@shipzone/npmci) | * [gitlab.com (source)](https://gitlab.com/shipzone/npmci) | ||||||
| [](https://GitLab.com/shipzone/npmci) | * [github.com (source mirror)](https://github.com/shipzone/npmci) | ||||||
| [](https://github.com/shipzone/npmci) | * [docs (typedoc)](https://shipzone.gitlab.io/npmci/) | ||||||
| [](https://shipzone.gitlab.io/npmci/) |  | ||||||
|  |  | ||||||
| ## Status for master | ## Status for master | ||||||
|  | [](https://gitlab.com/shipzone/npmci/commits/master) | ||||||
| [](https://GitLab.com/shipzone/npmci/commits/master) | [](https://gitlab.com/shipzone/npmci/commits/master) | ||||||
| [](https://GitLab.com/shipzone/npmci/commits/master) | [](https://www.npmjs.com/package/@shipzone/npmci) | ||||||
| [](https://www.npmjs.com/package/@shipzone/npmci) | [](https://snyk.io/test/npm/@shipzone/npmci) | ||||||
| [](https://david-dm.org/shipzone/npmci) | [](https://nodejs.org/dist/latest-v10.x/docs/api/) | ||||||
| [](https://www.bithound.io/github/shipzone/npmci/master/dependencies/npm) | [](https://nodejs.org/dist/latest-v10.x/docs/api/) | ||||||
| [](https://www.bithound.io/github/shipzone/npmci) | [](https://prettier.io/) | ||||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) |  | ||||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) |  | ||||||
| [](http://standardjs.com/) |  | ||||||
|  |  | ||||||
| ## Usage | ## Usage | ||||||
|  |  | ||||||
| @@ -98,9 +93,9 @@ For further information read the linked docs at the top of this README. | |||||||
|  |  | ||||||
| Use TypeScript for best in class instellisense. | Use TypeScript for best in class instellisense. | ||||||
|  |  | ||||||
| For further information read the linked docs at the top of this README. | For further information read the linked docs at the top of this readme. | ||||||
|  |  | ||||||
| > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) | > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) | ||||||
| > | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) | | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) | ||||||
|  |  | ||||||
| [](https://push.rocks) | [](https://maintainedby.lossless.com) | ||||||
|   | |||||||
| @@ -42,7 +42,9 @@ export class Dockerfile { | |||||||
|   public async build() { |   public async build() { | ||||||
|     logger.log('info', 'now building Dockerfile for ' + this.cleanTag); |     logger.log('info', 'now building Dockerfile for ' + this.cleanTag); | ||||||
|     const buildArgsString = await helpers.getDockerBuildArgs(); |     const buildArgsString = await helpers.getDockerBuildArgs(); | ||||||
|     const buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} ${buildArgsString} .`; |     const buildCommand = `docker build -t ${this.buildTag} -f ${ | ||||||
|  |       this.filePath | ||||||
|  |     } ${buildArgsString} .`; | ||||||
|     await bash(buildCommand); |     await bash(buildCommand); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| @@ -102,7 +104,9 @@ export class Dockerfile { | |||||||
|    * gets the id of a Dockerfile |    * gets the id of a Dockerfile | ||||||
|    */ |    */ | ||||||
|   public async getId() { |   public async getId() { | ||||||
|     const containerId = await bash('docker inspect --type=image --format="{{.Id}}" ' + this.buildTag); |     const containerId = await bash( | ||||||
|  |       'docker inspect --type=image --format="{{.Id}}" ' + this.buildTag | ||||||
|  |     ); | ||||||
|     return containerId; |     return containerId; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -165,7 +165,7 @@ export let getDockerBuildArgs = async (): Promise<string> => { | |||||||
|   let buildArgsString: string = ''; |   let buildArgsString: string = ''; | ||||||
|   for (const key in NpmciConfig.configObject.dockerBuildargEnvMap) { |   for (const key in NpmciConfig.configObject.dockerBuildargEnvMap) { | ||||||
|     const targetValue = process.env[NpmciConfig.configObject.dockerBuildargEnvMap[key]]; |     const targetValue = process.env[NpmciConfig.configObject.dockerBuildargEnvMap[key]]; | ||||||
|     buildArgsString = `${buildArgsString} --build-arg ${key}=${targetValue}`; |     buildArgsString = `${buildArgsString} --build-arg ${key}="${targetValue}"`; | ||||||
|   } |   } | ||||||
|   return buildArgsString; |   return buildArgsString; | ||||||
| }; | }; | ||||||
| @@ -178,7 +178,7 @@ export let cleanTagsArrayFunction = ( | |||||||
|   trackingArrayArg: Dockerfile[] |   trackingArrayArg: Dockerfile[] | ||||||
| ): string[] => { | ): string[] => { | ||||||
|   const cleanTagsArray: string[] = []; |   const cleanTagsArray: string[] = []; | ||||||
|   dockerfileArrayArg.forEach((dockerfileArg) => { |   dockerfileArrayArg.forEach(dockerfileArg => { | ||||||
|     if (trackingArrayArg.indexOf(dockerfileArg) === -1) { |     if (trackingArrayArg.indexOf(dockerfileArg) === -1) { | ||||||
|       cleanTagsArray.push(dockerfileArg.cleanTag); |       cleanTagsArray.push(dockerfileArg.cleanTag); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -3,6 +3,8 @@ import * as plugins from './mod.plugins'; | |||||||
| import { bash } from '../npmci.bash'; | import { bash } from '../npmci.bash'; | ||||||
| import { repo } from '../npmci.env'; | import { repo } from '../npmci.env'; | ||||||
|  |  | ||||||
|  | import { configObject } from '../npmci.config'; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * handle cli input |  * handle cli input | ||||||
|  * @param argvArg |  * @param argvArg | ||||||
| @@ -15,10 +17,10 @@ export let handleCli = async argvArg => { | |||||||
|         await mirror(); |         await mirror(); | ||||||
|         break; |         break; | ||||||
|       default: |       default: | ||||||
|         logger.log('error', `>>npmci git ...<< action >>${action}<< not supported`); |         logger.log('error', `npmci git -> action >>${action}<< not supported!`); | ||||||
|     } |     } | ||||||
|   } else { |   } else { | ||||||
|     logger.log('info', `>>npmci git ...<< cli arguments invalid... Please read the documentation.`); |     logger.log('info', `npmci git -> cli arguments invalid! Please read the documentation.`); | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -26,6 +28,16 @@ export let mirror = async () => { | |||||||
|   const githubToken = process.env.NPMCI_GIT_GITHUBTOKEN; |   const githubToken = process.env.NPMCI_GIT_GITHUBTOKEN; | ||||||
|   const githubUser = process.env.NPMCI_GIT_GITHUBGROUP || repo.user; |   const githubUser = process.env.NPMCI_GIT_GITHUBGROUP || repo.user; | ||||||
|   const githubRepo = process.env.NPMCI_GIT_GITHUB || repo.repo; |   const githubRepo = process.env.NPMCI_GIT_GITHUB || repo.repo; | ||||||
|  |   if ( | ||||||
|  |     configObject.projectInfo.npm.packageJson.private === true || | ||||||
|  |     configObject.npmAccessLevel === 'private' | ||||||
|  |   ) { | ||||||
|  |     logger.log( | ||||||
|  |       'warn', | ||||||
|  |       `refusing to mirror due to private property use a private mirror location instead` | ||||||
|  |     ); | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|   if (githubToken) { |   if (githubToken) { | ||||||
|     logger.log('info', 'found github token.'); |     logger.log('info', 'found github token.'); | ||||||
|     logger.log('info', 'attempting the mirror the repository to GitHub'); |     logger.log('info', 'attempting the mirror the repository to GitHub'); | ||||||
|   | |||||||
| @@ -36,11 +36,11 @@ export let install = async versionArg => { | |||||||
|   logger.log('info', `now installing node version ${versionArg}`); |   logger.log('info', `now installing node version ${versionArg}`); | ||||||
|   let version: string; |   let version: string; | ||||||
|   if (versionArg === 'stable') { |   if (versionArg === 'stable') { | ||||||
|     version = '10'; |     version = '12'; | ||||||
|   } else if (versionArg === 'lts') { |   } else if (versionArg === 'lts') { | ||||||
|     version = '8'; |     version = '10'; | ||||||
|   } else if (versionArg === 'legacy') { |   } else if (versionArg === 'legacy') { | ||||||
|     version = '9'; |     version = '8'; | ||||||
|   } else { |   } else { | ||||||
|     version = versionArg; |     version = versionArg; | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -37,15 +37,27 @@ export let handleCli = async argvArg => { | |||||||
|  * authenticates npm with token from env var |  * authenticates npm with token from env var | ||||||
|  */ |  */ | ||||||
| const prepare = async () => { | const prepare = async () => { | ||||||
|   const npmrcPrefix: string = '//registry.npmjs.org/:_authToken='; |   const config = await configModule.getConfig(); | ||||||
|   const npmToken: string = process.env.NPMCI_TOKEN_NPM; |   let npmrcFileString: string = ''; | ||||||
|   const npmrcFileString: string = npmrcPrefix + npmToken; |   await plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TOKEN_NPM*', npmEnvArg => { | ||||||
|   if (npmToken) { |     const npmRegistryUrl = npmEnvArg.split('|')[0]; | ||||||
|     logger.log('info', 'found access token'); |     const npmToken = npmEnvArg.split('|')[1]; | ||||||
|  |     npmrcFileString += `//${npmRegistryUrl}/:_authToken="${plugins.smartstring.base64.decode( | ||||||
|  |       npmToken | ||||||
|  |     )}"\n`; | ||||||
|  |   }); | ||||||
|  |   logger.log('info', `setting default npm registry to ${config.npmRegistryUrl}`); | ||||||
|  |   npmrcFileString += `registry=https://${config.npmRegistryUrl}\n`; | ||||||
|  |  | ||||||
|  |   // final check | ||||||
|  |   if (npmrcFileString.length > 0) { | ||||||
|  |     logger.log('info', 'found one or more access tokens'); | ||||||
|   } else { |   } else { | ||||||
|     logger.log('error', 'no access token found! Exiting!'); |     logger.log('error', 'no access token found! Exiting!'); | ||||||
|     process.exit(1); |     process.exit(1); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   // lets save it to disk | ||||||
|   plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc'); |   plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc'); | ||||||
|   return; |   return; | ||||||
| }; | }; | ||||||
| @@ -55,6 +67,7 @@ const prepare = async () => { | |||||||
|  */ |  */ | ||||||
| const publish = async () => { | const publish = async () => { | ||||||
|   let npmAccessCliString = ``; |   let npmAccessCliString = ``; | ||||||
|  |   let npmRegistryCliString = ``; | ||||||
|   const config = await configModule.getConfig(); |   const config = await configModule.getConfig(); | ||||||
|  |  | ||||||
|   // -> configure package access level |   // -> configure package access level | ||||||
| @@ -65,6 +78,14 @@ const publish = async () => { | |||||||
|     npmAccessCliString = `--access=${config.npmAccessLevel}`; |     npmAccessCliString = `--access=${config.npmAccessLevel}`; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   // -> configure registry url | ||||||
|  |   if (config.npmRegistryUrl) { | ||||||
|  |     npmRegistryCliString = `--registry=https://${config.npmRegistryUrl}`; | ||||||
|  |   } else { | ||||||
|  |     logger.log('error', `no registry url specified. Can't publish!`); | ||||||
|  |     process.exit(1); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   // -> preparing |   // -> preparing | ||||||
|   logger.log('info', `now preparing environment:`); |   logger.log('info', `now preparing environment:`); | ||||||
|   prepare(); |   prepare(); | ||||||
| @@ -84,7 +105,7 @@ const publish = async () => { | |||||||
|  |  | ||||||
|   // -> publish it |   // -> publish it | ||||||
|   logger.log('info', `now invoking npm to publish the package!`); |   logger.log('info', `now invoking npm to publish the package!`); | ||||||
|   await bash(`npm publish ${npmAccessCliString}`); |   await bash(`npm publish ${npmAccessCliString} ${npmRegistryCliString}`); | ||||||
|   logger.log('success', `Package was successfully published!`); |   logger.log('success', `Package was successfully published!`); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ const triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*) | |||||||
|  |  | ||||||
| export let trigger = async () => { | export let trigger = async () => { | ||||||
|   logger.log('info', 'now running triggers'); |   logger.log('info', 'now running triggers'); | ||||||
|   plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger); |   await plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| const evaluateTrigger = async triggerEnvVarArg => { | const evaluateTrigger = async triggerEnvVarArg => { | ||||||
|   | |||||||
| @@ -6,8 +6,10 @@ import { repo } from './npmci.env'; | |||||||
| import { KeyValueStore } from '@pushrocks/npmextra'; | import { KeyValueStore } from '@pushrocks/npmextra'; | ||||||
|  |  | ||||||
| export interface INpmciOptions { | export interface INpmciOptions { | ||||||
|  |   projectInfo: plugins.projectinfo.ProjectInfo; | ||||||
|   npmGlobalTools: string[]; |   npmGlobalTools: string[]; | ||||||
|   npmAccessLevel?: 'private' | 'public'; |   npmAccessLevel?: 'private' | 'public'; | ||||||
|  |   npmRegistryUrl: string; | ||||||
|   dockerRegistryRepoMap: any; |   dockerRegistryRepoMap: any; | ||||||
|   dockerBuildargEnvMap: any; |   dockerBuildargEnvMap: any; | ||||||
| } | } | ||||||
| @@ -18,8 +20,11 @@ export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`); | |||||||
| // handle config retrival | // handle config retrival | ||||||
| const npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd); | const npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd); | ||||||
| const defaultConfig: INpmciOptions = { | const defaultConfig: INpmciOptions = { | ||||||
|  |   projectInfo: new plugins.projectinfo.ProjectInfo(paths.cwd), | ||||||
|   npmGlobalTools: [], |   npmGlobalTools: [], | ||||||
|   dockerRegistryRepoMap: {}, |   dockerRegistryRepoMap: {}, | ||||||
|  |   npmAccessLevel: 'private', | ||||||
|  |   npmRegistryUrl: 'registry.npmjs.org', | ||||||
|   dockerBuildargEnvMap: {} |   dockerBuildargEnvMap: {} | ||||||
| }; | }; | ||||||
| export let configObject = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig); | export let configObject = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig); | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| import * as plugins from './npmci.plugins'; | import * as plugins from './npmci.plugins'; | ||||||
| import * as paths from './npmci.paths'; | import * as paths from './npmci.paths'; | ||||||
| import { GitRepo } from 'smartstring'; | import { GitRepo } from '@pushrocks/smartstring'; | ||||||
| import { Dockerfile } from './mod_docker/index'; | import { Dockerfile } from './mod_docker/index'; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ import { logger } from './npmci.logging'; | |||||||
| import * as plugins from './npmci.plugins'; | import * as plugins from './npmci.plugins'; | ||||||
| import * as env from './npmci.env'; | import * as env from './npmci.env'; | ||||||
|  |  | ||||||
| import { Analytics } from 'smartanalytics'; | import { Analytics } from '@pushrocks/smartanalytics'; | ||||||
|  |  | ||||||
| export let npmciAnalytics = new Analytics({ | export let npmciAnalytics = new Analytics({ | ||||||
|   apiEndPoint: 'https://pubapi.lossless.one/analytics', |   apiEndPoint: 'https://pubapi.lossless.one/analytics', | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ import * as smartparam from '@pushrocks/smartparam'; | |||||||
| import * as smartpromise from '@pushrocks/smartpromise'; | import * as smartpromise from '@pushrocks/smartpromise'; | ||||||
| import * as smartrequest from '@pushrocks/smartrequest'; | import * as smartrequest from '@pushrocks/smartrequest'; | ||||||
| import * as smartshell from '@pushrocks/smartshell'; | import * as smartshell from '@pushrocks/smartshell'; | ||||||
| import * as smartsocket from 'smartsocket'; | import * as smartsocket from '@pushrocks/smartsocket'; | ||||||
| import * as smartssh from '@pushrocks/smartssh'; | import * as smartssh from '@pushrocks/smartssh'; | ||||||
| import * as smartstring from '@pushrocks/smartstring'; | import * as smartstring from '@pushrocks/smartstring'; | ||||||
|  |  | ||||||
| @@ -36,8 +36,6 @@ export { | |||||||
|   smartstring |   smartstring | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // third party |  | ||||||
| import * as lodash from 'lodash'; |  | ||||||
| import * as through2 from 'through2'; | import * as through2 from 'through2'; | ||||||
|  |  | ||||||
| export { lodash, through2 }; | export { through2 }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user