@diagonal-hq/cli 0.21.1 → 0.21.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 +3 -3
- package/dist/cli.mjs +3092 -177
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,9 +89,9 @@ The build reads each file with a parser. It runs only the workflow and migration
|
|
|
89
89
|
|
|
90
90
|
## Definition uids and slugs
|
|
91
91
|
|
|
92
|
-
A definition can have two identity options. A resource, a field, a relation inverse, a policy, a static record, a permission, a role, a page, a workflow config, a notification type, a notification template, an email layout, a workspace field,
|
|
92
|
+
A definition can have two identity options. A resource, a field, a relation inverse, a policy, a static record, a permission, a role, a page, a workflow config, a notification type, a notification template, an email layout, a workspace field, the front matter of a skill file, and a layout or component module in `layouts/` or `components/` have a `uid`. A resource, a permission, a role, a workflow, a notification type, a notification template, and an email layout also have a `slug`. A workspace field has a `key` in the place of a `slug`.
|
|
93
93
|
|
|
94
|
-
- `uid` is the stable identity of the definition. Its value is a lowercase UUID string literal, such as `uid: '019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e'`. In skill front matter, it is a YAML string, such as `uid: 019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e`. A file move, a file rename, or a name change keeps the uid. The deploy keeps the stored id of a resource, a field, a page, a workflow, a workspace field, and a skill by its uid, so these changes keep the definition's records, runs, and references. Do not change a uid: a new uid is a new definition.
|
|
94
|
+
- `uid` is the stable identity of the definition. Its value is a lowercase UUID string literal, such as `uid: '019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e'`. In skill front matter, it is a YAML string, such as `uid: 019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e`. A layout or component module exports it after its imports, such as `export const uid = '019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e';`. It identifies the module's shared draft in the platform. A layout or component without a uid still builds. A file move, a file rename, or a name change keeps the uid. The deploy keeps the stored id of a resource, a field, a page, a workflow, a workspace field, and a skill by its uid, so these changes keep the definition's records, runs, and references. Do not change a uid: a new uid is a new definition.
|
|
95
95
|
- `slug` is the editable, user-facing name of the definition. It is an optional string literal in the `defineX()` call, which is the config of `defineWorkflow(config, handler)` for a workflow. Without it, the path gives the slug: the file name of a resource, a permission, a role, a workflow, or a template, and the folder name of a notification type or an email layout. A `slug` can differ from the path, and a file rename then keeps the slug. A slug change keeps the uid.
|
|
96
96
|
|
|
97
97
|
| Definition | Path | Slug without a `slug` option | Rule of the slug |
|
|
@@ -109,7 +109,7 @@ The path also gives the name of the definition in its generated module, such as
|
|
|
109
109
|
|
|
110
110
|
A setting that names another definition takes the `uid` of its generated entry, for example `NotificationTypes.MemberWelcome.uid`, `NotificationTypes.MemberWelcome.templates.Standard.uid`, `EmailLayouts.Standard.uid`, `Workflows.BookClass.uid`, `Permissions.ManageBookings.uid`, or `Pages.Home.uid`. The uid survives a rename, and the platform finds the definition from it. A notification send, a schedule, `defaultTemplate`, a template layout, a page workflow call, and `ctx.can` also take a slug, as a string or as a `.slug` member. It builds and runs, with a warning that names the `.uid` reference. A workflow path, such as `'workflows/add.ts'`, is an error in every workflow reference: a `workflowEvent` trigger, `workflow.run`, and page code. A resource is the exception: a setting names it with `Resources.<Name>.slug`. A domain and an Application Asset have no uid, so a setting names them with `.key`. A workspace field has a uid, but code reads its value by key, so a setting names it with `WorkspaceFields.<Name>.key`.
|
|
111
111
|
|
|
112
|
-
`diagonal check` writes a new uid into each definition that has none. It adds `uid: '<uuid>'` as the first option of the `defineX()` object, of each `field.<type>({...})` call, `settings.inverse` object, and policy, or of the config object of `defineWorkflow(config, handler)`,
|
|
112
|
+
`diagonal check` writes a new uid into each definition that has none. It adds `uid: '<uuid>'` as the first option of the `defineX()` object, of each `field.<type>({...})` call, `settings.inverse` object, and policy, or of the config object of `defineWorkflow(config, handler)`, `uid: <uuid>` as the first line of the front matter of a skill file, or `export const uid = '<uuid>';` after the imports of a layout or component module, and leaves the rest of the file unchanged. Commit the change.
|
|
113
113
|
|
|
114
114
|
The platform writes the missing uids too: a save in Files, and every other commit that the platform makes, adds a uid to each definition of the changed files that has none. A git push does not, so a pushed definition without a uid fails the deploy, and the error tells you to run `diagonal check`.
|
|
115
115
|
|