npmci/ts/npmci.config.ts

34 lines
948 B
TypeScript
Raw Permalink Normal View History

2018-04-04 22:25:13 +02:00
import * as plugins from './npmci.plugins';
import * as paths from './npmci.paths';
2016-11-24 23:21:40 +01:00
2018-04-04 22:25:13 +02:00
import { repo } from './npmci.env';
2017-08-28 17:11:47 +02:00
2018-09-22 14:13:25 +02:00
import { KeyValueStore } from '@pushrocks/npmextra';
2017-08-28 17:11:47 +02:00
2016-11-24 23:21:40 +01:00
export interface INpmciOptions {
2018-04-04 22:25:13 +02:00
npmGlobalTools: string[];
npmAccessLevel?: 'private' | 'public';
2018-12-09 02:50:00 +01:00
npmRegistryUrl?: string;
2018-04-04 22:25:13 +02:00
dockerRegistryRepoMap: any;
dockerBuildargEnvMap: any;
2016-11-24 23:21:40 +01:00
}
2017-08-28 17:11:47 +02:00
// instantiate a kvStorage for the current directory
2018-04-04 22:25:13 +02:00
export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`);
2017-08-28 17:11:47 +02:00
2017-08-28 18:09:59 +02:00
// handle config retrival
2018-11-24 15:00:19 +01:00
const npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
const defaultConfig: INpmciOptions = {
2017-08-28 18:09:59 +02:00
npmGlobalTools: [],
2017-08-28 19:11:24 +02:00
dockerRegistryRepoMap: {},
2017-08-29 06:07:13 +02:00
dockerBuildargEnvMap: {}
2018-04-04 22:25:13 +02:00
};
export let configObject = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig);
2017-08-28 18:09:59 +02:00
2018-04-04 22:25:13 +02:00
/**
* gets the npmci portion of the npmextra.json file
*/
2017-03-08 14:50:41 +01:00
export let getConfig = async (): Promise<INpmciOptions> => {
2018-04-04 22:25:13 +02:00
return configObject;
};