@decaf-ts/utils
Version:
module management utils for decaf-ts
212 lines (211 loc) • 6.04 kB
TypeScript
import { Command } from "../command";
import { CommandOptions } from "../types";
import { DefaultCommandValues } from "../index";
import { LoggingConfig } from "@decaf-ts/logging";
declare const options: {
templates: string[];
workflows: string[];
ide: string[];
docs: string[];
styles: string[];
scripts: string[];
tests: string[];
typescript: string[];
docker: string[];
automation: string[];
};
declare const argzz: {
boot: {
type: string;
};
org: {
type: string;
short: string;
};
name: {
type: string;
short: string;
default: undefined;
};
author: {
type: string;
short: string;
default: undefined;
};
all: {
type: string;
};
license: {
type: string;
message: string;
};
scripts: {
type: string;
};
styles: {
type: string;
};
docs: {
type: string;
};
ide: {
type: string;
};
workflows: {
type: string;
};
templates: {
type: string;
};
typescript: {
type: string;
};
docker: {
type: string;
};
pkg: {
type: string;
};
dependencies: {
type: string;
};
tests: {
type: string;
};
automation: {
type: string;
};
};
/**
* @class TemplateSync
* @extends {Command}
* @category scripts
* @description A command-line tool for synchronizing project templates and configurations.
* @summary This class provides functionality to download and update various project files and configurations from a remote repository.
* It supports updating licenses, IDE configurations, scripts, styles, documentation, workflows, and templates.
*
* @param {CommandOptions} args - The command options for TemplateSync
*/
export declare class TemplateSync extends Command<CommandOptions<typeof argzz>, void> {
private replacements;
constructor();
private loadValuesFromPackage;
/**
* @description Downloads files for a specific option category.
* @summary This method downloads all files associated with a given option key from the remote repository.
* @param {string} key - The key representing the option category to download
* @returns {Promise<void>}
* @throws {Error} If the specified option key is not found
*/
downloadOption(key: keyof typeof options): Promise<void>;
/**
* @description Downloads and sets up the specified license.
* @summary This method downloads the chosen license file, saves it to the project, and updates the package.json license field.
* @param {"MIT" | "GPL" | "Apache" | "LGPL" | "AGPL"} license - The license to download and set up
* @returns {Promise<void>}
*/
getLicense(license: "MIT" | "GPL" | "Apache" | "LGPL" | "AGPL"): Promise<void>;
/**
* @description Downloads IDE configuration files.
* @returns {Promise<void>}
*/
getIde(): Promise<void>;
/**
* @description Update npm scripts
* @returns {Promise<void>}
*/
getScripts(): Promise<void>;
/**
* @description Downloads style configuration files.
* @returns {Promise<void>}
*/
getStyles: () => Promise<void>;
/**
* @description Downloads template files.
* @returns {Promise<void>}
*/
getTemplates: () => Promise<void>;
/**
* @description Downloads workflow configuration files.
* @returns {Promise<void>}
*/
getWorkflows: () => Promise<void>;
/**
* @description Downloads documentation files.
* @returns {Promise<void>}
*/
getDocs: () => Promise<void>;
/**
* @description Downloads typescript config files.
* @returns {Promise<void>}
*/
getTypescript: () => Promise<void>;
/**
* @description Downloads automation documentation files.
* @returns {Promise<void>}
*/
getAutomation: () => Promise<void>;
/**
* @description Downloads automation documentation files.
* @returns {Promise<void>}
*/
getTests: () => Promise<void>;
/**
* @description Downloads docker image files.
* @returns {Promise<void>}
*/
getDocker: () => Promise<void>;
initPackage(pkgName: string, author: string, license: string): Promise<void>;
updatePackageScrips(): Promise<void>;
createTokenFiles(): Promise<void>;
getOrg(): Promise<string>;
auditFix(): Promise<string>;
patchFiles(): void;
updateDependencies(): Promise<void>;
/**
* @description Runs the template synchronization process.
* @summary This method orchestrates the downloading of various project components based on the provided arguments.
* @param {ParseArgsResult} args - The parsed command-line arguments
* @returns {Promise<void>}
*
* @mermaid
* sequenceDiagram
* participant T as TemplateSync
* participant L as getLicense
* participant I as getIde
* participant S as getScripts
* participant St as getStyles
* participant D as getDocs
* participant W as getWorkflows
* participant Te as getTemplates
* T->>T: Parse arguments
* alt all flag is true
* T->>T: Set all component flags to true
* end
* alt license is specified
* T->>L: getLicense(license)
* end
* alt ide flag is true
* T->>I: getIde()
* end
* alt scripts flag is true
* T->>S: getScripts()
* end
* alt styles flag is true
* T->>St: getStyles()
* end
* alt docs flag is true
* T->>D: getDocs()
* end
* alt workflows flag is true
* T->>W: getWorkflows()
* end
* alt templates flag is true
* T->>Te: getTemplates()
* end
*/
run(args: LoggingConfig & typeof DefaultCommandValues & {
[k in keyof typeof argzz]: unknown;
}): Promise<void>;
}
export {};