@multiplatform.one/cli 7.90.2 → 7.90.4

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/README.md CHANGED
@@ -143,7 +143,7 @@ clone-derived.
143
143
 
144
144
  ```bash
145
145
  sh scripts/scaffold.sh [--app <name>]... [--service <name>]... [--mpo-version <range>] [--into] \
146
- <path-or-url> <ref> <target>
146
+ [--source-url <url>] [--name <name>] <path-or-url> <ref> <target>
147
147
  ```
148
148
 
149
149
  ## Other commands
@@ -157,7 +157,11 @@ sh scripts/scaffold.sh [--app <name>]... [--service <name>]... [--mpo-version <r
157
157
  | `mpo frappe clean` | Clean Frappe bench artifacts |
158
158
  | `mpo frappe types <doctype…>` | Emit doctype TypeScript types from getdoctype; `--check -o <file>` fails on drift |
159
159
  | `mpo build` | Run the build command |
160
- | `mpo test` | Run tests (E2E flags: `--up-only`, `--down`, `--filter`, …) |
160
+ | `mpo test [tier]` | Run unit (default), integration, e2e or visual tests (E2E: `--up-only`, …) |
161
+ | `mpo lint` | Run the root `lint` script (`//#lint`), then `ruff check` |
162
+ | `mpo format` | Run the root `format` script (`//#format`), then `ruff format` |
163
+ | `mpo count` | Count lines of code with `cloc` |
164
+ | `mpo generate` | Run the turbo `generate` task |
161
165
 
162
166
  ## Development
163
167
 
@@ -2,82 +2,24 @@ import { addApp } from "../commands/addApp.mjs";
2
2
  import { INIT_APP_PIECES } from "../commands/pieces.mjs";
3
3
  import { adoptApp } from "../commands/adoptApp.mjs";
4
4
  import { generateDoctypeTypes, typesDrift } from "../commands/doctypeTypes.mjs";
5
- import { discoverE2EApp, runE2ESession } from "../commands/e2e.mjs";
5
+ import { runE2ESession } from "../commands/e2e.mjs";
6
6
  import { SINGLETON_APPS, init } from "../commands/init.mjs";
7
7
  import { runRuff } from "../commands/ruff.mjs";
8
8
  import { updateApp } from "../commands/updateApp.mjs";
9
+ import { availableServices, parseTestTiers, runBuild, runFrappeBench, runIntegrationTests, runTurboLint, runUnitTests, testTiers, waitFunctions } from "../commands/verbs.mjs";
9
10
  import fsSync from "node:fs";
10
11
  import path from "node:path";
11
12
  import { fileURLToPath } from "node:url";
12
13
  import fs from "node:fs/promises";
13
- import { formatServiceList, lookupProjectRoot, waitForFrappe, waitForKeycloak, waitForPostgres, waitServices } from "@multiplatform.one/utils/dev";
14
+ import { formatServiceList, lookupProjectRoot, waitServices } from "@multiplatform.one/utils/dev";
14
15
  import { Command } from "commander";
15
16
  import dotenv from "dotenv";
16
17
  import spawn from "nano-spawn";
17
- import YAML from "yaml";
18
18
  import yoctoSpinner from "yocto-spinner";
19
19
 
20
20
  //#region src/bin/multiplatformOne.ts
21
21
  const projectRoot = lookupProjectRoot();
22
- const availableServices = [
23
- "api",
24
- "frappe",
25
- "solana",
26
- "ethereum",
27
- "sui"
28
- ];
29
- /** Map a service name to its relative directory from the project root. */
30
- function serviceDir(name) {
31
- return `apps/${name}`;
32
- }
33
22
  const defaultDotenvPath = path.resolve(projectRoot, ".env");
34
- /** Apps that exist under apps/ and have package.json (discovered from filesystem). */
35
- async function getPresentApps(root) {
36
- const appsDir = path.join(root, "apps");
37
- try {
38
- const entries = await fs.readdir(appsDir, { withFileTypes: true });
39
- const names = [];
40
- for (const e of entries) {
41
- if (!e.isDirectory()) continue;
42
- const pkgPath = path.join(appsDir, e.name, "package.json");
43
- try {
44
- await fs.access(pkgPath);
45
- names.push(e.name);
46
- } catch {}
47
- }
48
- return names;
49
- } catch {
50
- return [];
51
- }
52
- }
53
- /** Root-level services that exist and have package.json (discovered from filesystem). */
54
- async function getPresentServices(root) {
55
- const names = [];
56
- for (const name of availableServices) {
57
- const dir = path.join(root, serviceDir(name));
58
- const pkgPath = path.join(dir, "package.json");
59
- try {
60
- if (!(await fs.stat(dir)).isDirectory()) continue;
61
- await fs.access(pkgPath);
62
- names.push(name);
63
- } catch {}
64
- }
65
- return names;
66
- }
67
- /** Turbo --filter args to exclude root-level workspaces that are not present (so turbo only runs where they exist).
68
- * Only generates exclude filters for directories that exist on disk (turbo errors on non-existent filter paths). */
69
- async function getTurboExcludeFiltersForMissing(root) {
70
- const present = await getPresentServices(root);
71
- const filters = [];
72
- for (const s of availableServices) {
73
- if (present.includes(s)) continue;
74
- const dir = serviceDir(s);
75
- try {
76
- if ((await fs.stat(path.join(root, dir))).isDirectory()) filters.push(`!./${dir}`);
77
- } catch {}
78
- }
79
- return filters;
80
- }
81
23
  async function getStorybookVisualWorkspaces(root) {
82
24
  const out = [];
83
25
  const searchDirs = [{
@@ -140,37 +82,6 @@ async function getStorybookVisualWorkspaces(root) {
140
82
  }
141
83
  return out;
142
84
  }
143
- /** Discover frappe apps from frappe.yaml that have local source paths.
144
- * Supports both string entries (`- ./apps/core`) and object entries (`- name: core\n source: ./apps/core`). */
145
- async function getFrappeApps(root) {
146
- const frappeDir = path.join(root, "apps", "frappe");
147
- const frappeYamlPath = path.join(frappeDir, "frappe.yaml");
148
- if (!fsSync.existsSync(frappeYamlPath)) return [];
149
- const raw = await fs.readFile(frappeYamlPath, "utf8");
150
- const config = YAML.parse(raw);
151
- const out = [];
152
- for (const app of config?.apps ?? []) {
153
- let src;
154
- let name;
155
- if (typeof app === "string") {
156
- src = app;
157
- name = path.basename(app);
158
- } else {
159
- if (!app.source || !app.name) continue;
160
- src = app.source;
161
- name = app.name;
162
- }
163
- src = src.startsWith("file://") ? src.slice(7) : src;
164
- if (!src.startsWith("./") && !src.startsWith("../") && !src.startsWith("/")) continue;
165
- const absPath = path.isAbsolute(src) ? src : path.resolve(frappeDir, src);
166
- if (!fsSync.existsSync(absPath)) continue;
167
- out.push({
168
- name,
169
- absolutePath: absPath
170
- });
171
- }
172
- return out;
173
- }
174
85
  const program = new Command();
175
86
  program.name("mpo");
176
87
  program.version(JSON.parse(fsSync.readFileSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../package.json"), "utf8"))?.version);
@@ -264,14 +175,10 @@ frappe.command("dev").description("start frappe development server").action(asyn
264
175
  cwd: projectRoot
265
176
  });
266
177
  });
267
- frappe.command("bench").description("run bench command").action(async () => {
178
+ frappe.command("bench").description("run bench command").argument("[args...]", "arguments for bench, after --").action(async (args) => {
268
179
  const parentOptions = frappe.opts();
269
180
  dotenv.config({ path: parentOptions.dotenv || defaultDotenvPath });
270
- await spawn("sh", [path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/frappe.sh"), "bench"], {
271
- stdio: "inherit",
272
- shell: true,
273
- cwd: projectRoot
274
- });
181
+ await runFrappeBench(args, path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/frappe.sh"), projectRoot);
275
182
  });
276
183
  frappe.command("types").description("generate TypeScript types for doctypes from getdoctype (auth: $FRAPPE_API_KEY, $FRAPPE_API_SECRET)").argument("<doctypes...>", "doctype names; child tables come along").option("-o, --out <file>", "write the module here instead of stdout").option("--check", "exit 1 and print the diff when --out differs from the server").option("--url <url>", "frappe base URL (default $FRAPPE_URL or http://localhost:8000)").action(async (doctypes, options) => {
277
184
  const parentOptions = frappe.opts();
@@ -304,111 +211,16 @@ frappe.command("types").description("generate TypeScript types for doctypes from
304
211
  await fs.writeFile(out, generated);
305
212
  });
306
213
  program.command("build").argument("[args...]", `build to run: ${[...availableServices, "packages"].join(", ")} (default: all)`).description("run build command").action(async (args) => {
307
- const parsed = args.flatMap((arg) => arg.split(","));
308
- const packages = parsed.includes("packages");
309
- const projects = parsed.filter((arg) => arg !== "packages");
310
- const presentApps = await getPresentApps(projectRoot);
311
- const presentServices = await getPresentServices(projectRoot);
312
- if (!projects.length && !packages || packages) await spawn("pnpm", [
313
- "turbo",
314
- "run",
315
- "build",
316
- "--filter",
317
- "'!./apps/*'",
318
- ...presentServices.flatMap((s) => ["--filter", `'!./${serviceDir(s)}'`])
319
- ], {
320
- stdio: "inherit",
321
- shell: true,
322
- cwd: projectRoot
323
- });
324
- for (const platform of presentApps) if (!projects.length && !packages || projects.includes(platform)) {
325
- if (await fs.access(path.join(projectRoot, "apps", platform, "package.json")).then(() => JSON.parse(fsSync.readFileSync(path.join(projectRoot, "apps", platform, "package.json"), "utf8")).scripts?.build).catch(() => false)) await spawn("pnpm", [
326
- "turbo",
327
- "run",
328
- "build",
329
- `--filter=./apps/${platform}`
330
- ], {
331
- stdio: "inherit",
332
- shell: true,
333
- cwd: projectRoot
334
- });
335
- }
336
- for (const service of presentServices) if (!projects.length && !packages || projects.includes(service)) {
337
- const dir = serviceDir(service);
338
- if (await fs.access(path.join(projectRoot, dir, "package.json")).then(() => JSON.parse(fsSync.readFileSync(path.join(projectRoot, dir, "package.json"), "utf8")).scripts?.build).catch(() => false)) await spawn("pnpm", [
339
- "turbo",
340
- "run",
341
- "build",
342
- `--filter=./${dir}`
343
- ], {
344
- stdio: "inherit",
345
- shell: true,
346
- cwd: projectRoot
347
- });
348
- }
214
+ await runBuild(args, projectRoot);
349
215
  });
350
- program.command("test").argument("[args...]", "test to run: unit, integration, e2e, visual (default: unit)").option("--up-only", "start E2E environment and exit (for agent/manual testing)").option("--down", "tear down E2E test environment").option("--port-offset <number>", "port offset from defaults", "1000").option("--project <name>", "Docker project name for E2E").option("--no-build", "skip image builds for E2E").option("--filter <pattern>", "run specific Playwright test files").description("run test command").action(async (args, options) => {
351
- const parsed = args.flatMap((arg) => arg.split(","));
216
+ program.command("test").argument("[args...]", `test to run: ${testTiers.join(", ")} (default: unit)`).option("--up-only", "start E2E environment and exit (for agent/manual testing)").option("--down", "tear down E2E test environment").option("--port-offset <number>", "port offset from defaults", "1000").option("--project <name>", "Docker project name for E2E").option("--no-build", "skip image builds for E2E").option("--filter <pattern>", "run specific Playwright test files").description("run test command").action(async (args, options) => {
217
+ const parsed = parseTestTiers(args);
352
218
  if (parsed.includes("unit")) {
353
- const excludeFilters = await getTurboExcludeFiltersForMissing(projectRoot);
354
- const e2eApp = await discoverE2EApp(projectRoot);
355
- await spawn("pnpm", [
356
- "turbo",
357
- "run",
358
- "test",
359
- ...[...excludeFilters.flatMap((f) => ["--filter", f]), ...e2eApp ? ["--filter", `'!./apps/${e2eApp}'`] : []]
360
- ], {
361
- stdio: "inherit",
362
- shell: true,
363
- cwd: projectRoot
364
- });
365
- const frappeApps = await getFrappeApps(projectRoot);
366
- for (const app of frappeApps) if (await fs.access(path.join(app.absolutePath, "pyproject.toml")).then(() => true).catch(() => false)) try {
367
- await spawn("bench", [
368
- "run-tests",
369
- "--app",
370
- app.name,
371
- "--",
372
- "-m",
373
- "not integration"
374
- ], {
375
- stdio: "inherit",
376
- cwd: path.join(projectRoot, "apps", "frappe")
377
- });
378
- } catch {
379
- console.warn(`frappe app ${app.name} unit tests failed (bench may not be available)`);
380
- }
219
+ await runUnitTests(projectRoot);
381
220
  if (parsed.length === 1) return;
382
221
  }
383
222
  if (parsed.includes("integration")) {
384
- const excludeFilters = await getTurboExcludeFiltersForMissing(projectRoot);
385
- const e2eApp = await discoverE2EApp(projectRoot);
386
- await spawn("pnpm", [
387
- "turbo",
388
- "run",
389
- "test",
390
- ...[...excludeFilters.flatMap((f) => ["--filter", f]), ...e2eApp ? ["--filter", `'!./apps/${e2eApp}'`] : []]
391
- ], {
392
- stdio: "inherit",
393
- shell: true,
394
- cwd: projectRoot
395
- });
396
- const frappeApps = await getFrappeApps(projectRoot);
397
- for (const app of frappeApps) if (await fs.access(path.join(app.absolutePath, "pyproject.toml")).then(() => true).catch(() => false)) try {
398
- await spawn("bench", [
399
- "run-tests",
400
- "--app",
401
- app.name,
402
- "--",
403
- "-m",
404
- "integration"
405
- ], {
406
- stdio: "inherit",
407
- cwd: path.join(projectRoot, "apps", "frappe")
408
- });
409
- } catch {
410
- console.warn(`frappe app ${app.name} integration tests failed (bench may not be available)`);
411
- }
223
+ await runIntegrationTests(projectRoot);
412
224
  if (parsed.length === 1) return;
413
225
  }
414
226
  if (parsed.includes("e2e")) {
@@ -483,26 +295,8 @@ program.command("format").description("format all supported files (TS, Python, e
483
295
  });
484
296
  await ruffStep("format");
485
297
  });
486
- program.command("lint").description("lint and typecheck all supported files (TS, Python, etc.) via turbo").action(async () => {
487
- const excludeFilters = await getTurboExcludeFiltersForMissing(projectRoot);
488
- let turboFailed = false;
489
- try {
490
- await spawn("turbo", [
491
- "run",
492
- "lint",
493
- "typecheck",
494
- "--filter=//",
495
- "--continue",
496
- "--filter",
497
- "!@package/features",
498
- ...excludeFilters.flatMap((f) => ["--filter", f])
499
- ], {
500
- stdio: "inherit",
501
- cwd: projectRoot
502
- });
503
- } catch {
504
- turboFailed = true;
505
- }
298
+ program.command("lint").description("lint all supported files (TS, Python, etc.) via turbo").action(async () => {
299
+ const turboFailed = await runTurboLint(projectRoot);
506
300
  const ruffFailed = await ruffStep("check");
507
301
  if (turboFailed || ruffFailed) process.exit(1);
508
302
  });
@@ -532,11 +326,6 @@ program.parseAsync(process.argv).catch((err) => {
532
326
  });
533
327
  async function waitWithSpinner(services, options = {}) {
534
328
  const { interval = 1e3, timeout = 6e5 } = options;
535
- const waitFunctions = {
536
- frappe: waitForFrappe,
537
- postgres: waitForPostgres,
538
- keycloak: waitForKeycloak
539
- };
540
329
  const unreadyServices = [...services];
541
330
  const spinner = yoctoSpinner({ text: `waiting for ${formatServiceList(unreadyServices)}` }).start();
542
331
  function updateSpinner(readyService) {
@@ -1,10 +1,10 @@
1
1
  import path from "node:path";
2
2
  import fs from "node:fs/promises";
3
3
  import spawn from "nano-spawn";
4
- import YAML from "yaml";
5
4
  import yoctoSpinner from "yocto-spinner";
6
5
  import os from "node:os";
7
6
  import crypto from "node:crypto";
7
+ import YAML from "yaml";
8
8
 
9
9
  //#region src/commands/e2e.ts
10
10
  function sessionFileName(portOffset) {
@@ -0,0 +1,230 @@
1
+ import { discoverE2EApp } from "./e2e.mjs";
2
+ import fsSync from "node:fs";
3
+ import path from "node:path";
4
+ import fs from "node:fs/promises";
5
+ import { waitForFrappe, waitForKeycloak, waitForMariaDB, waitForPostgres } from "@multiplatform.one/utils/dev";
6
+ import spawn from "nano-spawn";
7
+ import YAML from "yaml";
8
+
9
+ //#region src/commands/verbs.ts
10
+ const availableServices = [
11
+ "frappe",
12
+ "solana",
13
+ "ethereum",
14
+ "sui"
15
+ ];
16
+ /** Map a service name to its relative directory from the project root. */
17
+ function serviceDir(name) {
18
+ return `apps/${name}`;
19
+ }
20
+ /** Apps that exist under apps/ and have package.json (discovered from filesystem). */
21
+ async function getPresentApps(root) {
22
+ const appsDir = path.join(root, "apps");
23
+ try {
24
+ const entries = await fs.readdir(appsDir, { withFileTypes: true });
25
+ const names = [];
26
+ for (const e of entries) {
27
+ if (!e.isDirectory()) continue;
28
+ const pkgPath = path.join(appsDir, e.name, "package.json");
29
+ try {
30
+ await fs.access(pkgPath);
31
+ names.push(e.name);
32
+ } catch {}
33
+ }
34
+ return names;
35
+ } catch {
36
+ return [];
37
+ }
38
+ }
39
+ /** Root-level services that exist and have package.json (discovered from filesystem). */
40
+ async function getPresentServices(root) {
41
+ const names = [];
42
+ for (const name of availableServices) {
43
+ const dir = path.join(root, serviceDir(name));
44
+ const pkgPath = path.join(dir, "package.json");
45
+ try {
46
+ if (!(await fs.stat(dir)).isDirectory()) continue;
47
+ await fs.access(pkgPath);
48
+ names.push(name);
49
+ } catch {}
50
+ }
51
+ return names;
52
+ }
53
+ /** Turbo --filter args to exclude root-level workspaces that are not present (so turbo only runs where they exist).
54
+ * Only generates exclude filters for directories that exist on disk (turbo errors on non-existent filter paths). */
55
+ async function getTurboExcludeFiltersForMissing(root) {
56
+ const present = await getPresentServices(root);
57
+ const filters = [];
58
+ for (const s of availableServices) {
59
+ if (present.includes(s)) continue;
60
+ const dir = serviceDir(s);
61
+ try {
62
+ if ((await fs.stat(path.join(root, dir))).isDirectory()) filters.push(`!./${dir}`);
63
+ } catch {}
64
+ }
65
+ return filters;
66
+ }
67
+ /** Discover frappe apps from frappe.yaml that have local source paths.
68
+ * Supports both string entries (`- ./apps/core`) and object entries (`- name: core\n source: ./apps/core`). */
69
+ async function getFrappeApps(root) {
70
+ const frappeDir = path.join(root, "apps", "frappe");
71
+ const frappeYamlPath = path.join(frappeDir, "frappe.yaml");
72
+ if (!fsSync.existsSync(frappeYamlPath)) return [];
73
+ const raw = await fs.readFile(frappeYamlPath, "utf8");
74
+ const config = YAML.parse(raw);
75
+ const out = [];
76
+ for (const app of config?.apps ?? []) {
77
+ let src;
78
+ let name;
79
+ if (typeof app === "string") {
80
+ src = app;
81
+ name = path.basename(app);
82
+ } else {
83
+ if (!app.source || !app.name) continue;
84
+ src = app.source;
85
+ name = app.name;
86
+ }
87
+ src = src.startsWith("file://") ? src.slice(7) : src;
88
+ if (!src.startsWith("./") && !src.startsWith("../") && !src.startsWith("/")) continue;
89
+ const absPath = path.isAbsolute(src) ? src : path.resolve(frappeDir, src);
90
+ if (!fsSync.existsSync(absPath)) continue;
91
+ out.push({
92
+ name,
93
+ absolutePath: absPath
94
+ });
95
+ }
96
+ return out;
97
+ }
98
+ const testTiers = [
99
+ "unit",
100
+ "integration",
101
+ "e2e",
102
+ "visual"
103
+ ];
104
+ /** The tiers `mpo test` was asked for (comma or space separated); unit when none is named. */
105
+ function parseTestTiers(args) {
106
+ const parsed = args.flatMap((arg) => arg.split(",")).filter(Boolean);
107
+ for (const tier of parsed) if (!testTiers.includes(tier)) throw new Error(`unknown test tier ${tier} (${testTiers.join(", ")})`);
108
+ return parsed.length ? parsed : ["unit"];
109
+ }
110
+ /**
111
+ * `bench run-tests` for every frappe app with a pyproject.toml, limited to the
112
+ * pytest marker expression. Skipped when the bench is not bootstrapped
113
+ * (no apps/frappe/sites); once it is, any app whose run fails fails the tier.
114
+ */
115
+ async function runBenchTests(projectRoot, marker, spawn) {
116
+ const benchDir = path.join(projectRoot, "apps", "frappe");
117
+ const apps = (await getFrappeApps(projectRoot)).filter((app) => fsSync.existsSync(path.join(app.absolutePath, "pyproject.toml")));
118
+ if (!apps.length) return;
119
+ if (!fsSync.existsSync(path.join(benchDir, "sites"))) {
120
+ console.warn(`no frappe bench (apps/frappe/sites): skipped bench tests -m "${marker}"`);
121
+ return;
122
+ }
123
+ const failed = [];
124
+ for (const app of apps) try {
125
+ await spawn("bench", [
126
+ "run-tests",
127
+ "--app",
128
+ app.name,
129
+ "--",
130
+ "-m",
131
+ marker
132
+ ], {
133
+ stdio: "inherit",
134
+ cwd: benchDir
135
+ });
136
+ } catch (error) {
137
+ console.error(error.message);
138
+ failed.push(app.name);
139
+ }
140
+ if (failed.length) throw new Error(`bench tests -m "${marker}" failed: ${failed.join(", ")}`);
141
+ }
142
+ /** The unit tier: turbo test minus missing services and the e2e app, then the bench's non-integration tests. */
143
+ async function runUnitTests(projectRoot, spawn$1 = spawn) {
144
+ const excludeFilters = await getTurboExcludeFiltersForMissing(projectRoot);
145
+ const e2eApp = await discoverE2EApp(projectRoot);
146
+ await spawn$1("pnpm", [
147
+ "turbo",
148
+ "run",
149
+ "test",
150
+ ...[...excludeFilters.flatMap((f) => ["--filter", f]), ...e2eApp ? ["--filter", `'!./apps/${e2eApp}'`] : []]
151
+ ], {
152
+ stdio: "inherit",
153
+ shell: true,
154
+ cwd: projectRoot
155
+ });
156
+ await runBenchTests(projectRoot, "not integration", spawn$1);
157
+ }
158
+ /** The integration tier: the bench's integration-marked tests only; the JS suite belongs to unit. */
159
+ async function runIntegrationTests(projectRoot, spawn$2 = spawn) {
160
+ await runBenchTests(projectRoot, "integration", spawn$2);
161
+ }
162
+ /** `mpo build`: the packages, then every present app with a build script, each once. */
163
+ async function runBuild(args, projectRoot, spawn$3 = spawn) {
164
+ const parsed = args.flatMap((arg) => arg.split(","));
165
+ const packages = parsed.includes("packages");
166
+ const projects = parsed.filter((arg) => arg !== "packages");
167
+ const presentApps = await getPresentApps(projectRoot);
168
+ const presentServices = await getPresentServices(projectRoot);
169
+ if (!projects.length && !packages || packages) await spawn$3("pnpm", [
170
+ "turbo",
171
+ "run",
172
+ "build",
173
+ "--filter",
174
+ "'!./apps/*'",
175
+ ...presentServices.flatMap((s) => ["--filter", `'!./${serviceDir(s)}'`])
176
+ ], {
177
+ stdio: "inherit",
178
+ shell: true,
179
+ cwd: projectRoot
180
+ });
181
+ for (const platform of presentApps) if (!projects.length && !packages || projects.includes(platform)) {
182
+ if (await fs.access(path.join(projectRoot, "apps", platform, "package.json")).then(() => JSON.parse(fsSync.readFileSync(path.join(projectRoot, "apps", platform, "package.json"), "utf8")).scripts?.build).catch(() => false)) await spawn$3("pnpm", [
183
+ "turbo",
184
+ "run",
185
+ "build",
186
+ `--filter=./apps/${platform}`
187
+ ], {
188
+ stdio: "inherit",
189
+ shell: true,
190
+ cwd: projectRoot
191
+ });
192
+ }
193
+ }
194
+ /** `mpo lint`'s turbo half: the root `//#lint` task. Resolves true when it failed. */
195
+ async function runTurboLint(projectRoot, spawn$4 = spawn) {
196
+ try {
197
+ await spawn$4("turbo", [
198
+ "run",
199
+ "lint",
200
+ "--filter=//"
201
+ ], {
202
+ stdio: "inherit",
203
+ cwd: projectRoot
204
+ });
205
+ return false;
206
+ } catch {
207
+ return true;
208
+ }
209
+ }
210
+ /** `mpo frappe bench [args...]`: frappe.sh's bench command with the arguments passed through as given. */
211
+ async function runFrappeBench(args, frappeScript, projectRoot, spawn$5 = spawn) {
212
+ await spawn$5("sh", [
213
+ frappeScript,
214
+ "bench",
215
+ ...args
216
+ ], {
217
+ stdio: "inherit",
218
+ cwd: projectRoot
219
+ });
220
+ }
221
+ /** The readiness probe behind each `mpo wait` service. */
222
+ const waitFunctions = {
223
+ frappe: waitForFrappe,
224
+ postgres: waitForPostgres,
225
+ mariadb: waitForMariaDB,
226
+ keycloak: waitForKeycloak
227
+ };
228
+
229
+ //#endregion
230
+ export { availableServices, parseTestTiers, runBuild, runFrappeBench, runIntegrationTests, runTurboLint, runUnitTests, testTiers, waitFunctions };
package/lib/source.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "cliVersion": "7.90.2",
2
+ "cliVersion": "7.90.4",
3
3
  "url": "https://git.corp.bitspur.com/multiplatform.one/mpo.git",
4
- "sha": "549f0054924e96ada60353d5bd2916abbe5083f3"
4
+ "sha": "a484db92ebdad1956d8047203d42f224e57f0d71"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/cli",
3
- "version": "7.90.2",
3
+ "version": "7.90.4",
4
4
  "description": "multiplatform.one cli — mpo init clones and prunes the monorepo, mpo update merges it back",
5
5
  "keywords": [
6
6
  "create-multiplatform-app",
@@ -57,7 +57,7 @@
57
57
  "access": "public"
58
58
  },
59
59
  "dependencies": {
60
- "@multiplatform.one/utils": "^7.90.2",
60
+ "@multiplatform.one/utils": "^7.90.4",
61
61
  "commander": "^15.0.0",
62
62
  "dotenv": "^17.4.2",
63
63
  "inquirer": "^14.2.3",