@jpp-toolkit/plugin-clean 0.0.60 → 0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +5 -8
- package/dist/index.mjs.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import { findProjectRoot } from "@jpp-toolkit/utils";
|
|
|
4
4
|
import { Flags } from "@oclif/core";
|
|
5
5
|
import { execa } from "execa";
|
|
6
6
|
import { rimraf } from "rimraf";
|
|
7
|
-
|
|
8
7
|
//#region src/clean-command.ts
|
|
9
8
|
const RESET_PATTERNS = ["!old", "!tmp"];
|
|
10
9
|
const CLEAN_PATTERNS = [
|
|
@@ -16,7 +15,9 @@ const CLEAN_PATTERNS = [
|
|
|
16
15
|
"!**/hooks/_/**",
|
|
17
16
|
"!.env"
|
|
18
17
|
];
|
|
19
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/index.ts
|
|
20
|
+
const commands = { clean: class CleanCommand extends Command {
|
|
20
21
|
static summary = "Remove build artifacts and temporary files from the project.";
|
|
21
22
|
static flags = {
|
|
22
23
|
"dry-run": Flags.boolean({
|
|
@@ -77,12 +78,8 @@ var CleanCommand = class CleanCommand extends Command {
|
|
|
77
78
|
this.logger.success("Cleaned the following files:");
|
|
78
79
|
this.logger.paths(paths);
|
|
79
80
|
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/index.ts
|
|
84
|
-
const commands = { clean: CleanCommand };
|
|
85
|
-
|
|
81
|
+
} };
|
|
86
82
|
//#endregion
|
|
87
83
|
export { commands };
|
|
84
|
+
|
|
88
85
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/clean-command.ts","../src/index.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { Command } from '@jpp-toolkit/core';\nimport { findProjectRoot } from '@jpp-toolkit/utils';\nimport { Flags } from '@oclif/core';\nimport { execa } from 'execa';\nimport { rimraf } from 'rimraf';\n\nconst RESET_PATTERNS = ['!old', '!tmp'];\nconst CLEAN_PATTERNS = [\n ...RESET_PATTERNS,\n '!node_modules',\n '!node_modules/**',\n '**/node_modules/.cache',\n '!**/hooks/_',\n '!**/hooks/_/**',\n '!.env',\n];\n\nexport class CleanCommand extends Command {\n static override summary = 'Remove build artifacts and temporary files from the project.';\n\n static override flags = {\n 'dry-run': Flags.boolean({\n char: 'd',\n description: 'Perform a dry run without deleting files.',\n default: false,\n }),\n 'reset': Flags.boolean({\n char: 'r',\n description: 'Reset the project to a clean state.',\n default: false,\n }),\n 'root': Flags.boolean({\n char: 'R',\n description: 'Clean from the project root directory.',\n default: false,\n }),\n };\n\n static override examples = [\n {\n description: 'Perform a dry run of the clean command.',\n command: '<%= config.bin %> <%= command.id %> --dry-run',\n },\n {\n description: 'Reset the project to a clean state.',\n command: '<%= config.bin %> <%= command.id %> --reset',\n },\n {\n description: 'Clean from the project root directory.',\n command: '<%= config.bin %> <%= command.id %> --root',\n },\n ];\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(CleanCommand);\n\n const cwd = flags.root ? findProjectRoot() : process.cwd();\n const patterns = flags.reset ? RESET_PATTERNS : CLEAN_PATTERNS;\n\n const { stdout } = await execa(\n 'git',\n [\n 'ls-files',\n '--others',\n '--ignored',\n '--exclude-standard',\n '--directory',\n ...patterns.map((pattern) => `--exclude=${pattern}`),\n ],\n { cwd, lines: true },\n );\n\n const paths = stdout\n .filter((line) => line.trim().length > 0)\n .map((filePath) => path.resolve(cwd, filePath));\n\n if (paths.length === 0) {\n this.logger.info('No files to clean');\n return;\n }\n\n if (flags['dry-run']) {\n this.logger.info('The following files would be removed:');\n this.logger.paths(paths);\n return;\n }\n\n await rimraf(paths);\n\n this.logger.success('Cleaned the following files:');\n this.logger.paths(paths);\n }\n}\n","import { CleanCommand } from './clean-command';\n\nexport const commands = {\n clean: CleanCommand,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/clean-command.ts","../src/index.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { Command } from '@jpp-toolkit/core';\nimport { findProjectRoot } from '@jpp-toolkit/utils';\nimport { Flags } from '@oclif/core';\nimport { execa } from 'execa';\nimport { rimraf } from 'rimraf';\n\nconst RESET_PATTERNS = ['!old', '!tmp'];\nconst CLEAN_PATTERNS = [\n ...RESET_PATTERNS,\n '!node_modules',\n '!node_modules/**',\n '**/node_modules/.cache',\n '!**/hooks/_',\n '!**/hooks/_/**',\n '!.env',\n];\n\nexport class CleanCommand extends Command {\n static override summary = 'Remove build artifacts and temporary files from the project.';\n\n static override flags = {\n 'dry-run': Flags.boolean({\n char: 'd',\n description: 'Perform a dry run without deleting files.',\n default: false,\n }),\n 'reset': Flags.boolean({\n char: 'r',\n description: 'Reset the project to a clean state.',\n default: false,\n }),\n 'root': Flags.boolean({\n char: 'R',\n description: 'Clean from the project root directory.',\n default: false,\n }),\n };\n\n static override examples = [\n {\n description: 'Perform a dry run of the clean command.',\n command: '<%= config.bin %> <%= command.id %> --dry-run',\n },\n {\n description: 'Reset the project to a clean state.',\n command: '<%= config.bin %> <%= command.id %> --reset',\n },\n {\n description: 'Clean from the project root directory.',\n command: '<%= config.bin %> <%= command.id %> --root',\n },\n ];\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(CleanCommand);\n\n const cwd = flags.root ? findProjectRoot() : process.cwd();\n const patterns = flags.reset ? RESET_PATTERNS : CLEAN_PATTERNS;\n\n const { stdout } = await execa(\n 'git',\n [\n 'ls-files',\n '--others',\n '--ignored',\n '--exclude-standard',\n '--directory',\n ...patterns.map((pattern) => `--exclude=${pattern}`),\n ],\n { cwd, lines: true },\n );\n\n const paths = stdout\n .filter((line) => line.trim().length > 0)\n .map((filePath) => path.resolve(cwd, filePath));\n\n if (paths.length === 0) {\n this.logger.info('No files to clean');\n return;\n }\n\n if (flags['dry-run']) {\n this.logger.info('The following files would be removed:');\n this.logger.paths(paths);\n return;\n }\n\n await rimraf(paths);\n\n this.logger.success('Cleaned the following files:');\n this.logger.paths(paths);\n }\n}\n","import { CleanCommand } from './clean-command';\n\nexport const commands = {\n clean: CleanCommand,\n};\n"],"mappings":";;;;;;;AAQA,MAAM,iBAAiB,CAAC,QAAQ,OAAO;AACvC,MAAM,iBAAiB;CACnB,GAAG;CACH;CACA;CACA;CACA;CACA;CACA;CACH;;;ACfD,MAAa,WAAW,EACpB,ODgBJ,MAAa,qBAAqB,QAAQ;CACtC,OAAgB,UAAU;CAE1B,OAAgB,QAAQ;EACpB,WAAW,MAAM,QAAQ;GACrB,MAAM;GACN,aAAa;GACb,SAAS;GACZ,CAAC;EACF,SAAS,MAAM,QAAQ;GACnB,MAAM;GACN,aAAa;GACb,SAAS;GACZ,CAAC;EACF,QAAQ,MAAM,QAAQ;GAClB,MAAM;GACN,aAAa;GACb,SAAS;GACZ,CAAC;EACL;CAED,OAAgB,WAAW;EACvB;GACI,aAAa;GACb,SAAS;GACZ;EACD;GACI,aAAa;GACb,SAAS;GACZ;EACD;GACI,aAAa;GACb,SAAS;GACZ;EACJ;CAED,MAAa,MAAqB;EAC9B,MAAM,EAAE,UAAU,MAAM,KAAK,MAAM,aAAa;EAEhD,MAAM,MAAM,MAAM,OAAO,iBAAiB,GAAG,QAAQ,KAAK;EAG1D,MAAM,EAAE,WAAW,MAAM,MACrB,OACA;GACI;GACA;GACA;GACA;GACA;GACA,IAVS,MAAM,QAAQ,iBAAiB,gBAU5B,KAAK,YAAY,aAAa,UAAU;GACvD,EACD;GAAE;GAAK,OAAO;GAAM,CACvB;EAED,MAAM,QAAQ,OACT,QAAQ,SAAS,KAAK,MAAM,CAAC,SAAS,EAAE,CACxC,KAAK,aAAa,KAAK,QAAQ,KAAK,SAAS,CAAC;AAEnD,MAAI,MAAM,WAAW,GAAG;AACpB,QAAK,OAAO,KAAK,oBAAoB;AACrC;;AAGJ,MAAI,MAAM,YAAY;AAClB,QAAK,OAAO,KAAK,wCAAwC;AACzD,QAAK,OAAO,MAAM,MAAM;AACxB;;AAGJ,QAAM,OAAO,MAAM;AAEnB,OAAK,OAAO,QAAQ,+BAA+B;AACnD,OAAK,OAAO,MAAM,MAAM;;GCxF/B"}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpp-toolkit/plugin-clean",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"description": "Plugin that add the clean command to the jpp cli.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jpp",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@jpp-toolkit/utils": "0.0.29"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"oclif": "4.22.
|
|
43
|
+
"oclif": "4.22.84"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": "24",
|