@percy/cli-snapshot 1.6.4 → 1.7.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/dist/snapshot.js +7 -4
- package/package.json +3 -3
package/dist/snapshot.js
CHANGED
|
@@ -84,9 +84,12 @@ export const snapshot = command('snapshot', {
|
|
|
84
84
|
|
|
85
85
|
if (file) {
|
|
86
86
|
// load snapshots file
|
|
87
|
-
let snapshots = yield loadSnapshotFile(file); // accept
|
|
87
|
+
let snapshots = yield loadSnapshotFile(file); // remove any references and accept an array of snapshots instead of an config object
|
|
88
88
|
|
|
89
|
-
let
|
|
89
|
+
let {
|
|
90
|
+
references,
|
|
91
|
+
...config
|
|
92
|
+
} = Array.isArray(snapshots) ? {
|
|
90
93
|
snapshots
|
|
91
94
|
} : snapshots;
|
|
92
95
|
options = merge(config, {
|
|
@@ -147,14 +150,14 @@ function merge(...objs) {
|
|
|
147
150
|
async function loadSnapshotFile(file) {
|
|
148
151
|
let ext = path.extname(file);
|
|
149
152
|
|
|
150
|
-
if (ext
|
|
153
|
+
if (/\.(c|m)?js$/.test(ext)) {
|
|
151
154
|
let {
|
|
152
155
|
default: module
|
|
153
156
|
} = await import(path.resolve(file));
|
|
154
157
|
return typeof module === 'function' ? await module() : module;
|
|
155
158
|
} else if (ext === '.json') {
|
|
156
159
|
return JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
157
|
-
} else if (
|
|
160
|
+
} else if (/\.ya?ml$/.test(ext)) {
|
|
158
161
|
let {
|
|
159
162
|
default: YAML
|
|
160
163
|
} = await import('yaml');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/cli-snapshot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
]
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@percy/cli-command": "1.
|
|
35
|
+
"@percy/cli-command": "1.7.2",
|
|
36
36
|
"yaml": "^2.0.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "d9da4a4f9eafc3c3ac361a50f679f030172ad362"
|
|
39
39
|
}
|