@visual-check/cli 0.1.2 → 0.2.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/dist/addon-child/image-files.js +1 -1
- package/dist/addon-child/image-files.js.map +1 -1
- package/dist/agent-skill/skill-files.d.ts +4 -0
- package/dist/agent-skill/skill-files.d.ts.map +1 -1
- package/dist/agent-skill/skill-files.js +4 -0
- package/dist/agent-skill/skill-files.js.map +1 -1
- package/dist/baselines/baseline-error.d.ts +15 -2
- package/dist/baselines/baseline-error.d.ts.map +1 -1
- package/dist/baselines/baseline-error.js +32 -2
- package/dist/baselines/baseline-error.js.map +1 -1
- package/dist/capture/capture-session.d.ts +161 -30
- package/dist/capture/capture-session.d.ts.map +1 -1
- package/dist/capture/capture-session.js +291 -72
- package/dist/capture/capture-session.js.map +1 -1
- package/dist/capture/driver/cdp/cdp-page.d.ts.map +1 -1
- package/dist/capture/driver/cdp/cdp-page.js +120 -31
- package/dist/capture/driver/cdp/cdp-page.js.map +1 -1
- package/dist/capture/driver/cdp/failed-loads.d.ts +16 -0
- package/dist/capture/driver/cdp/failed-loads.d.ts.map +1 -0
- package/dist/capture/driver/cdp/failed-loads.js +71 -0
- package/dist/capture/driver/cdp/failed-loads.js.map +1 -0
- package/dist/capture/driver/cdp/launch-arguments.d.ts +7 -1
- package/dist/capture/driver/cdp/launch-arguments.d.ts.map +1 -1
- package/dist/capture/driver/cdp/launch-arguments.js +8 -1
- package/dist/capture/driver/cdp/launch-arguments.js.map +1 -1
- package/dist/capture/driver/driver.d.ts +88 -4
- package/dist/capture/driver/driver.d.ts.map +1 -1
- package/dist/capture/driver/driver.js +33 -0
- package/dist/capture/driver/driver.js.map +1 -1
- package/dist/capture/frames.d.ts +10 -0
- package/dist/capture/frames.d.ts.map +1 -1
- package/dist/capture/frames.js +67 -0
- package/dist/capture/frames.js.map +1 -1
- package/dist/capture/page-script.d.ts +19 -8
- package/dist/capture/page-script.d.ts.map +1 -1
- package/dist/capture/page-script.js +46 -12
- package/dist/capture/page-script.js.map +1 -1
- package/dist/capture/prepare-capture.d.ts +50 -3
- package/dist/capture/prepare-capture.d.ts.map +1 -1
- package/dist/capture/prepare-capture.js +157 -16
- package/dist/capture/prepare-capture.js.map +1 -1
- package/dist/commands/check-storybooks.d.ts +5 -4
- package/dist/commands/check-storybooks.d.ts.map +1 -1
- package/dist/commands/check-storybooks.js +11 -8
- package/dist/commands/check-storybooks.js.map +1 -1
- package/dist/commands/consistency-output.d.ts.map +1 -1
- package/dist/commands/consistency-output.js +3 -3
- package/dist/commands/consistency-output.js.map +1 -1
- package/dist/commands/failed-loads-hint.d.ts +7 -0
- package/dist/commands/failed-loads-hint.d.ts.map +1 -0
- package/dist/commands/failed-loads-hint.js +16 -0
- package/dist/commands/failed-loads-hint.js.map +1 -0
- package/dist/commands/local-update.d.ts +22 -0
- package/dist/commands/local-update.d.ts.map +1 -0
- package/dist/commands/local-update.js +39 -0
- package/dist/commands/local-update.js.map +1 -0
- package/dist/commands/network-warning.d.ts.map +1 -1
- package/dist/commands/network-warning.js +2 -18
- package/dist/commands/network-warning.js.map +1 -1
- package/dist/commands/plan-snapshots.d.ts +23 -8
- package/dist/commands/plan-snapshots.d.ts.map +1 -1
- package/dist/commands/plan-snapshots.js +15 -9
- package/dist/commands/plan-snapshots.js.map +1 -1
- package/dist/commands/report-entries.d.ts +5 -2
- package/dist/commands/report-entries.d.ts.map +1 -1
- package/dist/commands/report-entries.js +63 -15
- package/dist/commands/report-entries.js.map +1 -1
- package/dist/commands/run-browser.d.ts +5 -5
- package/dist/commands/run-browser.d.ts.map +1 -1
- package/dist/commands/run-browser.js +1 -0
- package/dist/commands/run-browser.js.map +1 -1
- package/dist/commands/run-cli.d.ts +16 -5
- package/dist/commands/run-cli.d.ts.map +1 -1
- package/dist/commands/run-cli.js +74 -54
- package/dist/commands/run-cli.js.map +1 -1
- package/dist/commands/run-report.d.ts +3 -3
- package/dist/commands/run-report.d.ts.map +1 -1
- package/dist/commands/run-report.js +4 -2
- package/dist/commands/run-report.js.map +1 -1
- package/dist/commands/run-snapshots.d.ts +7 -4
- package/dist/commands/run-snapshots.d.ts.map +1 -1
- package/dist/commands/run-snapshots.js +49 -17
- package/dist/commands/run-snapshots.js.map +1 -1
- package/dist/commands/snapshot-result.d.ts +66 -9
- package/dist/commands/snapshot-result.d.ts.map +1 -1
- package/dist/commands/snapshot-result.js +46 -6
- package/dist/commands/snapshot-result.js.map +1 -1
- package/dist/commands/stop-message.d.ts.map +1 -1
- package/dist/commands/stop-message.js +6 -1
- package/dist/commands/stop-message.js.map +1 -1
- package/dist/commands/stopped-run.d.ts +10 -5
- package/dist/commands/stopped-run.d.ts.map +1 -1
- package/dist/commands/stopped-run.js +35 -22
- package/dist/commands/stopped-run.js.map +1 -1
- package/dist/commands/take-snapshot.d.ts +9 -6
- package/dist/commands/take-snapshot.d.ts.map +1 -1
- package/dist/commands/take-snapshot.js +16 -7
- package/dist/commands/take-snapshot.js.map +1 -1
- package/dist/commands/test-snapshot.d.ts +2 -2
- package/dist/commands/test-snapshot.d.ts.map +1 -1
- package/dist/commands/test-snapshot.js.map +1 -1
- package/dist/commands/update-baselines.d.ts.map +1 -1
- package/dist/commands/update-baselines.js +3 -2
- package/dist/commands/update-baselines.js.map +1 -1
- package/dist/commands/update-snapshot.d.ts +22 -4
- package/dist/commands/update-snapshot.d.ts.map +1 -1
- package/dist/commands/update-snapshot.js +79 -18
- package/dist/commands/update-snapshot.js.map +1 -1
- package/dist/config/checks.d.ts +26 -0
- package/dist/config/checks.d.ts.map +1 -1
- package/dist/config/checks.js +68 -6
- package/dist/config/checks.js.map +1 -1
- package/dist/config/define-config.d.ts +38 -2
- package/dist/config/define-config.d.ts.map +1 -1
- package/dist/config/define-config.js.map +1 -1
- package/dist/config/resolve-config.d.ts +15 -2
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/config/resolve-config.js +6 -0
- package/dist/config/resolve-config.js.map +1 -1
- package/dist/config/story-options.d.ts +32 -4
- package/dist/config/story-options.d.ts.map +1 -1
- package/dist/config/story-options.js +38 -7
- package/dist/config/story-options.js.map +1 -1
- package/dist/config/unrunnable-regexp.d.ts +22 -0
- package/dist/config/unrunnable-regexp.d.ts.map +1 -0
- package/dist/config/unrunnable-regexp.js +25 -0
- package/dist/config/unrunnable-regexp.js.map +1 -0
- package/dist/config/validate-config.d.ts.map +1 -1
- package/dist/config/validate-config.js +6 -21
- package/dist/config/validate-config.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/init/find-storybooks.d.ts +5 -0
- package/dist/init/find-storybooks.d.ts.map +1 -1
- package/dist/init/find-storybooks.js +8 -1
- package/dist/init/find-storybooks.js.map +1 -1
- package/dist/init/ignored-skill.d.ts +50 -0
- package/dist/init/ignored-skill.d.ts.map +1 -0
- package/dist/init/ignored-skill.js +61 -0
- package/dist/init/ignored-skill.js.map +1 -0
- package/dist/init/install.d.ts +24 -9
- package/dist/init/install.d.ts.map +1 -1
- package/dist/init/install.js +66 -26
- package/dist/init/install.js.map +1 -1
- package/dist/init/package-manager.d.ts +6 -0
- package/dist/init/package-manager.d.ts.map +1 -1
- package/dist/init/package-manager.js +4 -0
- package/dist/init/package-manager.js.map +1 -1
- package/dist/init/run-init.d.ts +17 -4
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +31 -11
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/workspace.d.ts +2 -0
- package/dist/init/workspace.d.ts.map +1 -1
- package/dist/init/workspace.js +2 -0
- package/dist/init/workspace.js.map +1 -1
- package/dist/page-errors/judge-page-errors.d.ts +50 -0
- package/dist/page-errors/judge-page-errors.d.ts.map +1 -0
- package/dist/page-errors/judge-page-errors.js +39 -0
- package/dist/page-errors/judge-page-errors.js.map +1 -0
- package/dist/page-errors/page-error-policy.d.ts +36 -0
- package/dist/page-errors/page-error-policy.d.ts.map +1 -0
- package/dist/page-errors/page-error-policy.js +15 -0
- package/dist/page-errors/page-error-policy.js.map +1 -0
- package/dist/real-network-requests/judge-real-requests.d.ts +26 -0
- package/dist/real-network-requests/judge-real-requests.d.ts.map +1 -0
- package/dist/real-network-requests/judge-real-requests.js +17 -0
- package/dist/real-network-requests/judge-real-requests.js.map +1 -0
- package/dist/real-network-requests/real-request-policy.d.ts +29 -0
- package/dist/real-network-requests/real-request-policy.d.ts.map +1 -0
- package/dist/real-network-requests/real-request-policy.js +10 -0
- package/dist/real-network-requests/real-request-policy.js.map +1 -0
- package/dist/real-network-requests/silenced-hosts.d.ts +9 -0
- package/dist/real-network-requests/silenced-hosts.d.ts.map +1 -0
- package/dist/real-network-requests/silenced-hosts.js +28 -0
- package/dist/real-network-requests/silenced-hosts.js.map +1 -0
- package/dist/report/report-document.d.ts +154 -9
- package/dist/report/report-document.d.ts.map +1 -1
- package/dist/report/report-document.js +1 -1
- package/dist/report/report-document.js.map +1 -1
- package/dist/report/report-folder.d.ts +7 -3
- package/dist/report/report-folder.d.ts.map +1 -1
- package/dist/report/report-folder.js +5 -5
- package/dist/report/report-folder.js.map +1 -1
- package/dist/reporter/end-block.d.ts +32 -3
- package/dist/reporter/end-block.d.ts.map +1 -1
- package/dist/reporter/end-block.js +55 -3
- package/dist/reporter/end-block.js.map +1 -1
- package/dist/reporter/page-errors-block.d.ts +52 -0
- package/dist/reporter/page-errors-block.d.ts.map +1 -0
- package/dist/reporter/page-errors-block.js +98 -0
- package/dist/reporter/page-errors-block.js.map +1 -0
- package/dist/reporter/real-requests-block.d.ts +33 -0
- package/dist/reporter/real-requests-block.d.ts.map +1 -0
- package/dist/reporter/real-requests-block.js +53 -0
- package/dist/reporter/real-requests-block.js.map +1 -0
- package/dist/step-summary/step-summary.d.ts +27 -7
- package/dist/step-summary/step-summary.d.ts.map +1 -1
- package/dist/step-summary/step-summary.js +107 -15
- package/dist/step-summary/step-summary.js.map +1 -1
- package/dist/storybook/options-encoding.d.ts +18 -5
- package/dist/storybook/options-encoding.d.ts.map +1 -1
- package/dist/storybook/options-encoding.js +12 -4
- package/dist/storybook/options-encoding.js.map +1 -1
- package/dist/storybook/options-read.d.ts +3 -2
- package/dist/storybook/options-read.d.ts.map +1 -1
- package/dist/storybook/options-read.js +17 -0
- package/dist/storybook/options-read.js.map +1 -1
- package/dist/storybook/read-stories.d.ts +15 -0
- package/dist/storybook/read-stories.d.ts.map +1 -1
- package/dist/storybook/read-stories.js +60 -14
- package/dist/storybook/read-stories.js.map +1 -1
- package/package.json +2 -1
- package/skill/SKILL.md +25 -7
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A regular expression the page read from a story's options that Node.js can't build, such as one with a syntax the
|
|
3
|
+
* browser knows and Node.js doesn't yet. It keeps the source and flags, so validation can name it and reject it at its
|
|
4
|
+
* key path, rather than the whole read failing.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export class UnrunnableRegExp {
|
|
9
|
+
/**
|
|
10
|
+
* The source, as the page read it.
|
|
11
|
+
*/
|
|
12
|
+
source;
|
|
13
|
+
/**
|
|
14
|
+
* The flags, as the page read them.
|
|
15
|
+
*/
|
|
16
|
+
flags;
|
|
17
|
+
/**
|
|
18
|
+
* Keeps the source and flags of a regular expression Node.js couldn't build.
|
|
19
|
+
*/
|
|
20
|
+
constructor(source, flags) {
|
|
21
|
+
this.source = source;
|
|
22
|
+
this.flags = flags;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=unrunnable-regexp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unrunnable-regexp.js","sourceRoot":"","sources":["../../src/config/unrunnable-regexp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IACM,MAAM,CAAQ;IACvB;;OAEG;IACM,KAAK,CAAQ;IAEtB;;OAEG;IACH,YAAY,MAAc,EAAE,KAAa;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-config.d.ts","sourceRoot":"","sources":["../../src/config/validate-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-config.d.ts","sourceRoot":"","sources":["../../src/config/validate-config.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAiC,MAAM,EAA+B,MAAM,oBAAoB,CAAA;AA0L5G;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAe1E"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { checkKeys, checksOf, isPlainObject, join, lowercaseNamePattern, meets, mustBe, nonEmptyString, objectOf, optional, toleranceExample, toleranceRequirements, viewportExample, viewportRequirements, wholeNumber, withoutUndefined, } from './checks.js';
|
|
1
|
+
import { checkExpectedPageErrors, checkKeys, checksOf, isPlainObject, join, listOf, lowercaseNamePattern, meets, mustBe, nonEmptyString, objectOf, oneOf, optional, pageErrorsRequirement, readyTimeoutRequirement, realRequestsRequirement, toleranceExample, toleranceRequirements, viewportExample, viewportRequirements, wholeNumber, withoutUndefined, } from './checks.js';
|
|
2
2
|
import { ConfigError } from './config-error.js';
|
|
3
3
|
import { findStorybookUrlProblem, serveStorybookFix } from './find-storybook-url-problem.js';
|
|
4
4
|
/**
|
|
5
5
|
* The URL the examples in issues use.
|
|
6
6
|
*/
|
|
7
7
|
const exampleUrl = 'http://127.0.0.1:6006';
|
|
8
|
-
/**
|
|
9
|
-
* The longest timeout Node's `setTimeout` takes, in milliseconds. A longer one fires at once.
|
|
10
|
-
*/
|
|
11
|
-
const maxTimeout = 2_147_483_647;
|
|
12
8
|
/**
|
|
13
9
|
* What a key that doesn't take a `{ local, ci }` pair reports when it holds one.
|
|
14
10
|
*/
|
|
@@ -72,21 +68,7 @@ function pairOf(requirement) {
|
|
|
72
68
|
* Checks a key that takes an array of items meeting `item`. `text` says what the array must be.
|
|
73
69
|
*/
|
|
74
70
|
function arrayOf(item, text) {
|
|
75
|
-
|
|
76
|
-
return noPair((value, path) => Array.isArray(value)
|
|
77
|
-
? Array.from(value).flatMap((entry, index) => checkItem(entry, `${path}[${index}]`))
|
|
78
|
-
: [mustBe(path, text, value)]);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* One of the keys of `members`. Pass the union as the type argument, so a missing member fails to compile.
|
|
82
|
-
*/
|
|
83
|
-
function oneOf(members) {
|
|
84
|
-
const values = Object.keys(members);
|
|
85
|
-
const quoted = values.map((value) => `'${value}'`);
|
|
86
|
-
return {
|
|
87
|
-
text: `${quoted.slice(0, -1).join(', ')} or ${quoted.at(-1)}`,
|
|
88
|
-
accepts: (value) => values.some((allowed) => allowed === value),
|
|
89
|
-
};
|
|
71
|
+
return noPair(listOf(item, text));
|
|
90
72
|
}
|
|
91
73
|
/**
|
|
92
74
|
* A Storybook URL: an http(s) URL string that holds no user name or password. The issue for a login doesn't show the
|
|
@@ -152,12 +134,15 @@ const configKeys = {
|
|
|
152
134
|
text: `'auto' or ${wholeNumber(1).text}`,
|
|
153
135
|
accepts: (value) => value === 'auto' || wholeNumber(1).accepts(value),
|
|
154
136
|
}),
|
|
155
|
-
readyTimeout: pairOf(
|
|
137
|
+
readyTimeout: pairOf(readyTimeoutRequirement),
|
|
156
138
|
retries: oneValue(wholeNumber(0)),
|
|
157
139
|
silenceHosts: arrayOf({
|
|
158
140
|
text: "a host such as 'example.com', or '*.' and a host, such as '*.example.com'",
|
|
159
141
|
accepts: (value) => typeof value === 'string' && /^(\*\.)?[^*/\s]+$/.test(value),
|
|
160
142
|
}, "an array of hosts, such as ['example.com', '*.example.com']"),
|
|
143
|
+
pageErrors: oneValue(pageErrorsRequirement),
|
|
144
|
+
expectedPageErrors: noPair(checkExpectedPageErrors),
|
|
145
|
+
realRequests: oneValue(realRequestsRequirement),
|
|
161
146
|
affected: noPair(objectOf({
|
|
162
147
|
selectAll: arrayOf(nonEmptyString, "an array of globs, such as ['package.json']"),
|
|
163
148
|
ignore: arrayOf(nonEmptyString, "an array of globs, such as ['**/*.md']"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../src/config/validate-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,QAAQ,EACR,aAAa,EACb,IAAI,EAEJ,oBAAoB,EACpB,KAAK,EACL,MAAM,EACN,cAAc,EACd,QAAQ,EACR,QAAQ,
|
|
1
|
+
{"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../src/config/validate-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,aAAa,EACb,IAAI,EAEJ,MAAM,EACN,oBAAoB,EACpB,KAAK,EACL,MAAM,EACN,cAAc,EACd,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,qBAAqB,EAErB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,gBAAgB,GACjB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAE5F;;GAEG;AACH,MAAM,UAAU,GAAG,uBAAuB,CAAA;AAE1C;;GAEG;AACH,MAAM,YAAY,GAChB,kHAAkH,CAAA;AAEpH;;GAEG;AACH,SAAS,MAAM,CAAC,KAAc;IAC5B,qGAAqG;IACrG,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAE3D,OAAO,I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CAAC,CAAA;IAC5G,CAAC;IAED,kHAAkH;IAClH,8GAA8G;IAC9G,0CAA0C;IAC1C,OAAO,gBAAgB,CAAC,KAAK,CAAW,CAAA;AAC1C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AffectedSettings, type ColorScheme, type Config, defineConfig, type LocalAndCi, type Platform, type StorybookSettings, type Tolerance, type Viewport } from './config/define-config.js';
|
|
2
|
-
import type { Report, ReportBrokenDetails, ReportBrokenReason, ReportConsoleLevel, ReportConsoleMessage, ReportDiffReason, ReportHint, ReportImages, ReportPixels, ReportRunError, ReportSelection, ReportShard, ReportSize, ReportStorybook, ReportStoryRef, ReportWarning, TestReport, TestReportCounts, TestReportEntry, UpdateReport, UpdateReportCounts, UpdateReportEntry } from './report/report-document.js';
|
|
3
|
-
export type { AffectedSettings, ColorScheme, Config, LocalAndCi, Platform, Report, ReportBrokenDetails, ReportBrokenReason, ReportConsoleLevel, ReportConsoleMessage, ReportDiffReason, ReportHint, ReportImages, ReportPixels, ReportRunError, ReportSelection, ReportShard, ReportSize, ReportStorybook, ReportStoryRef, ReportWarning, StorybookSettings, TestReport, TestReportCounts, TestReportEntry, Tolerance, UpdateReport, UpdateReportCounts, UpdateReportEntry, Viewport, };
|
|
1
|
+
import { type AffectedSettings, type ColorScheme, type Config, defineConfig, type LocalAndCi, type PageErrorCheck, type Platform, type RealRequestCheck, type StorybookSettings, type Tolerance, type Viewport } from './config/define-config.js';
|
|
2
|
+
import type { Report, ReportBrokenDetails, ReportBrokenReason, ReportConsoleLevel, ReportConsoleMessage, ReportDiffReason, ReportFailedLoad, ReportFailedLoadsHint, ReportHint, ReportImages, ReportPageError, ReportPixels, ReportRealRequest, ReportRemoteContentHint, ReportRunError, ReportSelection, ReportShard, ReportSize, ReportStorybook, ReportStoryRef, ReportWarning, TestReport, TestReportCounts, TestReportEntry, UpdateReport, UpdateReportCounts, UpdateReportEntry } from './report/report-document.js';
|
|
3
|
+
export type { AffectedSettings, ColorScheme, Config, LocalAndCi, PageErrorCheck, Platform, RealRequestCheck, Report, ReportBrokenDetails, ReportBrokenReason, ReportConsoleLevel, ReportConsoleMessage, ReportDiffReason, ReportFailedLoad, ReportFailedLoadsHint, ReportHint, ReportImages, ReportPageError, ReportPixels, ReportRealRequest, ReportRemoteContentHint, ReportRunError, ReportSelection, ReportShard, ReportSize, ReportStorybook, ReportStoryRef, ReportWarning, StorybookSettings, TestReport, TestReportCounts, TestReportEntry, Tolerance, UpdateReport, UpdateReportCounts, UpdateReportEntry, Viewport, };
|
|
4
4
|
export { defineConfig };
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,eAAe,EACf,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,6BAA6B,CAAA;AAEpC,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,UAAU,EACV,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,eAAe,EACf,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,GACT,CAAA;AACD,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,6BAA6B,CAAA;AAEpC,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,UAAU,EACV,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,GACT,CAAA;AACD,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,GAQb,MAAM,2BAA2B,CAAA;AAsElC,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -6,6 +6,11 @@ import { type StorybookCall } from './storybook-scripts.js';
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export type ListFiles = (root: string) => Promise<string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the path of the `main.<extension>` file a config folder holds on disk, the first by extension, or `undefined`
|
|
11
|
+
* when it holds none.
|
|
12
|
+
*/
|
|
13
|
+
export declare function mainFileIn(configDir: string): string | undefined;
|
|
9
14
|
/**
|
|
10
15
|
* Returns a check for whether a config folder, relative to `root`, holds a `main.<extension>` file on disk.
|
|
11
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-storybooks.d.ts","sourceRoot":"","sources":["../../src/init/find-storybooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE5F;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;AAsB3D;;G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;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,GAC1C,MAAM,EAAE,CAUV;AAeD;;GAEG;AACH,UAAU,UAAU;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAA;CACrB;AAmBD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAUtE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAExD"}
|
|
@@ -19,11 +19,18 @@ const mainFileExtensions = ['ts', 'js', 'mjs', 'cjs', 'mts', 'cts'];
|
|
|
19
19
|
* A path that is the main file of a config folder: `.storybook/main.<extension>`, in the root or deeper.
|
|
20
20
|
*/
|
|
21
21
|
const mainFilePath = new RegExp(`(?:^|/)\\.storybook/main\\.(?:${mainFileExtensions.join('|')})$`);
|
|
22
|
+
/**
|
|
23
|
+
* Returns the path of the `main.<extension>` file a config folder holds on disk, the first by extension, or `undefined`
|
|
24
|
+
* when it holds none.
|
|
25
|
+
*/
|
|
26
|
+
export function mainFileIn(configDir) {
|
|
27
|
+
return mainFileExtensions.map((extension) => join(configDir, `main.${extension}`)).find(isFile);
|
|
28
|
+
}
|
|
22
29
|
/**
|
|
23
30
|
* Returns a check for whether a config folder, relative to `root`, holds a `main.<extension>` file on disk.
|
|
24
31
|
*/
|
|
25
32
|
export function mainFileOnDiskIn(root) {
|
|
26
|
-
return (configDir) =>
|
|
33
|
+
return (configDir) => mainFileIn(join(root, configDir)) !== undefined;
|
|
27
34
|
}
|
|
28
35
|
/**
|
|
29
36
|
* Lists the files git tracks or would track in `root`: tracked files and untracked ones that `.gitignore` doesn't
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-storybooks.js","sourceRoot":"","sources":["../../src/init/find-storybooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAsB,MAAM,wBAAwB,CAAA;AAS5F;;GAEG;AACH,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAEzC;;GAEG;AACH,MAAM,YAAY,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA;AAEtC;;GAEG;AACH,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;AAEnE;;GAEG;AACH,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,iCAAiC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAElG
|
|
1
|
+
{"version":3,"file":"find-storybooks.js","sourceRoot":"","sources":["../../src/init/find-storybooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,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,KAAK,gBAAgB,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAA;IACjD,CAAC;IAED,OAAO,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,IAAiB;IAC5D,IAAI,IAAI,GAAG,IAAI,CAAA;IAEf,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC;QACjD,IAAI,GAAG,GAAG,IAAI,IAAI,MAAM,EAAE,CAAA;IAC5B,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAEd,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,MAAkB;IAC9C,OAAO,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A path git ignores, with the rule that ignores it.
|
|
3
|
+
*/
|
|
4
|
+
export interface IgnoredPath {
|
|
5
|
+
/**
|
|
6
|
+
* The path, relative to the folder git ran in and `/` separated.
|
|
7
|
+
*/
|
|
8
|
+
path: string;
|
|
9
|
+
/**
|
|
10
|
+
* The file the rule is in, such as `.gitignore`: relative to the repository's root, or absolute for a file outside
|
|
11
|
+
* it, such as the global excludes file.
|
|
12
|
+
*/
|
|
13
|
+
source: string;
|
|
14
|
+
/**
|
|
15
|
+
* The rule's line in that file, from 1.
|
|
16
|
+
*/
|
|
17
|
+
line: number;
|
|
18
|
+
/**
|
|
19
|
+
* The rule's pattern, such as `.claude/skills/*`.
|
|
20
|
+
*/
|
|
21
|
+
pattern: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Asks git which of `paths`, relative to `root`, it ignores in the repository around `root`. Gives none when git can't
|
|
25
|
+
* tell. Never throws.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export type FindIgnoredPaths = (root: string, paths: readonly string[]) => Promise<IgnoredPath[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Reads what `git check-ignore -v -z --stdin` prints: four NUL-terminated fields for each path a rule matched. A match
|
|
32
|
+
* of a negated pattern, which starts with `!`, keeps the path, so it's left out.
|
|
33
|
+
*/
|
|
34
|
+
export declare function ignoredPathsOf(output: string): IgnoredPath[];
|
|
35
|
+
/**
|
|
36
|
+
* Asks git which of `paths`, relative to `root`, it ignores in the repository around `root`, each with the rule that
|
|
37
|
+
* ignores it. `-z` takes the paths on stdin only, so they go there, `/` separated. Gives none when git finds none (it
|
|
38
|
+
* exits 1), outside a repository, without git, or when git fails.
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export declare function findIgnoredPaths(root: string, paths: readonly string[]): Promise<IgnoredPath[]>;
|
|
43
|
+
/**
|
|
44
|
+
* The warning that git ignores the agent skill's folder or its link, naming each path and the rule that ignores it, or
|
|
45
|
+
* `undefined` when it ignores neither.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export declare function ignoredSkillWarningOf(ignored: readonly IgnoredPath[]): string | undefined;
|
|
50
|
+
//# sourceMappingURL=ignored-skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignored-skill.d.ts","sourceRoot":"","sources":["../../src/init/ignored-skill.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;AAYjG;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAa5D;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAYrG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,GAAG,SAAS,CASzF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { sep } from 'node:path';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { listOf } from './list-of.js';
|
|
5
|
+
/**
|
|
6
|
+
* `execFile` that returns a promise.
|
|
7
|
+
*/
|
|
8
|
+
const execFileAsync = promisify(execFile);
|
|
9
|
+
/**
|
|
10
|
+
* How many NUL-terminated fields `git check-ignore -v -z` prints for each path: source, line, pattern, path.
|
|
11
|
+
*/
|
|
12
|
+
const fieldsPerMatch = 4;
|
|
13
|
+
/**
|
|
14
|
+
* Reads what `git check-ignore -v -z --stdin` prints: four NUL-terminated fields for each path a rule matched. A match
|
|
15
|
+
* of a negated pattern, which starts with `!`, keeps the path, so it's left out.
|
|
16
|
+
*/
|
|
17
|
+
export function ignoredPathsOf(output) {
|
|
18
|
+
const fields = output.split('\0');
|
|
19
|
+
const ignored = [];
|
|
20
|
+
for (let index = 0; index + fieldsPerMatch <= fields.length; index += fieldsPerMatch) {
|
|
21
|
+
const [source = '', line = '', pattern = '', path = ''] = fields.slice(index, index + fieldsPerMatch);
|
|
22
|
+
if (!pattern.startsWith('!')) {
|
|
23
|
+
ignored.push({ path, source, line: Number(line), pattern });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return ignored;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Asks git which of `paths`, relative to `root`, it ignores in the repository around `root`, each with the rule that
|
|
30
|
+
* ignores it. `-z` takes the paths on stdin only, so they go there, `/` separated. Gives none when git finds none (it
|
|
31
|
+
* exits 1), outside a repository, without git, or when git fails.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export async function findIgnoredPaths(root, paths) {
|
|
36
|
+
const run = execFileAsync('git', ['check-ignore', '-v', '-z', '--stdin'], { cwd: root, windowsHide: true });
|
|
37
|
+
// A git that has already exited closes stdin under the write: its exit code says what happened.
|
|
38
|
+
run.child.stdin?.on('error', () => undefined);
|
|
39
|
+
run.child.stdin?.end(paths.map((path) => `${path.split(sep).join('/')}\0`).join(''));
|
|
40
|
+
try {
|
|
41
|
+
return ignoredPathsOf((await run).stdout);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The warning that git ignores the agent skill's folder or its link, naming each path and the rule that ignores it, or
|
|
49
|
+
* `undefined` when it ignores neither.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export function ignoredSkillWarningOf(ignored) {
|
|
54
|
+
if (ignored.length === 0) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const paths = listOf(ignored.map(({ path, source, line, pattern }) => `${path} (${source} line ${line}: ${pattern})`));
|
|
58
|
+
const change = ignored.length === 1 ? 'Change that rule so git keeps it.' : 'Change those rules so git keeps them.';
|
|
59
|
+
return `Warning: git ignores ${paths}, so the agent skill won't reach other clones. ${change}`;
|
|
60
|
+
}
|
|
61
|
+
//#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G,CAAC"}
|
package/dist/init/install.d.ts
CHANGED
|
@@ -18,9 +18,13 @@ export interface DependenciesToAdd {
|
|
|
18
18
|
specs: string[];
|
|
19
19
|
/**
|
|
20
20
|
* Whether the package manager saves each at the exact version it resolves to, with no `^`: the packages that move in
|
|
21
|
-
* lockstep with the CLI
|
|
21
|
+
* lockstep with the CLI, and the browser package at the version the CLI names.
|
|
22
22
|
*/
|
|
23
23
|
exact: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether this is the browser package's add, which has a step of its own.
|
|
26
|
+
*/
|
|
27
|
+
browser: boolean;
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* A Storybook's package: the folder of its `package.json`, and its manifest.
|
|
@@ -60,15 +64,22 @@ interface DependenciesToAddInput {
|
|
|
60
64
|
*/
|
|
61
65
|
cliVersion: string;
|
|
62
66
|
/**
|
|
63
|
-
* The range of `@visual-check/chromium` the CLI works with
|
|
67
|
+
* The range of `@visual-check/chromium` the CLI works with, which the browser is added at when `browserVersion` is
|
|
68
|
+
* `undefined`.
|
|
64
69
|
*/
|
|
65
70
|
browserRange: string;
|
|
71
|
+
/**
|
|
72
|
+
* The exact version of `@visual-check/chromium` this CLI release was packed with, the newest it was tested on: its
|
|
73
|
+
* `devDependencies` entry, which `pnpm pack` writes over `workspace:*`. `undefined` when that entry isn't a plain
|
|
74
|
+
* version, as in this repository's workspace.
|
|
75
|
+
*/
|
|
76
|
+
browserVersion: string | undefined;
|
|
66
77
|
}
|
|
67
78
|
/**
|
|
68
79
|
* Works out the dependencies each package still needs: the CLI for the root, the Storybook package for each Storybook,
|
|
69
|
-
* and the addon for each that gets it, all exact, merged into one entry per folder; and the browser for the root
|
|
70
|
-
*
|
|
71
|
-
* it again, and an entry with nothing to add is left out. The root comes first.
|
|
80
|
+
* and the addon for each that gets it, all exact, merged into one entry per folder; and the browser for the root, in an
|
|
81
|
+
* entry of its own right after the root's: exact at the version the CLI names, else at the CLI's range. A package that
|
|
82
|
+
* already lists a name doesn't get it again, and an entry with nothing to add is left out. The root comes first.
|
|
72
83
|
*/
|
|
73
84
|
export declare function dependenciesToAddOf(input: DependenciesToAddInput): DependenciesToAdd[];
|
|
74
85
|
/**
|
|
@@ -158,14 +169,18 @@ interface InstallDependenciesInput {
|
|
|
158
169
|
*/
|
|
159
170
|
export declare function installDependencies(input: InstallDependenciesInput): Promise<string | undefined>;
|
|
160
171
|
/**
|
|
161
|
-
* The `storybook add` command for one Storybook: the Storybook's name, the command and the folder it runs in,
|
|
162
|
-
* `package.json` whose addon spec it changes.
|
|
172
|
+
* The `storybook add` command for one Storybook: the Storybook's name, the command and the folder it runs in, the
|
|
173
|
+
* config folder whose `main.*` it edits, and the `package.json` whose addon spec it changes.
|
|
163
174
|
*/
|
|
164
175
|
export interface AddonStep extends PlannedCommand {
|
|
165
176
|
/**
|
|
166
177
|
* The name of the Storybook.
|
|
167
178
|
*/
|
|
168
179
|
name: string;
|
|
180
|
+
/**
|
|
181
|
+
* The absolute config folder of the Storybook.
|
|
182
|
+
*/
|
|
183
|
+
configDir: string;
|
|
169
184
|
/**
|
|
170
185
|
* The absolute folder of the `package.json` the addon is in.
|
|
171
186
|
*/
|
|
@@ -228,8 +243,8 @@ interface AddAddonsInput {
|
|
|
228
243
|
progress: SetupProgress;
|
|
229
244
|
}
|
|
230
245
|
/**
|
|
231
|
-
* Adds the addon to each Storybook with `storybook add`, and keeps its spec exact. A step that
|
|
232
|
-
*
|
|
246
|
+
* Adds the addon to each Storybook with `storybook add`, and keeps its spec exact. A step that warns ends `warned`, and
|
|
247
|
+
* the next Storybook still runs. Returns each step's warnings, then its hint.
|
|
233
248
|
*/
|
|
234
249
|
export declare function addAddons(input: AddAddonsInput): Promise<string[]>;
|
|
235
250
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/init/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":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wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,aAAa,GAAG,MAAM,CAEhF"}
|
package/dist/init/install.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
1
2
|
import { join } from 'node:path';
|
|
2
3
|
import { addonPackage } from './addon-question.js';
|
|
3
|
-
import { relativePathOf, workspaceFolderOf } from './find-storybooks.js';
|
|
4
|
+
import { mainFileIn, relativePathOf, workspaceFolderOf } from './find-storybooks.js';
|
|
4
5
|
import { addDevDependenciesCommandOf, commandInFolderOf, commandLineOf, listsDependency, storybookCommandOf, } from './package-manager.js';
|
|
5
6
|
import { textOf } from './segment.js';
|
|
6
7
|
import { pinDependency } from './setup-files.js';
|
|
@@ -15,12 +16,12 @@ function missingSpecsOf(manifest, wanted) {
|
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Works out the dependencies each package still needs: the CLI for the root, the Storybook package for each Storybook,
|
|
18
|
-
* and the addon for each that gets it, all exact, merged into one entry per folder; and the browser for the root
|
|
19
|
-
*
|
|
20
|
-
* it again, and an entry with nothing to add is left out. The root comes first.
|
|
19
|
+
* and the addon for each that gets it, all exact, merged into one entry per folder; and the browser for the root, in an
|
|
20
|
+
* entry of its own right after the root's: exact at the version the CLI names, else at the CLI's range. A package that
|
|
21
|
+
* already lists a name doesn't get it again, and an entry with nothing to add is left out. The root comes first.
|
|
21
22
|
*/
|
|
22
23
|
export function dependenciesToAddOf(input) {
|
|
23
|
-
const { root, rootManifest, storybooks, addons, cliVersion, browserRange } = input;
|
|
24
|
+
const { root, rootManifest, storybooks, addons, cliVersion, browserRange, browserVersion } = input;
|
|
24
25
|
const found = [
|
|
25
26
|
{ dir: root, specs: missingSpecsOf(rootManifest, [['@visual-check/cli', cliVersion]]) },
|
|
26
27
|
...storybooks.map(({ manifestDir, manifest }) => ({
|
|
@@ -37,11 +38,12 @@ export function dependenciesToAddOf(input) {
|
|
|
37
38
|
const specsSoFar = merged.get(dir) ?? [];
|
|
38
39
|
merged.set(dir, [...specsSoFar, ...specs.filter((spec) => !specsSoFar.includes(spec))]);
|
|
39
40
|
}
|
|
40
|
-
const [rootAdd, ...packageAdds] = [...merged].map(([dir, specs]) => ({ dir, specs, exact: true }));
|
|
41
|
+
const [rootAdd, ...packageAdds] = [...merged].map(([dir, specs]) => ({ dir, specs, exact: true, browser: false }));
|
|
41
42
|
const browserAdd = {
|
|
42
43
|
dir: root,
|
|
43
|
-
specs: missingSpecsOf(rootManifest, [['@visual-check/chromium', browserRange]]),
|
|
44
|
-
exact:
|
|
44
|
+
specs: missingSpecsOf(rootManifest, [['@visual-check/chromium', browserVersion ?? browserRange]]),
|
|
45
|
+
exact: browserVersion !== undefined,
|
|
46
|
+
browser: true,
|
|
45
47
|
};
|
|
46
48
|
return [rootAdd, browserAdd, ...packageAdds].filter((add) => add !== undefined && add.specs.length > 0);
|
|
47
49
|
}
|
|
@@ -77,8 +79,8 @@ const browserInstallTitle = 'Install the browser package';
|
|
|
77
79
|
* Returns the title of the step that adds an entry: the browser's, the root's, or the one that names the package's
|
|
78
80
|
* folder, relative to the root.
|
|
79
81
|
*/
|
|
80
|
-
function installTitleOf({ dir,
|
|
81
|
-
if (
|
|
82
|
+
function installTitleOf({ dir, browser }, root) {
|
|
83
|
+
if (browser) {
|
|
82
84
|
return browserInstallTitle;
|
|
83
85
|
}
|
|
84
86
|
return dir === root ? installTitle : `${installTitle} in ${relativePathOf(root, dir)}`;
|
|
@@ -131,47 +133,85 @@ export function addonStepsOf(input) {
|
|
|
131
133
|
const ownConfigDir = relativePathOf(packageDir, join(root, configDir));
|
|
132
134
|
const configArgs = ownConfigDir === defaultConfigDir ? [] : ['-c', ownConfigDir];
|
|
133
135
|
const commandLine = storybookCommandOf(packageManager, ['add', `${addonPackage}@${cliVersion}`, '--yes', '--skip-install', ...configArgs], yarnBerry);
|
|
134
|
-
return { name, dir: packageDir, commandLine, manifestDir, version: cliVersion };
|
|
136
|
+
return { name, dir: packageDir, commandLine, configDir: join(root, configDir), manifestDir, version: cliVersion };
|
|
135
137
|
});
|
|
136
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Reads a text file, or gives `undefined` when it can't be read.
|
|
141
|
+
*/
|
|
142
|
+
function textOrUndefinedOf(path) {
|
|
143
|
+
try {
|
|
144
|
+
return readFileSync(path, 'utf8');
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Reads back the `main.*` file of the config folder after a successful `storybook add`. Gives a hint naming it, relative
|
|
152
|
+
* to `cwd`, since `storybook add` can leave its formatting untidy, and a warning when its text doesn't name the addon.
|
|
153
|
+
* Gives nothing when the folder holds no `main.*` file or it can't be read.
|
|
154
|
+
*/
|
|
155
|
+
function mainFileNotesOf(configDir, cwd) {
|
|
156
|
+
const mainFile = mainFileIn(configDir);
|
|
157
|
+
const text = mainFile === undefined ? undefined : textOrUndefinedOf(mainFile);
|
|
158
|
+
if (mainFile === undefined || text === undefined) {
|
|
159
|
+
return { warnings: [], hint: undefined };
|
|
160
|
+
}
|
|
161
|
+
const shown = relativePathOf(cwd, mainFile);
|
|
162
|
+
const hint = `hint: storybook add edited ${shown}; check its formatting.`;
|
|
163
|
+
if (text.includes(addonPackage)) {
|
|
164
|
+
return { warnings: [], hint };
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
warnings: [`Warning: storybook add ran, but ${shown} doesn't list ${addonPackage}. Add it to addons yourself.`],
|
|
168
|
+
hint,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
137
171
|
/**
|
|
138
172
|
* Runs one `storybook add`, then sets the addon's spec back to its exact version, since `storybook add` saves a `^`
|
|
139
173
|
* range even with `--skip-install`. The lockfile still holds the exact version the add command installed, so they
|
|
140
|
-
* agree again.
|
|
141
|
-
* Each says where to run the command and which
|
|
174
|
+
* agree again. Then reads back the config's `main.*` file, as `mainFileNotesOf` does. Warns when the command fails or
|
|
175
|
+
* throws, which skips the rest, or the spec can't be set back. Each warning says where to run the command and which
|
|
176
|
+
* `package.json` to fix, relative to `cwd`.
|
|
142
177
|
*/
|
|
143
178
|
async function addAddon(step, cwd, runCommand) {
|
|
144
|
-
const { name, dir, commandLine, manifestDir, version } = step;
|
|
179
|
+
const { name, dir, commandLine, configDir, manifestDir, version } = step;
|
|
145
180
|
const shown = commandLineOf(commandLine);
|
|
146
181
|
const manifestPath = join(manifestDir, 'package.json');
|
|
147
182
|
const pinText = `set ${addonPackage} back to "${version}" in ${relativePathOf(cwd, manifestPath)}`;
|
|
148
183
|
const exitCode = await runCommand(commandLine.command, commandLine.args, dir).catch(() => -1);
|
|
149
184
|
if (exitCode !== 0) {
|
|
150
|
-
return
|
|
151
|
-
|
|
185
|
+
return {
|
|
186
|
+
warnings: [
|
|
187
|
+
`Warning: ${shown} failed, so ${name} has no addon. ` +
|
|
188
|
+
`Run it yourself${inFolderTextOf(cwd, dir)} to add it, then ${pinText}.`,
|
|
189
|
+
],
|
|
190
|
+
hint: undefined,
|
|
191
|
+
};
|
|
152
192
|
}
|
|
193
|
+
const pinWarnings = [];
|
|
153
194
|
try {
|
|
154
195
|
pinDependency(manifestPath, addonPackage, version);
|
|
155
|
-
return undefined;
|
|
156
196
|
}
|
|
157
197
|
catch {
|
|
158
|
-
|
|
198
|
+
pinWarnings.push(`Warning: storybook add saved ${addonPackage} at a range, and init couldn't ${pinText}. Set it yourself.`);
|
|
159
199
|
}
|
|
200
|
+
const mainFileNotes = mainFileNotesOf(configDir, cwd);
|
|
201
|
+
return { warnings: [...pinWarnings, ...mainFileNotes.warnings], hint: mainFileNotes.hint };
|
|
160
202
|
}
|
|
161
203
|
/**
|
|
162
|
-
* Adds the addon to each Storybook with `storybook add`, and keeps its spec exact. A step that
|
|
163
|
-
*
|
|
204
|
+
* Adds the addon to each Storybook with `storybook add`, and keeps its spec exact. A step that warns ends `warned`, and
|
|
205
|
+
* the next Storybook still runs. Returns each step's warnings, then its hint.
|
|
164
206
|
*/
|
|
165
207
|
export async function addAddons(input) {
|
|
166
208
|
const { steps, cwd, runCommand, progress } = input;
|
|
167
|
-
const
|
|
209
|
+
const notes = [];
|
|
168
210
|
for (const step of steps) {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
warnings.push(warning);
|
|
172
|
-
}
|
|
211
|
+
const { warnings, hint } = await runStep(progress, { title: addonTitleOf(step.name), command: commandLineOf(step.commandLine) }, () => addAddon(step, cwd, runCommand), (found) => (found.warnings.length > 0 ? 'warned' : 'done'));
|
|
212
|
+
notes.push(...warnings, ...(hint === undefined ? [] : [hint]));
|
|
173
213
|
}
|
|
174
|
-
return
|
|
214
|
+
return notes;
|
|
175
215
|
}
|
|
176
216
|
/**
|
|
177
217
|
* Returns a command line as a person copies it: each argument holding `^` in double quotes, which `cmd.exe` would
|