@yopem-ui/cli 0.1.2 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +85 -73
  2. package/package.json +1 -1
  3. package/src/init.ts +0 -2
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # @yopem-ui/cli
2
2
 
3
- Copy Yopem UI components and configure StyleX in an existing React project.
4
- Requires Bun. Registry requests default to `https://ui.yopem.com/r`.
3
+ Copy Yopem UI components into an existing React project. Configure StyleX with
4
+ the CLI. The CLI requires Bun. Registry requests use `https://ui.yopem.com/r` by
5
+ default.
5
6
 
6
7
  ```sh
7
8
  bunx @yopem-ui/cli init
@@ -11,19 +12,20 @@ bunx @yopem-ui/cli --help
11
12
  bunx @yopem-ui/cli --version
12
13
  ```
13
14
 
14
- No arguments or `--help` (`-h`) prints usage; `--version` (`-v`) prints the
15
- installed CLI version. These commands need no project and exit successfully.
16
- Invalid commands or arguments exit with status 1.
15
+ Run the CLI without arguments, or with `--help` (`-h`), to show usage. Use
16
+ `--version` (`-v`) to show the installed CLI version. These commands do not need
17
+ a project. They exit successfully. Invalid commands or arguments exit with
18
+ status 1.
17
19
 
18
- `init` supports Vite, TanStack Router, TanStack Start, React Router, Next.js App
19
- Router, and Astro. Pass `--framework <name>` if autodetection is ambiguous.
20
- Installed source changes stay intact on `init` and `add`; `update` rejects
21
- modified files unless `--force` is supplied. Installed files and their hashes
22
- are tracked in `ui.json`.
20
+ The `init` command supports Vite, TanStack Router, TanStack Start, React Router,
21
+ Next.js App Router, and Astro. Pass `--framework <name>` if the CLI cannot
22
+ identify one framework. The `init` and `add` commands keep local changes to
23
+ installed source. The `update` command rejects modified files unless you pass
24
+ `--force`. The CLI records installed files and their hashes in `ui.json`.
23
25
 
24
26
  ## Dry run
25
27
 
26
- Preview `add` or `update` before installing:
28
+ Preview `add` or `update` before installation:
27
29
 
28
30
  ```sh
29
31
  bunx @yopem-ui/cli add button --dry-run
@@ -31,33 +33,35 @@ bunx @yopem-ui/cli update button --dry-run
31
33
  bunx @yopem-ui/cli update button --dry-run --force
32
34
  ```
33
35
 
34
- The plan lists file writes (including tracking in `ui.json`), skips, all local
35
- file conflicts, and runtime/dev dependency additions. Forced source overwrites
36
- are marked explicitly. As in normal mode, `add` skips modified tracked files;
37
- `update` reports them as conflicts without `--force`. Conflicts block a real
38
- install until resolved or forced. Dependency lists show the package arguments
39
- the installer would request, not package-manager version resolution.
40
-
41
- Dry runs still read the registry and validate URLs, schemas, paths, and file
42
- integrity. They write no files, create no directories or temporary files, never
43
- run a package manager, and do not create or change `ui.json`, project config,
44
- package manifests, lockfiles, or dependencies. `--cwd` and `--registry` work as
45
- usual. `init --dry-run` and `initProject({ dryRun: true })` are rejected before
46
- any changes.
47
-
48
- Programmatic callers use `installItem(name, { dryRun: true })` through
49
- `@yopem-ui/cli/install`. The result adds `preview.files` (`path`, `action`,
50
- optional `reason` and `forced`), `preview.dependencies`, and
51
- `preview.devDependencies`; `installed` is zero. Normal calls retain their
52
- `{ installed, skipped }` result. Previewed writes apply when no conflicts block
53
- the command and files have not changed before a subsequent real install.
36
+ The plan lists file writes, skipped files, local conflicts, and runtime and
37
+ development dependency additions. File writes include tracking changes in
38
+ `ui.json`. The plan identifies forced source overwrites explicitly. As in normal
39
+ mode, `add` skips modified tracked files. Without `--force`, `update` reports
40
+ those files as conflicts. Resolve conflicts before a real installation, or use
41
+ `--force` to overwrite files. Dependency lists show requested package arguments,
42
+ not package-manager version resolution.
43
+
44
+ Dry runs read the registry. They validate URLs, schemas, paths, and file
45
+ integrity. They do not write files or create directories or temporary files.
46
+ They do not run a package manager. They do not change `ui.json`, project
47
+ configuration, package manifests, lockfiles, or dependencies. Use `--cwd` and
48
+ `--registry` as usual. The `init --dry-run` command also previews setup for
49
+ supported frameworks and shared UI workspaces.
50
+
51
+ Programmatic callers can use `installItem(name, { dryRun: true })` through
52
+ `@yopem-ui/cli/install`. The result includes `preview.files`,
53
+ `preview.dependencies`, and `preview.devDependencies`. Each preview file has
54
+ `path` and `action`, with optional `reason` and `forced`. The `installed` count
55
+ is zero. Normal calls return `{ installed, skipped }`. Previewed writes apply
56
+ only if no conflicts block the command and files remain unchanged before the
57
+ real installation.
54
58
 
