@archon-research/uikit-cli 0.3.0-rohit-improve-cli.2 → 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/README.md +84 -32
- package/dist/cli.js +151 -443
- package/dist/cli.sh +10 -0
- package/dist/command-executor.js +41 -0
- package/dist/commands/format.js +36 -0
- package/dist/commands/link.js +162 -0
- package/dist/commands/lint.js +14 -0
- package/dist/commands/register.js +35 -0
- package/dist/commands/unlink.js +64 -0
- package/dist/fs-utils.js +56 -0
- package/dist/link-validator.js +80 -0
- package/dist/logger.js +43 -0
- package/dist/package-discovery.js +168 -0
- package/dist/shell-utils.js +9 -0
- package/dist/types.js +1 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -2,54 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
CLI tool for local package linking during active development with consumer repositories.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Setup (One-time)
|
|
6
|
+
|
|
7
|
+
### 1. Configure npm prefix for writable global packages
|
|
8
|
+
|
|
9
|
+
If using nix-managed Node.js, configure npm to use a writable location:
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
|
-
npm
|
|
12
|
+
npm config set prefix ~/.npm-global
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
Add to your shell profile (e.g., `~/.zshrc`):
|
|
16
|
+
```bash
|
|
17
|
+
export PATH="$HOME/.npm-global/bin:$PATH"
|
|
18
|
+
```
|
|
12
19
|
|
|
13
|
-
###
|
|
20
|
+
### 2. Link CLI in uikit monorepo
|
|
14
21
|
|
|
15
|
-
From
|
|
22
|
+
From the uikit repository root:
|
|
16
23
|
|
|
17
24
|
```bash
|
|
18
|
-
uikit-cli
|
|
19
|
-
uikit-cli format -c ./.oxfmtrc.ts --write "src/**/*.ts" "src/**/*.tsx" panda.config.ts vite.config.ts
|
|
25
|
+
npm link --workspace packages/uikit-cli
|
|
20
26
|
```
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
This makes the CLI available globally via workspace linking.
|
|
29
|
+
|
|
30
|
+
### 3. Link CLI into consumer repository
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
From your consumer repository root:
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
```bash
|
|
35
|
+
npm link @archon-research/uikit-cli --workspace <workspace-name>
|
|
36
|
+
```
|
|
28
37
|
|
|
38
|
+
Example for stl-verify:
|
|
29
39
|
```bash
|
|
30
|
-
|
|
40
|
+
cd /path/to/stl-verify/ts
|
|
41
|
+
npm link @archon-research/uikit-cli --workspace ui
|
|
31
42
|
```
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Run lint and format tools without downstream installs
|
|
47
|
+
|
|
48
|
+
From any consumer workspace:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
./node_modules/.bin/uikit-cli lint -c ./.oxlintrc.ts src panda.config.ts vite.config.ts
|
|
52
|
+
./node_modules/.bin/uikit-cli format -c ./.oxfmtrc.ts --write "src/**/*.ts" "src/**/*.tsx" panda.config.ts vite.config.ts
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The CLI runs pinned `oxlint` and `oxfmt` versions internally, so downstream workspaces do not
|
|
56
|
+
need to declare those tool packages directly.
|
|
35
57
|
|
|
36
58
|
### Link uikit packages into a consumer repository
|
|
37
59
|
|
|
38
60
|
From your consumer repository:
|
|
39
61
|
|
|
40
62
|
```bash
|
|
41
|
-
uikit-cli link
|
|
63
|
+
./node_modules/.bin/uikit-cli link
|
|
42
64
|
```
|
|
43
65
|
|
|
44
66
|
This command links all `@archon-research/*` packages from your local uikit monorepo into your consumer project, allowing you to develop packages and see changes immediately.
|
|
45
67
|
|
|
68
|
+
Verify links are working:
|
|
69
|
+
```bash
|
|
70
|
+
./node_modules/.bin/uikit-cli link --verify
|
|
71
|
+
```
|
|
72
|
+
|
|
46
73
|
Add this script to your consumer's `package.json`:
|
|
47
74
|
|
|
48
75
|
```json
|
|
49
76
|
{
|
|
50
77
|
"scripts": {
|
|
51
|
-
"uikit:link": "uikit-cli link",
|
|
52
|
-
"uikit:unlink": "uikit-cli unlink"
|
|
78
|
+
"uikit:link": "./node_modules/.bin/uikit-cli link",
|
|
79
|
+
"uikit:unlink": "./node_modules/.bin/uikit-cli unlink"
|
|
53
80
|
}
|
|
54
81
|
}
|
|
55
82
|
```
|
|
@@ -59,16 +86,17 @@ Add this script to your consumer's `package.json`:
|
|
|
59
86
|
When co-development is complete, restore published versions from npm:
|
|
60
87
|
|
|
61
88
|
```bash
|
|
62
|
-
uikit-cli unlink
|
|
89
|
+
./node_modules/.bin/uikit-cli unlink
|
|
63
90
|
```
|
|
64
91
|
|
|
65
92
|
## How it works
|
|
66
93
|
|
|
67
94
|
The CLI manages local development links by:
|
|
68
95
|
|
|
69
|
-
1. Auto-registering local `@archon-research/*` packages from your uikit checkout
|
|
96
|
+
1. Auto-registering local `@archon-research/*` packages from your uikit checkout via `npm link`
|
|
70
97
|
2. Linking only consumer workspaces that actually depend on those packages
|
|
71
|
-
3.
|
|
98
|
+
3. Cleaning up shadow installs and Vite caches to ensure symlinks work correctly
|
|
99
|
+
4. Using `--preserve-symlinks` flag and bundling to avoid ES module resolution issues
|
|
72
100
|
|
|
73
101
|
The CLI automatically detects the consumer workspace root and all dependent packages, working from any directory within the workspace.
|
|
74
102
|
|
|
@@ -77,28 +105,52 @@ The CLI auto-discovers the local uikit monorepo for typical sibling-checkout lay
|
|
|
77
105
|
## Requirements
|
|
78
106
|
|
|
79
107
|
- Local clone of the uikit monorepo
|
|
80
|
-
- Node.js and npm installed
|
|
108
|
+
- Node.js 24+ and npm installed
|
|
109
|
+
- Writable npm prefix configured (see Setup)
|
|
110
|
+
|
|
111
|
+
## Troubleshooting
|
|
112
|
+
|
|
113
|
+
### "EACCES: permission denied" when using npm link
|
|
114
|
+
|
|
115
|
+
You need to configure npm to use a writable prefix location. See Setup step 1 above.
|
|
116
|
+
|
|
117
|
+
### "ENOENT: no such file or directory" errors
|
|
81
118
|
|
|
82
|
-
|
|
119
|
+
Use the workspace-based linking approach (Setup steps 2-3) instead of global npm link. The CLI bundle includes `--preserve-symlinks` to handle ES module resolution with symlinks.
|
|
83
120
|
|
|
84
|
-
|
|
121
|
+
### Links not working after linking
|
|
122
|
+
|
|
123
|
+
Run with `--verify` flag to check link status:
|
|
124
|
+
```bash
|
|
125
|
+
./node_modules/.bin/uikit-cli link --verify
|
|
126
|
+
```
|
|
85
127
|
|
|
86
128
|
## Development workflow
|
|
87
129
|
|
|
88
|
-
In a
|
|
130
|
+
In a consumer workspace:
|
|
89
131
|
|
|
90
132
|
```bash
|
|
91
|
-
#
|
|
92
|
-
uikit-cli
|
|
133
|
+
# One-time setup (see Setup section above)
|
|
134
|
+
npm link @archon-research/uikit-cli --workspace <workspace-name>
|
|
93
135
|
|
|
94
136
|
# Link uikit packages for local development
|
|
95
|
-
uikit
|
|
137
|
+
npm run uikit:link
|
|
96
138
|
|
|
97
|
-
#
|
|
98
|
-
uikit
|
|
139
|
+
# Verify links
|
|
140
|
+
npm run uikit:link -- --verify
|
|
141
|
+
|
|
142
|
+
# Later, restore registry versions
|
|
143
|
+
npm run uikit:unlink
|
|
99
144
|
```
|
|
100
145
|
|
|
101
|
-
##
|
|
146
|
+
## Debug mode
|
|
102
147
|
|
|
103
|
-
|
|
104
|
-
|
|
148
|
+
Run with debug output:
|
|
149
|
+
```bash
|
|
150
|
+
UIKIT_DEBUG=1 ./node_modules/.bin/uikit-cli link --verify
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Or use the `--debug` flag:
|
|
154
|
+
```bash
|
|
155
|
+
./node_modules/.bin/uikit-cli link --debug --verify
|
|
156
|
+
```
|