@diagonal-hq/cli 0.38.2 → 0.38.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 +21 -5
- package/dist/check-data.json +1 -0
- package/dist/cli-assets-cli-VQBXYEIZ.mjs +386 -0
- package/dist/cli-check-data-GHZW7MSI.mjs +17893 -0
- package/dist/cli-chunk-A7Q2M4ZU.mjs +1052 -0
- package/dist/cli-chunk-F2J44UIS.mjs +39865 -0
- package/dist/cli-chunk-HWHRAOWD.mjs +24035 -0
- package/dist/cli-chunk-LRS5IEI3.mjs +48 -0
- package/dist/cli-chunk-T6442V5V.mjs +7463 -0
- package/dist/cli-chunk-U2ET6LQJ.mjs +277 -0
- package/dist/cli-chunk-WPC3DBHX.mjs +52 -0
- package/dist/cli-chunk-XMVYLKEB.mjs +359 -0
- package/dist/cli-chunk-YIPLFIKL.mjs +63 -0
- package/dist/cli-files.generated-WAU3U62D.mjs +61 -0
- package/dist/cli-sdk-files.generated-HAH7DJPZ.mjs +1429 -0
- package/dist/cli-skill-file-TEJUXCJB.mjs +262 -0
- package/dist/cli-workflows-CK5ZVNYR.mjs +462 -0
- package/dist/cli.mjs +545 -99388
- package/dist/script-sdk.json +1 -0
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ This package is the authoring SDK for file-based workspaces. A workspace reposit
|
|
|
7
7
|
- Editor types for the workflow script SDK: `@diagonal/workflow`, `@diagonal/workflow/testing`, and `@diagonal/workflow/workspace`.
|
|
8
8
|
- The `diagonal check` command. It runs the same build and checks that a platform deploy runs, including the workflow tests. It also writes `generated/resources.ts`, `generated/pages.ts`, `generated/workflows.ts`, `generated/assets.ts`, `generated/catalog.d.ts`, and the missing definition uids.
|
|
9
9
|
- The `diagonal make:migration <name>` command. It creates an ordinary workflow in `migrations/` with a timestamped filename. Every migration runs as system.
|
|
10
|
+
- The `diagonal update` command. It updates the `@diagonal-hq` packages of the workspace and installs them.
|
|
10
11
|
- The `diagonal assets upload` and `diagonal assets list` commands. They upload Application Assets, update `assets.ts`, and list immutable references.
|
|
11
12
|
- The `diagonal workflows`, `diagonal run`, and `diagonal logs` commands. They list the deployed workflows, run a manual workflow by its file path, and print recent runs with the error of each failed run.
|
|
12
13
|
|
|
@@ -14,10 +15,10 @@ This package is the authoring SDK for file-based workspaces. A workspace reposit
|
|
|
14
15
|
|
|
15
16
|
```bash
|
|
16
17
|
npm install
|
|
17
|
-
|
|
18
|
+
npx diagonal check
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
`npm
|
|
21
|
+
`npx` runs the `diagonal` binary that `npm install` installed in `node_modules/.bin`, so a workspace needs no `package.json` scripts for these commands. The command options are:
|
|
21
22
|
|
|
22
23
|
```text
|
|
23
24
|
diagonal check [dir] [--fix] [--json]
|
|
@@ -34,10 +35,25 @@ Each diagnostic prints as `path:line:column severity message`. The command exits
|
|
|
34
35
|
From the workspace root, run:
|
|
35
36
|
|
|
36
37
|
```bash
|
|
37
|
-
diagonal make:migration backfill_post_slug
|
|
38
|
+
npx diagonal make:migration backfill_post_slug
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
The command creates `migrations/YYYYMMDDHHmmss_backfill_post_slug.ts` with the current timestamp.
|
|
41
|
+
The command creates `migrations/YYYYMMDDHHmmss_backfill_post_slug.ts` with the current timestamp. Edit the generated workflow, then run `diagonal check` before committing. Keep deployed files unchanged. Use a new migration filename for a correction.
|
|
42
|
+
|
|
43
|
+
## Update the SDK packages
|
|
44
|
+
|
|
45
|
+
From the workspace root, run:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx diagonal update
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The command reads each `@diagonal-hq` package in `dependencies` and `devDependencies` of `package.json`:
|
|
52
|
+
|
|
53
|
+
- A `file:` tarball, such as `file:../scripts/dist/npm/diagonal-hq-cli-0.35.6.tgz`, moves to the tarball of that package with the highest version in the same directory. A `file:` path that is not a tarball stays. For a `@diagonal-hq/cli` tarball, the command also points the `@diagonal-hq/workflow-script-compiler-*` overrides at the compiler tarballs that the new CLI needs in that directory. Then it removes the `@diagonal-hq` entries from `package-lock.json` and `node_modules`, because a rebuilt tarball keeps its file name.
|
|
54
|
+
- Every other specifier installs `<package>@latest` from npm. npm writes the new range into `package.json`.
|
|
55
|
+
|
|
56
|
+
Then the command runs `npm install`. It exits with 1 when a tarball directory has no tarball of a package or `npm install` fails, and with 2 for a usage error. Run `npx diagonal check` after an update. A CLI version without this command needs one manual install first, for example `npm install -D @diagonal-hq/cli@latest`.
|
|
41
57
|
|
|
42
58
|
## Workspace API credentials
|
|
43
59
|
|
|
@@ -1170,7 +1186,7 @@ In the editor, a data call takes any resource string, and record data is untyped
|
|
|
1170
1186
|
|
|
1171
1187
|
## Build the package
|
|
1172
1188
|
|
|
1173
|
-
`npm run build:cli-package` (`scripts/build-cli-package.mjs`) writes `dist/` and packs `scripts/dist/npm/diagonal-hq-cli-<version>.tgz`. `dist/cli.mjs` bundles every dependency,
|
|
1189
|
+
`npm run build:cli-package` (`scripts/build-cli-package.mjs`) writes `dist/` and packs `scripts/dist/npm/diagonal-hq-cli-<version>.tgz`. `dist/cli.mjs` bundles every dependency, so the command needs no Diagonal checkout. It does not bundle TypeScript. `diagonal check` runs the whole workspace check in the workflow script compiler, which comes from its platform package, an optional dependency of the CLI. The compiler reads `dist/check-data.json`, the data of the build, and `dist/script-sdk.json`, the script SDK. Node answers the questions of the compiler that need a JavaScript engine and runs the workflow and migration tests. The test runner, with the bundled script SDK that the tests import, the skill reader, and the asset commands are chunks (`dist/cli-*.mjs`) that the command loads only when it needs them. The script needs the page Sdk contract and `scripts/generated/pageSdkContract.mjs`. `npm run generate-typescript` makes both and then runs the script with `--declarations-only`. That mode writes only the `.d.ts` files of `dist/`, which the Files editor and the draft editors bundle. It does not write `dist/cli.mjs` or the tarball. `npm run build:npm-packages` builds and packs all the packages.
|
|
1174
1190
|
|
|
1175
1191
|
`node scripts/smoke-cli-package.mjs [tarball]` installs the packed tarball in a copy of the starter template outside the repository, with one workflow and its test added. It checks the packed file list, imports the helpers through the `exports` map, runs `tsc` against the packed declarations, and runs `diagonal check`. The `generated-assets` job of PR CI runs it.
|
|
1176
1192
|
|