@multiplatform.one/cli 7.82.2 → 7.82.3

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
@@ -52,8 +52,8 @@ A project is the multiplatform.one monorepo at one commit, pruned:
52
52
  because every theme is CSS in the served document;
53
53
  `packages/themes/README.md` has the measurement and what to do when a
54
54
  surface needs a hue the subset drops.
55
- - `docs/`, `deploy/`, `.changeset`, `typedoc.json` and `.gitlab-ci.yml` are
56
- monorepo concerns and go too. `AGENTS.md` is the consumer copy
55
+ - `docs/`, `deploy/`, `.changeset`, `typedoc.json`, `.gitlab-ci.yml` and
56
+ `sonar-project.properties` are monorepo concerns and go too. `AGENTS.md` is the consumer copy
57
57
  (`templates/AGENTS.md`), which names only paths and scripts the project has.
58
58
  `README.md` is the consumer copy too (`templates/README.md`): a block
59
59
  between `<!-- service:<app> -->` and `<!-- /service:<app> -->` stays only
package/lib/source.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "cliVersion": "7.82.2",
2
+ "cliVersion": "7.82.3",
3
3
  "url": "https://git.corp.bitspur.com/multiplatform.one/mpo.git",
4
- "sha": "d66408364568fc1f05210d951176320e444e6a11"
4
+ "sha": "33fb9fe13e1cd903a59fe1836c8643777122f644"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/cli",
3
- "version": "7.82.2",
3
+ "version": "7.82.3",
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.82.2",
60
+ "@multiplatform.one/utils": "^7.82.3",
61
61
  "commander": "^15.0.0",
62
62
  "dotenv": "^17.4.2",
63
63
  "inquirer": "^14.2.3",
@@ -94,7 +94,7 @@ PROJECT_NAME=""
94
94
  SOURCE=""
95
95
  REF=""
96
96
  TARGET=""
97
- PRUNE="public agent-os .changeset docs deploy typedoc.json .gitlab-ci.yml"
97
+ PRUNE="public agent-os .changeset docs deploy typedoc.json .gitlab-ci.yml sonar-project.properties"
98
98
  TAB="$(printf '\t')"
99
99
 
100
100
  while [ $# -gt 0 ]; do
@@ -813,6 +813,12 @@ if (typeof scripts.dev === "string" && /--filter=one\b/.test(scripts.dev)) {
813
813
  if (apps.length > 1) for (const app of apps) scripts[`dev:${app}`] = `pnpm --filter @app/${app} dev`;
814
814
  }
815
815
  }
