2018-04-04 20:25:13 +00:00
|
|
|
import * as q from 'q';
|
2016-11-24 22:21:40 +00:00
|
|
|
|
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';
|
|
|
|
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-04-04 20:25:13 +00:00
|
|
|
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
|
2017-08-28 16:09:59 +00:00
|
|
|
let defaultConfig: INpmciOptions = {
|
|
|
|
npmGlobalTools: [],
|
2017-08-28 17:11:24 +00:00
|
|
|
dockerRegistryRepoMap: {},
|
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;
|
|
|
|
};
|