@_linked/cli 1.28.2 → 1.30.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 +49 -0
- package/README.md +28 -0
- package/lib/esm/cli-methods.d.ts.map +1 -1
- package/lib/esm/cli-methods.js +8 -0
- package/lib/esm/cli-methods.js.map +1 -1
- package/lib/esm/cli.js +24 -0
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/commands/localize.d.ts +22 -0
- package/lib/esm/commands/localize.d.ts.map +1 -0
- package/lib/esm/commands/localize.js +69 -0
- package/lib/esm/commands/localize.js.map +1 -0
- package/lib/esm/utils/shapeNames.d.ts +2 -0
- package/lib/esm/utils/shapeNames.d.ts.map +1 -1
- package/lib/esm/utils/shapeNames.js +8 -0
- package/lib/esm/utils/shapeNames.js.map +1 -1
- package/lib/esm/utils/shapeReferences.d.ts +97 -0
- package/lib/esm/utils/shapeReferences.d.ts.map +1 -0
- package/lib/esm/utils/shapeReferences.js +308 -0
- package/lib/esm/utils/shapeReferences.js.map +1 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#175](https://github.com/linked-fw/cli/pull/175) [`816f961`](https://github.com/linked-fw/cli/commit/816f961709b03ea05341f1a2f62713f721f0e20a) Thanks [@flyon](https://github.com/flyon)! - `linked build` now checks that loading a shape module registers every shape its properties point at.
|
|
8
|
+
|
|
9
|
+
A property that names its value shape by `[package, name]` (`shape: ['@_linked/schema', 'ImageObject']`)
|
|
10
|
+
does not load that shape, and consumers deep-import single shape modules. So a package could ship a
|
|
11
|
+
module whose query `workspace.image.contentUrl` threw `Shape class not found for …/ImageObject` in a
|
|
12
|
+
production bundle where nothing else happened to load ImageObject — which is how Create Now came to
|
|
13
|
+
show "No organizations found". `@_linked/sioc` also named shapes under its old package name
|
|
14
|
+
(`lincd-sioc`), which could never resolve.
|
|
15
|
+
|
|
16
|
+
The new step, **Checking shape references**, runs after the ESM output is final. It loads every module
|
|
17
|
+
under `lib/esm/shapes/` (and any other module that declares a `@linkedShape`) in a `node` process of
|
|
18
|
+
its own, with nothing imported first, and then **fails the build** for:
|
|
19
|
+
|
|
20
|
+
- a module that throws when loaded on its own (e.g. `Cannot access 'X' before initialization`);
|
|
21
|
+
- a property of one of the package's shapes whose value shape is not registered — naming the
|
|
22
|
+
property, the missing shape's IRI and the modules that showed it, and whether the target package's
|
|
23
|
+
entry registers it (a missing import), does not (a wrong name), or the IRI belongs to no dependency
|
|
24
|
+
(an old package name).
|
|
25
|
+
|
|
26
|
+
`*.class.js` modules are skipped: they are the class half of a split shape module and are checked
|
|
27
|
+
through the public module that re-exports them. Asset imports (`.css`, images, fonts) load as stubs.
|
|
28
|
+
`@_linked/core`'s `PropertyShape.in → List` is a known, tracked gap and warns instead of failing.
|
|
29
|
+
|
|
30
|
+
## 1.29.0
|
|
31
|
+
|
|
32
|
+
### Minor Changes
|
|
33
|
+
|
|
34
|
+
- [#173](https://github.com/linked-fw/cli/pull/173) [`830b7b9`](https://github.com/linked-fw/cli/commit/830b7b9fea6f1704bb91e135397a2e9011a28289) Thanks [@flyon](https://github.com/flyon)! - Add `linked localize` and `linked delocalize`, for developing an npm dependency
|
|
35
|
+
from a git checkout.
|
|
36
|
+
|
|
37
|
+
`linked localize <package…>` clones the package's repository (resolved from the
|
|
38
|
+
registry's `repository` field), installs inside the checkout, builds it and
|
|
39
|
+
symlinks it into `node_modules` — without touching `package.json` or
|
|
40
|
+
`package-lock.json`. `--list`/`--check` report what is localized and whether it
|
|
41
|
+
really is, `--relink` recreates the recorded symlinks and is what a
|
|
42
|
+
`postinstall` should run, and `delocalize` undoes it.
|
|
43
|
+
|
|
44
|
+
The work is done by the new dependency-free `@_linked/localize`, which
|
|
45
|
+
deliberately has no opinion about how a checkout is built. That is the only
|
|
46
|
+
thing this CLI adds: it supplies `linked build` as the build command
|
|
47
|
+
(overridable with `--build`, disabled with `--build ""`).
|
|
48
|
+
|
|
49
|
+
Packages are named exactly as npm names them; there is no short-name expansion
|
|
50
|
+
and no org probing.
|
|
51
|
+
|
|
3
52
|
## 1.28.2
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -188,6 +188,34 @@ linked dev # file-watch rebuild (package)
|
|
|
188
188
|
linked yarn <args> # safe-yarn: run yarn at the workspace root, forwarding all args
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
+
### Developing a dependency from a git checkout
|
|
192
|
+
|
|
193
|
+
`linked localize` clones an npm dependency, installs inside the checkout, builds
|
|
194
|
+
it with `linked build` and symlinks it into `node_modules` — **without** touching
|
|
195
|
+
`package.json` or `package-lock.json`, so the manifest still describes the
|
|
196
|
+
released dependency and CI is unaffected.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
linked localize @_linked/rdfs # clone, install, build, symlink into node_modules
|
|
200
|
+
linked localize # report what is localized (same as --list)
|
|
201
|
+
linked localize --list --check # exit 1 when something recorded is not actually linked
|
|
202
|
+
linked localize --relink # recreate the recorded symlinks — run this from postinstall
|
|
203
|
+
linked delocalize @_linked/rdfs # unlink and forget, keeping the checkout
|
|
204
|
+
linked delocalize --purge # undo everything and delete the checkouts
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Name packages exactly as npm names them (`@_linked/rdfs`, `lodash`): the
|
|
208
|
+
repository is read from the package's published `repository` field, so there is
|
|
209
|
+
no short-name expansion and no org guessing. `--dir` moves the checkout
|
|
210
|
+
directory (default `packages-local`), `--repo`/`--subdir` cover a package whose
|
|
211
|
+
published metadata does not point at the right place, and `--build "<cmd>"`
|
|
212
|
+
replaces `linked build` (an empty string builds nothing). A failing build only
|
|
213
|
+
warns — a package whose build is broken is usually why you localized it.
|
|
214
|
+
|
|
215
|
+
The work is done by [`@_linked/localize`](https://www.npmjs.com/package/@_linked/localize),
|
|
216
|
+
which is dependency-free and framework-agnostic; this CLI only supplies the
|
|
217
|
+
build command.
|
|
218
|
+
|
|
191
219
|
### Registry / dev utilities
|
|
192
220
|
|
|
193
221
|
```bash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-methods.d.ts","sourceRoot":"","sources":["../../src/cli-methods.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-methods.d.ts","sourceRoot":"","sources":["../../src/cli-methods.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAepD;;;;;;GAMG;AAKH,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,GACb,CAAC;AAoBF,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,cAAc,CAAC;AAEjD,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,SAAI,EAAE,iBAAwB,EAAE,UAAS;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;CAAM,kBA4LtL,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,CAcR;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB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,cAAc,GAAU,gBAAW,qBA8B/C,CAAC"}
|
package/lib/esm/cli-methods.js
CHANGED
|
@@ -20,6 +20,7 @@ import { planPackageSetup } from './utils/packageSetup.js';
|
|
|
20
20
|
import { detectPackageManager, execBinCommand, runScriptCommand, } from './utils/packageManager.js';
|
|
21
21
|
import { rewriteExtensionlessImports } from './utils/esmSpecifiers.js';
|
|
22
22
|
import { checkShapeNames } from './utils/shapeNames.js';
|
|
23
|
+
import { checkShapeReferences } from './utils/shapeReferences.js';
|
|
23
24
|
import { spawn as spawnChild } from 'child_process';
|
|
24
25
|
import { findNearestPackageJson } from 'find-nearest-package-json';
|
|
25
26
|
import { statSync } from 'fs';
|
|
@@ -2273,6 +2274,13 @@ export const planBuildSteps = (pkgJson, packagePath) => [
|
|
|
2273
2274
|
name: 'Checking shape names',
|
|
2274
2275
|
apply: () => checkShapeNames(packagePath),
|
|
2275
2276
|
},
|
|
2277
|
+
{
|
|
2278
|
+
// Loads each compiled shape module on its own, so it needs the final
|
|
2279
|
+
// lib/esm too. Fails the build: an unresolved reference is a query that
|
|
2280
|
+
// throws "Shape class not found" in a consumer's bundle.
|
|
2281
|
+
name: 'Checking shape references',
|
|
2282
|
+
apply: () => checkShapeReferences(packagePath),
|
|
2283
|
+
},
|
|
2276
2284
|
{
|
|
2277
2285
|
name: 'Checking dependencies',
|
|
2278
2286
|
apply: () => depCheck(packagePath),
|