@widgetic/dev-tools 0.3.1 → 0.3.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.
- package/CHANGELOG.md +7 -0
- package/README.md +36 -16
- package/bin/check-readme-contracts.mjs +2 -2
- package/bin/publish-all-to-npm.mjs +43 -0
- package/lib/publish-to-npm.mjs +24 -0
- package/lib/readme-contract.mjs +9 -12
- package/package.json +7 -3
- package/test/publish-to-npm.test.mjs +49 -0
- package/test/readme-contract.test.mjs +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
The format roughly follows [Keep a Changelog](https://keepachangelog.com/); the
|
|
4
4
|
reasons matter more than the categories.
|
|
5
5
|
|
|
6
|
+
## Unreleased
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- **`publish-all-to-npm`** (`bin/publish-all-to-npm.mjs`): the laptop fallback for when GitLab has no compute minutes. It walks the npm packages and runs each package's own `publish-to-npm` script. That script raises the patch, runs `npm publish`, then commits the version files and pushes that commit. ui-sdk's script also raises the modules patch and releases them, and it commits before that release so `modules/` is clean. embed-sdk's script also uploads its CDN file, then commits `dist/`. `dev-tools` uses the same `publish-to-npm` name for its own package.
|
|
11
|
+
- The README contract no longer checks `recorder` or `__template__`. The linking tier is `embed-sdk` and `ui-sdk`. The adopter tier is the apps that compile sibling source.
|
|
12
|
+
|
|
6
13
|
## 0.3.1 — 2026-10-08
|
|
7
14
|
|
|
8
15
|
### Added
|
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ the repositories that consume it cannot drift apart.
|
|
|
8
8
|
| `check-runtime-deps` | Fails when a package's `package.json` and its published output disagree: a `dependencies` entry the output never imports (a *phantom*, install weight every consumer pays for), or an import the manifest does not declare (a *missing* dependency, which breaks a consumer's build). |
|
|
9
9
|
| `check-runtime-deps-fixtures` | Runs the fixture suite that proves the check above fails when it should. |
|
|
10
10
|
| `check-design-system-peers` | Fails when `canvas` and `file-browser` — the two peers that resolve `@widgetic/design-system` from the registry — disagree: lockfiles resolving different versions, or a lockfile that no longer matches the version the design-system checkout carries. Makes the next publish's consumer refresh land as one coordinated change instead of two drifted ones. |
|
|
11
|
+
| `publish-all-to-npm` | Laptop fallback when GitLab has no compute minutes. Walks the npm packages and runs each package's own `publish-to-npm` script. |
|
|
11
12
|
|
|
12
13
|
It also ships two `lib/` modules with hand-written types and their own `node --test`
|
|
13
14
|
fixtures:
|
|
@@ -174,17 +175,16 @@ tarball, publish, and have every consumer refresh its lockfile in the same
|
|
|
174
175
|
commit as its version bump. Run it as `npm run check:readme` here, or
|
|
175
176
|
`npx check-readme-contracts` anywhere the package is installed.
|
|
176
177
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
that half of the ban would be banning the truth about them. What stays banned
|
|
178
|
+
Two packages consume a sibling the other way round: `embed-sdk` and `ui-sdk`
|
|
179
|
+
link a sibling checkout by hand to its built output instead — `lapisdk`, or a
|
|
180
|
+
raw `ln -s`. The sibling-source sentences would be false in their READMEs, so
|
|
181
|
+
they carry [their own canonical sentences](lib/readme-contract.mjs) — the link,
|
|
182
|
+
what it resolves, and why a sibling edit needs a rebuild to show up — and
|
|
183
|
+
[Linked siblings](#linked-siblings-consuming-built-output-not-source) below is
|
|
184
|
+
the section they copy. The retired-instruction ban reaches them one tier
|
|
185
|
+
narrower: `npm link`, `volta run`, `llinks` and the after-install re-run are a
|
|
186
|
+
hand-made link's live setup, so that half of the ban would be banning the
|
|
187
|
+
truth about them. What stays banned
|
|
188
188
|
in either tier is the lore that is dead everywhere: the `ldt` step, which these
|
|
189
189
|
packages never adopted, and the retired `typescript-sdk` name. All of it is
|
|
190
190
|
data in `LINKING_PACKAGES` and `STALE_PATTERNS` in
|
|
@@ -209,11 +209,11 @@ they are not part of dev-tools setup, and no step here depends on them.
|
|
|
209
209
|
|
|
210
210
|
### Linked siblings: consuming built output, not source
|
|
211
211
|
|
|
212
|
-
`embed-sdk
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
`embed-sdk` and `ui-sdk` consume a sibling the other way round: they link a
|
|
213
|
+
sibling checkout into `node_modules` by hand — from a script the package owns
|
|
214
|
+
— and import what that checkout **builds**, so a sibling edit is invisible
|
|
215
|
+
here until that package rebuilds its `dist/`. The mechanism is theirs and the
|
|
216
|
+
scripts differ (`lapisdk`, a raw `ln -s`), so the
|
|
217
217
|
canonical sentences stay command-neutral and each README names its own scripts
|
|
218
218
|
around them. These are the four sentences, in this order; the same text is
|
|
219
219
|
data in [`lib/readme-contract.mjs`](lib/readme-contract.mjs), which is what the
|
|
@@ -319,6 +319,26 @@ here and a release** — not an edit in the consumer. Every entry needs a reason
|
|
|
319
319
|
specific enough that a reviewer can check it; each one is a claim the check can
|
|
320
320
|
no longer make.
|
|
321
321
|
|
|
322
|
+
## Publishing from a laptop
|
|
323
|
+
|
|
324
|
+
GitLab CI on `main` remains the way a package is published. When the group has no compute minutes left, the same publish can be done from this checkout.
|
|
325
|
+
|
|
326
|
+
Each package's `publish-to-npm` script raises the patch in `package.json`, publishes that version, then commits the version files and pushes that commit. The token is the one in `~/.npmrc`. ui-sdk's script also keeps `SDK_VERSION` in step, then raises the modules patch and writes one changelog sentence. It commits those files before the modules release, because that release refuses a dirty `modules/` directory, and pushes after the release. The R2 settings for the modules are in `modules/.env`, which is not committed. embed-sdk's script then uploads `dist/umd/embed-sdk.js` to the CDN and purges it, then commits the version and `dist/` and pushes. The R2 settings for that upload are in `.env.cdn`, which is not committed. The other packages have no CDN file.
|
|
327
|
+
|
|
328
|
+
From one package, publish only that package:
|
|
329
|
+
|
|
330
|
+
```sh
|
|
331
|
+
npm run publish-to-npm
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
From `dev-tools`, walk every package:
|
|
335
|
+
|
|
336
|
+
```sh
|
|
337
|
+
npm run publish-all-to-npm
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
The walk is `api-sdk`, `cache-layer`, `design-system`, `dev-tools`, `canvas`, `chat`, `editor`, `file-browser`, `widget-creator`, `embed-sdk` and `ui-sdk`. `site` is not in it.
|
|
341
|
+
|
|
322
342
|
## Releasing
|
|
323
343
|
|
|
324
344
|
Push to `main` with a new `version` in `package.json`. CI runs the check against
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* workflow change had no single place to land. Nothing fails when it does —
|
|
12
12
|
* the section just stops being true.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* output — `embed-sdk
|
|
14
|
+
* Two more packages consume a sibling through a hand-made link to its built
|
|
15
|
+
* output — `embed-sdk` and `ui-sdk` — and were read by nothing at
|
|
16
16
|
* all, so drift in one of their READMEs failed nothing. They compile no
|
|
17
17
|
* sibling source, so the sibling-source sentences would be false in them; they
|
|
18
18
|
* carry the canonical linked-sibling sentences instead, which state what the
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Run each package's own publish-to-npm script.
|
|
4
|
+
*
|
|
5
|
+
* npm run publish-all-to-npm
|
|
6
|
+
*
|
|
7
|
+
* The script in each package.json decides what "publish" means there.
|
|
8
|
+
* ui-sdk also raises the module version and releases the modules.
|
|
9
|
+
* embed-sdk also uploads its CDN file. This file only walks the checkouts.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { spawnSync } from 'node:child_process';
|
|
13
|
+
import { existsSync, statSync } from 'node:fs';
|
|
14
|
+
import { resolve } from 'node:path';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
16
|
+
import { PUBLISHABLE_PACKAGES } from '../lib/publish-to-npm.mjs';
|
|
17
|
+
|
|
18
|
+
const frontendRoot = fileURLToPath(new URL('../..', import.meta.url));
|
|
19
|
+
|
|
20
|
+
let failed = 0;
|
|
21
|
+
for (const pkg of PUBLISHABLE_PACKAGES) {
|
|
22
|
+
const packageDir = resolve(frontendRoot, pkg.dir);
|
|
23
|
+
if (!existsSync(packageDir) || !statSync(packageDir).isDirectory()) {
|
|
24
|
+
console.log(`[publish-all-to-npm] ${pkg.dir}: not checked out, skipping`);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
console.log(`[publish-all-to-npm] ${pkg.dir}: npm run ${pkg.script}`);
|
|
28
|
+
const result = spawnSync('npm', ['run', pkg.script], {
|
|
29
|
+
cwd: packageDir,
|
|
30
|
+
stdio: 'inherit'
|
|
31
|
+
});
|
|
32
|
+
if (result.status !== 0) {
|
|
33
|
+
failed += 1;
|
|
34
|
+
console.error(
|
|
35
|
+
`[publish-all-to-npm] ${pkg.dir}: npm run ${pkg.script} exited ${result.status ?? 'without a status'}`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (failed > 0) {
|
|
41
|
+
console.error(`[publish-all-to-npm] ${failed} package(s) failed`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Frontend checkouts whose `npm run publish-to-npm` publishes that package.
|
|
3
|
+
*
|
|
4
|
+
* `publish-all-to-npm` in dev-tools walks this list and runs that script. The
|
|
5
|
+
* command itself lives in each package.json. `site` is absent because it is an
|
|
6
|
+
* app, not a package on npm.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @typedef {{ dir: string, script: string }} PublishablePackage */
|
|
10
|
+
|
|
11
|
+
/** @type {readonly PublishablePackage[]} */
|
|
12
|
+
export const PUBLISHABLE_PACKAGES = [
|
|
13
|
+
{ dir: 'api-sdk', script: 'publish-to-npm' },
|
|
14
|
+
{ dir: 'cache-layer', script: 'publish-to-npm' },
|
|
15
|
+
{ dir: 'design-system', script: 'publish-to-npm' },
|
|
16
|
+
{ dir: 'dev-tools', script: 'publish-to-npm' },
|
|
17
|
+
{ dir: 'canvas', script: 'publish-to-npm' },
|
|
18
|
+
{ dir: 'chat', script: 'publish-to-npm' },
|
|
19
|
+
{ dir: 'editor', script: 'publish-to-npm' },
|
|
20
|
+
{ dir: 'file-browser', script: 'publish-to-npm' },
|
|
21
|
+
{ dir: 'widget-creator', script: 'publish-to-npm' },
|
|
22
|
+
{ dir: 'embed-sdk', script: 'publish-to-npm' },
|
|
23
|
+
{ dir: 'ui-sdk', script: 'publish-to-npm' }
|
|
24
|
+
];
|
package/lib/readme-contract.mjs
CHANGED
|
@@ -16,10 +16,9 @@
|
|
|
16
16
|
* {@link CANONICAL_LINKING_SENTENCES} instead, which state what the link
|
|
17
17
|
* resolves to and what that costs. The retired-instruction ban reaches them
|
|
18
18
|
* through its global half only: the link-era mechanics are these packages'
|
|
19
|
-
* *live* setup
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* half is the dev-alias story, and that is an adopter's story.
|
|
19
|
+
* *live* setup, so banning `npm link` in their prose would ban the truth
|
|
20
|
+
* about them. The ban's other half is the dev-alias story, and that is an
|
|
21
|
+
* adopter's story.
|
|
23
22
|
*
|
|
24
23
|
* The section earned its guard by drifting three different ways. It taught a
|
|
25
24
|
* hand-linking practice after the practice was retired (site's `lps` and
|
|
@@ -63,8 +62,7 @@ export const ADOPTER_PACKAGES = [
|
|
|
63
62
|
'editor',
|
|
64
63
|
'file-browser',
|
|
65
64
|
'site',
|
|
66
|
-
'widget-creator'
|
|
67
|
-
'__template__'
|
|
65
|
+
'widget-creator'
|
|
68
66
|
];
|
|
69
67
|
|
|
70
68
|
/**
|
|
@@ -91,8 +89,8 @@ export const PUBLISH_PACKAGES = ['chat', 'file-browser'];
|
|
|
91
89
|
* ordered substrings over whitespace-collapsed prose, with app-specific
|
|
92
90
|
* sentences allowed between them.
|
|
93
91
|
*
|
|
94
|
-
* What the
|
|
95
|
-
* its `lapisdk` script, `
|
|
92
|
+
* What the two share is the shape, not the command: `embed-sdk` links from
|
|
93
|
+
* its `lapisdk` script, `ui-sdk` from a raw `ln -s`.
|
|
96
94
|
* These sentences therefore stay command-neutral — they say what the link
|
|
97
95
|
* resolves, why that is not the dev-alias workflow, and that the package's own
|
|
98
96
|
* install script is the setup and the repair path — and each README names its
|
|
@@ -107,13 +105,12 @@ export const CANONICAL_LINKING_SENTENCES = [
|
|
|
107
105
|
|
|
108
106
|
/**
|
|
109
107
|
* The packages that consume a sibling checkout through a hand-made link to its
|
|
110
|
-
* built output rather than the dev-alias workflow
|
|
111
|
-
* link `@widgetic/api-sdk` from a script
|
|
112
|
-
* `@widgetic/design-system` from `lps`. They are exempt from the canonical
|
|
108
|
+
* built output rather than the dev-alias workflow. `embed-sdk` and `ui-sdk`
|
|
109
|
+
* link `@widgetic/api-sdk` from a script. They are exempt from the canonical
|
|
113
110
|
* sibling-source sentences (they compile no sibling source) and carry
|
|
114
111
|
* {@link CANONICAL_LINKING_SENTENCES} instead.
|
|
115
112
|
*/
|
|
116
|
-
export const LINKING_PACKAGES = ['embed-sdk', '
|
|
113
|
+
export const LINKING_PACKAGES = ['embed-sdk', 'ui-sdk'];
|
|
117
114
|
|
|
118
115
|
/** Every package the check reads, in tier order. */
|
|
119
116
|
export const CHECKED_PACKAGES = [...ADOPTER_PACKAGES, ...LINKING_PACKAGES];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widgetic/dev-tools",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Build-time checks and dev tooling shared by the published @widgetic packages, released once so the repositories that consume them cannot drift apart. Currently: check-runtime-deps (with the fixture suite that proves it fails), the Vite sibling-$lib remap, the canonical Frontend sibling layout that builds every consumer's dev-alias tables, and check-links — the link-doctor that fails when a sibling symlink dangles, a promised dist/ file is missing, or a dead checkout name lingers, and check-design-system-peers — which fails when the two design-system peers' lockfiles drift apart.",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"check-readme-contracts": "bin/check-readme-contracts.mjs",
|
|
23
23
|
"check-readme-contracts-fixtures": "bin/check-readme-contracts-fixtures.mjs",
|
|
24
24
|
"check-layout-fixtures": "bin/check-layout-fixtures.mjs",
|
|
25
|
-
"check-design-system-peers": "bin/check-design-system-peers.mjs"
|
|
25
|
+
"check-design-system-peers": "bin/check-design-system-peers.mjs",
|
|
26
|
+
"publish-all-to-npm": "bin/publish-all-to-npm.mjs"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
29
|
"bin",
|
|
@@ -42,7 +43,10 @@
|
|
|
42
43
|
"test:links": "node bin/check-links-fixtures.mjs",
|
|
43
44
|
"test:readme": "node --test test/readme-contract.test.mjs",
|
|
44
45
|
"test:peers": "node --test test/lockfile-peers.test.mjs",
|
|
45
|
-
"test": "
|
|
46
|
+
"test:publish": "node --test test/publish-to-npm.test.mjs",
|
|
47
|
+
"test": "npm run check:deps && npm run test:deps && npm run test:vite && npm run test:layout && npm run test:links && npm run test:readme && npm run test:peers && npm run test:publish",
|
|
48
|
+
"publish-to-npm": "npm test && npm version patch --no-git-tag-version && npm publish --ignore-scripts --access public && git add package.json package-lock.json && git commit -m \"chore: publish $(node -p 'require(\"./package.json\").version')\" -m \"- Record the patch that was just published to npm\" && git push origin HEAD",
|
|
49
|
+
"publish-all-to-npm": "node bin/publish-all-to-npm.mjs",
|
|
46
50
|
"prepublishOnly": "npm test"
|
|
47
51
|
},
|
|
48
52
|
"volta": {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { PUBLISHABLE_PACKAGES } from '../lib/publish-to-npm.mjs';
|
|
7
|
+
|
|
8
|
+
const FRONTEND = fileURLToPath(new URL('../..', import.meta.url));
|
|
9
|
+
|
|
10
|
+
test('the walk calls publish-to-npm in each npm package', () => {
|
|
11
|
+
assert.deepEqual(
|
|
12
|
+
PUBLISHABLE_PACKAGES.map((pkg) => `${pkg.dir}:${pkg.script}`),
|
|
13
|
+
[
|
|
14
|
+
'api-sdk:publish-to-npm',
|
|
15
|
+
'cache-layer:publish-to-npm',
|
|
16
|
+
'design-system:publish-to-npm',
|
|
17
|
+
'dev-tools:publish-to-npm',
|
|
18
|
+
'canvas:publish-to-npm',
|
|
19
|
+
'chat:publish-to-npm',
|
|
20
|
+
'editor:publish-to-npm',
|
|
21
|
+
'file-browser:publish-to-npm',
|
|
22
|
+
'widget-creator:publish-to-npm',
|
|
23
|
+
'embed-sdk:publish-to-npm',
|
|
24
|
+
'ui-sdk:publish-to-npm'
|
|
25
|
+
]
|
|
26
|
+
);
|
|
27
|
+
assert.equal(PUBLISHABLE_PACKAGES.some((pkg) => pkg.dir === 'site'), false);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('each package script is the publish, and the walk is a separate script', () => {
|
|
31
|
+
for (const pkg of PUBLISHABLE_PACKAGES) {
|
|
32
|
+
const manifest = JSON.parse(readFileSync(resolve(FRONTEND, pkg.dir, 'package.json'), 'utf8'));
|
|
33
|
+
const command = manifest.scripts?.[pkg.script];
|
|
34
|
+
assert.equal(typeof command, 'string', `${pkg.dir} is missing scripts.${pkg.script}`);
|
|
35
|
+
assert.equal(command.includes('npm version patch'), true, `${pkg.dir} does not raise the patch`);
|
|
36
|
+
assert.equal(command.includes('npm publish'), true, `${pkg.dir} does not publish`);
|
|
37
|
+
assert.equal(command.includes('git commit'), true, `${pkg.dir} does not commit the version`);
|
|
38
|
+
assert.equal(command.includes('git push origin HEAD'), true, `${pkg.dir} does not push the version`);
|
|
39
|
+
assert.equal(command.includes('publish-all-to-npm'), false, `${pkg.dir} script is the walk`);
|
|
40
|
+
}
|
|
41
|
+
const uiSdk = JSON.parse(readFileSync(resolve(FRONTEND, 'ui-sdk/package.json'), 'utf8'));
|
|
42
|
+
assert.equal(uiSdk.scripts['publish-to-npm'].indexOf('git commit') < uiSdk.scripts['publish-to-npm'].indexOf('release:publish'), true);
|
|
43
|
+
assert.equal(uiSdk.scripts['publish-to-npm'].includes('advance-module-version.mjs'), true);
|
|
44
|
+
assert.equal(uiSdk.scripts['publish-to-npm'].includes('release:publish'), true);
|
|
45
|
+
const embed = JSON.parse(readFileSync(resolve(FRONTEND, 'embed-sdk/package.json'), 'utf8'));
|
|
46
|
+
assert.equal(embed.scripts['publish-to-npm'].includes('publish:cdn'), true);
|
|
47
|
+
const devTools = JSON.parse(readFileSync(resolve(FRONTEND, 'dev-tools/package.json'), 'utf8'));
|
|
48
|
+
assert.equal(devTools.scripts['publish-all-to-npm'], 'node bin/publish-all-to-npm.mjs');
|
|
49
|
+
});
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* degrades silently: nothing fails, the section just stops being true.
|
|
12
12
|
*
|
|
13
13
|
* The second tier is the packages that link a sibling by hand instead of
|
|
14
|
-
* compiling its source — `embed-sdk
|
|
14
|
+
* compiling its source — `embed-sdk` and `ui-sdk`. Their READMEs
|
|
15
15
|
* were read by nothing at all: not the adopters' check, not a test. They get
|
|
16
16
|
* no canonical section (it would be false) but they do get the
|
|
17
17
|
* retired-instruction ban, and both rules are driven here.
|
|
@@ -390,8 +390,8 @@ describe('the checkout collector', () => {
|
|
|
390
390
|
});
|
|
391
391
|
|
|
392
392
|
describe('the linking tier', () => {
|
|
393
|
-
it('reads the
|
|
394
|
-
assert.deepEqual(LINKING_PACKAGES, ['embed-sdk', '
|
|
393
|
+
it('reads the hand-linking packages by default', () => {
|
|
394
|
+
assert.deepEqual(LINKING_PACKAGES, ['embed-sdk', 'ui-sdk']);
|
|
395
395
|
// Every linking package is a subject, and none of them is an adopter:
|
|
396
396
|
// the canonical sentences would be false in their READMEs.
|
|
397
397
|
assert.ok(LINKING_PACKAGES.every((p) => CHECKED_PACKAGES.includes(p)));
|
|
@@ -425,7 +425,7 @@ describe('the linking tier', () => {
|
|
|
425
425
|
'not its source',
|
|
426
426
|
'rather than its source'
|
|
427
427
|
);
|
|
428
|
-
const f = readmeFindings('
|
|
428
|
+
const f = readmeFindings('embed-sdk', 'embed-sdk/README.md', forked);
|
|
429
429
|
assert.equal(f.length, 1);
|
|
430
430
|
assert.equal(f[0].kind, 'linked-sibling section drift');
|
|
431
431
|
// The finding names the first canonical sentence that is missing, so the
|
|
@@ -440,7 +440,7 @@ describe('the linking tier', () => {
|
|
|
440
440
|
'Here that script is `npm run lps`, which links both siblings at once.\n\n' +
|
|
441
441
|
`${CANONICAL_LINKING_SENTENCES.slice(1).join(' ')}\n\n` +
|
|
442
442
|
'```sh\nnpm run i\nnpm run lps\n```\n';
|
|
443
|
-
assert.deepEqual(readmeFindings('
|
|
443
|
+
assert.deepEqual(readmeFindings('embed-sdk', 'embed-sdk/README.md', withNotes), []);
|
|
444
444
|
});
|
|
445
445
|
|
|
446
446
|
it('fails a linking README whose only mention of the sibling is not the section', () => {
|
|
@@ -455,15 +455,15 @@ describe('the linking tier', () => {
|
|
|
455
455
|
});
|
|
456
456
|
|
|
457
457
|
it('allows the link-era mechanics that are these packages live setup', () => {
|
|
458
|
-
//
|
|
459
|
-
//
|
|
460
|
-
//
|
|
458
|
+
// A hand-made link is this tier's live setup, so prose that names
|
|
459
|
+
// `volta run`, `npm link` and `llinks` stays allowed. The ban stops
|
|
460
|
+
// at the tier boundary.
|
|
461
461
|
const raw =
|
|
462
462
|
`${linkingSection(72)}\n\n` +
|
|
463
463
|
'`npm run lps` links both siblings through `volta run` with the pinned\n' +
|
|
464
464
|
'toolchain, and `npm run llinks` reports what `node_modules/@widgetic`\n' +
|
|
465
465
|
'resolves to.\n';
|
|
466
|
-
assert.deepEqual(readmeFindings('
|
|
466
|
+
assert.deepEqual(readmeFindings('embed-sdk', 'embed-sdk/README.md', raw), []);
|
|
467
467
|
});
|
|
468
468
|
|
|
469
469
|
it('flags the instructions that are dead for every package, wherever they appear', () => {
|
|
@@ -483,12 +483,12 @@ describe('the linking tier', () => {
|
|
|
483
483
|
it('requires its own sentences — and only its own — from a linking package', () => {
|
|
484
484
|
// Same prose, two tiers: the linked-sibling section completes a linking
|
|
485
485
|
// package, while an adopter carrying that text has drifted from its own.
|
|
486
|
-
assert.deepEqual(readmeFindings('
|
|
486
|
+
assert.deepEqual(readmeFindings('embed-sdk', 'embed-sdk/README.md', linkingSection(72)), []);
|
|
487
487
|
const adopter = readmeFindings('site', 'site/README.md', linkingSection(72));
|
|
488
488
|
assert.deepEqual(adopter.map((x) => x.kind), ['ldt section drift']);
|
|
489
489
|
// The reverse: an adopter's section satisfies a linking package nowhere,
|
|
490
490
|
// because it never states how the sibling arrives.
|
|
491
|
-
const linking = readmeFindings('
|
|
491
|
+
const linking = readmeFindings('embed-sdk', 'embed-sdk/README.md', section(72));
|
|
492
492
|
assert.deepEqual(linking.map((x) => x.kind), ['linked-sibling section drift']);
|
|
493
493
|
});
|
|
494
494
|
|
|
@@ -503,14 +503,14 @@ describe('the linking tier', () => {
|
|
|
503
503
|
|
|
504
504
|
it('exempts fenced examples, exactly as the adopter tier does', () => {
|
|
505
505
|
const fenced = `${linkingSection(72)}\n\`\`\`sh\n# historical: npm run ldt after every install\n\`\`\`\n`;
|
|
506
|
-
assert.deepEqual(readmeFindings('
|
|
506
|
+
assert.deepEqual(readmeFindings('embed-sdk', 'embed-sdk/README.md', fenced), []);
|
|
507
507
|
});
|
|
508
508
|
|
|
509
509
|
it('flags the same words when prose carries them rather than a fence', () => {
|
|
510
510
|
// The counterpart of the fence test: outside a fence, the words fail —
|
|
511
511
|
// with the globally-dead lore, which is what the fence above quotes.
|
|
512
512
|
const proseForm = `${linkingSection(72)}\nHistorical note: npm run ldt was how it used to work.\n`;
|
|
513
|
-
const f = readmeFindings('
|
|
513
|
+
const f = readmeFindings('embed-sdk', 'embed-sdk/README.md', proseForm);
|
|
514
514
|
assert.equal(f.length, 1);
|
|
515
515
|
assert.equal(f[0].kind, 'linked-sibling section drift');
|
|
516
516
|
});
|
|
@@ -532,7 +532,7 @@ describe('the real Frontend checkout', { skip: !DISK_OK }, () => {
|
|
|
532
532
|
const { packages } = collectReadmeDrift(FRONTEND);
|
|
533
533
|
assert.deepEqual(packages, CHECKED_PACKAGES);
|
|
534
534
|
// A subject whose file vanished would pass a prose scan vacuously, so
|
|
535
|
-
// this asserts the
|
|
535
|
+
// this asserts the linking READMEs are really there to be read.
|
|
536
536
|
for (const pkg of LINKING_PACKAGES) {
|
|
537
537
|
assert.ok(
|
|
538
538
|
existsSync(join(FRONTEND, pkg, 'README.md')),
|