feat(cli): Add Docker command for cleaning up Docker system and extend deprecation command for multiple registries
This commit is contained in:
parent
16ea9bb8bd
commit
6b3d4d1ecf
@ -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
|
||||
|
||||
|
@ -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.'
|
||||
}
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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}`,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
12
ts/mod_docker/index.ts
Normal file
12
ts/mod_docker/index.ts
Normal file
@ -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;
|
||||
}
|
||||
};
|
4
ts/mod_docker/mod.plugins.ts
Normal file
4
ts/mod_docker/mod.plugins.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export * from '../plugins.js';
|
||||
|
||||
import * as smartshell from '@push.rocks/smartshell';
|
||||
export { smartshell };
|
Loading…
x
Reference in New Issue
Block a user