@designos/compiler-cli 0.2.0 → 0.3.1
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/LICENSE +21 -0
- package/README.md +16 -6
- package/dist/cli.js +570 -7
- package/dist/cli.js.map +1 -1
- package/package.json +5 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 relacloud
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,12 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
The package exposes the `designos` command for build-time compilation. It reads either a version-1 IR project or a version-2 file-based TSX project, invokes the registered compiler for one target, writes generated modules and the target registry when one is registered, emits a neutral `manifests.json` map, then copies declared component and project-level style/assets beneath a dedicated target directory in `dist`.
|
|
4
4
|
|
|
5
|
+
## Using a repository checkout
|
|
6
|
+
|
|
7
|
+
From the repository root, build the CLI and its transitive workspace dependencies. In this checkout, the package does not expose its own `designos` bin through `pnpm --filter @designos/compiler-cli exec`, so run the built entry point with Node:
|
|
8
|
+
|
|
5
9
|
```bash
|
|
6
|
-
pnpm --filter
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
pnpm exec turbo run build --filter=@designos/compiler-cli...
|
|
11
|
+
node packages/compiler-cli/dist/cli.js compile --target react --project-root docs/specifications/examples/component-kit --config designos.project.json
|
|
12
|
+
node packages/compiler-cli/dist/cli.js compile --target vue --project-root docs/specifications/examples/component-kit --config designos.project.json --out-dir dist/designos/vue
|
|
13
|
+
node packages/compiler-cli/dist/cli.js kit validate --root docs/specifications/examples/component-kit
|
|
9
14
|
```
|
|
10
15
|
|
|
16
|
+
Component-kit validation supports schema versions 1 and 2. Schema v2 also validates the referenced kit-owned design manifest, including its tokens and presets.
|
|
17
|
+
|
|
11
18
|
`designos kit validate` applies the root Draft 2020-12 kit schema before resolving manifest references, then checks package metadata agreement, SemVer and compatibility ranges, safe file and symlink resolution, normalized and unique output paths (including file/directory conflicts), kit inventory/compiler-project correspondence, component manifests, declared styles/assets and local imports, and editor catalog references. Compatibility-range mismatches for versions available to the validator are reported as warnings; the editor range is parsed but is not compared because this CLI does not resolve an editor version. Schema or semantic errors return a nonzero exit code. The command is read-only: it does not compile targets, write artifacts, publish packages, or claim target semantic parity. The `--root` option defaults to the current directory.
|
|
12
19
|
|
|
13
20
|
The command defaults to `designos.project.json` and `dist/designos/<target>`. `--out-dir` must be a dedicated subdirectory under the project’s `dist` directory. Existing generated files at matching paths are replaced; unrelated output files are left untouched. For version-1 projects, component `outputDirectory` values are relative to the target output root and default to `components`. For version-2 source projects, the default generated module directory follows the source file's relative directory, preserving relative imports. Declared asset `outputPath` values are relative to the target output root and default to their project-relative `source` path.
|
|
@@ -36,7 +43,10 @@ A minimal config has this shape. Project-level `styles` are copied into every ta
|
|
|
36
43
|
},
|
|
37
44
|
"outputDirectory": "src/components",
|
|
38
45
|
"assets": [
|
|
39
|
-
{
|
|
46
|
+
{
|
|
47
|
+
"source": "src/assets/hero-glow.png",
|
|
48
|
+
"outputPath": "src/assets/hero-glow.png"
|
|
49
|
+
}
|
|
40
50
|
]
|
|
41
51
|
}
|
|
42
52
|
]
|
|
@@ -66,10 +76,10 @@ Example `designos.project.json`:
|
|
|
66
76
|
}
|
|
67
77
|
```
|
|
68
78
|
|
|
69
|
-
The manifest path contains the DesignOS editor manifest (`type`, `displayName`, `fields`, `slots` and optional capabilities). The CLI emits these separately in `manifests.json`, keyed by stable component `type`; the target component registry remains a separate build-time module. TSX and Mitosis runtime behavior remain in the component source; neither is written into `PageDocument`. Paths are project-relative and the CLI rejects paths that escape the project root. Declared `styles` are copied and imported by the generated component entry module; `assets` are copied without automatic bundling or reference rewriting. Declare CSS under `styles` even when it is imported in source, because Mitosis does not necessarily retain stylesheet imports in generated targets. The consuming build environment remains responsible for installing third-party packages.
|
|
79
|
+
The manifest path contains the DesignOS editor manifest (`type`, `displayName`, `fields`, `slots` and optional capabilities). The CLI emits these separately in `manifests.json`, keyed by stable component `type`; the target component registry remains a separate build-time module. TSX and Mitosis runtime behavior remain in the component source; neither is written into `PageDocument`. Paths are project-relative and the CLI rejects paths that escape the project root. Declared `styles` are copied and imported by the generated component entry module; `assets` are copied without automatic bundling or reference rewriting. Declare CSS under `styles` even when it is imported in source, because Mitosis does not necessarily retain stylesheet imports in generated targets. The consuming build environment remains responsible for installing third-party packages. From the repository root, compile the included source-project sample with `node packages/compiler-cli/dist/cli.js compile --target react --project-root packages/compiler-cli/examples/designos-source --config designos.project.json`. In a consuming project with the CLI installed as a dependency, run `pnpm exec designos compile --target react` from that project root. A complete source-project sample is in [`examples/designos-source`](./examples/designos-source/). React is the editor's initial preview target; this does not imply that all targets preserve all Mitosis semantics.
|
|
70
80
|
|
|
71
81
|
The React and Vue renderer examples use `apps/shared-designos/designos.project.json` to compile their framework-specific maps, and import the same `apps/shared-designos/openpage-page.json` neutral page document. Their app scripts run `compile:designos` before typecheck/build/dev. Generated compiler modules stay in `dist/designos/<target>`; Vite writes the deployable app bundle separately to `dist/site`. Current Mitosis React TSX output is marked `@ts-nocheck` because the bridge does not yet preserve all prop and inferred callback types; the CLI diagnostics remain visible and this must not be read as semantic parity or a substitute for the remaining target audits.
|
|
72
82
|
|
|
73
83
|
The editor app demos use the `PagePublisher` interface through a localStorage-backed adapter for demonstration only. Production SaaS integrations should inject their own adapter; the editor does not call the component compiler at publish time, and publishing a page JSON snapshot does not itself compile or deploy framework code.
|
|
74
84
|
|
|
75
|
-
For
|
|
85
|
+
For clean monorepo checkouts, use the built Node entry point shown above. In a consuming project with `@designos/compiler-cli` installed as a dependency, `pnpm exec designos` resolves the package's bin from that project. After the package is published, it can also be installed globally with `pnpm add --global @designos/compiler-cli`; its bin name is `designos`.
|