inkhash 0.0.1 → 0.0.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 +11 -0
- package/dist/cli.mjs +33 -3
- package/package.json +20 -17
package/README.md
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
1
|
# inkhash
|
|
2
|
+
|
|
3
|
+
## Why did I start this project?
|
|
4
|
+
|
|
5
|
+
I don't agree that regression tests should always use devices, browsers, or simulators.
|
|
6
|
+
They're too expensive and inefficient, so my idea is to skip them and just use a lock file that hashes your service's UI.
|
|
7
|
+
|
|
8
|
+
## How to use it
|
|
9
|
+
|
|
10
|
+
1. Scaffold it with `npx inkhash init`.
|
|
11
|
+
2. Add your config (supported browser versions, etc.).
|
|
12
|
+
3. That's it.
|
package/dist/cli.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { defineCommand, runMain } from "citty";
|
|
3
3
|
import { n as load } from "./config-CvO48-dR.mjs";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
+
import { appendFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
6
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
7
|
import { registerHooks } from "node:module";
|
|
6
8
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
9
|
import { transformSync } from "oxc-transform";
|
|
8
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
9
|
-
import { dirname, join, resolve } from "node:path";
|
|
10
10
|
import { selectAll, selectOne } from "css-select";
|
|
11
11
|
import postcss from "postcss";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
@@ -15,8 +15,32 @@ import { createElement } from "react";
|
|
|
15
15
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
16
16
|
// package.json
|
|
17
17
|
var name = "inkhash";
|
|
18
|
-
var version = "0.0.
|
|
18
|
+
var version = "0.0.2";
|
|
19
19
|
var description = "Visual regression keys from React views and browser profiles, without running a browser";
|
|
20
|
+
// src/init.ts
|
|
21
|
+
const template = `import { defineConfig } from 'inkhash'
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
renderers: [],
|
|
25
|
+
css: [],
|
|
26
|
+
views: [],
|
|
27
|
+
})
|
|
28
|
+
`;
|
|
29
|
+
async function init(cwd = process.cwd()) {
|
|
30
|
+
const changed = [];
|
|
31
|
+
const config = join(cwd, "inkhash.config.ts");
|
|
32
|
+
if (!existsSync(config)) {
|
|
33
|
+
await writeFile(config, template);
|
|
34
|
+
changed.push("inkhash.config.ts");
|
|
35
|
+
}
|
|
36
|
+
const ignore = join(cwd, ".gitignore");
|
|
37
|
+
const text = existsSync(ignore) ? await readFile(ignore, "utf8") : "";
|
|
38
|
+
if (!text.split("\n").includes(".inkhash")) {
|
|
39
|
+
await appendFile(ignore, `${text && !text.endsWith("\n") ? "\n" : ""}.inkhash\n`);
|
|
40
|
+
changed.push(".gitignore");
|
|
41
|
+
}
|
|
42
|
+
return changed;
|
|
43
|
+
}
|
|
20
44
|
// src/hooks.ts
|
|
21
45
|
const graph = /* @__PURE__ */ new Map();
|
|
22
46
|
const source = /\.[mc]?[jt]sx?$/;
|
|
@@ -297,6 +321,12 @@ runMain(defineCommand({
|
|
|
297
321
|
description
|
|
298
322
|
},
|
|
299
323
|
subCommands: {
|
|
324
|
+
init: defineCommand({
|
|
325
|
+
meta: { description: "Scaffold inkhash.config.ts and ignore .inkhash" },
|
|
326
|
+
async run() {
|
|
327
|
+
print(await init());
|
|
328
|
+
}
|
|
329
|
+
}),
|
|
300
330
|
run: defineCommand({
|
|
301
331
|
meta: { description: "Hash every view and list the ones that need a capture" },
|
|
302
332
|
async run() {
|
package/package.json
CHANGED
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inkhash",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Visual regression keys from React views and browser profiles, without running a browser",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"css",
|
|
7
|
+
"react",
|
|
8
|
+
"static-analysis",
|
|
9
|
+
"visual-regression",
|
|
10
|
+
"vrt"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/NaamuKim/inkhash#readme",
|
|
13
|
+
"bugs": "https://github.com/NaamuKim/inkhash/issues",
|
|
5
14
|
"license": "MIT",
|
|
6
15
|
"repository": {
|
|
7
16
|
"type": "git",
|
|
8
17
|
"url": "git+https://github.com/NaamuKim/inkhash.git"
|
|
9
18
|
},
|
|
10
|
-
"homepage": "https://github.com/NaamuKim/inkhash#readme",
|
|
11
|
-
"bugs": "https://github.com/NaamuKim/inkhash/issues",
|
|
12
|
-
"type": "module",
|
|
13
|
-
"keywords": [
|
|
14
|
-
"visual-regression",
|
|
15
|
-
"vrt",
|
|
16
|
-
"react",
|
|
17
|
-
"css",
|
|
18
|
-
"static-analysis"
|
|
19
|
-
],
|
|
20
19
|
"bin": {
|
|
21
20
|
"inkhash": "./dist/cli.mjs"
|
|
22
21
|
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
23
26
|
"exports": {
|
|
24
27
|
".": {
|
|
25
28
|
"types": "./dist/index.d.mts",
|
|
26
29
|
"default": "./dist/index.mjs"
|
|
27
30
|
}
|
|
28
31
|
},
|
|
29
|
-
"files": [
|
|
30
|
-
"dist"
|
|
31
|
-
],
|
|
32
|
-
"engines": {
|
|
33
|
-
"node": ">=22.15"
|
|
34
|
-
},
|
|
35
32
|
"dependencies": {
|
|
36
33
|
"c12": "4.0.0-rc.4",
|
|
37
34
|
"citty": "^0.2.2",
|
|
@@ -48,6 +45,7 @@
|
|
|
48
45
|
"@types/react-dom": "^19.3.0",
|
|
49
46
|
"fs-fixture": "^2.16.2",
|
|
50
47
|
"odiff-bin": "^4.5.0",
|
|
48
|
+
"oxfmt": "^0.81.0",
|
|
51
49
|
"playwright-core": "^1.65.2",
|
|
52
50
|
"react": "^19.3.1",
|
|
53
51
|
"react-dom": "^19.3.1",
|
|
@@ -58,9 +56,14 @@
|
|
|
58
56
|
"react": ">=18",
|
|
59
57
|
"react-dom": ">=18"
|
|
60
58
|
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=22.15"
|
|
61
|
+
},
|
|
61
62
|
"scripts": {
|
|
62
63
|
"build": "tsdown",
|
|
63
64
|
"typecheck": "tsc --noEmit",
|
|
65
|
+
"format": "oxfmt",
|
|
66
|
+
"format:check": "oxfmt --check",
|
|
64
67
|
"test": "tsdown && node --test 'test/*.test.ts'",
|
|
65
68
|
"bench": "node bench/bench.ts",
|
|
66
69
|
"changeset": "changeset",
|