@vlandoss/run-run 0.0.2-git-7e82168.0 → 0.0.2-git-8d13199.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/bin.ts CHANGED
@@ -4,5 +4,3 @@ import { main } from "./src/main";
4
4
  main({
5
5
  binDir: __dirname,
6
6
  });
7
-
8
- // force preview release
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vlandoss/run-run",
3
- "version": "0.0.2-git-7e82168.0",
3
+ "version": "0.0.2-git-8d13199.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.1",
34
- "@vlandoss/loggy": "0.0.1"
33
+ "@vlandoss/loggy": "0.0.2-git-8d13199.0",
34
+ "@vlandoss/clibuddy": "0.0.2-git-8d13199.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -129,7 +129,7 @@ check if TypeScript code is well typed 🎨
129
129
  Options:
130
130
  -h, --help display help for command
131
131
 
132
- Under the hood, this command uses the TSC CLI to check the code.
132
+ Under the hood, this command uses the TypeScript CLI to check the code.
133
133
  "
134
134
  `;
135
135
 
@@ -1,3 +1,4 @@
1
+ import type { Project } from "@vlandoss/clibuddy";
1
2
  import { createCommand } from "commander";
2
3
  import type { Context } from "~/services/ctx";
3
4
  import { logger } from "~/services/logger";
@@ -7,19 +8,61 @@ export function createTypecheckCommand(ctx: Context) {
7
8
  .alias("tsc")
8
9
  .description("check if TypeScript code is well typed 🎨")
9
10
  .action(async function typecheckAction() {
10
- const { appPkg } = ctx;
11
- const $ = ctx.shell.$;
11
+ const { appPkg, shell } = ctx;
12
12
 
13
- try {
14
- if (appPkg?.hasFile("tsconfig.json")) {
15
- await $`tsc --noEmit`;
16
- } else {
13
+ async function singleTypecheck(dir?: string): Promise<boolean | undefined> {
14
+ if (!appPkg.hasFile("tsconfig.json", dir)) {
17
15
  logger.info("No tsconfig.json found. Skipping type checking.");
16
+ return;
17
+ }
18
+
19
+ if (dir) {
20
+ await shell.at(dir).$`tsc --noEmit`;
21
+ } else {
22
+ await shell.$`tsc --noEmit`;
23
+ }
24
+
25
+ return true;
26
+ }
27
+
28
+ async function typecheckAtProject(project: Project) {
29
+ const childLogger = logger.child({
30
+ tag: project.manifest.name,
31
+ namespace: "typecheck",
32
+ });
33
+
34
+ try {
35
+ childLogger.start("Type checking...");
36
+
37
+ const success = await singleTypecheck(project.rootDir);
38
+
39
+ if (success) {
40
+ childLogger.success("Typecheck completed successfully");
41
+ }
42
+ } catch {
43
+ childLogger.error("Typecheck failed");
44
+ process.exit(1);
45
+ }
46
+ }
47
+
48
+ if (!appPkg.isMonorepo()) {
49
+ try {
50
+ await singleTypecheck();
51
+ } catch (error) {
52
+ logger.error(error);
53
+ process.exit(1);
54
+ }
55
+ }
56
+
57
+ try {
58
+ const projects = await appPkg.getWorkspaceProjects();
59
+ for (const project of projects) {
60
+ await typecheckAtProject(project);
18
61
  }
19
62
  } catch (error) {
20
63
  logger.error(error);
21
64
  process.exit(1);
22
65
  }
23
66
  })
24
- .addHelpText("afterAll", "\nUnder the hood, this command uses the TSC CLI to check the code.");
67
+ .addHelpText("afterAll", "\nUnder the hood, this command uses the TypeScript CLI to check the code.");
25
68
  }
@@ -31,6 +31,7 @@ export async function createContext(binDir: string): Promise<Context> {
31
31
 
32
32
  const shell = createShellService({
33
33
  localBaseBinPath: [binDir],
34
+ stdio: "inherit",
34
35
  });
35
36
 
36
37
  return {