Comparing version 0.25.0 to 0.26.0
@@ -1,1 +0,1 @@ | ||
{"version":"0.25.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: true] Caches successful network responses in asset discovery","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"}]}}} | ||
{"version":"0.26.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: true] Caches successful network responses in asset discovery","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."},"dry-run":{"name":"dry-run","type":"boolean","char":"d","description":"Print the list of paths to snapshot without creating a new build","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":[{"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."},"dry-run":{"name":"dry-run","type":"boolean","char":"d","description":"Print the list of images to upload without uploading them","allowNo":false},"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.26.0](https://github.com/percy/percy-agent/compare/v0.25.0...v0.26.0) (2020-03-17) | ||
### Features | ||
* snapshot and upload --dry-run flag ([#486](https://github.com/percy/percy-agent/issues/486)) ([6e259a3](https://github.com/percy/percy-agent/commit/6e259a3)) | ||
# [0.25.0](https://github.com/percy/percy-agent/compare/v0.24.3...v0.25.0) (2020-03-13) | ||
@@ -2,0 +9,0 @@ |
import { flags } from '@oclif/command'; | ||
import { StaticSnapshotsConfiguration } from '../configuration/static-snapshots-configuration'; | ||
import PercyCommand from './percy-command'; | ||
@@ -15,2 +16,3 @@ export default class Snapshot extends PercyCommand { | ||
'base-url': flags.IOptionFlag<string | undefined>; | ||
'dry-run': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; | ||
'allowed-hostname': flags.IOptionFlag<string[]>; | ||
@@ -22,2 +24,3 @@ 'network-idle-timeout': import("@oclif/parser/lib/flags").IOptionFlag<number | undefined>; | ||
run(): Promise<void>; | ||
dryrun(configuration: StaticSnapshotsConfiguration): Promise<void>; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const fs_1 = require("fs"); | ||
const globby = require("globby"); | ||
const configuration_1 = require("../configuration/configuration"); | ||
@@ -16,2 +17,6 @@ const static_snapshot_service_1 = require("../services/static-snapshot-service"); | ||
const configuration = configuration_2.default(flags, args); | ||
if (flags['dry-run']) { | ||
await this.dryrun(configuration['static-snapshots']); | ||
this.exit(0); | ||
} | ||
// exit gracefully if percy will not run | ||
@@ -43,2 +48,12 @@ if (!this.percyWillRun()) { | ||
} | ||
// will print the paths that would have been snapshotted | ||
async dryrun(configuration) { | ||
// this cannot be done in the static snapshot service because not only does | ||
// it map paths to localhost URLs, but it also starts the localhost server | ||
// and creates a new Percy build before parsing any globs | ||
const globs = configuration_2.parseGlobs(configuration['snapshot-files']); | ||
const ignore = configuration_2.parseGlobs(configuration['ignore-files']); | ||
const paths = await globby(globs, { cwd: configuration.path, ignore }); | ||
console.log(paths.map((p) => configuration['base-url'] + p).join('\n')); | ||
} | ||
} | ||
@@ -82,2 +97,6 @@ Snapshot.description = 'Snapshot a directory containing a pre-built static website.'; | ||
}), | ||
'dry-run': command_1.flags.boolean({ | ||
char: 'd', | ||
description: 'Print the list of paths to snapshot without creating a new build', | ||
}), | ||
// from exec command. needed to start the agent service. | ||
@@ -84,0 +103,0 @@ 'allowed-hostname': command_1.flags.string({ |
@@ -11,5 +11,6 @@ import { Command, flags } from '@oclif/command'; | ||
static flags: { | ||
files: flags.IOptionFlag<string | undefined>; | ||
ignore: flags.IOptionFlag<string | undefined>; | ||
config: flags.IOptionFlag<string | undefined>; | ||
'files': flags.IOptionFlag<string | undefined>; | ||
'ignore': flags.IOptionFlag<string | undefined>; | ||
'dry-run': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; | ||
'config': flags.IOptionFlag<string | undefined>; | ||
}; | ||
@@ -16,0 +17,0 @@ percyToken: string; |
@@ -25,3 +25,3 @@ "use strict"; | ||
const imageSnapshotService = new image_snapshot_service_1.default(configuration['image-snapshots']); | ||
await imageSnapshotService.snapshotAll(); | ||
await imageSnapshotService.snapshotAll({ dry: flags['dry-run'] }); | ||
} | ||
@@ -43,3 +43,3 @@ } | ||
Upload.flags = { | ||
files: command_1.flags.string({ | ||
'files': command_1.flags.string({ | ||
char: 'f', | ||
@@ -51,3 +51,3 @@ description: [ | ||
}), | ||
ignore: command_1.flags.string({ | ||
'ignore': command_1.flags.string({ | ||
char: 'i', | ||
@@ -59,3 +59,7 @@ description: [ | ||
}), | ||
config: command_1.flags.string({ | ||
'dry-run': command_1.flags.boolean({ | ||
char: 'd', | ||
description: 'Print the list of images to upload without uploading them', | ||
}), | ||
'config': command_1.flags.string({ | ||
char: 'c', | ||
@@ -62,0 +66,0 @@ description: 'Path to percy config file', |
@@ -11,3 +11,5 @@ import { ImageSnapshotsConfiguration } from '../configuration/image-snapshots-configuration'; | ||
createSnapshot(name: string, resources: any[], width: number, height: number): Promise<any>; | ||
snapshotAll(): Promise<undefined>; | ||
snapshotAll({ dry }?: { | ||
dry?: boolean; | ||
}): Promise<undefined>; | ||
} |
@@ -91,3 +91,3 @@ "use strict"; | ||
} | ||
async snapshotAll() { | ||
async snapshotAll({ dry = false } = {}) { | ||
const globs = configuration_2.parseGlobs(this.configuration.files); | ||
@@ -99,5 +99,8 @@ const ignore = configuration_2.parseGlobs(this.configuration.ignore); | ||
logger_1.default.error(`no matching files found in '${this.configuration.path}''`); | ||
logger_1.default.info('exiting'); | ||
return process.exit(1); | ||
} | ||
if (dry) { | ||
console.log(paths.join('\n')); | ||
return; | ||
} | ||
await this.buildService.create(); | ||
@@ -104,0 +107,0 @@ logger_1.default.debug('uploading snapshots of static images'); |
{ | ||
"name": "percy", | ||
"description": "An agent process for integrating with Percy.", | ||
"version": "0.25.0", | ||
"version": "0.26.0", | ||
"author": "Perceptual Inc", | ||
@@ -6,0 +6,0 @@ "bin": { |
@@ -24,3 +24,3 @@ @percy/agent | ||
$ percy (-v|--version|version) | ||
percy/0.25.0 linux-x64 node-v12.16.1 | ||
percy/0.26.0 linux-x64 node-v12.16.1 | ||
$ percy --help [COMMAND] | ||
@@ -62,3 +62,3 @@ USAGE | ||
_See code: [dist/commands/exec.ts](https://github.com/percy/percy-agent/blob/v0.25.0/dist/commands/exec.ts)_ | ||
_See code: [dist/commands/exec.ts](https://github.com/percy/percy-agent/blob/v0.26.0/dist/commands/exec.ts)_ | ||
@@ -81,3 +81,3 @@ ## `percy finalize` | ||
_See code: [dist/commands/finalize.ts](https://github.com/percy/percy-agent/blob/v0.25.0/dist/commands/finalize.ts)_ | ||
_See code: [dist/commands/finalize.ts](https://github.com/percy/percy-agent/blob/v0.26.0/dist/commands/finalize.ts)_ | ||
@@ -119,2 +119,4 @@ ## `percy help [COMMAND]` | ||
-d, --dry-run Print the list of paths to snapshot without creating a new build | ||
-h, --allowed-hostname=allowed-hostname Allowable hostname(s) to capture assets from | ||
@@ -138,3 +140,3 @@ | ||
_See code: [dist/commands/snapshot.ts](https://github.com/percy/percy-agent/blob/v0.25.0/dist/commands/snapshot.ts)_ | ||
_See code: [dist/commands/snapshot.ts](https://github.com/percy/percy-agent/blob/v0.26.0/dist/commands/snapshot.ts)_ | ||
@@ -154,2 +156,3 @@ ## `percy upload [UPLOADDIRECTORY]` | ||
-c, --config=config Path to percy config file | ||
-d, --dry-run Print the list of images to upload without uploading them | ||
@@ -167,3 +170,3 @@ -f, --files=files [default: **/*.png,**/*.jpg,**/*.jpeg] Glob or comma-seperated string of globs for matching the | ||
_See code: [dist/commands/upload.ts](https://github.com/percy/percy-agent/blob/v0.25.0/dist/commands/upload.ts)_ | ||
_See code: [dist/commands/upload.ts](https://github.com/percy/percy-agent/blob/v0.26.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
165913
2785
166