55
59
  ## Registry
56
60
 
57
61
  Pass `--registry <URL>` to `init`, `add`, or `update` to use another registry.
58
- The override applies to that command only; it is not stored in `ui.json`. URLs
59
- must use HTTPS, except HTTP on `localhost` or loopback addresses. Credentials,
60
- query strings, and fragments are rejected.
62
+ The setting applies only to that command. The CLI does not store it in
63
+ `ui.json`. URLs must use HTTPS, except HTTP on `localhost` or loopback
64
+ addresses. The CLI rejects credentials, query strings, and fragments.
61
65
 
62
66
  For local development, start this repository's docs server with `bun run dev`:
63
67
 
@@ -67,16 +71,17 @@ bunx @yopem-ui/cli add button --registry http://localhost:3100/r
67
71
  bunx @yopem-ui/cli update button --registry http://localhost:3100/r
68
72
  ```
69
73
 
70
- Each request has a 30-second timeout covering connection and JSON body reads.
71
- Failures report timeout, network, HTTP status, or malformed JSON details without
72
- writing source, configuration, or dependencies. Programmatic callers can set
73
- `InstallOptions.registryUrl` and `requestTimeoutMs` (milliseconds).
74
+ Each request has a 30-second timeout for connection and JSON body reads.
75
+ Failures report timeout, network, HTTP status, or malformed JSON details. The
76
+ CLI makes no source, configuration, or dependency changes after these failures.
77
+ Programmatic callers can set `InstallOptions.registryUrl` and
78
+ `requestTimeoutMs`. The timeout uses milliseconds.
74
79
 
75
80
  ## Monorepos
76
81
 
77
- Target an app from the repository root with `--cwd`. Package manager detection
78
- uses the app and its workspace root; dependencies stay in the target package.
79
- Bun, npm, pnpm, and Yarn workspaces are supported.
82
+ Use `--cwd` to target an app from the repository root. The CLI detects the
83
+ package manager from the app and its workspace root. Dependencies stay in the
84
+ target package. The CLI supports Bun, npm, pnpm, and Yarn workspaces.
80
85
 
81
86
  ```sh
82
87
  bunx @yopem-ui/cli init --cwd apps/web
@@ -84,7 +89,8 @@ bunx @yopem-ui/cli add button --cwd apps/web
84
89
  ```
85
90
 
86
91
  For shared components, use an existing named React package in the same
87
- workspace. `--ui` is relative to the target app, not the repository root.
92
+ workspace. The `--ui` path is relative to the target app, not the repository
93
+ root.
88
94
 
89
95
  ```sh
90
96
  bunx @yopem-ui/cli init --cwd apps/web --ui ../../packages/ui
@@ -92,20 +98,22 @@ bunx @yopem-ui/cli add button --cwd packages/ui
92
98
  bunx @yopem-ui/cli update button --cwd packages/ui
93
99
  ```
94
100
 
95
- `init --ui` installs base files in the UI package, adds source subpath exports,
96
- links the app, and configures StyleX to scan both packages. Next.js also gets
97
- `transpilePackages`. Init registers shared package imports with the Yopem UI
98
- Oxlint rules, preserving existing rule options and explicit opt-outs. Shared
99
- source imports use the UI package name, such as `@acme/ui/components/ui/button`;
100
- later `add` and `update` reuse that name from its `ui.json`. Run `init --ui` for
101
- each consuming app and keep passing `--ui` when repeating init. Existing
102
- conflicting exports or build configuration require manual review; init does not
103
- migrate app-local components.
101
+ The `init --ui` command installs base files in the UI package. It adds source
102
+ subpath exports and links the app. It configures StyleX to scan both packages.
103
+ For Next.js, it also adds `transpilePackages`. The command registers shared
104
+ package imports with the Yopem UI Oxlint rules. It keeps existing rule options
105
+ and explicit opt-outs.
106
+
107
+ Shared source imports use the UI package name, such as
108
+ `@acme/ui/components/ui/button`. Later `add` and `update` commands use that name
109
+ from the package's `ui.json`. Run `init --ui` for each consuming app. Pass
110
+ `--ui` again when you repeat init. Review conflicting exports or build
111
+ configuration manually. The init command does not migrate app-local components.
104
112
 
105
113
  ## Development checks
106
114
 
107
- From the repository root, generate registry fixtures and build the lint plugin
108
- before running CLI tests:
115
+ Generate registry fixtures from the repository root. Build the lint plugin
116
+ before you run CLI tests:
109
117
 
110
118
  ```sh
