Skip to content

Commit dba6c7d

Browse files
committed
fix(cli): Resolve issue building cli package in build script
1 parent d6674a9 commit dba6c7d

5 files changed

Lines changed: 141 additions & 38 deletions

File tree

packages/cli/package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@
5353
"@storm-software/testing-tools": "catalog:",
5454
"@types/node": "catalog:"
5555
},
56-
"publishConfig": {
57-
"access": "public"
58-
},
56+
"publishConfig": { "access": "public" },
5957
"types": "./dist/index.d.cts",
60-
"bin": {
61-
"cli": "./dist/bin.mjs"
62-
}
58+
"bin": { "cli": "./dist/bin.mjs" }
6359
}

packages/cli/project.json

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,92 @@
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
44
"projectType": "application",
55
"sourceRoot": "packages/cli/src",
6-
"targets": {},
7-
"implicitDependencies": ["nx"]
6+
"targets": {
7+
"clean": {
8+
"executor": "@shell-shock/nx:clean"
9+
},
10+
"prepare": {
11+
"cache": true,
12+
"inputs": ["typescript", "^production"],
13+
"outputs": ["{projectRoot}/.shell-shock"],
14+
"dependsOn": ["^build"],
15+
"executor": "@shell-shock/nx:prepare",
16+
"defaultConfiguration": "production",
17+
"options": {
18+
"mode": "production"
19+
},
20+
"configurations": {
21+
"development": {
22+
"mode": "development"
23+
},
24+
"staging": {
25+
"mode": "staging"
26+
},
27+
"production": {
28+
"mode": "production"
29+
}
30+
}
31+
},
32+
"build-base": {
33+
"cache": true,
34+
"inputs": ["typescript", "^production"],
35+
"outputs": ["{options.outputPath}"],
36+
"dependsOn": ["^build"],
37+
"executor": "@shell-shock/nx:build",
38+
"defaultConfiguration": "production",
39+
"options": {
40+
"mode": "production"
41+
},
42+
"configurations": {
43+
"development": {
44+
"mode": "development"
45+
},
46+
"staging": {
47+
"mode": "staging"
48+
},
49+
"production": {
50+
"mode": "production"
51+
}
52+
}
53+
},
54+
"build": {
55+
"dependsOn": ["build-base"],
56+
"executor": "nx:run-commands",
57+
"options": {
58+
"command": "pnpm copyfiles --up=3 \"packages/cli/dist/**/*\" dist/packages/powerlines/bin"
59+
}
60+
},
61+
"docs": {
62+
"cache": true,
63+
"inputs": ["typescript", "^production"],
64+
"outputs": ["{projectRoot}/docs"],
65+
"dependsOn": ["build"],
66+
"executor": "@shell-shock/nx:docs",
67+
"defaultConfiguration": "production",
68+
"options": {
69+
"mode": "production"
70+
},
71+
"configurations": {
72+
"development": {
73+
"mode": "development"
74+
},
75+
"staging": {
76+
"mode": "staging"
77+
},
78+
"production": {
79+
"mode": "production"
80+
}
81+
}
82+
}
83+
},
84+
"implicitDependencies": [
85+
"deepkit",
86+
"powerlines",
87+
"plugin-deepkit",
88+
"plugin-style-dictionary",
89+
"plugin-automd",
90+
"plugin-alloy",
91+
"plugin-tsdown",
92+
"plugin-nodejs"
93+
]
894
}

packages/plugin-terraform/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@
101101
"types": "./dist/types/plugin.d.mts",
102102
"default": "./dist/types/plugin.mjs"
103103
}
104+
},
105+
"./types/terraform": {
106+
"require": {
107+
"types": "./dist/types/terraform.d.cts",
108+
"default": "./dist/types/terraform.cjs"
109+
},
110+
"import": {
111+
"types": "./dist/types/terraform.d.mts",
112+
"default": "./dist/types/terraform.mjs"
113+
},
114+
"default": {
115+
"types": "./dist/types/terraform.d.mts",
116+
"default": "./dist/types/terraform.mjs"
117+
}
104118
}
105119
},
106120
"main": "./dist/index.cjs",

packages/powerlines/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,5 +513,6 @@
513513
},
514514
"publishConfig": {
515515
"access": "public"
516-
}
516+
},
517+
"bin": { "powerlines": "./bin/bin.mjs" }
517518
}

tools/scripts/src/build.mjs

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ try {
6969
);
7070
}
7171

72-
proc = $`pnpm nx reset --only-daemon --only-workspace-data`.timeout(
73-
`${2 * 60}s`
74-
);
72+
proc = $`pnpm nx reset --only-daemon`.timeout(`${2 * 60}s`);
7573
proc.stdout.on("data", data => {
7674
echo`${data}`;
7775
});
@@ -112,34 +110,42 @@ try {
112110
);
113111
}
114112
} else if (filter === "cli" || filter === "all") {
115-
// proc = $`pnpm nx run cli:build:${
116-
// configuration
117-
// } --outputStyle=dynamic-legacy --parallel=5`.timeout(`${15 * 60}s`);
118-
// proc.stdout.on("data", data => {
119-
// echo`${data}`;
120-
// });
121-
// result = await proc;
122-
// if (!result.ok) {
123-
// throw new Error(
124-
// `An error occurred while building the CLI application in ${configuration} mode: \n\n${result.message}\n`
125-
// );
126-
// }
113+
proc = $`pnpm nx reset --only-daemon`.timeout(`${2 * 60}s`);
114+
proc.stdout.on("data", data => {
115+
echo`${data}`;
116+
});
117+
result = await proc;
118+
if (!result.ok) {
119+
throw new Error(
120+
`An error occurred while resetting the Nx daemon process: \n\n${result.message}\n`
121+
);
122+
}
127123

128-
if (filter === "all") {
129-
// proc =
130-
// $`pnpm nx run-many --target=build --projects="examples-*" --configuration=${configuration} --outputStyle=dynamic-legacy --parallel=5`.timeout(
131-
// `${8 * 60}s`
132-
// );
133-
// proc.stdout.on("data", data => {
134-
// echo`${data}`;
135-
// });
136-
// result = await proc;
137-
// if (!result.ok) {
138-
// throw new Error(
139-
// `An error occurred while building the monorepo's examples in ${configuration} mode: \n\n${result.message}\n`
140-
// );
141-
// }
124+
proc = $`pnpm bootstrap`.timeout(`${2 * 60}s`);
125+
proc.stdout.on("data", data => {
126+
echo`${data}`;
127+
});
128+
result = await proc;
129+
if (!result.ok) {
130+
throw new Error(
131+
`An error occurred while bootstrapping the monorepo: \n\n${result.message}\n`
132+
);
133+
}
142134

135+
proc = $`pnpm nx run cli:build:${
136+
configuration
137+
} --outputStyle=dynamic-legacy --parallel=5`.timeout(`${15 * 60}s`);
138+
proc.stdout.on("data", data => {
139+
echo`${data}`;
140+
});
141+
result = await proc;
142+
if (!result.ok) {
143+
throw new Error(
144+
`An error occurred while building the CLI application in ${configuration} mode: \n\n${result.message}\n`
145+
);
146+
}
147+
148+
if (filter === "all") {
143149
proc =
144150
$`pnpm nx run-many --target=build --exclude="monorepo,examples-*" --configuration=${configuration} --outputStyle=dynamic-legacy --parallel=5`.timeout(
145151
`${20 * 60}s`

0 commit comments

Comments
 (0)