Class

TemplateSync

TemplateSync(args)

Constructor

# new TemplateSync(args)

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.

A command-line tool for synchronizing project templates and configurations.

Parameters:
Name Type Description
args CommandOptions

The command options for TemplateSync

View Source cli/commands/update-scripts.ts, line 127

Extends

Members

# getAutomation

Downloads automation documentation files.

Downloads automation documentation files.

View Source cli/commands/update-scripts.ts, line 239

# getAutomation

Downloads automation documentation files.

Downloads automation documentation files.

View Source cli/commands/update-scripts.ts, line 583

# getDocker

Downloads docker image files.

Downloads docker image files.

View Source cli/commands/update-scripts.ts, line 249

# getDocker

Downloads docker image files.

Downloads docker image files.

View Source cli/commands/update-scripts.ts, line 593

# getDocs

Downloads documentation files.

Downloads documentation files.

View Source cli/commands/update-scripts.ts, line 229

# getDocs

Downloads documentation files.

Downloads documentation files.

View Source cli/commands/update-scripts.ts, line 573

# getStyles

Downloads style configuration files.

Downloads style configuration files.

View Source cli/commands/update-scripts.ts, line 214

# getStyles

Downloads style configuration files.

Downloads style configuration files.

View Source cli/commands/update-scripts.ts, line 558

# getTemplates

Downloads template files.

Downloads template files.

View Source cli/commands/update-scripts.ts, line 219

# getTemplates

Downloads template files.

Downloads template files.

View Source cli/commands/update-scripts.ts, line 563

# getTests

Downloads automation documentation files.

Downloads automation documentation files.

View Source cli/commands/update-scripts.ts, line 244

# getTests

Downloads automation documentation files.

Downloads automation documentation files.

View Source cli/commands/update-scripts.ts, line 588

# getTypescript

Downloads typescript config files.

Downloads typescript config files.

View Source cli/commands/update-scripts.ts, line 234

# getTypescript

Downloads typescript config files.

Downloads typescript config files.

View Source cli/commands/update-scripts.ts, line 578

# getWorkflows

Downloads workflow configuration files.

Downloads workflow configuration files.

View Source cli/commands/update-scripts.ts, line 224

# getWorkflows

Downloads workflow configuration files.

Downloads workflow configuration files.

View Source cli/commands/update-scripts.ts, line 568

Logger

# log

Static logger for the Command class.

Static logger for the Command class.

Overrides:

View Source cli/command.ts, line 30

Methods

# async protected checkRequirements() → {Promise.<void>}

Retrieves the list of dependencies and compares it against the required dependencies for the command.

Checks if all required dependencies are present.

sequenceDiagram participant Command participant getDependencies participant Set Command->>getDependencies: Call getDependencies-->>Command: Return {prod, dev, peer} Command->>Set: Create Set from prod, dev, peer Set-->>Command: Return unique dependencies Command->>Command: Compare against requirements alt Missing dependencies Command->>Command: Add to missing list end Note over Command: If missing.length > 0, handle missing dependencies
Overrides:

View Source cli/command.ts, line 73

A promise that resolves when the check is complete.

Promise.<void>

# async downloadOption(key) → {Promise.<void>}

This method downloads all files associated with a given option key from the remote repository.

Downloads files for a specific option category.

Parameters:
Name Type Description
key string

The key representing the option category to download

View Source cli/commands/update-scripts.ts, line 530

If the specified option key is not found

Error
Promise.<void>

# async execute() → {Promise.<(R|string|void)>}

This method handles the overall execution flow of the command, including parsing arguments, setting up logging, checking for version or help requests, and running the command.

Executes the command.

sequenceDiagram participant Command participant UserInput participant Logging participant getPackageVersion participant printBanner Command->>UserInput: parseArgs(inputs) UserInput-->>Command: Return ParseArgsResult Command->>Command: Process options Command->>Logging: setConfig(options) alt version requested Command->>getPackageVersion: Call getPackageVersion-->>Command: Return version else help requested Command->>Command: help(args) else banner requested Command->>printBanner: Call end Command->>Command: run(args) alt error occurs Command->>Command: Log error end Command-->>Command: Return result
Overrides:

View Source cli/command.ts, line 126

A promise that resolves with the command's result.

Promise.<(R|string|void)>

# async getIde() → {Promise.<void>}

Downloads IDE configuration files.

Downloads IDE configuration files.

View Source cli/commands/update-scripts.ts, line 546

Promise.<void>

# async getLicense(license) → {Promise.<void>}

This method downloads the chosen license file, saves it to the project, and updates the package.json license field.

Downloads and sets up the specified license.

Parameters:
Name Type Description
license "MIT" | "GPL" | "Apache" | "LGPL" | "AGPL"

The license to download and set up

View Source cli/commands/update-scripts.ts, line 539

Promise.<void>

# async getScripts() → {Promise.<void>}

Update npm scripts

.

Update npm scripts

View Source cli/commands/update-scripts.ts, line 553

Promise.<void>

# protected help(args) → {void}

This method should be overridden in derived classes to provide specific help information.

Provides help information for the command.

Parameters:
Name Type Description
args ParseArgsResult

The parsed command-line arguments.

Overrides:

View Source cli/command.ts, line 91

void

# async run(args) → {Promise.<void>}

This method orchestrates the downloading of various project components based on the provided arguments.

Runs the template synchronization process.

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
Parameters:
Name Type Description
args ParseArgsResult

The parsed command-line arguments

Overrides:

View Source cli/commands/update-scripts.ts, line 638

Promise.<void>