@vlandoss/run-run 0.0.12 → 0.0.13-git-62457e3.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.
|
|
3
|
+
"version": "0.0.13-git-62457e3.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": {
|
|
@@ -10,21 +10,18 @@ export function createTypecheckCommand(ctx: Context) {
|
|
|
10
10
|
.action(async function typecheckAction() {
|
|
11
11
|
const { appPkg, shell } = ctx;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
const log = options?.logger ?? logger;
|
|
13
|
+
const isTsProject = (dir: string) => appPkg.hasFile("tsconfig.json", dir);
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
15
|
+
const getPreScript = (scripts: Record<string, string> | undefined) => {
|
|
16
|
+
return scripts?.pretsc ?? scripts?.pretypecheck;
|
|
17
|
+
};
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
await shell.$`tsc --noEmit`;
|
|
19
|
+
async function typecheckTask(dir: string, preScript?: string) {
|
|
20
|
+
if (preScript) {
|
|
21
|
+
await shell.at(dir).$`${preScript}`;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
await shell.at(dir).$`tsc --noEmit`;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
async function typecheckAtProject(project: Project) {
|
|
@@ -35,14 +32,9 @@ export function createTypecheckCommand(ctx: Context) {
|
|
|
35
32
|
|
|
36
33
|
try {
|
|
37
34
|
childLogger.start("Type checking started");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
if (success) {
|
|
44
|
-
childLogger.success("Typecheck completed");
|
|
45
|
-
}
|
|
35
|
+
const preScript = getPreScript(project.manifest.scripts);
|
|
36
|
+
await typecheckTask(project.rootDir, preScript);
|
|
37
|
+
childLogger.success("Typecheck completed");
|
|
46
38
|
} catch (error) {
|
|
47
39
|
childLogger.error("Typecheck failed");
|
|
48
40
|
throw error;
|
|
@@ -51,18 +43,32 @@ export function createTypecheckCommand(ctx: Context) {
|
|
|
51
43
|
|
|
52
44
|
if (!appPkg.isMonorepo()) {
|
|
53
45
|
try {
|
|
54
|
-
|
|
46
|
+
if (!isTsProject(appPkg.dirPath)) {
|
|
47
|
+
logger.info("No tsconfig.json found, skipping typecheck");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const preScript = getPreScript(appPkg.packageJson.scripts);
|
|
52
|
+
|
|
53
|
+
logger.start("Type checking started");
|
|
54
|
+
await typecheckTask(appPkg.dirPath, preScript);
|
|
55
|
+
logger.success("Typecheck completed");
|
|
55
56
|
} catch (error) {
|
|
56
57
|
logger.error("Typecheck failed");
|
|
57
58
|
throw error;
|
|
58
59
|
}
|
|
60
|
+
return;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
const projects = await appPkg.getWorkspaceProjects();
|
|
64
|
+
const tsProjects = projects.filter((project) => isTsProject(project.rootDir));
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
if (!tsProjects.length) {
|
|
67
|
+
logger.warn("No TypeScript projects found in the monorepo, skipping typecheck");
|
|
68
|
+
return;
|
|
65
69
|
}
|
|
70
|
+
|
|
71
|
+
await Promise.all(tsProjects.map(typecheckAtProject));
|
|
66
72
|
})
|
|
67
73
|
.addHelpText("afterAll", "\nUnder the hood, this command uses the TypeScript CLI to check the code.");
|
|
68
74
|
}
|