viewev 0.1.0-beta.0 → 0.1.0-beta.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.
Files changed (49) hide show
  1. package/README.md +44 -27
  2. package/dist/baselines/memory-store.d.ts +3 -0
  3. package/dist/baselines/memory-store.js +15 -0
  4. package/dist/baselines/memory-store.js.map +1 -0
  5. package/dist/browser/playwright/capturer.js.map +1 -1
  6. package/dist/ci/github-summary.js +23 -8
  7. package/dist/ci/github-summary.js.map +1 -1
  8. package/dist/cli/commands/test.js +185 -23
  9. package/dist/cli/commands/test.js.map +1 -1
  10. package/dist/cli/doctor.js +17 -8
  11. package/dist/cli/doctor.js.map +1 -1
  12. package/dist/cli/format.d.ts +1 -1
  13. package/dist/cli/format.js +29 -7
  14. package/dist/cli/format.js.map +1 -1
  15. package/dist/cli/impact.d.ts +3 -0
  16. package/dist/cli/impact.js +21 -15
  17. package/dist/cli/impact.js.map +1 -1
  18. package/dist/config/schema.d.ts +175 -1
  19. package/dist/config/schema.js +24 -1
  20. package/dist/config/schema.js.map +1 -1
  21. package/dist/core/result.d.ts +6 -0
  22. package/dist/core/result.js.map +1 -1
  23. package/dist/core/test-run.d.ts +3 -1
  24. package/dist/core/test-run.js +1 -0
  25. package/dist/core/test-run.js.map +1 -1
  26. package/dist/impact/storybook.d.ts +16 -0
  27. package/dist/impact/storybook.js +324 -0
  28. package/dist/impact/storybook.js.map +1 -0
  29. package/dist/impact/types.d.ts +4 -0
  30. package/dist/impact/types.js.map +1 -1
  31. package/dist/reference/build.d.ts +10 -0
  32. package/dist/reference/build.js +36 -0
  33. package/dist/reference/build.js.map +1 -0
  34. package/dist/reference/git-worktree.d.ts +8 -0
  35. package/dist/reference/git-worktree.js +77 -0
  36. package/dist/reference/git-worktree.js.map +1 -0
  37. package/dist/reference/open.d.ts +13 -0
  38. package/dist/reference/open.js +66 -0
  39. package/dist/reference/open.js.map +1 -0
  40. package/dist/reporting/html.js +19 -12
  41. package/dist/reporting/html.js.map +1 -1
  42. package/dist/reporting/results-json.d.ts +2 -1
  43. package/dist/reporting/results-json.js +1 -0
  44. package/dist/reporting/results-json.js.map +1 -1
  45. package/docs/architecture.md +55 -59
  46. package/docs/ci.md +51 -177
  47. package/docs/impact.md +27 -12
  48. package/docs/publishing.md +35 -0
  49. package/package.json +1 -1
package/docs/impact.md CHANGED
@@ -1,7 +1,17 @@
1
- # Optional impact analysis
1
+ # Impact analysis
2
2
 
3
- `viewev test --changed` can run only the scenarios affected by changed files. Viewev does not
4
- assume how source files relate to stories; each project supplies a small analysis module.
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`, `repoRoot`, and
18
- `baseRef`. It returns either `{ mode: 'all', reason }` or
19
- `{ mode: 'impact', scenarios: { [scenarioId]: ['reason'] } }`:
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: 'impact', scenarios: selected };
45
+ return { mode: 'subset', scenarios: selected };
35
46
  };
36
47
  ```
37
48
 
38
- Run `viewev test --changed`; `--base <ref>` overrides `impact.baseRef`. Changed files are measured
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. This favors a slower run over missing a possible regression.
55
+ why it fell back.
43
56
 
44
- Impact analysis only selects scenarios. It does not select approved baselines: baseline lookup
45
- uses the target branch configured by `baselines.baseRef`, `--base-ref`, or the GitHub Actions pull
46
- request environment.
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewev",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.1",
4
4
  "description": "Visual evaluation for the web. Open-source visual regression testing for web interfaces.",
5
5
  "license": "MIT",
6
6
  "type": "module",