fix(core): update
This commit is contained in:
47
ts/classes.gitzoneconfig.ts
Normal file
47
ts/classes.gitzoneconfig.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import * as paths from './paths.js';
|
||||
|
||||
export type TGitzoneProjectType = 'npm' | 'service' | 'wcc' | 'website';
|
||||
|
||||
/**
|
||||
* type of the actual gitzone data
|
||||
*/
|
||||
export interface IGitzoneConfigData {
|
||||
projectType: TGitzoneProjectType;
|
||||
module: {
|
||||
githost: string;
|
||||
gitscope: string;
|
||||
gitrepo: string;
|
||||
description: string;
|
||||
npmPackageName: string;
|
||||
license: string;
|
||||
projectDomain: string;
|
||||
};
|
||||
copy: {[key: string]: string}
|
||||
npmciOptions: {
|
||||
npmAccessLevel: 'public' | 'private';
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* gitzone config
|
||||
*/
|
||||
export class GitzoneConfig {
|
||||
public static async fromCwd() {
|
||||
const gitzoneConfig = new GitzoneConfig();
|
||||
await gitzoneConfig.readConfigFromCwd();
|
||||
return gitzoneConfig;
|
||||
}
|
||||
|
||||
public data: IGitzoneConfigData;
|
||||
|
||||
public async readConfigFromCwd() {
|
||||
const npmextraInstance = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
this.data = npmextraInstance.dataFor<IGitzoneConfigData>('gitzone', {});
|
||||
this.data.npmciOptions = npmextraInstance.dataFor<IGitzoneConfigData['npmciOptions']>('npmci', {
|
||||
npmAccessLevel: 'public',
|
||||
});
|
||||
}
|
||||
|
||||
constructor() {}
|
||||
}
|
Reference in New Issue
Block a user