fix(config): migrate configuration handling from npmextra to smartconfig
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/cli',
|
||||
version: '2.13.9',
|
||||
version: '2.13.10',
|
||||
description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export class GitzoneConfig {
|
||||
public data: IGitzoneConfigData;
|
||||
|
||||
public async readConfigFromCwd() {
|
||||
const npmextraInstance = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
const npmextraInstance = new plugins.npmextra.Smartconfig(paths.cwd);
|
||||
this.data = npmextraInstance.dataFor<IGitzoneConfigData>('@git.zone/cli', {});
|
||||
|
||||
// Read szci config for backward compatibility
|
||||
|
||||
@@ -9,7 +9,7 @@ import { ReleaseConfig } from '../mod_config/classes.releaseconfig.js';
|
||||
|
||||
export const run = async (argvArg: any) => {
|
||||
// Read commit config from npmextra.json
|
||||
const npmextraConfig = new plugins.npmextra.Npmextra();
|
||||
const npmextraConfig = new plugins.npmextra.Smartconfig();
|
||||
const gitzoneConfig = npmextraConfig.dataFor<{
|
||||
commit?: {
|
||||
alwaysTest?: boolean;
|
||||
|
||||
@@ -31,7 +31,7 @@ export class CommitConfig {
|
||||
* Load configuration from npmextra.json
|
||||
*/
|
||||
public async load(): Promise<void> {
|
||||
const npmextraInstance = new plugins.npmextra.Npmextra(this.cwd);
|
||||
const npmextraInstance = new plugins.npmextra.Smartconfig(this.cwd);
|
||||
const gitzoneConfig = npmextraInstance.dataFor<any>('@git.zone/cli', {});
|
||||
|
||||
this.config = {
|
||||
@@ -44,7 +44,7 @@ export class CommitConfig {
|
||||
* Save configuration to npmextra.json
|
||||
*/
|
||||
public async save(): Promise<void> {
|
||||
const npmextraPath = plugins.path.join(this.cwd, 'npmextra.json');
|
||||
const npmextraPath = plugins.path.join(this.cwd, 'smartconfig.json');
|
||||
let npmextraData: any = {};
|
||||
|
||||
// Read existing npmextra.json
|
||||
|
||||
@@ -33,7 +33,7 @@ export class ReleaseConfig {
|
||||
* Load configuration from npmextra.json
|
||||
*/
|
||||
public async load(): Promise<void> {
|
||||
const npmextraInstance = new plugins.npmextra.Npmextra(this.cwd);
|
||||
const npmextraInstance = new plugins.npmextra.Smartconfig(this.cwd);
|
||||
const gitzoneConfig = npmextraInstance.dataFor<any>('@git.zone/cli', {});
|
||||
|
||||
// Also check szci for backward compatibility
|
||||
@@ -49,7 +49,7 @@ export class ReleaseConfig {
|
||||
* Save configuration to npmextra.json
|
||||
*/
|
||||
public async save(): Promise<void> {
|
||||
const npmextraPath = plugins.path.join(this.cwd, 'npmextra.json');
|
||||
const npmextraPath = plugins.path.join(this.cwd, 'smartconfig.json');
|
||||
let npmextraData: any = {};
|
||||
|
||||
// Read existing npmextra.json
|
||||
|
||||
@@ -6,7 +6,7 @@ export const run = async (projectArg: Project) => {
|
||||
const gitzoneConfig = await projectArg.gitzoneConfig;
|
||||
|
||||
// Get copy configuration from npmextra.json
|
||||
const npmextraConfig = new plugins.npmextra.Npmextra();
|
||||
const npmextraConfig = new plugins.npmextra.Smartconfig();
|
||||
const copyConfig = npmextraConfig.dataFor<any>('gitzone.format.copy', {
|
||||
patterns: [],
|
||||
});
|
||||
|
||||
@@ -76,7 +76,7 @@ const migrateAccessLevel = (npmextraJson: any): boolean => {
|
||||
*/
|
||||
export const run = async (projectArg: Project) => {
|
||||
const formatSmartstream = new plugins.smartstream.StreamWrapper([
|
||||
plugins.smartgulp.src([`npmextra.json`]),
|
||||
plugins.smartgulp.src([`smartconfig.json`]),
|
||||
gulpFunction.forEach(async (fileArg: plugins.smartfile.SmartFile) => {
|
||||
const fileString = fileArg.contents.toString();
|
||||
const npmextraJson = JSON.parse(fileString);
|
||||
|
||||
@@ -73,7 +73,7 @@ export const run = async (projectArg: Project) => {
|
||||
const formatStreamWrapper = new plugins.smartstream.StreamWrapper([
|
||||
plugins.smartgulp.src([`package.json`]),
|
||||
gulpFunction.forEach(async (fileArg: plugins.smartfile.SmartFile) => {
|
||||
const npmextraConfig = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
const npmextraConfig = new plugins.npmextra.Smartconfig(paths.cwd);
|
||||
const gitzoneData: any = npmextraConfig.dataFor('@git.zone/cli', {});
|
||||
const fileString = fileArg.contents.toString();
|
||||
const packageJson = JSON.parse(fileString);
|
||||
@@ -149,7 +149,7 @@ export const run = async (projectArg: Project) => {
|
||||
'dist_ts_web/**/*',
|
||||
'assets/**/*',
|
||||
'cli.js',
|
||||
'npmextra.json',
|
||||
'smartconfig.json',
|
||||
'readme.md',
|
||||
];
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export class CopyFormatter extends BaseFormatter {
|
||||
const changes: IPlannedChange[] = [];
|
||||
|
||||
// Get copy configuration from npmextra.json
|
||||
const npmextraConfig = new plugins.npmextra.Npmextra();
|
||||
const npmextraConfig = new plugins.npmextra.Smartconfig();
|
||||
const copyConfig = npmextraConfig.dataFor<{ patterns: ICopyPattern[] }>(
|
||||
'gitzone.format.copy',
|
||||
{ patterns: [] },
|
||||
|
||||
@@ -70,7 +70,7 @@ export class NpmextraFormatter extends BaseFormatter {
|
||||
|
||||
async analyze(): Promise<IPlannedChange[]> {
|
||||
const changes: IPlannedChange[] = [];
|
||||
const npmextraPath = 'npmextra.json';
|
||||
const npmextraPath = 'smartconfig.json';
|
||||
|
||||
// Check if file exists
|
||||
const exists = await plugins.smartfs.file(npmextraPath).exists();
|
||||
|
||||
@@ -101,7 +101,7 @@ export class PackageJsonFormatter extends BaseFormatter {
|
||||
const packageJson = JSON.parse(currentContent);
|
||||
|
||||
// Get gitzone config from npmextra
|
||||
const npmextraConfig = new plugins.npmextra.Npmextra(paths.cwd);
|
||||
const npmextraConfig = new plugins.npmextra.Smartconfig(paths.cwd);
|
||||
const gitzoneData: any = npmextraConfig.dataFor('@git.zone/cli', {});
|
||||
|
||||
// Set metadata from gitzone config
|
||||
@@ -156,7 +156,7 @@ export class PackageJsonFormatter extends BaseFormatter {
|
||||
'dist_ts_web/**/*',
|
||||
'assets/**/*',
|
||||
'cli.js',
|
||||
'npmextra.json',
|
||||
'smartconfig.json',
|
||||
'readme.md',
|
||||
];
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export class PrettierFormatter extends BaseFormatter {
|
||||
const rootConfigFiles = [
|
||||
'package.json',
|
||||
'tsconfig.json',
|
||||
'npmextra.json',
|
||||
'smartconfig.json',
|
||||
'.prettierrc',
|
||||
'.prettierrc.json',
|
||||
'.prettierrc.js',
|
||||
@@ -232,7 +232,7 @@ export class PrettierFormatter extends BaseFormatter {
|
||||
|
||||
private async getPrettierConfig(): Promise<any> {
|
||||
// Try to load prettier config from the project
|
||||
const prettierConfig = new plugins.npmextra.Npmextra();
|
||||
const prettierConfig = new plugins.npmextra.Smartconfig();
|
||||
return prettierConfig.dataFor('prettier', {
|
||||
// Default prettier config
|
||||
singleQuote: true,
|
||||
|
||||
@@ -47,7 +47,7 @@ export let run = async (
|
||||
const planner = new FormatPlanner();
|
||||
|
||||
// Get configuration from npmextra
|
||||
const npmextraConfig = new plugins.npmextra.Npmextra();
|
||||
const npmextraConfig = new plugins.npmextra.Smartconfig();
|
||||
const formatConfig = npmextraConfig.dataFor<any>('@git.zone/cli.format', {
|
||||
interactive: true,
|
||||
showDiffs: false,
|
||||
|
||||
@@ -11,7 +11,7 @@ import * as smartobject from '@push.rocks/smartobject';
|
||||
import * as smartnpm from '@push.rocks/smartnpm';
|
||||
import * as smartstream from '@push.rocks/smartstream';
|
||||
import * as through2 from 'through2';
|
||||
import * as npmextra from '@push.rocks/npmextra';
|
||||
import * as npmextra from '@push.rocks/smartconfig';
|
||||
import * as smartdiff from '@push.rocks/smartdiff';
|
||||
|
||||
export {
|
||||
|
||||
@@ -42,7 +42,7 @@ export class ServiceManager {
|
||||
* Load service configuration from npmextra.json
|
||||
*/
|
||||
private async loadServiceConfiguration(): Promise<void> {
|
||||
const npmextraConfig = new plugins.npmextra.Npmextra(process.cwd());
|
||||
const npmextraConfig = new plugins.npmextra.Smartconfig(process.cwd());
|
||||
const gitzoneConfig = npmextraConfig.dataFor<any>('@git.zone/cli', {});
|
||||
|
||||
// Check if services array exists
|
||||
@@ -75,7 +75,7 @@ export class ServiceManager {
|
||||
* Save service configuration to npmextra.json
|
||||
*/
|
||||
private async saveServiceConfiguration(services: string[]): Promise<void> {
|
||||
const npmextraPath = plugins.path.join(process.cwd(), 'npmextra.json');
|
||||
const npmextraPath = plugins.path.join(process.cwd(), 'smartconfig.json');
|
||||
let npmextraData: any = {};
|
||||
|
||||
// Read existing npmextra.json if it exists
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as smartlog from '@push.rocks/smartlog';
|
||||
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
||||
import * as npmextra from '@push.rocks/npmextra';
|
||||
import * as npmextra from '@push.rocks/smartconfig';
|
||||
import * as path from 'path';
|
||||
import * as projectinfo from '@push.rocks/projectinfo';
|
||||
import * as smartcli from '@push.rocks/smartcli';
|
||||
|
||||
Reference in New Issue
Block a user