@diagonal-hq/cli 0.5.0 → 0.6.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/README.md +2 -0
- package/dist/cli.mjs +213 -31
- package/dist/index.d.ts +7 -0
- package/dist/sdk-contract.d.ts +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,6 +51,8 @@ The build reads each file with a parser. It runs only the workflow tests.
|
|
|
51
51
|
- Each `resources/*.ts` file goes through the resource checks in [Resources and fields](#resources-and-fields).
|
|
52
52
|
- The build removes imports from `@diagonal-hq/cli`. Pages, layouts, components, and workflow scripts can import workspace files through `@app/`. A resource file can import only `@app/generated/resources`. Workflow scripts can also import `@diagonal/workflow` and `@diagonal/workflow/workspace`. Other external imports in these source files are rejected.
|
|
53
53
|
- The second argument of `definePage`, and the default export of a layout or component file, must be one function.
|
|
54
|
+
- Each `definePage` needs a `key` that is unique in the workspace: a camelCase name of at most 64 letters and digits, such as `members`. The page's id comes from the key, so a file move keeps it. A missing key fails with a suggested key.
|
|
55
|
+
- Pages, layouts, and components link to a page with `Pages.<key>`: `Pages.members.url()`, `Pages.member.url({ id })`, and `Pages.members.navigate()`. `Pages` needs no import, and `import { Pages } from '@diagonal/pages'` also works. The check fails at an unknown key and at a call without the route parameters of the page.
|
|
54
56
|
- Pages, layouts, and components go through the page lint gate: syntax, scope, the component return shape, and a type check against the page Sdk contract and the workspace resources. A page names a resource by slug, for example `Sdk.resource(Resources.Members)`.
|
|
55
57
|
- Each `workflows/<name>.ts` is a script workflow. It has one `export const config = { title, trigger, runAs? } satisfies WorkflowConfig` and one `export default defineWorkflow(...)`. The config must be a static literal. The build validates it: the trigger fields, the resources (see [Resource references](#resource-references)), the workflow paths of `workflowEvent` triggers, and the run-as rules. A `recordEvent`, `recordSchedule`, `scheduled`, or `workflowEvent` workflow needs `runAs`.
|
|
56
58
|
- The build removes the config and the `@diagonal-hq/cli` imports from the workflow, with spaces in their place, and compiles the rest with the workflow script compiler against the workspace resources. A compiler error has the line and column of the workflow file.
|