afterbefore 0.1.1 → 0.1.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/LICENSE CHANGED
@@ -1,21 +1,143 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Kai Revicius
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ PolyForm Shield License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/shield/1.0.0>
4
+
5
+ Copyright (c) 2026 Paulius Kairevicius
6
+
7
+ Acceptance
8
+
9
+ In order to get any license under these terms, you must agree to them as
10
+ both strict obligations and conditions to all your licenses.
11
+
12
+ Copyright License
13
+
14
+ The licensor grants you a copyright license for the software to do
15
+ everything you might do with the software that would otherwise infringe
16
+ the licensor's copyright in it for any permitted purpose. However, you
17
+ may only distribute the software according to Distribution License and
18
+ make changes or new works based on the software according to Changes and
19
+ New Works License.
20
+
21
+ Distribution License
22
+
23
+ The licensor grants you an additional copyright license to distribute
24
+ copies of the software. Your license to distribute covers distributing
25
+ the software with changes and new works permitted by Changes and New
26
+ Works License.
27
+
28
+ Notices
29
+
30
+ You must ensure that anyone who gets a copy of any part of the software
31
+ from you also gets a copy of these terms or the URL for them above, as
32
+ well as copies of any plain-text lines beginning with "Required Notice:"
33
+ that the licensor provided with the software.
34
+
35
+ Changes and New Works License
36
+
37
+ The licensor grants you an additional copyright license to make changes
38
+ and new works based on the software for any permitted purpose.
39
+
40
+ Patent License
41
+
42
+ The licensor grants you a patent license for the software that covers
43
+ patent claims the licensor can license, or becomes able to license, that
44
+ you would infringe by using the software.
45
+
46
+ Noncompete
47
+
48
+ Any purpose is a permitted purpose, except for providing any product
49
+ that competes with the software or any product the licensor or any of
50
+ its affiliates provides using the software.
51
+
52
+ Competition
53
+
54
+ Goods and services compete even when they provide functionality through
55
+ different kinds of interfaces or for different technical platforms.
56
+ Applications can compete with services, libraries with plugins,
57
+ frameworks with development tools, and so on, even if they're written in
58
+ different programming languages or for different computer architectures.
59
+ Goods and services compete even when provided free of charge. If you
60
+ market a product as a practical substitute for the software or another
61
+ product, it definitely competes.
62
+
63
+ New Products
64
+
65
+ If you are using the software to provide a product that does not
66
+ compete, but the licensor or any of its affiliates brings your product
67
+ into competition by providing a new version of the software or another
68
+ product using the software, you may continue using versions of the
69
+ software available under these terms beforehand to provide your
70
+ competing product, but not any later versions.
71
+
72
+ Discontinued Products
73
+
74
+ You may begin using the software to compete with a product or service
75
+ that the licensor or any of its affiliates has stopped providing, unless
76
+ the licensor includes a plain-text line beginning with "Licensor Line of
77
+ Business:" with the software that mentions that line of business.
78
+
79
+ Sales of Business
80
+
81
+ If the licensor or any of its affiliates sells a line of business
82
+ developing the software or using the software to provide a product, the
83
+ buyer can also enforce Noncompete for that product.
84
+
85
+ Fair Use
86
+
87
+ You may have "fair use" rights for the software under the law. These
88
+ terms do not limit them.
89
+
90
+ No Other Rights
91
+
92
+ These terms do not allow you to sublicense or transfer any of your
93
+ licenses to anyone else, or prevent the licensor from granting licenses
94
+ to anyone else. These terms do not imply any other licenses.
95
+
96
+ Patent Defense
97
+
98
+ If you make any written claim that the software infringes or contributes
99
+ to infringement of any patent, your patent license for the software
100
+ granted under these terms ends immediately. If your company makes such a
101
+ claim, your patent license ends immediately for work on behalf of your
102
+ company.
103
+
104
+ Violations
105
+
106
+ The first time you are notified in writing that you have violated any of
107
+ these terms, or done anything with the software not covered by your
108
+ licenses, your licenses can nonetheless continue if you come into full
109
+ compliance with these terms, and take practical steps to correct past
110
+ violations, within 32 days of receiving notice. Otherwise, all your
111
+ licenses end immediately.
112
+
113
+ No Liability
114
+
115
+ As far as the law allows, the software comes as is, without any warranty
116
+ or condition, and the licensor will not be liable to you for any damages
117
+ arising out of these terms or the use or nature of the software, under
118
+ any kind of legal claim.
119
+
120
+ Definitions
121
+
122
+ The licensor is the individual or entity offering these terms, and the
123
+ software is the software the licensor makes available under these terms.
124
+
125
+ A product can be a good or service, or a combination of them.
126
+
127
+ You refers to the individual or entity agreeing to these terms.
128
+
129
+ Your company is any legal entity, sole proprietorship, or other kind of
130
+ organization that you work for, plus all its affiliates.
131
+
132
+ Affiliates means the other organizations than an organization has
133
+ control over, is under the control of, or is under common control with.
134
+
135
+ Control means ownership of substantially all the assets of an entity, or
136
+ the power to direct its management and policies by vote, contract, or
137
+ otherwise. Control can be direct or indirect.
138
+
139
+ Your licenses are all the licenses granted to you for the software under
140
+ these terms.
141
+
142
+ Use means anything you do with the software requiring one of your
143
+ licenses.
package/README.md CHANGED
@@ -1,141 +1,14 @@
1
1
  # afterbefore
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/afterbefore)](https://www.npmjs.com/package/afterbefore)
4
- [![npm downloads](https://img.shields.io/npm/dm/afterbefore)](https://www.npmjs.com/package/afterbefore)
3
+ [![npm version](https://img.shields.io/npm/v/afterbefore?color=blue)](https://www.npmjs.com/package/afterbefore)
4
+ [![npm downloads](https://img.shields.io/npm/dm/afterbefore?color=green)](https://www.npmjs.com/package/afterbefore)
5
5
 
6
- Automatic before/after screenshot capture for Next.js pull requests. **The git diff is the config.**
7
-
8
- Change code, run one command, and get a visual report of only impacted routes.
6
+ Automatic before/after screenshot capture for Next.js pull requests. The git diff is the config.
9
7
 
10
8
  ```bash
11
9
  npx afterbefore
12
10
  ```
13
11
 
14
- ## What It Does
15
-
16
- 1. Reads changed files from `git diff` against a base ref
17
- 2. Builds an import graph and finds affected `app/**/page.*` routes
18
- 3. Handles layout/global style changes that are not direct imports
19
- 4. Creates a temporary git worktree for the base ref
20
- 5. Starts two Next.js dev servers (before + after)
21
- 6. Captures screenshots with Playwright
22
- 7. Computes pixel diffs with `pixelmatch`
23
- 8. Generates:
24
- - `index.html` visual report
25
- - per-route slider pages for changed routes
26
- - `summary.md` for PR comments
27
- 9. Optionally posts/updates a GitHub PR comment (`--post`)
28
-
29
- ## Installation
30
-
31
- ```bash
32
- # npm
33
- npm install --save-dev afterbefore
34
-
35
- # from GitHub
36
- npm install --save-dev github:kairevicius/afterbefore
37
-
38
- # run without installing
39
- npx afterbefore
40
- ```
41
-
42
- ## Usage
43
-
44
- ```bash
45
- # compare current branch vs main
46
- npx afterbefore
47
-
48
- # compare against a different base branch
49
- npx afterbefore --base develop
50
-
51
- # post/update comment on the open PR (requires gh auth)
52
- npx afterbefore --post
53
- ```
54
-
55
- ### CLI Options
56
-
57
- | Flag | Description | Default |
58
- |------|-------------|---------|
59
- | `--base <ref>` | Base branch or ref to compare against | `main` |
60
- | `--output <dir>` | Output directory root | `.afterbefore` |
61
- | `--post` | Post/update results as a PR comment via `gh` CLI | `false` |
62
- | `--threshold <percent>` | Diff threshold percentage below which route is marked unchanged | `0.1` |
63
- | `--max-routes <count>` | Maximum routes to capture (`0` = unlimited) | `6` |
64
- | `--open` | Auto-open `index.html` after run | `false` |
65
- | `--width <pixels>` | Viewport width | `1280` |
66
- | `--height <pixels>` | Viewport height | `720` |
67
- | `--device <name>` | Playwright device preset (for example `iPhone 14`) | unset |
68
- | `--delay <ms>` | Extra wait after page load/actions | `0` |
69
- | `--no-auto-tabs` | Disable ARIA tab state auto-capture | auto-tabs enabled |
70
- | `--max-tabs <count>` | Max auto-detected inactive tabs per route | `5` |
71
- | `--auto-sections` | Auto-detect and capture heading-labeled sections | `false` |
72
- | `--max-sections <count>` | Max auto-detected sections per page/tab state | `10` |
73
-
74
- ## Optional Scenario Config
75
-
76
- `afterbefore` can run scripted interactions before capture via config files:
77
-
78
- - `afterbefore.config.json`
79
- - `afterbefore.config.js`
80
- - `afterbefore.config.mjs`
81
-
82
- Example:
83
-
84
- ```json
85
- {
86
- "scenarios": {
87
- "/pricing": [
88
- {
89
- "name": "annual-toggle",
90
- "actions": [
91
- { "click": "[data-testid='billing-toggle']" },
92
- { "wait": 300 }
93
- ]
94
- },
95
- {
96
- "name": "plan-cards-only",
97
- "selector": "[data-testid='plan-grid']",
98
- "actions": []
99
- }
100
- ]
101
- }
102
- }
103
- ```
104
-
105
- When a route has manual scenarios, default auto tab/section expansion is skipped for that route.
106
-
107
- ## Output
108
-
109
- Each run creates a dated session directory:
110
-
111
- ```text
112
- .afterbefore/
113
- <branch>_YYYY-MM-DD/
114
- index.html
115
- summary.md
116
- _root-before.png
117
- _root-after.png
118
- _root-diff.png
119
- _root-compare.png # only when changed
120
- _root-slider.html # only when changed
121
- about-before.png
122
- about-after.png
123
- about-diff.png
124
- about-compare.png
125
- about-slider.html
126
- ```
127
-
128
- Open `index.html` to review all captured states.
129
-
130
- ## Requirements And Limits
131
-
132
- - Node.js `>=18`
133
- - Git repository
134
- - Next.js App Router project (`app/` pages)
135
- - Dependencies installable in temporary worktree
136
- - `gh` CLI authenticated if using `--post`
137
- - Dynamic routes (for example `app/blog/[slug]/page.tsx`) are currently skipped
138
-
139
12
  ## License
140
13
 
141
- MIT
14
+ Licensed under [PolyForm Shield 1.0.0](https://polyformproject.org/licenses/shield/1.0.0)
package/dist/cli.js CHANGED
@@ -1958,7 +1958,7 @@ async function runPipeline(options) {
1958
1958
  const outputDir = resolve4(cwd, output, sessionName);
1959
1959
  const startTime = Date.now();
1960
1960
  try {
1961
- const version = true ? "0.1.1" : "dev";
1961
+ const version = true ? "0.1.2" : "dev";
1962
1962
  console.log(`
1963
1963
  afterbefore v${version} \xB7 Comparing against ${base}
1964
1964
  `);
@@ -2092,7 +2092,7 @@ afterbefore v${version} \xB7 Comparing against ${base}
2092
2092
  var program = new Command();
2093
2093
  program.name("afterbefore").description(
2094
2094
  "Automatic before/after screenshot capture for PRs. Git diff is the config."
2095
- ).version("0.1.1").option("--base <ref>", "Base branch or ref to compare against", "main").option("--output <dir>", "Output directory for screenshots", ".afterbefore").option("--post", "Post results as a PR comment via gh CLI", false).option(
2095
+ ).version("0.1.2").option("--base <ref>", "Base branch or ref to compare against", "main").option("--output <dir>", "Output directory for screenshots", ".afterbefore").option("--post", "Post results as a PR comment via gh CLI", false).option(
2096
2096
  "--threshold <percent>",
2097
2097
  "Diff threshold percentage (changes below this are ignored)",
2098
2098
  "0.1"
package/dist/index.js CHANGED
@@ -1945,7 +1945,7 @@ async function runPipeline(options) {
1945
1945
  const outputDir = resolve4(cwd, output, sessionName);
1946
1946
  const startTime = Date.now();
1947
1947
  try {
1948
- const version = true ? "0.1.1" : "dev";
1948
+ const version = true ? "0.1.2" : "dev";
1949
1949
  console.log(`
1950
1950
  afterbefore v${version} \xB7 Comparing against ${base}
1951
1951
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afterbefore",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Automatic before/after screenshot capture for PRs. Git diff is the config.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  "visual-testing"
40
40
  ],
41
41
  "author": "Kai Revicius",
42
- "license": "MIT",
42
+ "license": "PolyForm-Shield-1.0.0",
43
43
  "bugs": {
44
44
  "url": "https://github.com/kairevicius/afterbefore/issues"
45
45
  },