@_linked/cli 1.41.1 → 1.42.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/CHANGELOG.md +17 -0
- package/README.md +21 -54
- package/lib/esm/cli-methods.js +2 -2
- package/lib/esm/cli-methods.js.map +1 -1
- package/lib/esm/cli.js +13 -1
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/commands/localize.d.ts +6 -15
- package/lib/esm/commands/localize.d.ts.map +1 -1
- package/lib/esm/commands/localize.js +26 -35
- package/lib/esm/commands/localize.js.map +1 -1
- package/lib/esm/installed-packages.d.ts +12 -12
- package/lib/esm/installed-packages.d.ts.map +1 -1
- package/lib/esm/installed-packages.js +37 -27
- package/lib/esm/installed-packages.js.map +1 -1
- package/lib/esm/lifecycle.d.ts +4 -3
- package/lib/esm/lifecycle.d.ts.map +1 -1
- package/lib/esm/lifecycle.js +6 -14
- package/lib/esm/lifecycle.js.map +1 -1
- package/lib/esm/localize/adopt.d.ts +10 -0
- package/lib/esm/localize/adopt.d.ts.map +1 -0
- package/lib/esm/localize/adopt.js +76 -0
- package/lib/esm/localize/adopt.js.map +1 -0
- package/lib/esm/localize/delocalize.d.ts +6 -0
- package/lib/esm/localize/delocalize.d.ts.map +1 -0
- package/lib/esm/localize/delocalize.js +138 -0
- package/lib/esm/localize/delocalize.js.map +1 -0
- package/lib/esm/localize/ensure.d.ts +26 -0
- package/lib/esm/localize/ensure.d.ts.map +1 -0
- package/lib/esm/localize/ensure.js +152 -0
- package/lib/esm/localize/ensure.js.map +1 -0
- package/lib/esm/localize/errors.d.ts +23 -0
- package/lib/esm/localize/errors.d.ts.map +1 -0
- package/lib/esm/localize/errors.js +26 -0
- package/lib/esm/localize/errors.js.map +1 -0
- package/lib/esm/localize/fsops.d.ts +36 -0
- package/lib/esm/localize/fsops.d.ts.map +1 -0
- package/lib/esm/localize/fsops.js +155 -0
- package/lib/esm/localize/fsops.js.map +1 -0
- package/lib/esm/localize/index.d.ts +29 -0
- package/lib/esm/localize/index.d.ts.map +1 -0
- package/lib/esm/localize/index.js +22 -0
- package/lib/esm/localize/index.js.map +1 -0
- package/lib/esm/localize/list.d.ts +18 -0
- package/lib/esm/localize/list.d.ts.map +1 -0
- package/lib/esm/localize/list.js +174 -0
- package/lib/esm/localize/list.js.map +1 -0
- package/lib/esm/localize/localize.d.ts +84 -0
- package/lib/esm/localize/localize.d.ts.map +1 -0
- package/lib/esm/localize/localize.js +354 -0
- package/lib/esm/localize/localize.js.map +1 -0
- package/lib/esm/localize/manifest.d.ts +54 -0
- package/lib/esm/localize/manifest.d.ts.map +1 -0
- package/lib/esm/localize/manifest.js +133 -0
- package/lib/esm/localize/manifest.js.map +1 -0
- package/lib/esm/localize/provided.d.ts +28 -0
- package/lib/esm/localize/provided.d.ts.map +1 -0
- package/lib/esm/localize/provided.js +89 -0
- package/lib/esm/localize/provided.js.map +1 -0
- package/lib/esm/localize/prune.d.ts +58 -0
- package/lib/esm/localize/prune.d.ts.map +1 -0
- package/lib/esm/localize/prune.js +390 -0
- package/lib/esm/localize/prune.js.map +1 -0
- package/lib/esm/localize/relink.d.ts +11 -0
- package/lib/esm/localize/relink.d.ts.map +1 -0
- package/lib/esm/localize/relink.js +174 -0
- package/lib/esm/localize/relink.js.map +1 -0
- package/lib/esm/localize/resolve.d.ts +47 -0
- package/lib/esm/localize/resolve.d.ts.map +1 -0
- package/lib/esm/localize/resolve.js +153 -0
- package/lib/esm/localize/resolve.js.map +1 -0
- package/lib/esm/localize/run.d.ts +35 -0
- package/lib/esm/localize/run.d.ts.map +1 -0
- package/lib/esm/localize/run.js +30 -0
- package/lib/esm/localize/run.js.map +1 -0
- package/lib/esm/localized-dedupe.d.ts +6 -0
- package/lib/esm/localized-dedupe.d.ts.map +1 -1
- package/lib/esm/localized-dedupe.js +23 -66
- package/lib/esm/localized-dedupe.js.map +1 -1
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.42.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#222](https://github.com/linked-fw/cli/pull/222) [`4f7ce0c`](https://github.com/linked-fw/cli/commit/4f7ce0ca420d585eb1e286281c122638362de2ae) Thanks [@flyon](https://github.com/flyon)! - Localize is now part of the cli. `linked localize` and `linked delocalize` no longer load the separate `@_linked/localize` package, which is no longer a dependency and will be deprecated in favour of `linked localize`; its `linked-localize` binary is not replaced. The guide is in `docs/localize.md`.
|
|
8
|
+
|
|
9
|
+
New:
|
|
10
|
+
|
|
11
|
+
- `linked localize --ensure` removes every localized checkout's own copy of a package the app provides and exits 0. It never runs npm and prints nothing when there is nothing to remove — for an app's npm `pre*` scripts.
|
|
12
|
+
- `linked localize --reinstall <pkg>` runs `npm install` inside that package's checkout and then prunes it. Use it instead of a hand-run `npm install` in a checkout.
|
|
13
|
+
- A run-time one-copy check before `linked start`, `linked script`, `linked call` and `linked build-all`: stat-only, it removes a checkout's own copy of what the app provides with one line of output.
|
|
14
|
+
- `linked localize --list` shows directories in `packages-local/` that `local-packages.json` does not record, as `UNRECORDED` (they do not fail `--check`).
|
|
15
|
+
|
|
16
|
+
One rule now says what the app provides: the localized packages, plus their runtime dependencies (`dependencies`, `peerDependencies`, `optionalDependencies`) that the app has at a version satisfying every localized range, plus `react` and `react-dom`. Pruning, the run-time check and Vite's `resolve.dedupe` all use it.
|
|
17
|
+
|
|
18
|
+
Behaviour change: pruning now also removes a checkout's own copy of tooling or other runtime dependencies the app provides in range (for example `vite` or `typescript` declared in `dependencies`); the checkout resolves the app's copy instead. devDependencies are no longer candidates.
|
|
19
|
+
|
|
3
20
|
## 1.41.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -227,10 +227,10 @@ linked app-doctor # in an app: check optimizeDeps.include and Re
|
|
|
227
227
|
|
|
228
228
|
### Developing a dependency from a git checkout
|
|
229
229
|
|
|
230
|
-
`linked localize` clones an npm dependency, installs inside the checkout, builds
|
|
231
|
-
|
|
232
|
-
`package
|
|
233
|
-
|
|
230
|
+
`linked localize` clones an npm dependency, installs inside the checkout, builds it with
|
|
231
|
+
`linked build` and symlinks it into `node_modules` — **without** touching `package.json` or
|
|
232
|
+
`package-lock.json`, so the manifest still describes the released dependency and CI is unaffected.
|
|
233
|
+
Full guide: [docs/localize.md](docs/localize.md).
|
|
234
234
|
|
|
235
235
|
```bash
|
|
236
236
|
linked localize @_linked/rdfs # clone, install, build, symlink into node_modules
|
|
@@ -238,61 +238,28 @@ linked localize # report what is localized (same as --list)
|
|
|
238
238
|
linked localize --list --check # exit 1 when something recorded is not actually linked
|
|
239
239
|
linked localize --relink # recreate the recorded symlinks — run this from postinstall
|
|
240
240
|
linked localize @_linked/rdfs --adopt # link a checkout already in packages-local/_linked-rdfs, no clone
|
|
241
|
+
linked localize --reinstall @_linked/rdfs # npm install inside the checkout, then prune it
|
|
242
|
+
linked localize --ensure # remove checkouts' own copies of what the app provides; exit 0
|
|
241
243
|
linked delocalize @_linked/rdfs # unlink and forget, keeping the checkout
|
|
242
244
|
linked delocalize --purge # undo everything and delete the checkouts
|
|
243
245
|
```
|
|
244
246
|
|
|
245
247
|
Checkouts go in `packages-local/` under the npm name with the scope flattened:
|
|
246
|
-
`@_linked/rdfs` → `packages-local/_linked-rdfs`.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
`@_linked/core` (pinned by the checkout's lockfile, often older than the app's)
|
|
262
|
-
and a registry copy of any localized sibling in its `node_modules`, and Node
|
|
263
|
-
loads those instead of the app's. So after installing, and on every `--relink`,
|
|
264
|
-
`linked localize` removes from every checkout's `node_modules` its own copy of
|
|
265
|
-
a linked package the app has installed, `react` and `react-dom` (plus its
|
|
266
|
-
peerDependencies) when the app has a version that satisfies the checkout's range; a localized sibling always
|
|
267
|
-
counts. A copy the app's version does not satisfy is kept, with a warning naming
|
|
268
|
-
the package, the range and the app's version. The checkout still builds and runs
|
|
269
|
-
its tests, resolving those packages from the app — this CLI included: npm puts
|
|
270
|
-
every ancestor's `node_modules/.bin` on the `PATH`, so `npx linked build` in a
|
|
271
|
-
checkout runs the app's `linked`. `--no-prune` keeps every checkout's
|
|
272
|
-
`node_modules` as npm left it. The
|
|
273
|
-
A linked package is one whose `package.json` says `"linkedPackage": true` — the
|
|
274
|
-
definition `build-all` and `linked build` use — whatever its npm scope;
|
|
275
|
-
`@_linked/localize`, a plain tool, is not one.
|
|
276
|
-
|
|
277
|
-
The dev server gets the same guarantee from Vite's `resolve.dedupe`, which
|
|
278
|
-
`createViteConfig` derives from what is localized: the localized packages
|
|
279
|
-
themselves, plus every runtime dependency a localized checkout declares that the
|
|
280
|
-
app has at a version satisfying the checkout's range, plus React. A dependency
|
|
281
|
-
whose range the app does not satisfy keeps the checkout's own copy (the dev log
|
|
282
|
-
says which), and so does a name some registry install nests its own copy of —
|
|
283
|
-
a dedupe hands every importer the app's copy without checking versions. With
|
|
284
|
-
nothing localized, only React is deduped. The dedupe covers what Vite loads; the
|
|
285
|
-
removal on disk covers plain Node, `tsx` and test runners, which never read it.
|
|
286
|
-
|
|
287
|
-
The work is done by [`@_linked/localize`](https://www.npmjs.com/package/@_linked/localize),
|
|
288
|
-
which is dependency-free and framework-agnostic; this CLI supplies the
|
|
289
|
-
build command and the list of what an app provides. That package's own binary, `linked-localize`, is the same mechanism with
|
|
290
|
-
three differences: it builds nothing unless given `--build "<cmd>"`, it treats only localized
|
|
291
|
-
siblings and peerDependencies as provided unless given `--provided "<name>,…"`,
|
|
292
|
-
and its verbs are subcommands —
|
|
293
|
-
`linked-localize adopt <pkg>` and `linked-localize remove <pkg>` where this CLI has
|
|
294
|
-
`linked localize --adopt <pkg>` and `linked delocalize <pkg>`. In a linked app, use
|
|
295
|
-
`linked localize`.
|
|
248
|
+
`@_linked/rdfs` → `packages-local/_linked-rdfs`. `--list` also flags a directory there that
|
|
249
|
+
`local-packages.json` does not record (`UNRECORDED`).
|
|
250
|
+
|
|
251
|
+
**One copy of each package the app provides.** A checkout's own install leaves its own copies of
|
|
252
|
+
what it depends on, and Node loads those instead of the app's. One rule says what the app provides:
|
|
253
|
+
the localized packages, plus every runtime dependency (`dependencies`, `peerDependencies`,
|
|
254
|
+
`optionalDependencies`) a localized checkout declares that the app has at a version satisfying
|
|
255
|
+
every localized range, plus `react` and `react-dom`. After every install in a checkout and on every
|
|
256
|
+
`--relink`, the checkouts' own copies of those are removed; `linked start`, `script`, `call` and
|
|
257
|
+
`build-all` re-check first (stat-only, one line of output when it removes something), and
|
|
258
|
+
`createViteConfig` derives Vite's `resolve.dedupe` from the same rule. `--no-prune` keeps every
|
|
259
|
+
checkout's `node_modules` as npm left it.
|
|
260
|
+
|
|
261
|
+
Localize used to be the separate `@_linked/localize` package (binary `linked-localize`), now
|
|
262
|
+
deprecated; `linked localize` replaces it.
|
|
296
263
|
|
|
297
264
|
### Registry / dev utilities
|
|
298
265
|
|
package/lib/esm/cli-methods.js
CHANGED
|
@@ -1869,7 +1869,7 @@ export const createPackage = (name_1, uriBase_1, ...args_1) => __awaiter(void 0,
|
|
|
1869
1869
|
else {
|
|
1870
1870
|
// localize's own naming, so `linked localize` and this command can never
|
|
1871
1871
|
// disagree about where a package lives.
|
|
1872
|
-
const { checkoutNameFor, DEFAULT_DIR } = yield import('
|
|
1872
|
+
const { checkoutNameFor, DEFAULT_DIR } = yield import('./localize/index.js');
|
|
1873
1873
|
targetFolder = path.join(appRoot, DEFAULT_DIR, checkoutNameFor(name));
|
|
1874
1874
|
}
|
|
1875
1875
|
if (fs.existsSync(targetFolder)) {
|
|
@@ -2057,7 +2057,7 @@ function installOwnRepoPackage(name, targetFolder, appRoot, decision) {
|
|
|
2057
2057
|
log(`Added \`${RELINK_COMMAND}\` to the app's postinstall, so npm install keeps the link`);
|
|
2058
2058
|
}
|
|
2059
2059
|
const { adoptPackage } = yield import('./commands/localize.js');
|
|
2060
|
-
const { EXIT_WARNED } = yield import('
|
|
2060
|
+
const { EXIT_WARNED } = yield import('./localize/index.js');
|
|
2061
2061
|
// Only the build command matters here: adopt always installs with npm, so
|
|
2062
2062
|
// the package-manager half of the plan does not apply.
|
|
2063
2063
|
const { buildCommand } = planPackageSetup('', path.join(getScriptDir(), 'launch.js'), process.execPath);
|