816
+ // build:web and serve name the One app; they act on the first product app.
817
+ for (const name of Object.keys(scripts)) {
818
+ if (!scripts[name].includes("@platform/one")) continue;
819
+ if (!apps.length) delete scripts[name];
820
+ else scripts[name] = scripts[name].replace(/@platform\/one\b/g, `@app/${apps[0]}`);
821
+ }
816
822
  for (const name of Object.keys(scripts)) {
817
823
  if (removed.some((app) => scripts[name].includes(`apps/${app}`) || scripts[name].includes(`@platform/${app}`))) {
818
824
  delete scripts[name];
@@ -827,6 +833,16 @@ if (pruned.includes("public") && pkg.pnpm?.patchedDependencies) {
827
833
  fs.writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\n`);
828
834
  NODE
829
835
 
836
+ # The monorepo tags its images for its own private registry. A project's local
837
+ # `make docker/build/<target>` tags them under the project's name instead, so
838
+ # `docker run <project>/app` works with no registry at all (FZ-8862).
839
+ _image_ns="$(printf '%s' "$PROJECT_NAME" | tr 'A-Z' 'a-z' | sed 's|^@||; s|[^a-z0-9._/-]|-|g')"
840
+ for _file in "$TREE/.env.example" "$TREE/.env" "$TREE/docker/Makefile"; do
841
+ [ -f "$_file" ] || continue
842
+ sed_file "$_file" "s|registry\\.git\\.corp\\.bitspur\\.com/multiplatform\\.one/mpo\\([^/A-Za-z0-9._-]\\)|$_image_ns\\1|g
843
+ s|registry\\.git\\.corp\\.bitspur\\.com/multiplatform\\.one/mpo\$|$_image_ns|"
844
+ done
845
+
830
846
  # From MPO-367 (pnpm 11) the patches live in pnpm-workspace.yaml, which gets
831
847
  # the same two edits the package.json `pnpm` field gets above.
832
848
  if [ -f "$TREE/pnpm-workspace.yaml" ]; then
@@ -149,6 +149,8 @@ loading.
149
149
  | ----------------------- | -------------------------------------------------------------- |
150
150
  | `pnpm dev` | The first product app's dev server (`dev:<name>` when several) |
151
151
  | `pnpm build` | Build every workspace package except the apps |
152
+ | `pnpm build:web` | Production web build of the first product app |
153
+ | `pnpm serve` | Serve that build on port 3000 |
152
154
  | `pnpm lint` | oxlint (incl. convention rules) + structural convention checks |
153
155
  | `pnpm lint:conventions` | Structural checks only (css twin, features twin) |
154
156
  | `pnpm format` | oxfmt |
@@ -165,6 +167,16 @@ from npmjs, the default registry, so an install needs no token.
165
167
  as advisory and fails if the installed tree records a different linker from the
166
168
  workspace; an existing isolated tree needs `pnpm install` to repair its layout.
167
169
 
170
+ ## Deploying
171
+
172
+ The web app ships as a container image built from
173
+ `apps/<name>/docker/Dockerfile` with plain `docker build`, which listens on
174
+ `PORT` (3000) and reads its settings (`SECRET`, `PUBLIC_URL`, the keys in
175
+ `packages/config/config.json`) from the environment at request time, so one
176
+ image serves every environment. Never bake an environment's values into the
177
+ build: an environment that needs more extends the image (`FROM` it) instead.
178
+ `README.md` has the steps.
179
+
168
180
  ## Coding defaults
169
181
 
170
182
  - Named exports only; cut dead/legacy aliases unless a task explicitly needs them.
@@ -2,10 +2,11 @@
2
2
 
3
3
  Web, iOS and Android from one React + Tamagui tree, with desktop, browser
4
4
  extension and VS Code targets inside each product app. This repository is the
5
- [multiplatform.one](https://git.corp.bitspur.com/multiplatform.one/mpo)
6
- monorepo at one commit, pruned to the product apps and services picked at
7
- `mpo init`. `.mpo.json` records the commit and the selection, and `AGENTS.md`
8
- holds the conventions.
5
+ multiplatform.one monorepo at one commit, pruned to the product apps and
6
+ services picked at `mpo init`. `.mpo.json` records the commit and the
7
+ selection, and `AGENTS.md` holds the conventions. Everything you need to run,
8
+ build and deploy it is in this file; the `mpo` CLI's own reference is its
9
+ [npm page](https://www.npmjs.com/package/@multiplatform.one/cli).
9
10
 
10
11
  ## Layout
11
12
 
@@ -28,6 +29,59 @@ pnpm dev # the first product app (dev:<name> picks one of several)
28
29
 
29
30
  `.env` starts as a copy of `.env.example`.
30
31
 
32
+ ## Deploy
33
+
34
+ The web app runs as a Node server (`one serve`), so it ships as a container
35
+ image or on any host with Node 22+. Nothing here needs an account anywhere.
36
+
37
+ Build it and serve it the way production will:
38
+
39
+ ```sh
40
+ pnpm build:web # the first product app and the packages it uses, into apps/<name>/dist
41
+ pnpm serve # that build on http://localhost:3000
42
+ ```
43
+
44
+ Then build the container image and run it:
45
+
46
+ ```sh
47
+ docker build -f apps/<name>/docker/Dockerfile -t <project>/app:latest .
48
+ docker run --rm -p 3000:3000 -e SECRET="$(openssl rand -base64 32)" <project>/app:latest
49
+ ```
50
+
51
+ The build installs and builds inside the image, so it needs only Docker (with
52
+ BuildKit, the default since Docker 23), not Node or this checkout's
53
+ `node_modules`. Publish the image to any registry and run it on any container
54
+ host (a VM with Docker, Kubernetes, Fly.io, Cloud Run):
55
+
56
+ ```sh
57
+ docker tag <project>/app:latest registry.example.com/team/<project>:latest
58
+ docker push registry.example.com/team/<project>:latest
59
+ ```
60
+
61
+ The image is generic: nothing about one environment is baked in, so build it
62
+ once and configure it where it runs. Extend it like any base image when an
63
+ environment needs more (a CA certificate, a sidecar tool, fixed defaults):
64
+
65
+ ```dockerfile
66
+ FROM <project>/app:latest
67
+ ENV PUBLIC_URL=https://app.example.com
68
+ ```
69
+
70
+ Settings come from the server's environment, not the build, so one image
71
+ serves every environment:
72
+
73
+ | Variable | What it does |
74
+ | ------------ | ------------------------------------------------------------------------------------ |
75
+ | `PORT` | The port the image listens on (3000). `pnpm serve` takes `ONE_PORT`. |
76
+ | `SECRET` | Signs sessions. Unset, `/api/auth/*` answers 500; every other page still renders. |
77
+ | `PUBLIC_URL` | The public origin. The browser's Frappe client dials it unless `BASE_URL` says else. |
78
+
79
+ Every key in `packages/config/config.json` (`FRAPPE_ENABLED`, `KEYCLOAK_*`,
80
+ `SENTRY_DSN`, ...) is read the same way, per request.
81
+
82
+ The multiplatform.one apps themselves ship this same image, deployed on their
83
+ estate with SHC.
84
+
31
85
  <!-- service:frappe -->
32
86
 
33
87
  ## Frappe