@vlandoss/run-run 0.0.2-git-203d02b.0 → 0.0.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vlandoss/run-run",
|
|
3
|
-
"version": "0.0.2
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "The CLI toolbox to fullstack common scripts in Variable Land",
|
|
5
5
|
"homepage": "https://github.com/variableland/dx/tree/main/packages/run-run#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@biomejs/biome": "1.9.4",
|
|
29
29
|
"commander": "13.1.0",
|
|
30
|
+
"glob": "^11.0.2",
|
|
30
31
|
"is-ci": "4.1.0",
|
|
31
32
|
"rimraf": "6.0.1",
|
|
32
33
|
"typescript": "5.8.2",
|
|
33
|
-
"@vlandoss/clibuddy": "0.0.2
|
|
34
|
-
"@vlandoss/loggy": "0.0.
|
|
34
|
+
"@vlandoss/clibuddy": "0.0.2",
|
|
35
|
+
"@vlandoss/loggy": "0.0.2"
|
|
35
36
|
},
|
|
36
37
|
"publishConfig": {
|
|
37
38
|
"access": "public"
|
|
@@ -115,6 +115,7 @@ delete dirty folders or files such as node_modules, etc 🗑️
|
|
|
115
115
|
|
|
116
116
|
Options:
|
|
117
117
|
--only-dist delete 'dist' folders only
|
|
118
|
+
--dry-run outputs the paths that would be deleted
|
|
118
119
|
-h, --help display help for command
|
|
119
120
|
|
|
120
121
|
Under the hood, this command uses the rimraf.js to delete dirty folders or files.
|
|
@@ -1,41 +1,51 @@
|
|
|
1
1
|
import { cwd } from "@vlandoss/clibuddy";
|
|
2
2
|
import { createCommand } from "commander";
|
|
3
|
+
import { type GlobOptions, glob } from "glob";
|
|
3
4
|
import { rimraf } from "rimraf";
|
|
4
5
|
import { logger } from "~/services/logger";
|
|
5
6
|
|
|
7
|
+
type Options = {
|
|
8
|
+
onlyDist: boolean;
|
|
9
|
+
dryRun: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
6
12
|
export function createCleanCommand() {
|
|
7
13
|
return createCommand("clean")
|
|
8
14
|
.description("delete dirty folders or files such as node_modules, etc 🗑️")
|
|
9
15
|
.option("--only-dist", "delete 'dist' folders only")
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
.option("--dry-run", "outputs the paths that would be deleted")
|
|
17
|
+
.action(async function cleanCommandAction(options: Options) {
|
|
18
|
+
async function run(paths: string[], globOptions: GlobOptions) {
|
|
19
|
+
if (options.dryRun) {
|
|
20
|
+
const toDelete = await glob(paths, globOptions);
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
glob: {
|
|
16
|
-
cwd,
|
|
17
|
-
ignore: ["**/node_modules/**"],
|
|
18
|
-
},
|
|
19
|
-
});
|
|
22
|
+
logger.info("Paths that would be deleted: %O", toDelete);
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
}
|
|
27
|
+
logger.start("Clean started");
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
await rimraf(paths, {
|
|
30
|
+
glob: globOptions,
|
|
31
|
+
});
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
logger.success("Clean completed");
|
|
34
|
+
}
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
const BUILD_PATHS = ["**/dist"];
|
|
37
|
+
const ALL_DIRTY_PATHS = ["**/.turbo", "**/node_modules", "pnpm-lock.yaml", "bun.lock", ...BUILD_PATHS];
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
if (options.onlyDist) {
|
|
40
|
+
await run(BUILD_PATHS, {
|
|
34
41
|
cwd,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
ignore: ["**/node_modules/**"],
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
await run(ALL_DIRTY_PATHS, {
|
|
46
|
+
cwd,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
39
49
|
})
|
|
40
50
|
.addHelpText("afterAll", "\nUnder the hood, this command uses the rimraf.js to delete dirty folders or files.");
|
|
41
51
|
}
|
|
@@ -32,12 +32,12 @@ export function createTypecheckCommand(ctx: Context) {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
try {
|
|
35
|
-
childLogger.start("Type checking
|
|
35
|
+
childLogger.start("Type checking started");
|
|
36
36
|
|
|
37
37
|
const success = await singleTypecheck(project.rootDir);
|
|
38
38
|
|
|
39
39
|
if (success) {
|
|
40
|
-
childLogger.success("Typecheck completed
|
|
40
|
+
childLogger.success("Typecheck completed");
|
|
41
41
|
}
|
|
42
42
|
} catch (error) {
|
|
43
43
|
childLogger.error("Typecheck failed");
|