From 2e189b066040d818efd07daef79aaf462f2c8584 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 23 Dec 2018 17:29:25 +0100 Subject: [PATCH] fix(core): update --- package-lock.json | 2 +- ts/mod_git/index.ts | 10 ++++++++-- ts/npmci.config.ts | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7bfc045..617ead4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -102,7 +102,7 @@ }, "@pushrocks/projectinfo": { "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@pushrocks/projectinfo/-/projectinfo-4.0.2.tgz", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fprojectinfo/-/projectinfo-4.0.2.tgz", "integrity": "sha512-u5tSlrJTdDb5r3qmPub5WkDWlW561WfjqylZMkswP4yNZSR2krhew4ra4Y2/6q2QUnMBXRmo1lj4n7ggXoDNWQ==", "requires": { "@pushrocks/smartfile": "^6.0.8", diff --git a/ts/mod_git/index.ts b/ts/mod_git/index.ts index b859fc8..c6c9cba 100644 --- a/ts/mod_git/index.ts +++ b/ts/mod_git/index.ts @@ -3,6 +3,8 @@ import * as plugins from './mod.plugins'; import { bash } from '../npmci.bash'; import { repo } from '../npmci.env'; +import { configObject } from '../npmci.config'; + /** * handle cli input * @param argvArg @@ -15,10 +17,10 @@ export let handleCli = async argvArg => { await mirror(); break; default: - logger.log('error', `>>npmci git ...<< action >>${action}<< not supported`); + logger.log('error', `npmci git -> action >>${action}<< not supported!`); } } 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,10 @@ export let mirror = async () => { const githubToken = process.env.NPMCI_GIT_GITHUBTOKEN; const githubUser = process.env.NPMCI_GIT_GITHUBGROUP || repo.user; const githubRepo = process.env.NPMCI_GIT_GITHUB || repo.repo; + if(configObject.projectInfo.npm.packageJson.private) { + logger.log('warn', `refusing to mirror due to private property`); + return; + } if (githubToken) { logger.log('info', 'found github token.'); logger.log('info', 'attempting the mirror the repository to GitHub'); diff --git a/ts/npmci.config.ts b/ts/npmci.config.ts index f84db30..8da2b9c 100644 --- a/ts/npmci.config.ts +++ b/ts/npmci.config.ts @@ -6,6 +6,7 @@ import { repo } from './npmci.env'; import { KeyValueStore } from '@pushrocks/npmextra'; export interface INpmciOptions { + projectInfo: plugins.projectinfo.ProjectInfo; npmGlobalTools: string[]; npmAccessLevel?: 'private' | 'public'; npmRegistryUrl: string; @@ -19,6 +20,7 @@ export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`); // handle config retrival const npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd); const defaultConfig: INpmciOptions = { + projectInfo: new plugins.projectinfo.ProjectInfo(paths.cwd), npmGlobalTools: [], dockerRegistryRepoMap: {}, npmAccessLevel: 'private',