111
119
  bun run registry:build
@@ -113,27 +121,31 @@ bun run --cwd packages/oxlint-plugin build
113
121
  bun test packages/cli
114
122
  ```
115
123
 
116
- `bun run --cwd packages/cli test` also runs the CLI suite. Tests use `bun:test`,
117
- not browsers; packaged installation checks explicitly pass a local `--registry`
118
- and serve registry JSON with Bun when port 3100 has no registry server. Registry
119
- network tests use isolated local Bun servers for successful workflows, header
120
- and body stalls, malformed JSON, and HTTP/network failures. Command logs and
121
- configuration artifacts are saved in `packages/cli/test-results/`.
122
-
123
- `bun test packages/cli/test/dry-run.test.ts` checks real fixture projects with
124
- local registries, whole-project file/directory snapshots, dependency-call
125
- tracking, conflict/force previews, shared import prefixes, validation failures,
126
- and CLI argument rules. Snapshot and preview evidence is saved in
127
- `step5-dry-run.json` under the results directory.
128
-
129
- `bun test packages/cli/test/public.test.ts` runs packed CLI production smoke
130
- checks: help, version matching the packed manifest, dry-run previews, init, add
131
- Button, lint, and build in Vite and Next.js App Router apps, including shared UI
132
- workspaces. Requires Node.js for Next.js and network access for fixture
133
- dependencies. Tests verify build artifacts and compiled StyleX CSS, then save
134
- `packaged-*.log`, `packaged-*.html`, and `packaged-*.css` evidence.
124
+ The `bun run --cwd packages/cli test` command also runs the CLI suite. Tests use
125
+ `bun:test`, not browsers. Packaged installation checks explicitly pass a local
126
+ `--registry`. They serve registry JSON with Bun if port 3100 has no registry
127
+ server.
128
+
129
+ Registry network tests use isolated local Bun servers. They cover successful
130
+ workflows, header and body stalls, malformed JSON, and HTTP and network
131
+ failures. Tests save command logs and configuration artifacts in
132
+ `packages/cli/test-results/`.
133
+
134
+ Run `bun test packages/cli/test/dry-run.test.ts` for real fixture project
135
+ checks. These checks use local registries and complete file and directory
136
+ snapshots. They cover dependency-call tracking, conflict and force previews,
137
+ shared import prefixes, validation failures, and CLI argument rules. Tests save
138
+ snapshot and preview evidence in `step5-dry-run.json` in the results directory.
139
+
140
+ Run `bun test packages/cli/test/public.test.ts` for packed CLI production
141
+ checks. These checks cover help, version matching, dry-run previews, init,
142
+ Button installation, lint, and builds. They use Vite and Next.js App Router
143
+ apps, including shared UI workspaces. Next.js checks require Node.js. Fixture
144
+ dependencies require network access. Tests verify build artifacts and compiled
145
+ StyleX CSS. They save evidence in `packaged-*.log`, `packaged-*.html`, and
146
+ `packaged-*.css`.
135
147
 
136
148
  ## Licence
137
149
 
138
- This project is licensed under the terms of the
150
+ This project uses the
139
151
  [MIT license](https://github.com/yopem/ui/blob/main/LICENSE.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yopem-ui/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "CLI for installing Yopem UI source components and StyleX setup",
5
5
  "keywords": [
6
6
  "cli",
package/src/init.ts CHANGED
@@ -1402,7 +1402,6 @@ const lintRules = {
1402
1402
  "yopem-ui/no-raw-stylex-colors": "error",
1403
1403
  "yopem-ui/prefer-layout-primitives": "error",
1404
1404
  "yopem-ui/static-stylex": "error",
1405
- "yopem-ui/valid-polymorphic-as": "error",
1406
1405
  }
1407
1406
 
1408
1407
  function lintConfig(content: string, shared?: SharedUI) {
@@ -1441,7 +1440,6 @@ function lintConfig(content: string, shared?: SharedUI) {
1441
1440
  for (const name of [
1442
1441
  "yopem-ui/enforce-styling-methods",
1443
1442
  "yopem-ui/no-restyle",
1444
- "yopem-ui/valid-polymorphic-as",
1445
1443
  ]) {
1446
1444
  const setting = configuredRules[name] ?? "error"
1447
1445
  const level = Array.isArray(setting) ? (setting[0] ?? "error") : setting