@zenuml/core 3.32.0 → 3.32.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/index.html
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Script to update Cypress image snapshots
|
|
5
|
+
*
|
|
6
|
+
* This script:
|
|
7
|
+
* 1. Removes all .diff.png files
|
|
8
|
+
* 2. Replaces .png files with their .actual.png counterparts
|
|
9
|
+
* 3. Removes all .actual.png files
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const { promisify } = require("util");
|
|
15
|
+
const { exec } = require("child_process");
|
|
16
|
+
|
|
17
|
+
const execAsync = promisify(exec);
|
|
18
|
+
|
|
19
|
+
// Path to the image snapshots directory
|
|
20
|
+
const SNAPSHOTS_DIR = path.resolve(
|
|
21
|
+
__dirname,
|
|
22
|
+
"../cypress/e2e/__image_snapshots__",
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
async function updateSnapshots() {
|
|
26
|
+
try {
|
|
27
|
+
console.log("Starting snapshot update process...");
|
|
28
|
+
|
|
29
|
+
// Check if the snapshots directory exists
|
|
30
|
+
if (!fs.existsSync(SNAPSHOTS_DIR)) {
|
|
31
|
+
console.error(`Error: Snapshots directory not found at ${SNAPSHOTS_DIR}`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
console.log("1. Removing .diff.png files...");
|
|
36
|
+
await execAsync(`find "${SNAPSHOTS_DIR}" -name "*.diff.png" -delete`);
|
|
37
|
+
|
|
38
|
+
console.log(
|
|
39
|
+
"2. Replacing .png files with their .actual.png counterparts...",
|
|
40
|
+
);
|
|
41
|
+
// Find all .actual.png files and replace their corresponding .png files
|
|
42
|
+
const files = await execAsync(
|
|
43
|
+
`find "${SNAPSHOTS_DIR}" -name "*.actual.png"`,
|
|
44
|
+
);
|
|
45
|
+
const actualFiles = files.stdout.trim().split("\n").filter(Boolean);
|
|
46
|
+
|
|
47
|
+
for (const actualFile of actualFiles) {
|
|
48
|
+
const targetFile = actualFile.replace(".actual.png", ".png");
|
|
49
|
+
console.log(
|
|
50
|
+
` Replacing ${path.basename(targetFile)} with ${path.basename(
|
|
51
|
+
actualFile,
|
|
52
|
+
)}`,
|
|
53
|
+
);
|
|
54
|
+
fs.copyFileSync(actualFile, targetFile);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log("3. Removing .actual.png files...");
|
|
58
|
+
await execAsync(`find "${SNAPSHOTS_DIR}" -name "*.actual.png" -delete`);
|
|
59
|
+
|
|
60
|
+
console.log("Snapshot update completed successfully!");
|
|
61
|
+
console.log(
|
|
62
|
+
"Remember to commit and push these changes to update the reference snapshots.",
|
|
63
|
+
);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error("Error updating snapshots:", error);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
updateSnapshots();
|