Files
npmci/ts/npmci.config.ts

47 lines
1.3 KiB
TypeScript
Raw 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
2019-06-19 10:41:58 +02:00
/**
* the main config interface for npmci
*/
2016-11-24 23:21:40 +01:00
export interface INpmciOptions {
2018-12-23 17:29:25 +01:00
projectInfo: plugins.projectinfo.ProjectInfo;
2019-06-19 10:41:58 +02:00
// npm
2018-04-04 22:25:13 +02:00
npmGlobalTools: string[];
npmAccessLevel?: 'private' | 'public';
2018-12-11 01:02:21 +01:00
npmRegistryUrl: string;
2019-06-19 10:41:58 +02:00
// docker
dockerRegistries: string[];
dockerRegistryRepoMap: { [key: string]: string };
dockerBuildargEnvMap: { [key: string]: string };
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 = {
2018-12-23 17:29:25 +01:00
projectInfo: new plugins.projectinfo.ProjectInfo(paths.cwd),
2017-08-28 18:09:59 +02:00
npmGlobalTools: [],
2019-06-19 10:41:58 +02:00
dockerRegistries: [],
2017-08-28 19:11:24 +02:00
dockerRegistryRepoMap: {},
2018-12-11 01:02:21 +01:00
npmAccessLevel: 'private',
npmRegistryUrl: 'registry.npmjs.org',
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;
};