Comparing version 0.19.7 to 0.20.0
@@ -1,1 +0,1 @@ | ||
{"version":"0.19.7","commands":{"exec":{"id":"exec","description":"Start and stop Percy around a supplied command.","pluginName":"percy","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy exec -- echo \"percy is running around this echo command\"","$ percy exec -- bash -c \"echo foo && echo bar\""],"flags":{"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[]},"finalize":{"id":"finalize","description":"Finalize a build. Commonly used for parallelized builds, especially when the number of parallelized processes is unknown.","pluginName":"percy","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy finalize --all\n[percy] Finalized parallel build."],"flags":{"all":{"name":"all","type":"boolean","char":"a","required":true,"allowNo":false}},"args":[]},"health-check":{"id":"health-check","description":"Determines if the Percy Agent process is currently running","pluginName":"percy","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy healthcheck","$ percy healthcheck --port 6884"],"flags":{"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port","default":5338}},"args":[]},"percy-command":{"id":"percy-command","pluginName":"percy","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"snapshot":{"id":"snapshot","description":"Snapshot a directory containing a pre-built static website.","pluginName":"percy","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy snapshot _site/","$ percy snapshot _site/ --base-url \"/blog/\"","$ percy snapshot _site/ --ignore-files \"/blog/drafts/**\""],"flags":{"snapshot-files":{"name":"snapshot-files","type":"option","char":"s","description":"[default: **/*.html,**/*.htm] Glob or comma-seperated string of globs for matching the files and directories to snapshot."},"ignore-files":{"name":"ignore-files","type":"option","char":"i","description":"[default: ] Glob or comma-seperated string of globs for matching the files and directories to ignore."},"base-url":{"name":"base-url","type":"option","char":"b","description":"[default: /] If your static files will be hosted in a subdirectory, instead of the webserver's root path, set that subdirectory with this flag."},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[{"name":"snapshotDirectory","description":"[default: .] A path to the directory you would like to snapshot"}]},"start":{"id":"start","description":"Starts the percy process.","pluginName":"percy","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy start\ninfo: percy has started on port 5338."],"flags":{"detached":{"name":"detached","type":"boolean","char":"d","description":"start as a detached process","allowNo":false},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[]},"stop":{"id":"stop","description":"Stops the percy process.","pluginName":"percy","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy stop\ninfo: percy has stopped."],"flags":{"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"}},"args":[]},"upload":{"id":"upload","description":"Upload a directory containing static snapshot images.","pluginName":"percy","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy upload _images/","$ percy upload _images/ --files **/*.png"],"flags":{"files":{"name":"files","type":"option","char":"f","description":"[default: **/*.png,**/*.jpg,**/*.jpeg] Glob or comma-seperated string of globs for matching the files and directories to snapshot."},"ignore":{"name":"ignore","type":"option","char":"i","description":"[default: ] Glob or comma-seperated string of globs for matching the files and directories to ignore."},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[{"name":"uploadDirectory","description":"[default: .] A path to the directory containing static snapshot images"}]}}} | ||
{"version":"0.20.0","commands":{"exec":{"id":"exec","description":"Start and stop Percy around a supplied command.","pluginName":"percy","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy exec -- echo \"percy is running around this echo command\"","$ percy exec -- bash -c \"echo foo && echo bar\""],"flags":{"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"cache-responses":{"name":"cache-responses","type":"boolean","description":"[default: false] Enable caching network responses for asset discovery (experimental)","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[]},"finalize":{"id":"finalize","description":"Finalize a build. Commonly used for parallelized builds, especially when the number of parallelized processes is unknown.","pluginName":"percy","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy finalize --all\n[percy] Finalized parallel build."],"flags":{"all":{"name":"all","type":"boolean","char":"a","required":true,"allowNo":false}},"args":[]},"health-check":{"id":"health-check","description":"Determines if the Percy Agent process is currently running","pluginName":"percy","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy healthcheck","$ percy healthcheck --port 6884"],"flags":{"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port","default":5338}},"args":[]},"percy-command":{"id":"percy-command","pluginName":"percy","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"snapshot":{"id":"snapshot","description":"Snapshot a directory containing a pre-built static website.","pluginName":"percy","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy snapshot _site/","$ percy snapshot _site/ --base-url \"/blog/\"","$ percy snapshot _site/ --ignore-files \"/blog/drafts/**\""],"flags":{"snapshot-files":{"name":"snapshot-files","type":"option","char":"s","description":"[default: **/*.html,**/*.htm] Glob or comma-seperated string of globs for matching the files and directories to snapshot."},"ignore-files":{"name":"ignore-files","type":"option","char":"i","description":"[default: ] Glob or comma-seperated string of globs for matching the files and directories to ignore."},"base-url":{"name":"base-url","type":"option","char":"b","description":"[default: /] If your static files will be hosted in a subdirectory, instead of the webserver's root path, set that subdirectory with this flag."},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[{"name":"snapshotDirectory","description":"[default: .] A path to the directory you would like to snapshot"}]},"start":{"id":"start","description":"Starts the percy process.","pluginName":"percy","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy start\ninfo: percy has started on port 5338."],"flags":{"detached":{"name":"detached","type":"boolean","char":"d","description":"start as a detached process","allowNo":false},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"Allowable hostname(s) to capture assets from"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"[default: 50] Asset discovery network idle timeout (in milliseconds)"},"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[]},"stop":{"id":"stop","description":"Stops the percy process.","pluginName":"percy","pluginType":"core","hidden":true,"aliases":[],"examples":["$ percy stop\ninfo: percy has stopped."],"flags":{"port":{"name":"port","type":"option","char":"p","description":"[default: 5338] Port"}},"args":[]},"upload":{"id":"upload","description":"Upload a directory containing static snapshot images.","pluginName":"percy","pluginType":"core","hidden":false,"aliases":[],"examples":["$ percy upload _images/","$ percy upload _images/ --files **/*.png"],"flags":{"files":{"name":"files","type":"option","char":"f","description":"[default: **/*.png,**/*.jpg,**/*.jpeg] Glob or comma-seperated string of globs for matching the files and directories to snapshot."},"ignore":{"name":"ignore","type":"option","char":"i","description":"[default: ] Glob or comma-seperated string of globs for matching the files and directories to ignore."},"config":{"name":"config","type":"option","char":"c","description":"Path to percy config file"}},"args":[{"name":"uploadDirectory","description":"[default: .] A path to the directory containing static snapshot images"}]}}} |
@@ -0,1 +1,8 @@ | ||
# [0.20.0](https://github.com/percy/percy-agent/compare/v0.19.7...v0.20.0) (2019-11-08) | ||
### Features | ||
* Introduce asset discovery response caching behind flag ([#419](https://github.com/percy/percy-agent/issues/419)) ([7d7dd52](https://github.com/percy/percy-agent/commit/7d7dd52)) | ||
## [0.19.7](https://github.com/percy/percy-agent/compare/v0.19.6...v0.19.7) (2019-11-05) | ||
@@ -2,0 +9,0 @@ |
@@ -11,2 +11,3 @@ import { flags } from '@oclif/command'; | ||
'network-idle-timeout': import("@oclif/parser/lib/flags").IOptionFlag<number | undefined>; | ||
'cache-responses': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; | ||
'port': import("@oclif/parser/lib/flags").IOptionFlag<number | undefined>; | ||
@@ -13,0 +14,0 @@ 'config': flags.IOptionFlag<string | undefined>; |
@@ -59,2 +59,8 @@ "use strict"; | ||
}), | ||
'cache-responses': command_1.flags.boolean({ | ||
description: [ | ||
`[default: ${configuration_1.DEFAULT_CONFIGURATION.agent['asset-discovery']['cache-responses']}]`, | ||
'Enable caching network responses for asset discovery (experimental)', | ||
].join(' '), | ||
}), | ||
'port': command_1.flags.integer({ | ||
@@ -61,0 +67,0 @@ char: 'p', |
@@ -7,2 +7,3 @@ export interface AssetDiscoveryConfiguration { | ||
'page-pool-size-max': number; | ||
'cache-responses': boolean; | ||
} |
@@ -19,2 +19,3 @@ "use strict"; | ||
'page-pool-size-max': 5, | ||
'cache-responses': false, | ||
}, | ||
@@ -21,0 +22,0 @@ }, |
@@ -8,2 +8,3 @@ "use strict"; | ||
const logger_1 = require("../utils/logger"); | ||
const response_cache_1 = require("../utils/response-cache"); | ||
const wait_for_network_idle_1 = require("../utils/wait-for-network-idle"); | ||
@@ -130,2 +131,3 @@ const percy_client_service_1 = require("./percy-client-service"); | ||
page.on('request', async (request) => { | ||
const requestUrl = request.url(); | ||
try { | ||
@@ -136,3 +138,3 @@ if (!this.shouldRequestResolve(request)) { | ||
} | ||
if (request.url() === rootResourceUrl) { | ||
if (requestUrl === rootResourceUrl) { | ||
await request.respond({ | ||
@@ -145,2 +147,7 @@ body: domSnapshot, | ||
} | ||
if (this.configuration['cache-responses'] === true && response_cache_1.getResponseCache(requestUrl)) { | ||
logger.debug(`Asset cache hit for ${requestUrl}`); | ||
await request.respond(response_cache_1.getResponseCache(requestUrl)); | ||
return; | ||
} | ||
await request.continue(); | ||
@@ -158,2 +165,5 @@ } | ||
if (response) { | ||
if (this.configuration['cache-responses'] === true) { | ||
await response_cache_1.cacheResponse(response, logger); | ||
} | ||
// Parallelize the work in processResponse as much as possible, but make sure to | ||
@@ -160,0 +170,0 @@ // wait for it to complete before returning from the asset discovery phase. |
@@ -43,2 +43,3 @@ "use strict"; | ||
'network-idle-timeout': flags['network-idle-timeout'], | ||
'cache-responses': flags['cache-responses'], | ||
}, | ||
@@ -45,0 +46,0 @@ }, |
{ | ||
"name": "percy", | ||
"description": "An agent process for integrating with Percy.", | ||
"version": "0.19.7", | ||
"version": "0.20.0", | ||
"author": "Perceptual Inc", | ||
@@ -150,3 +150,3 @@ "bin": { | ||
"test:client": "karma start ./test/percy-agent-client/karma.conf.js", | ||
"test:integration": "yarn build-client && node ./bin/run exec -h *.localtest.me -c .ci.percy.yml -- mocha test/integration/**/*.test.ts", | ||
"test:integration": "yarn build-client && node ./bin/run exec --cache-responses -h *.localtest.me -c .ci.percy.yml -- mocha test/integration/**/*.test.ts", | ||
"test:command:snapshot": "./bin/run snapshot test/integration/test-static-site -b /dummy-base-url/ -i **/red-keep.** -s **/*.{html}", | ||
@@ -153,0 +153,0 @@ "test:command:upload": "./bin/run upload test/integration/test-static-images", |
@@ -24,3 +24,3 @@ @percy/agent | ||
$ percy (-v|--version|version) | ||
percy/0.19.7 linux-x64 node-v8.16.2 | ||
percy/0.20.0 linux-x64 node-v8.16.2 | ||
$ percy --help [COMMAND] | ||
@@ -54,2 +54,5 @@ USAGE | ||
--cache-responses [default: false] Enable caching network responses for asset discovery | ||
(experimental) | ||
EXAMPLES | ||
@@ -60,3 +63,3 @@ $ percy exec -- echo "percy is running around this echo command" | ||
_See code: [dist/commands/exec.ts](https://github.com/percy/percy-agent/blob/v0.19.7/dist/commands/exec.ts)_ | ||
_See code: [dist/commands/exec.ts](https://github.com/percy/percy-agent/blob/v0.20.0/dist/commands/exec.ts)_ | ||
@@ -79,3 +82,3 @@ ## `percy finalize` | ||
_See code: [dist/commands/finalize.ts](https://github.com/percy/percy-agent/blob/v0.19.7/dist/commands/finalize.ts)_ | ||
_See code: [dist/commands/finalize.ts](https://github.com/percy/percy-agent/blob/v0.20.0/dist/commands/finalize.ts)_ | ||
@@ -135,3 +138,3 @@ ## `percy help [COMMAND]` | ||
_See code: [dist/commands/snapshot.ts](https://github.com/percy/percy-agent/blob/v0.19.7/dist/commands/snapshot.ts)_ | ||
_See code: [dist/commands/snapshot.ts](https://github.com/percy/percy-agent/blob/v0.20.0/dist/commands/snapshot.ts)_ | ||
@@ -163,3 +166,3 @@ ## `percy upload [UPLOADDIRECTORY]` | ||
_See code: [dist/commands/upload.ts](https://github.com/percy/percy-agent/blob/v0.19.7/dist/commands/upload.ts)_ | ||
_See code: [dist/commands/upload.ts](https://github.com/percy/percy-agent/blob/v0.20.0/dist/commands/upload.ts)_ | ||
<!-- commandsstop --> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147559
88
2609
163