diff --git a/changelog.md b/changelog.md index 1bf3aad..4ff79c3 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-01-08 - 1.11.0 - feat(cli) +Add Docker command for cleaning up Docker system and extend deprecation command for multiple registries + +- Added a new command 'docker' to handle Docker system cleanup operations. +- Improved the 'deprecate' command to support deprecating packages across multiple npm registry URLs. + ## 2025-01-01 - 1.10.10 - fix(templates) Corrected typo in template file comment diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index e6176ac..bc4de74 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/cli', - version: '1.10.10', + version: '1.11.0', description: 'A CLI toolbelt to streamline local development cycles by using various gitzone utilities.' } diff --git a/ts/gitzone.cli.ts b/ts/gitzone.cli.ts index 16e8bb2..be114b6 100644 --- a/ts/gitzone.cli.ts +++ b/ts/gitzone.cli.ts @@ -48,6 +48,14 @@ export let run = async () => { await modDeprecate.run(); }); + /** + * docker + */ + gitzoneSmartcli.addCommand('docker').subscribe(async (argvArg) => { + const modDocker = await import('./mod_docker/index.js'); + await modDocker.run(argvArg); + }); + /** * Update all files that comply with the gitzone standard */ diff --git a/ts/mod_deprecate/index.ts b/ts/mod_deprecate/index.ts index b2fedd6..089cd26 100644 --- a/ts/mod_deprecate/index.ts +++ b/ts/mod_deprecate/index.ts @@ -4,6 +4,15 @@ import { logger } from '../gitzone.logging.js'; export const run = async () => { const smartInteract = new plugins.smartinteract.SmartInteract([ + { + name: `registryUrls`, + message: `What are the comma separated registry URLs?`, + type: `input`, + default: `https://registry.npmjs.org`, + validate: (stringInput) => { + return stringInput !== '' && !process.env.CI; + }, + }, { name: `oldPackageName`, message: `Whats the name of the OLD package?`, @@ -24,14 +33,17 @@ export const run = async () => { }, ]); const answerBucket = await smartInteract.runQueue(); + const registryUrls = answerBucket.getAnswerFor(`registryUrls`).split(','); const oldPackageName = answerBucket.getAnswerFor(`oldPackageName`); const newPackageName = answerBucket.getAnswerFor(`newPackageName`); logger.log('info', `Deprecating package ${oldPackageName} in favour of ${newPackageName}`); const smartshellInstance = new plugins.smartshell.Smartshell({ executor: 'bash', }); - await smartshellInstance.exec( - `npm deprecate ${oldPackageName}@* ` + - `"${oldPackageName} has been deprecated in favour of ${newPackageName} - please upgrade asap!!!"` - ); + for (const registryUrl of registryUrls) { + await smartshellInstance.exec( + `npm deprecate ${oldPackageName}@* ` + + `"${oldPackageName} has been deprecated in favour of ${newPackageName} - please upgrade asap!!!" --registry ${registryUrl}`, + ); + } }; diff --git a/ts/mod_docker/index.ts b/ts/mod_docker/index.ts new file mode 100644 index 0000000..dcf7b38 --- /dev/null +++ b/ts/mod_docker/index.ts @@ -0,0 +1,12 @@ +import * as plugins from './mod.plugins.js'; + +export const run = async (argvArg) => { + const smartshellInstance = new plugins.smartshell.Smartshell({ + executor: 'bash', + }); + switch (argvArg._[1]) { + case 'prune': + await smartshellInstance.exec(`docker system prune -a -f --volumes`); + break; + } +}; \ No newline at end of file diff --git a/ts/mod_docker/mod.plugins.ts b/ts/mod_docker/mod.plugins.ts new file mode 100644 index 0000000..43d2c87 --- /dev/null +++ b/ts/mod_docker/mod.plugins.ts @@ -0,0 +1,4 @@ +export * from '../plugins.js'; + +import * as smartshell from '@push.rocks/smartshell'; +export { smartshell }; \ No newline at end of file