@monimesl/dot-cli 0.1.0-alpha.10
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 +96 -0
- package/bin/dotctl.js +2 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +942 -0
- package/dist/cli.js.map +1 -0
- package/dist/server-Dbrgkelo.js +11215 -0
- package/dist/server-Dbrgkelo.js.map +1 -0
- package/dist/templates/showcase/.env +3 -0
- package/dist/templates/showcase/dot.ts +24 -0
- package/dist/templates/showcase/pages/cache/controller.ts +45 -0
- package/dist/templates/showcase/pages/cache/state.ts +17 -0
- package/dist/templates/showcase/pages/cache/view.dml +36 -0
- package/dist/templates/showcase/pages/carousel/controller.ts +40 -0
- package/dist/templates/showcase/pages/carousel/state.ts +77 -0
- package/dist/templates/showcase/pages/carousel/view.dml +40 -0
- package/dist/templates/showcase/pages/device/controller.ts +80 -0
- package/dist/templates/showcase/pages/device/state.ts +7 -0
- package/dist/templates/showcase/pages/device/view.dml +49 -0
- package/dist/templates/showcase/pages/feedback/controller.ts +21 -0
- package/dist/templates/showcase/pages/feedback/state.ts +8 -0
- package/dist/templates/showcase/pages/feedback/view.dml +87 -0
- package/dist/templates/showcase/pages/files/controller.ts +66 -0
- package/dist/templates/showcase/pages/files/state.ts +19 -0
- package/dist/templates/showcase/pages/files/view.dml +50 -0
- package/dist/templates/showcase/pages/filters/controller.ts +27 -0
- package/dist/templates/showcase/pages/filters/state.ts +118 -0
- package/dist/templates/showcase/pages/filters/view.dml +44 -0
- package/dist/templates/showcase/pages/forms/controller.ts +68 -0
- package/dist/templates/showcase/pages/forms/state.ts +34 -0
- package/dist/templates/showcase/pages/forms/view.dml +49 -0
- package/dist/templates/showcase/pages/images/controller.ts +41 -0
- package/dist/templates/showcase/pages/images/state.ts +10 -0
- package/dist/templates/showcase/pages/images/view.dml +53 -0
- package/dist/templates/showcase/pages/index/controller.ts +10 -0
- package/dist/templates/showcase/pages/index/state.ts +128 -0
- package/dist/templates/showcase/pages/index/view.dml +20 -0
- package/dist/templates/showcase/pages/layout/controller.ts +60 -0
- package/dist/templates/showcase/pages/layout/state.ts +34 -0
- package/dist/templates/showcase/pages/layout/view.dml +103 -0
- package/dist/templates/showcase/pages/lists/controller.ts +37 -0
- package/dist/templates/showcase/pages/lists/state.ts +117 -0
- package/dist/templates/showcase/pages/lists/view.dml +59 -0
- package/dist/templates/showcase/pages/navigation/controller.ts +65 -0
- package/dist/templates/showcase/pages/navigation/state.ts +17 -0
- package/dist/templates/showcase/pages/navigation/view.dml +34 -0
- package/dist/templates/showcase/pages/network/controller.ts +151 -0
- package/dist/templates/showcase/pages/network/state.ts +22 -0
- package/dist/templates/showcase/pages/network/view.dml +67 -0
- package/dist/templates/showcase/pages/payments/controller.ts +46 -0
- package/dist/templates/showcase/pages/payments/state.ts +13 -0
- package/dist/templates/showcase/pages/payments/view.dml +45 -0
- package/dist/templates/showcase/pages/secrets/controller.ts +43 -0
- package/dist/templates/showcase/pages/secrets/state.ts +5 -0
- package/dist/templates/showcase/pages/secrets/view.dml +24 -0
- package/dist/templates/showcase/pages/state/controller.ts +22 -0
- package/dist/templates/showcase/pages/state/state.ts +10 -0
- package/dist/templates/showcase/pages/state/view.dml +33 -0
- package/dist/templates/showcase/pages/text/controller.ts +10 -0
- package/dist/templates/showcase/pages/text/state.ts +8 -0
- package/dist/templates/showcase/pages/text/view.dml +58 -0
- package/dist/templates/showcase/statics/logo.png +0 -0
- package/dist/templates/starter/.env +3 -0
- package/dist/templates/starter/dot.ts +3 -0
- package/dist/templates/starter/pages/index/controller.ts +9 -0
- package/dist/templates/starter/pages/index/state.ts +4 -0
- package/dist/templates/starter/pages/index/view.dml +16 -0
- package/dist/templates/starter/statics/logo.png +0 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @monimesl/dot-cli
|
|
2
|
+
|
|
3
|
+
The `dotctl` command. It creates dots, builds them and runs them in the simulator. Later it will
|
|
4
|
+
also package, sign and publish them.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
dotctl create [dir] # create a dot (asks for its name and template)
|
|
8
|
+
dotctl create page <path> # add a page to the dot you are in
|
|
9
|
+
dotctl build [root] # build the dot, minified, into dist/ui and dist/logic
|
|
10
|
+
dotctl dev [root] # run the dot in the browser simulator and reload it on each change
|
|
11
|
+
dotctl preview [root] # build as `build` does, then run that build in the browser simulator
|
|
12
|
+
dotctl keys show # print this computer's developer key: its public key and key ID
|
|
13
|
+
dotctl lsp # start the .dml language server (editors run this)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
| Option | Applies to | What it does |
|
|
17
|
+
| --------------------- | ------------------------- | -------------------------------------------------------------------------- |
|
|
18
|
+
| `--out-dir <dir>` | `build`, `dev`, `preview` | Output directory (default: `<root>/dist`) |
|
|
19
|
+
| `--conditions <list>` | `build`, `dev`, `preview` | Extra export conditions, such as `@monimesl/dot-source` |
|
|
20
|
+
| `--port <port>` | `dev`, `preview` | Simulator port (default: `3680`, or the next free one) |
|
|
21
|
+
| `--device` | `dev` | Also serve the dot to the Dot example apps on phones, through a QR code |
|
|
22
|
+
| `--name <name>` | `create` | The dot's name, instead of asking |
|
|
23
|
+
| `--template <name>` | `create` | `starter` (one page to build on, the default) or `showcase` (all features) |
|
|
24
|
+
| `--pm <name>` | `create` | The package manager to install with: npm, pnpm, yarn or bun |
|
|
25
|
+
|
|
26
|
+
## `dotctl create`
|
|
27
|
+
|
|
28
|
+
Creates a self-contained project for a new dot. It asks for:
|
|
29
|
+
|
|
30
|
+
- **The name.** The default is `Dot`. The project goes in `dir`, or a folder named after the dot in
|
|
31
|
+
kebab case.
|
|
32
|
+
- **The template.** `starter` is one page to build on. `showcase` has a page for each feature.
|
|
33
|
+
|
|
34
|
+
The dot depends on `@monimesl/dot-runtime` and `@monimesl/dot-cli`. Inside the Dot repository it
|
|
35
|
+
uses the workspace packages instead.
|
|
36
|
+
|
|
37
|
+
Then it offers to install the dependencies and start the simulator. If more than one package
|
|
38
|
+
manager is installed (npm, pnpm, yarn or bun), it asks which to use. The default is the one that
|
|
39
|
+
ran `dotctl`, or npm.
|
|
40
|
+
|
|
41
|
+
## `dotctl dev`
|
|
42
|
+
|
|
43
|
+
Builds the dot, opens it in the browser simulator, and builds it again each time you save:
|
|
44
|
+
|
|
45
|
+
- A change under `pages/` reloads in place. Each open page keeps its state and runs the new code. A
|
|
46
|
+
page whose initial state changed starts over with the new state.
|
|
47
|
+
- Any other change, such as to `dot.ts`, `dot.json`, `.env` or `statics/`, restarts the dot on the
|
|
48
|
+
pages it had open.
|
|
49
|
+
- If a build fails, the simulator shows the error and keeps running the last good build.
|
|
50
|
+
|
|
51
|
+
With `--device`, it also serves each build to the Dot example apps on your local network. It prints
|
|
52
|
+
a QR code. Scan it with an example app, and the app follows the dot in the same way. See
|
|
53
|
+
[the example apps](../hosts/native/README.md#the-example-apps).
|
|
54
|
+
|
|
55
|
+
## `dotctl preview`
|
|
56
|
+
|
|
57
|
+
Builds the dot as `dotctl build` does, then runs that build in the browser simulator. The build is
|
|
58
|
+
minified and has only the components its pages use, just as the host app gets it. Use it to check a
|
|
59
|
+
build before you publish it. It doesn't rebuild when files change, so run it again after editing.
|
|
60
|
+
It keeps the files the dot saved during `dotctl dev`.
|
|
61
|
+
|
|
62
|
+
## Developer keys
|
|
63
|
+
|
|
64
|
+
Dash only opens a link if it was signed by one of the signed-in developer's keys.
|
|
65
|
+
`dotctl dev --device` signs with the Ed25519 key in `~/.dot/developer-key.pem`, or in the file that
|
|
66
|
+
`DOT_DEVELOPER_KEY` names. dotctl reads this key but never creates it. Make one with OpenSSL 3.
|
|
67
|
+
macOS's built-in `openssl` can't, so run `brew install openssl` first:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
mkdir -p ~/.dot && openssl genpkey -algorithm ed25519 -out ~/.dot/developer-key.pem
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`dotctl keys show` prints the public key in base64, and the key ID: the first 8 bytes of the public
|
|
74
|
+
key in lowercase hex. Add the public key to your Monime account, once for each computer you work on.
|
|
75
|
+
|
|
76
|
+
The link looks like `dotdev://connect?server=…&secret=…`. It only carries what a device can't
|
|
77
|
+
get any other way, so the QR code stays small.
|
|
78
|
+
|
|
79
|
+
- **The secret** is 16 random bytes and never goes over the network.
|
|
80
|
+
- A device proves it has the link by sending `HMAC-SHA256(secret, "dotdev-token")` as its bearer
|
|
81
|
+
token. The token reveals nothing about the secret.
|
|
82
|
+
- Each build listing has the SHA-256 of every file. `dotctl dev --device` sends the listing with
|
|
83
|
+
an HMAC-SHA256 of it, keyed with the secret, in a `dot-build-mac` header.
|
|
84
|
+
- A device only accepts a listing with the right MAC, and only accepts files that match their
|
|
85
|
+
hashes. So no one else on the network can swap in a different build.
|
|
86
|
+
- **The signature** is served at `GET <server>/dev/link`, which needs no token. It returns
|
|
87
|
+
`{ "expires": …, "keyId": "…", "sig": "…" }`.
|
|
88
|
+
- It signs these values, one per line: `dotdev-connect`, the server, the secret, the expiry time
|
|
89
|
+
(12 hours after the link was made) and the key ID.
|
|
90
|
+
- Before opening the link, Dash sends Monime the key ID, the signed text (in base64) and the
|
|
91
|
+
signature. Monime checks that the key belongs to the signed-in account, that it made the
|
|
92
|
+
signature, and that the link hasn't expired.
|
|
93
|
+
- A signature served by anyone else fails this check. Dash itself stores no keys.
|
|
94
|
+
|
|
95
|
+
Without a key there is no signature, and `/dev/link` answers 404. The Dot example apps don't need
|
|
96
|
+
one.
|
package/bin/dotctl.js
ADDED
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|