@multiplatform.one/cli 7.7.4 → 7.8.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": "@multiplatform.one/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.8.0",
|
|
4
4
|
"description": "multiplatform.one cli — mpo init / create-multiplatform-app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create-multiplatform-app",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"nano-spawn": "^2.1.0",
|
|
62
62
|
"yaml": "^2.8.3",
|
|
63
63
|
"yocto-spinner": "^1.1.0",
|
|
64
|
-
"@multiplatform.one/utils": "7.
|
|
64
|
+
"@multiplatform.one/utils": "7.8.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/inquirer": "^9.0.9",
|
|
@@ -429,6 +429,10 @@ describe("initApp generator", () => {
|
|
|
429
429
|
const readme = readFileSync(join(root, "README.md"), "utf-8");
|
|
430
430
|
expect(readme).toContain("## Frappe backend");
|
|
431
431
|
expect(readme).toContain("## Keycloak auth");
|
|
432
|
+
// Fixtures are a supported way to run the generated app (MPO-228),
|
|
433
|
+
// so the README has to say how.
|
|
434
|
+
expect(readme).toContain("### Running against fixtures, with no bench");
|
|
435
|
+
expect(readme).toContain("frappe: { fixtures }");
|
|
432
436
|
});
|
|
433
437
|
|
|
434
438
|
// Two measured first-boot failures, both cheap to reintroduce. The
|
|
@@ -30,3 +30,60 @@ bench start
|
|
|
30
30
|
Then set `FRAPPE_URL=http://__NAME__.localhost:8000` (or keep
|
|
31
31
|
`http://localhost:8000` and make the site the default with
|
|
32
32
|
`bench use __NAME__.localhost`) and restart `pnpm dev`.
|
|
33
|
+
|
|
34
|
+
### Running against fixtures, with no bench
|
|
35
|
+
|
|
36
|
+
`createApp` takes a fixture corpus, so the app runs with no server and no
|
|
37
|
+
network. Hand `frappe.fixtures` a `FixtureProvider` in
|
|
38
|
+
`apps/__NAME__/src/app.ts`:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createApp } from "@multiplatform.one/core";
|
|
42
|
+
import { InMemoryFixtureProvider } from "@multiplatform.one/frappe";
|
|
43
|
+
import { themeConfig } from "@package/themes";
|
|
44
|
+
|
|
45
|
+
const fixtures = new InMemoryFixtureProvider({
|
|
46
|
+
Customer: [
|
|
47
|
+
{ name: "CUST-0001", doctype: "Customer", customer_name: "Acme" },
|
|
48
|
+
{ name: "CUST-0002", doctype: "Customer", customer_name: "Globex" },
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const { AppProvider, useAppConfig, withApp } = createApp({
|
|
53
|
+
theme: themeConfig,
|
|
54
|
+
frappe: { fixtures },
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`FrappeTable`, `FrappeList` and the other collection-backed components then
|
|
59
|
+
read from the corpus. Writes land in it too, so create/update/delete work for
|
|
60
|
+
the session.
|
|
61
|
+
|
|
62
|
+
Two things follow from setting `fixtures`:
|
|
63
|
+
|
|
64
|
+
- the provider mounts without `FRAPPE_ENABLED=1`, and
|
|
65
|
+
- `baseURL` takes no fallback. Only a `baseURL` you pass explicitly is used,
|
|
66
|
+
so `BASE_URL` cannot quietly point fixture reads at the app's own origin.
|
|
67
|
+
|
|
68
|
+
Column labels and filter fields come from DocType metadata, which lives in
|
|
69
|
+
the corpus under the `DocType` doctype (the `getdoctype` shape) when you want
|
|
70
|
+
it:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
const fixtures = new InMemoryFixtureProvider({
|
|
74
|
+
DocType: [
|
|
75
|
+
{
|
|
76
|
+
name: "Customer",
|
|
77
|
+
doctype: "DocType",
|
|
78
|
+
fields: [{ fieldname: "customer_name", fieldtype: "Data", label: "Customer Name" }],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
Customer: [{ name: "CUST-0001", doctype: "Customer", customer_name: "Acme" }],
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Leave it out and the table still renders its rows; it just has no
|
|
86
|
+
metadata-derived filter fields.
|
|
87
|
+
|
|
88
|
+
To point the same app at a real bench again, drop `fixtures` and set
|
|
89
|
+
`FRAPPE_ENABLED=1` + `FRAPPE_URL` in `.env`.
|