@vlandoss/run-run 0.0.2-git-394818b.0 → 0.0.2-git-203d02b.0

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-git-394818b.0",
3
+ "version": "0.0.2-git-203d02b.0",
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": {
@@ -30,8 +30,8 @@
30
30
  "is-ci": "4.1.0",
31
31
  "rimraf": "6.0.1",
32
32
  "typescript": "5.8.2",
33
- "@vlandoss/clibuddy": "0.0.2-git-394818b.0",
34
- "@vlandoss/loggy": "0.0.2-git-394818b.0"
33
+ "@vlandoss/clibuddy": "0.0.2-git-203d02b.0",
34
+ "@vlandoss/loggy": "0.0.1"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
package/src/main.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { isProcessOutput } from "@vlandoss/clibuddy";
1
2
  import { type Options, createProgram } from "./program";
2
3
  import { logger } from "./services/logger";
3
4
 
@@ -6,7 +7,9 @@ export async function main(options: Options) {
6
7
  const { cmd } = await createProgram(options);
7
8
  await cmd.parseAsync();
8
9
  } catch (error) {
9
- logger.error("Cannot run main successfully", error);
10
+ if (!isProcessOutput(error)) {
11
+ logger.error("Cannot run main successfully", error);
12
+ }
10
13
  process.exit(1);
11
14
  }
12
15
  }
