-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·54 lines (50 loc) · 2.54 KB
/
index.js
File metadata and controls
executable file
·54 lines (50 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env node
import { program } from 'commander';
/**
* Output directory structure:
* $shotsDir/
* ..pathKey/
* ....size_browser_domain1.png
* ....size_browser_domain2.png
* ....size_browser_diff.png
* ....size_browser_data.txt - percent diff
* ....size2_browser_domain1.png
* ......
* ..pathKey/
* ....size_browser_domain1.png
* ......
* ..thumbnails/
* ....pathKey/
* ......size_browser_domain1.png
* ......size_browser_domain2.png
* ......size_browser_diff.png
* ........
* ....pathKey/
* ......size_browser_domain1.png
* ........
* ......
* ..gallery.html
*/
program
.version('0.0.1')
.option('-c, --config-file <config-file>', 'Configuration file')
.option('-d, --defaults-file <defaults-file>', 'Default configuration')
.option('-o, --output-directory [shots-dir]', 'Output directory for tests, directory in config file')
.option('--debug', 'Show browser while doing snaps')
.hook('preSubcommand', (thisCommand, actionCommand) => {
// Pass global options via environment variables
const opts = thisCommand.opts();
if (opts.configFile) process.env.VISUALIFY_CONFIG_FILE = opts.configFile;
if (opts.defaultsFile) process.env.VISUALIFY_DEFAULTS_FILE = opts.defaultsFile;
if (opts.outputDirectory) process.env.VISUALIFY_OUTPUT_DIRECTORY = opts.outputDirectory;
if (opts.debug) process.env.VISUALIFY_DEBUG = 'true';
})
.command("capture [domain1name] [domain1url] [domain2name] [domain2url]", "Capture screenshots of sites", { executableFile: 'visualify-capture.js' })
.command('compare [domain1name] [domain1url] [domain2name] [domain2url]', 'Compare captured shots', { executableFile: 'visualify-compare.js' })
.command('thumbnail [domain1name] [domain1url] [domain2name] [domain2url]', 'Generate thumbnails', { executableFile: 'visualify-thumbnail.js' })
.command('gallery [domain1name] [domain1url] [domain2name] [domain2url]', 'Call wraith to generate a gallery', { executableFile: 'visualify-gallery.js' })
.command('all','Run all steps', { executableFile: 'visualify-all.js' })
.command('compare-dirs <golden-dir> <current-dir>', 'Compare two directories of screenshots', { executableFile: 'visualify-compare-dirs.js' })
.command('thumbnail-dirs <golden-dir> <current-dir>', 'Generate thumbnails from directory comparison', { executableFile: 'visualify-thumbnail-dirs.js' })
.command('gallery-dirs <golden-dir> <current-dir>', 'Generate HTML gallery from directory comparison', { executableFile: 'visualify-gallery-dirs.js' });
program.parse(process.argv);