viewev 0.1.0-beta.0 → 0.1.0-beta.2
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/README.md +44 -27
- package/dist/baselines/memory-store.d.ts +3 -0
- package/dist/baselines/memory-store.js +15 -0
- package/dist/baselines/memory-store.js.map +1 -0
- package/dist/browser/playwright/capturer.js.map +1 -1
- package/dist/ci/github-summary.js +23 -8
- package/dist/ci/github-summary.js.map +1 -1
- package/dist/cli/commands/test.js +185 -23
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/doctor.js +17 -8
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/format.d.ts +1 -1
- package/dist/cli/format.js +29 -7
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/impact.d.ts +3 -0
- package/dist/cli/impact.js +21 -15
- package/dist/cli/impact.js.map +1 -1
- package/dist/config/schema.d.ts +175 -1
- package/dist/config/schema.js +24 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/core/result.d.ts +6 -0
- package/dist/core/result.js.map +1 -1
- package/dist/core/test-run.d.ts +3 -1
- package/dist/core/test-run.js +1 -0
- package/dist/core/test-run.js.map +1 -1
- package/dist/impact/storybook.d.ts +16 -0
- package/dist/impact/storybook.js +324 -0
- package/dist/impact/storybook.js.map +1 -0
- package/dist/impact/types.d.ts +4 -0
- package/dist/impact/types.js.map +1 -1
- package/dist/reference/build.d.ts +10 -0
- package/dist/reference/build.js +36 -0
- package/dist/reference/build.js.map +1 -0
- package/dist/reference/git-worktree.d.ts +8 -0
- package/dist/reference/git-worktree.js +77 -0
- package/dist/reference/git-worktree.js.map +1 -0
- package/dist/reference/open.d.ts +13 -0
- package/dist/reference/open.js +66 -0
- package/dist/reference/open.js.map +1 -0
- package/dist/reporting/html.js +19 -12
- package/dist/reporting/html.js.map +1 -1
- package/dist/reporting/results-json.d.ts +2 -1
- package/dist/reporting/results-json.js +1 -0
- package/dist/reporting/results-json.js.map +1 -1
- package/docs/architecture.md +55 -59
- package/docs/ci.md +51 -177
- package/docs/impact.md +27 -12
- package/docs/publishing.md +35 -0
- package/package.json +1 -1
package/docs/impact.md
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Impact analysis
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
When comparing a pull request with a freshly captured target branch, Viewev selects scenarios
|
|
4
|
+
before taking screenshots. The Storybook analyzer traces static JavaScript, TypeScript and
|
|
5
|
+
stylesheet imports starting from each story's `importPath`. Changed component, style, image and
|
|
6
|
+
font dependencies select the stories that use them.
|
|
7
|
+
|
|
8
|
+
The analyzer is conservative. It selects all scenarios when a story source is unavailable, an
|
|
9
|
+
import cannot be resolved, the project uses a dynamic import pattern that cannot be followed, or
|
|
10
|
+
a changed source/configuration file cannot be mapped. This protects coverage when Viewev cannot
|
|
11
|
+
make a confident selection. `--filter` and `include`/`exclude` still apply after impact selection.
|
|
12
|
+
|
|
13
|
+
For provider-specific logic, a project can still supply an analyzer module. `viewev test --changed`
|
|
14
|
+
uses this extension for non-reference runs:
|
|
5
15
|
|
|
6
16
|
```js
|
|
7
17
|
// viewev.config.mjs
|
|
@@ -14,9 +24,10 @@ export default {
|
|
|
14
24
|
};
|
|
15
25
|
```
|
|
16
26
|
|
|
17
|
-
The module's default export receives `changedFiles`, all discovered `scenarios`,
|
|
18
|
-
`baseRef`.
|
|
19
|
-
`
|
|
27
|
+
The module's default export receives `changedFiles`, all discovered current-branch `scenarios`,
|
|
28
|
+
`repoRoot`, and `baseRef`. During a fresh-reference run, it also receives `baseScenarios` and
|
|
29
|
+
`baseRepoRoot` for the target branch. It returns either `{ mode: 'all', reason }` or
|
|
30
|
+
`{ mode: 'subset', scenarios: { [scenarioId]: ['reason'] } }`:
|
|
20
31
|
|
|
21
32
|
```js
|
|
22
33
|
// viewev-impact.mjs
|
|
@@ -31,16 +42,20 @@ export default ({ changedFiles, scenarios }) => {
|
|
|
31
42
|
}
|
|
32
43
|
}
|
|
33
44
|
|
|
34
|
-
return { mode: '
|
|
45
|
+
return { mode: 'subset', scenarios: selected };
|
|
35
46
|
};
|
|
36
47
|
```
|
|
37
48
|
|
|
38
|
-
Run `viewev test --changed
|
|
49
|
+
Run `viewev test --changed` for legacy image-baseline comparisons; `--base <ref>` overrides
|
|
50
|
+
`impact.baseRef`. For fresh target-branch comparisons, configure `reference` and the same
|
|
51
|
+
`impact.module` is called with both scenario lists and repository roots. Changed files are measured
|
|
39
52
|
from the Git merge base and include committed, staged, working-tree, and non-ignored untracked
|
|
40
53
|
changes. The target ref must be available locally. If Git cannot determine the changes or the
|
|
41
54
|
analysis module fails or returns invalid data, Viewev runs every filtered scenario and records
|
|
42
|
-
why it fell back.
|
|
55
|
+
why it fell back.
|
|
43
56
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
For Storybook projects using `reference`, no custom impact module is needed for common static
|
|
58
|
+
imports. The target and current Storybooks are both discovered, and the import graph on each side
|
|
59
|
+
is considered so story additions, removals and moved source files are handled. Other scenario
|
|
60
|
+
providers can supply their own mapping with `impact.module`. Dynamic branch comparison does not
|
|
61
|
+
read approved image baselines.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Publishing to npm
|
|
2
|
+
|
|
3
|
+
Viewev publishes automatically from version tags with npm's GitHub Actions trusted publishing
|
|
4
|
+
(OIDC). The workflow runs format checks, lint, type checking, unit and browser integration tests,
|
|
5
|
+
builds and packs the package, then publishes it with npm provenance. It does not use an npm token.
|
|
6
|
+
|
|
7
|
+
## One-time npm setup
|
|
8
|
+
|
|
9
|
+
On npmjs.com, open the `viewev` package settings and add a GitHub Actions trusted publisher:
|
|
10
|
+
|
|
11
|
+
- Organization or user: `viewev`
|
|
12
|
+
- Repository: `viewev`
|
|
13
|
+
- Workflow filename: `publish.yml`
|
|
14
|
+
- Enable direct `npm publish` for this publisher
|
|
15
|
+
|
|
16
|
+
The verification job uses Node.js 22.14.0 and npm 11.5.1. The isolated publishing job uses Node.js
|
|
17
|
+
24.13.1 with its bundled npm 11.8.0. Both meet npm's trusted-publishing requirements. npm generates
|
|
18
|
+
provenance automatically for eligible public packages. The trusted publisher must make its first
|
|
19
|
+
successful publish within two days of being created.
|
|
20
|
+
|
|
21
|
+
## Release a version
|
|
22
|
+
|
|
23
|
+
Update `version` in `package.json` and the root `package-lock.json`, commit that change, and push a
|
|
24
|
+
matching `v` tag. The workflow stops if the tag and package versions differ.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
git tag v0.1.0-beta.1
|
|
28
|
+
git push origin v0.1.0-beta.1
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Prerelease identifiers determine the npm dist-tag: `0.1.0-beta.1` publishes as `beta`,
|
|
32
|
+
`0.1.0-rc.1` as `rc`, and stable versions publish as `latest`. For example, users can install the
|
|
33
|
+
beta with `npm install viewev@beta`.
|
|
34
|
+
|
|
35
|
+
The workflow runs only in `viewev/viewev`. Fork tags cannot publish the package.
|