@@ -8,39 +8,34 @@ export function createCleanCommand() {
8
8
  .description("delete dirty folders or files such as node_modules, etc 🗑️")
9
9
  .option("--only-dist", "delete 'dist' folders only")
10
10
  .action(async function cleanCommandAction(options) {
11
- try {
12
- if (options.onlyDist) {
13
- logger.info("Cleaning only 'dist' folders... ⌛");
11
+ if (options.onlyDist) {
12
+ logger.info("Cleaning only 'dist' folders... ⌛");
14
13
 
15
- await rimraf("**/dist", {
16
- glob: {
17
- cwd,
18
- ignore: ["**/node_modules/**"],
19
- },
20
- });
21
-
22
- logger.info("Done ✅");
23
-
24
- return;
25
- }
26
-
27
- logger.info("Cleaning all... ⌛");
28
-
29
- const dirtyPaths = ["**/.turbo", "**/dist", "**/node_modules", "pnpm-lock.yaml", "bun.lock"];
30
-
31
- logger.info(dirtyPaths.join("\n"));
32
-
33
- await rimraf(dirtyPaths, {
14
+ await rimraf("**/dist", {
34
15
  glob: {
35
16
  cwd,
17
+ ignore: ["**/node_modules/**"],
36
18
  },
37
19
  });
38
20
 
39
21
  logger.info("Done ✅");
40
- } catch (error) {
41
- logger.error(error);
42
- process.exit(1);
22
+
23
+ return;
43
24
  }
25
+
26
+ logger.info("Cleaning all... ⌛");
27
+
28
+ const dirtyPaths = ["**/.turbo", "**/dist", "**/node_modules", "pnpm-lock.yaml", "bun.lock"];
29
+
30
+ logger.info(dirtyPaths.join("\n"));
31
+
32
+ await rimraf(dirtyPaths, {
33
+ glob: {
34
+ cwd,
35
+ },
36
+ });
37
+
38
+ logger.info("Done ✅");
44
39
  })
45
40
  .addHelpText("afterAll", "\nUnder the hood, this command uses the rimraf.js to delete dirty folders or files.");
46
41
  }
@@ -12,18 +12,13 @@ export function createFormatCommand(ctx: Context) {
12
12
  const $ = ctx.shell.$;
13
13
  const toolCmd = "biome format --no-errors-on-unmatched --colors=force";
14
14
 
15
- try {
16
- if (options.fix) {
17
- await $`${toolCmd} --fix`;
18
- return;
19
- }
15
+ if (options.fix) {
16
+ await $`${toolCmd} --fix`;
17
+ return;
18
+ }
20
19
 
21
- if (options.check) {
22
- await $`${toolCmd}`;
23
- }
24
- } catch (error) {
25
- logger.error(error);
26
- process.exit(1);
20
+ if (options.check) {
21
+ await $`${toolCmd}`;
27
22
  }
28
23
  })
29
24
  .addHelpText("afterAll", "\nUnder the hood, this command uses the biome CLI to format the code.");
@@ -9,28 +9,23 @@ export function createInfoPkgCommand(ctx: Context) {
9
9
  .option("-f, --filter <filter>", "lodash get id like to filter info by")
10
10
  .option("-c, --current", "display package.json where run-run will be executed")
11
11
  .action(async function pkgAction(options) {
12
- try {
13
- const { appPkg, binPkg } = ctx;
12
+ const { appPkg, binPkg } = ctx;
14
13
 
15
- const infoObject = options.current ? appPkg.info() : binPkg.info();
14
+ const infoObject = options.current ? appPkg.info() : binPkg.info();
16
15
 
17
- if (!options.filter) {
18
- logger.info("%O", infoObject);
19
- return;
20
- }
21
-
22
- const { filter } = options;
23
- const subInfoObject = get(infoObject.packageJson, filter);
16
+ if (!options.filter) {
17
+ logger.info("%O", infoObject);
18
+ return;
19
+ }
24
20
 
25
- if (!subInfoObject) {
26
- logger.info("No info found");
27
- return;
28
- }
21
+ const { filter } = options;
22
+ const subInfoObject = get(infoObject.packageJson, filter);
29
23
 
30
- logger.info("%O", { [filter]: subInfoObject });
31
- } catch (error) {
32
- logger.error(error);
33
- process.exit(1);
24
+ if (!subInfoObject) {
25
+ logger.info("No info found");
26
+ return;
34
27
  }
28
+
29
+ logger.info("%O", { [filter]: subInfoObject });
35
30
  });
36
31
  }
@@ -11,18 +11,13 @@ export function createLintCommand(ctx: Context) {
11
11
  const $ = ctx.shell.$;
12
12
  const toolCmd = "biome check --colors=force --formatter-enabled=false";
13
13
 
14
- try {
15
- if (options.fix) {
16
- await $`${toolCmd} --fix --unsafe`;
17
- return;
18
- }
14
+ if (options.fix) {
15
+ await $`${toolCmd} --fix --unsafe`;
16
+ return;
17
+ }
19
18
 
20
- if (options.check) {
21
- await $`${toolCmd}`;
22
- }
23
- } catch (error) {
24
- logger.error(error);
25
- process.exit(1);
19
+ if (options.check) {
20
+ await $`${toolCmd}`;
26
21
  }
27
22
  })
28
23
  .addHelpText("afterAll", "\nUnder the hood, this command uses the biome CLI to lint the code.");
@@ -1,3 +1,4 @@
1
+ import { isProcessOutput } from "@vlandoss/clibuddy";
1
2
  import { createCommand } from "commander";
2
3
  import isCI from "is-ci";
3
4
  import type { Context } from "~/services/ctx";
@@ -12,22 +13,17 @@ export function createTestStaticCommand(ctx: Context) {
12
13
  const $ = ctx.shell.$;
13
14
  const toolCmd = (cmd = "check") => `biome ${cmd} --colors=force`;
14
15
 
15
- try {
16
- if (options.fix) {
17
- await $`${toolCmd()} --fix --unsafe`;
18
- return;
19
- }
20
-
21
- if (options.fixStaged) {
22
- await $`${toolCmd()} --no-errors-on-unmatched --fix --unsafe --staged`;
23
- return;
24
- }
16
+ if (options.fix) {
17
+ await $`${toolCmd()} --fix --unsafe`;
18
+ return;
19
+ }
25
20
 
26
- await $`${toolCmd(isCI ? "ci" : "check")}`;
27
- } catch (error) {
28
- logger.error(error);
29
- process.exit(1);
21
+ if (options.fixStaged) {
22
+ await $`${toolCmd()} --no-errors-on-unmatched --fix --unsafe --staged`;
23
+ return;
30
24
  }
25
+
26
+ await $`${toolCmd(isCI ? "ci" : "check")}`;
31
27
  })
32
28
  .addHelpText("afterAll", "\nUnder the hood, this command uses the biome CLI to check the code.");
33
29
  }
@@ -1,4 +1,4 @@
1
- import type { Project } from "@vlandoss/clibuddy";
1
+ import { type Project, isProcessOutput } from "@vlandoss/clibuddy";
2
2
  import { createCommand } from "commander";
3
3
  import type { Context } from "~/services/ctx";
4
4
  import { logger } from "~/services/logger";
@@ -12,7 +12,7 @@ export function createTypecheckCommand(ctx: Context) {
12
12
 
13
13
  async function singleTypecheck(dir?: string): Promise<boolean | undefined> {
14
14
  if (!appPkg.hasFile("tsconfig.json", dir)) {
15
- logger.info("No tsconfig.json found. Skipping type checking.");
15
+ logger.info("No tsconfig.json found, skipping typecheck");
16
16
  return;
17
17
  }
18
18
 
@@ -39,9 +39,9 @@ export function createTypecheckCommand(ctx: Context) {
39
39
  if (success) {
40
40
  childLogger.success("Typecheck completed successfully");
41
41
  }
42
- } catch {
42
+ } catch (error) {
43
43
  childLogger.error("Typecheck failed");
44
- process.exit(1);
44
+ throw error;
45
45
  }
46
46
  }
47
47
 
@@ -49,19 +49,15 @@ export function createTypecheckCommand(ctx: Context) {
49
49
  try {
50
50
  await singleTypecheck();
51
51
  } catch (error) {
52
- logger.error(error);
53
- process.exit(1);
52
+ logger.error("Typecheck failed");
53
+ throw error;
54
54
  }
55
55
  }
56
56
 
57
- try {
58
- const projects = await appPkg.getWorkspaceProjects();
59
- for (const project of projects) {
60
- await typecheckAtProject(project);
61
- }
62
- } catch (error) {
63
- logger.error(error);
64
- process.exit(1);
57
+ const projects = await appPkg.getWorkspaceProjects();
58
+
59
+ for (const project of projects) {
60
+ await typecheckAtProject(project);
65
61
  }
66
62
  })
67
63
  .addHelpText("afterAll", "\nUnder the hood, this command uses the TypeScript CLI to check the code.");