git improve npmextra.json config

This commit is contained in:
Philipp Kunz 2017-08-28 17:19:31 +02:00
parent b9cc0556a8
commit 11ec419700
6 changed files with 16 additions and 9 deletions

View File

@ -64,7 +64,7 @@ exports.install = (versionArg) => __awaiter(this, void 0, void 0, function* () {
yield npmciConfig.getConfig() yield npmciConfig.getConfig()
.then((configArg) => __awaiter(this, void 0, void 0, function* () { .then((configArg) => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.log('Now checking for needed global npm tools...'); plugins.beautylog.log('Now checking for needed global npm tools...');
for (let npmTool of configArg.globalNpmTools) { for (let npmTool of configArg.npmGlobalTools) {
plugins.beautylog.info(`Checking for global "${npmTool}"`); plugins.beautylog.info(`Checking for global "${npmTool}"`);
let whichOutput = yield npmci_bash_1.bashNoError(`which ${npmTool}`); let whichOutput = yield npmci_bash_1.bashNoError(`which ${npmTool}`);
let toolAvailable = !((/not\sfound/.test(whichOutput)) || whichOutput === ''); let toolAvailable = !((/not\sfound/.test(whichOutput)) || whichOutput === '');

View File

@ -1,6 +1,7 @@
import { KeyValueStore } from 'npmextra'; import { KeyValueStore } from 'npmextra';
export interface INpmciOptions { export interface INpmciOptions {
globalNpmTools: string[]; npmGlobalTools: string[];
dockerRegistryRepoMap: any;
} }
export declare let kvStorage: KeyValueStore; export declare let kvStorage: KeyValueStore;
export declare let getConfig: () => Promise<INpmciOptions>; export declare let getConfig: () => Promise<INpmciOptions>;

View File

@ -13,13 +13,14 @@ const paths = require("./npmci.paths");
const npmci_env_1 = require("./npmci.env"); const npmci_env_1 = require("./npmci.env");
const npmextra_1 = require("npmextra"); const npmextra_1 = require("npmextra");
// instantiate a kvStorage for the current directory // instantiate a kvStorage for the current directory
exports.kvStorage = new npmextra_1.KeyValueStore('custom', npmci_env_1.repo.repo); exports.kvStorage = new npmextra_1.KeyValueStore('custom', `${npmci_env_1.repo.user}_${npmci_env_1.repo.repo}`);
exports.getConfig = () => __awaiter(this, void 0, void 0, function* () { exports.getConfig = () => __awaiter(this, void 0, void 0, function* () {
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd); let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
let defaultConfig = { let defaultConfig = {
globalNpmTools: [] npmGlobalTools: [],
dockerRegistryRepoMap: {}
}; };
let npmciConfig = npmciNpmextra.dataFor('npmci', defaultConfig); let npmciConfig = npmciNpmextra.dataFor('npmci', defaultConfig);
return npmciConfig; return npmciConfig;
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBRXRDLDJDQUFrQztBQUVsQyx1Q0FBd0M7QUFNeEMsb0RBQW9EO0FBQ3pDLFFBQUEsU0FBUyxHQUFHLElBQUksd0JBQWEsQ0FBQyxRQUFRLEVBQUUsZ0JBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQTtBQUVsRCxRQUFBLFNBQVMsR0FBRztJQUNyQixJQUFJLGFBQWEsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUM1RCxJQUFJLGFBQWEsR0FBa0I7UUFDakMsY0FBYyxFQUFFLEVBQUU7S0FDbkIsQ0FBQTtJQUNELElBQUksV0FBVyxHQUFHLGFBQWEsQ0FBQyxPQUFPLENBQWdCLE9BQU8sRUFBRSxhQUFhLENBQUMsQ0FBQTtJQUM5RSxNQUFNLENBQUMsV0FBVyxDQUFBO0FBQ3BCLENBQUMsQ0FBQSxDQUFBIn0= //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBRXRDLDJDQUFrQztBQUVsQyx1Q0FBd0M7QUFPeEMsb0RBQW9EO0FBQ3pDLFFBQUEsU0FBUyxHQUFHLElBQUksd0JBQWEsQ0FBQyxRQUFRLEVBQUUsR0FBRyxnQkFBSSxDQUFDLElBQUksSUFBSSxnQkFBSSxDQUFDLElBQUksRUFBRSxDQUFDLENBQUE7QUFFcEUsUUFBQSxTQUFTLEdBQUc7SUFDckIsSUFBSSxhQUFhLEdBQUcsSUFBSSxPQUFPLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUE7SUFDNUQsSUFBSSxhQUFhLEdBQWtCO1FBQ2pDLGNBQWMsRUFBRSxFQUFFO1FBQ2xCLHFCQUFxQixFQUFFLEVBQUU7S0FDMUIsQ0FBQTtJQUNELElBQUksV0FBVyxHQUFHLGFBQWEsQ0FBQyxPQUFPLENBQWdCLE9BQU8sRUFBRSxhQUFhLENBQUMsQ0FBQTtJQUM5RSxNQUFNLENBQUMsV0FBVyxDQUFBO0FBQ3BCLENBQUMsQ0FBQSxDQUFBIn0=

View File

@ -7,6 +7,9 @@
"npmci": { "npmci": {
"globalNpmTools": [ "globalNpmTools": [
"npmts" "npmts"
],
"npmGlobalTools": [
"npmts"
] ]
}, },
"npmdocker":{ "npmdocker":{

View File

@ -57,7 +57,7 @@ export let install = async (versionArg) => {
await npmciConfig.getConfig() await npmciConfig.getConfig()
.then(async configArg => { .then(async configArg => {
plugins.beautylog.log('Now checking for needed global npm tools...') plugins.beautylog.log('Now checking for needed global npm tools...')
for (let npmTool of configArg.globalNpmTools) { for (let npmTool of configArg.npmGlobalTools) {
plugins.beautylog.info(`Checking for global "${npmTool}"`) plugins.beautylog.info(`Checking for global "${npmTool}"`)
let whichOutput: string = await bashNoError(`which ${npmTool}`) let whichOutput: string = await bashNoError(`which ${npmTool}`)
let toolAvailable: boolean = !((/not\sfound/.test(whichOutput)) || whichOutput === '') let toolAvailable: boolean = !((/not\sfound/.test(whichOutput)) || whichOutput === '')

View File

@ -8,16 +8,18 @@ import { repo } from './npmci.env'
import { KeyValueStore } from 'npmextra' import { KeyValueStore } from 'npmextra'
export interface INpmciOptions { export interface INpmciOptions {
globalNpmTools: string[] npmGlobalTools: string[]
dockerRegistryRepoMap: any
} }
// instantiate a kvStorage for the current directory // instantiate a kvStorage for the current directory
export let kvStorage = new KeyValueStore('custom', repo.user + repo.repo) export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`)
export let getConfig = async (): Promise<INpmciOptions> => { export let getConfig = async (): Promise<INpmciOptions> => {
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd) let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
let defaultConfig: INpmciOptions = { let defaultConfig: INpmciOptions = {
globalNpmTools: [] npmGlobalTools: [],
dockerRegistryRepoMap: {}
} }
let npmciConfig = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig) let npmciConfig = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)
return npmciConfig return npmciConfig