npmci/ts/npmci.config.ts

36 lines
1016 B
TypeScript
Raw Normal View History

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