@percy/cli-snapshot 1.26.2 → 1.26.3-alpha.4
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 +8 -8
- package/dist/snapshot.js +14 -7
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -208,7 +208,7 @@ static:
|
|
|
208
208
|
include: **/*.html
|
|
209
209
|
exclude: []
|
|
210
210
|
rewrites: {}
|
|
211
|
-
|
|
211
|
+
options: []
|
|
212
212
|
```
|
|
213
213
|
|
|
214
214
|
- **base-url** - The base URL path the static site should be served under.
|
|
@@ -256,18 +256,18 @@ static:
|
|
|
256
256
|
/:year: /posts/index-:year.html
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
-
- **
|
|
259
|
+
- **options** - An array of per-snapshot options.
|
|
260
260
|
|
|
261
261
|
Just like [page listing options](#page-options), static snapshots may also contain
|
|
262
262
|
per-snapshot configuration options. However, since pages are matched against the `files`
|
|
263
|
-
option, so are per-snapshot configuration options via an array of `
|
|
264
|
-
|
|
263
|
+
option, so are per-snapshot configuration options via an array of `options`. If multiple
|
|
264
|
+
options match a snapshot, they will be merged with previously matched options.
|
|
265
265
|
|
|
266
266
|
``` yaml
|
|
267
267
|
# .percy.yml
|
|
268
268
|
version: 2
|
|
269
269
|
static:
|
|
270
|
-
|
|
270
|
+
options:
|
|
271
271
|
- files: /foo-bar.html
|
|
272
272
|
waitForSelector: .is-ready
|
|
273
273
|
execute: |
|
|
@@ -277,7 +277,7 @@ static:
|
|
|
277
277
|
### Sitemap URL
|
|
278
278
|
|
|
279
279
|
When providing a sitemap URL, the document must be an XML document. For sitemap URLs the `--include` and
|
|
280
|
-
`--exclude` flags can be used to filter snapshots. With a Percy config file, the `
|
|
280
|
+
`--exclude` flags can be used to filter snapshots. With a Percy config file, the `options` option
|
|
281
281
|
is also accepted.
|
|
282
282
|
|
|
283
283
|
> Tip: Sitemaps can contain **a lot** of URLs, so its best to always start with the `--dry-run` flag
|
|
@@ -308,8 +308,8 @@ version: 2
|
|
|
308
308
|
static:
|
|
309
309
|
include: **/*.html
|
|
310
310
|
exclude: []
|
|
311
|
-
|
|
311
|
+
options: []
|
|
312
312
|
```
|
|
313
313
|
|
|
314
314
|
See [the corresponding static options](#static-options) for details on `includes`, `excludes`, and
|
|
315
|
-
`
|
|
315
|
+
`options` options.
|
package/dist/snapshot.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const _excluded = ["references"];
|
|
2
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1
4
|
import fs from 'fs';
|
|
2
5
|
import path from 'path';
|
|
3
6
|
import { pathToFileURL } from 'url';
|
|
@@ -76,12 +79,13 @@ export const snapshot = command('snapshot', {
|
|
|
76
79
|
// load snapshots file
|
|
77
80
|
let snapshots = yield loadSnapshotFile(file);
|
|
78
81
|
// remove any references and accept an array of snapshots instead of an config object
|
|
79
|
-
let {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
let _ref = Array.isArray(snapshots) ? {
|
|
83
|
+
snapshots
|
|
84
|
+
} : snapshots,
|
|
85
|
+
{
|
|
86
|
+
references
|
|
87
|
+
} = _ref,
|
|
88
|
+
config = _objectWithoutProperties(_ref, _excluded);
|
|
85
89
|
options = merge(config, {
|
|
86
90
|
baseUrl,
|
|
87
91
|
include,
|
|
@@ -130,7 +134,10 @@ function parseBaseUrl(baseUrl, pathOnly) {
|
|
|
130
134
|
// Small shallow merge util that does not merge null or undefined values.
|
|
131
135
|
function merge(...objs) {
|
|
132
136
|
return objs.reduce((target, obj) => {
|
|
133
|
-
for (let k in obj)
|
|
137
|
+
for (let k in obj) {
|
|
138
|
+
var _obj$k;
|
|
139
|
+
target[k] = (_obj$k = obj[k]) !== null && _obj$k !== void 0 ? _obj$k : target[k];
|
|
140
|
+
}
|
|
134
141
|
return target;
|
|
135
142
|
}, {});
|
|
136
143
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/cli-snapshot",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.3-alpha.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public",
|
|
12
|
-
"tag": "
|
|
12
|
+
"tag": "alpha"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=14"
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@percy/cli-command": "1.26.
|
|
36
|
+
"@percy/cli-command": "1.26.3-alpha.4",
|
|
37
37
|
"yaml": "^2.0.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "d89ab97b8d5169eafd3eb42bdbbef41a2ac624ba"
|
|
40
40
|
}
|