Commit 9913348
committed
refactor: rename editable modules to edit for brevity
Rename editable modules to edit to reduce typing:
- src/json/editable.ts → src/json/edit.ts
- src/packages/editable.ts → src/packages/edit.ts
- test/unit/packages/editable.test.ts → test/unit/packages/edit.test.ts
Update all imports and exports:
- package.json: ./json/editable → ./json/edit, ./packages/editable → ./packages/edit
- src/packages.ts: Update import from './packages/editable' to './packages/edit'
- src/packages/operations.ts: Update import from './editable' to './edit'
- test/unit/json.test.ts: Update require from json/editable to json/edit
- test/unit/packages/edit.test.ts: Update import from packages/editable to packages/edit
Fix esm-imports.test.mjs:
- Convert from node:test API to vitest for compatibility
- Replace assert.strictEqual with expect().toBe()
- Replace assert.ok with expect().toBe(true)
All tests passing (6055 tests).
refactor: reorganize constants and dlx into subdirectories
Move constant files to constants/ and dlx files to dlx/ for better organization:
Constants moved to constants/:
- src/maintained-node-versions.ts → src/constants/maintained-node-versions.ts
- src/package-default-node-range.ts → src/constants/package-default-node-range.ts
- src/package-default-socket-categories.ts → src/constants/package-default-socket-categories.ts
- src/lifecycle-script-names.ts → src/constants/lifecycle-script-names.ts
DLX files moved to dlx/ (no index.ts):
- src/dlx.ts → src/dlx/main.ts
- src/dlx-binary.ts → src/dlx/binary.ts
- src/dlx-manifest.ts → src/dlx/manifest.ts
- src/dlx-package.ts → src/dlx/package.ts
Updated all imports:
- src/constants/node.ts: Import from ./maintained-node-versions
- src/constants/packages.ts: Import from ./lifecycle-script-names, ./package-default-*
- src/constants/package-default-node-range.ts: Import from ../external/semver.js
- src/dlx/*.ts: Update all internal and external imports to use ../
Updated package.json exports:
- ./maintained-node-versions → ./constants/maintained-node-versions
- ./package-default-node-range → ./constants/package-default-node-range
- ./package-default-socket-categories → ./constants/package-default-socket-categories
- ./lifecycle-script-names → ./constants/lifecycle-script-names
- ./dlx → ./dlx/main
- ./dlx-binary → ./dlx/binary
- ./dlx-manifest → ./dlx/manifest
- ./dlx-package → ./dlx/package
Moved test files to match new structure:
- test/unit/maintained-node-versions.test.ts → test/unit/constants/maintained-node-versions.test.ts
- test/unit/package-default-node-range.test.ts → test/unit/constants/package-default-node-range.test.ts
- test/unit/package-default-socket-categories.test.ts → test/unit/constants/package-default-socket-categories.test.ts
- test/unit/lifecycle-script-names.test.ts → test/unit/constants/lifecycle-script-names.test.ts
- test/unit/dlx.test.ts → test/unit/dlx/main.test.ts
- test/unit/dlx-binary.test.ts → test/unit/dlx/binary.test.ts
- test/unit/dlx-manifest.test.ts → test/unit/dlx/manifest.test.ts
- test/unit/dlx-package.test.ts → test/unit/dlx/package.test.ts
Updated test imports to use new module paths.
All tests passing (6060 tests).
refactor(dlx): split main.ts into focused modules
Split dlx/main.ts into smaller, focused modules for better organization
and maintainability.
Changes:
- Create dlx/cache.ts for cache key generation (generateCacheKey)
- Create dlx/paths.ts for path utilities (getDlxPackageDir, getDlxInstalledPackageDir, getDlxPackageJsonPath, getDlxPackageNodeModulesDir, isInSocketDlx)
- Create dlx/dir.ts for directory management (clearDlx, clearDlxSync, dlxDirExists, dlxDirExistsAsync, ensureDlxDir, ensureDlxDirSync)
- Create dlx/packages.ts for package management (isDlxPackageInstalled, isDlxPackageInstalledAsync, listDlxPackages, listDlxPackagesAsync, removeDlxPackage, removeDlxPackageSync)
- Remove old dlx/main.ts file
- Update imports in dlx/binary.ts and dlx/package.ts to use dlx/cache
- Update package.json exports:
- Remove ./dlx/main
- Add ./dlx/cache, ./dlx/dir, ./dlx/packages, ./dlx/paths
- Update test imports in test/unit/dlx/main.test.ts to use split modules
- All tests passing (182 tests, 179 passed, 3 skipped)1 parent 422b122 commit 9913348
File tree
29 files changed
+433
-381
lines changed- src
- constants
- dlx
- json
- packages
- test/unit
- constants
- dlx
- packages
29 files changed
+433
-381
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
154 | 162 | | |
155 | 163 | | |
156 | 164 | | |
157 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
158 | 174 | | |
159 | 175 | | |
160 | 176 | | |
| |||
203 | 219 | | |
204 | 220 | | |
205 | 221 | | |
206 | | - | |
207 | | - | |
208 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
209 | 233 | | |
210 | | - | |
211 | | - | |
212 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
213 | 237 | | |
214 | | - | |
215 | | - | |
216 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
217 | 241 | | |
218 | | - | |
219 | | - | |
220 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
221 | 249 | | |
222 | 250 | | |
223 | 251 | | |
| |||
355 | 383 | | |
356 | 384 | | |
357 | 385 | | |
358 | | - | |
359 | | - | |
360 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
361 | 389 | | |
362 | 390 | | |
363 | 391 | | |
| |||
371 | 399 | | |
372 | 400 | | |
373 | 401 | | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | 402 | | |
379 | 403 | | |
380 | 404 | | |
| |||
387 | 411 | | |
388 | 412 | | |
389 | 413 | | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | 414 | | |
395 | 415 | | |
396 | 416 | | |
| |||
399 | 419 | | |
400 | 420 | | |
401 | 421 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | 422 | | |
411 | 423 | | |
412 | 424 | | |
| |||
415 | 427 | | |
416 | 428 | | |
417 | 429 | | |
418 | | - | |
419 | | - | |
420 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
421 | 433 | | |
422 | 434 | | |
423 | 435 | | |
| |||
File renamed without changes.
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
0 commit comments