@percy/cli-exec 1.0.0-beta.9 → 1.0.0
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 +84 -55
- package/package.json +27 -31
- package/dist/commands/exec/index.js +0 -107
- package/dist/commands/exec/ping.js +0 -52
- package/dist/commands/exec/start.js +0 -57
- package/dist/commands/exec/stop.js +0 -58
- package/dist/flags.js +0 -17
- package/dist/index.js +0 -8
- package/oclif.manifest.json +0 -1
package/README.md
CHANGED
|
@@ -1,87 +1,116 @@
|
|
|
1
1
|
# @percy/cli-exec
|
|
2
2
|
|
|
3
|
-
Percy CLI commands for running a local snapshot server using `@percy/core
|
|
3
|
+
Percy CLI commands for running a local snapshot server using [`@percy/core`](./packages/core).
|
|
4
4
|
|
|
5
5
|
## Commands
|
|
6
6
|
<!-- commands -->
|
|
7
7
|
* [`percy exec`](#percy-exec)
|
|
8
|
-
* [`percy exec:ping`](#percy-execping)
|
|
9
8
|
* [`percy exec:start`](#percy-execstart)
|
|
10
9
|
* [`percy exec:stop`](#percy-execstop)
|
|
10
|
+
* [`percy exec:ping`](#percy-execping)
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
### `percy exec`
|
|
13
13
|
|
|
14
14
|
Start and stop Percy around a supplied command
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
|
|
18
|
-
$ percy exec
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
--
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
Usage:
|
|
18
|
+
$ percy exec [options] -- <command>
|
|
19
|
+
|
|
20
|
+
Subcommands:
|
|
21
|
+
exec:start [options] Starts a local Percy snapshot server
|
|
22
|
+
exec:stop [options] Stops a local running Percy snapshot server
|
|
23
|
+
exec:ping [options] Pings a local running Percy snapshot server
|
|
24
|
+
help [command] Display command help
|
|
25
|
+
|
|
26
|
+
Options:
|
|
27
|
+
-P, --port [number] Local CLI server port (default: 5338)
|
|
28
|
+
--parallel Marks the build as one of many parallel builds
|
|
29
|
+
--partial Marks the build as a partial build
|
|
30
|
+
|
|
31
|
+
Percy options:
|
|
32
|
+
-c, --config <file> Config file path
|
|
33
|
+
-d, --dry-run Print snapshot names only
|
|
34
|
+
-h, --allowed-hostname <hostname> Allowed hostnames to capture in asset discovery
|
|
35
|
+
--disallowed-hostname <hostname> Disallowed hostnames to abort in asset discovery
|
|
36
|
+
-t, --network-idle-timeout <ms> Asset discovery network idle timeout
|
|
37
|
+
--disable-cache Disable asset discovery caches
|
|
38
|
+
--debug Debug asset discovery and do not upload snapshots
|
|
39
|
+
|
|
40
|
+
Global options:
|
|
41
|
+
-v, --verbose Log everything
|
|
42
|
+
-q, --quiet Log errors only
|
|
43
|
+
-s, --silent Log nothing
|
|
44
|
+
--help Display command help
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
31
47
|
$ percy exec -- echo "percy is running around this echo command"
|
|
32
48
|
$ percy exec -- yarn test
|
|
33
49
|
```
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
### `percy exec:start`
|
|
36
52
|
|
|
37
|
-
|
|
53
|
+
Starts a local Percy snapshot server
|
|
38
54
|
|
|
39
55
|
```
|
|
40
|
-
|
|
41
|
-
$ percy exec:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
--
|
|
56
|
+
Usage:
|
|
57
|
+
$ percy exec:start [options]
|
|
58
|
+
|
|
59
|
+
Options:
|
|
60
|
+
-P, --port [number] Local CLI server port (default: 5338)
|
|
61
|
+
|
|
62
|
+
Percy options:
|
|
63
|
+
-c, --config <file> Config file path
|
|
64
|
+
-d, --dry-run Print snapshot names only
|
|
65
|
+
-h, --allowed-hostname <hostname> Allowed hostnames to capture in asset discovery
|
|
66
|
+
--disallowed-hostname <hostname> Disallowed hostnames to abort in asset discovery
|
|
67
|
+
-t, --network-idle-timeout <ms> Asset discovery network idle timeout
|
|
68
|
+
--disable-cache Disable asset discovery caches
|
|
69
|
+
--debug Debug asset discovery and do not upload snapshots
|
|
70
|
+
|
|
71
|
+
Global options:
|
|
72
|
+
-v, --verbose Log everything
|
|
73
|
+
-q, --quiet Log errors only
|
|
74
|
+
-s, --silent Log nothing
|
|
75
|
+
--help Display command help
|
|
76
|
+
|
|
77
|
+
Examples:
|
|
78
|
+
$ percy exec:start &> percy.log
|
|
48
79
|
```
|
|
49
80
|
|
|
50
|
-
|
|
81
|
+
### `percy exec:stop`
|
|
51
82
|
|
|
52
|
-
|
|
83
|
+
Stops a local running Percy snapshot server
|
|
53
84
|
|
|
54
85
|
```
|
|
55
|
-
|
|
56
|
-
$ percy exec:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
--silent log nothing
|
|
67
|
-
|
|
68
|
-
EXAMPLES
|
|
69
|
-
$ percy exec:start
|
|
70
|
-
$ percy exec:start &> percy.log
|
|
86
|
+
Usage:
|
|
87
|
+
$ percy exec:stop [options]
|
|
88
|
+
|
|
89
|
+
Options:
|
|
90
|
+
-P, --port [number] Local CLI server port (default: 5338)
|
|
91
|
+
|
|
92
|
+
Global options:
|
|
93
|
+
-v, --verbose Log everything
|
|
94
|
+
-q, --quiet Log errors only
|
|
95
|
+
-s, --silent Log nothing
|
|
96
|
+
-h, --help Display command help
|
|
71
97
|
```
|
|
72
98
|
|
|
73
|
-
|
|
99
|
+
### `percy exec:ping`
|
|
74
100
|
|
|
75
|
-
|
|
101
|
+
Pings a local running Percy snapshot server
|
|
76
102
|
|
|
77
103
|
```
|
|
78
|
-
|
|
79
|
-
$ percy exec:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
--
|
|
104
|
+
Usage:
|
|
105
|
+
$ percy exec:ping [options]
|
|
106
|
+
|
|
107
|
+
Options:
|
|
108
|
+
-P, --port [number] Local CLI server port (default: 5338)
|
|
109
|
+
|
|
110
|
+
Global options:
|
|
111
|
+
-v, --verbose Log everything
|
|
112
|
+
-q, --quiet Log errors only
|
|
113
|
+
-s, --silent Log nothing
|
|
114
|
+
-h, --help Display command help
|
|
86
115
|
```
|
|
87
116
|
<!-- commandsstop -->
|
package/package.json
CHANGED
|
@@ -1,44 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/cli-exec",
|
|
3
|
-
"
|
|
4
|
-
"version": "1.0.0-beta.9",
|
|
3
|
+
"version": "1.0.0",
|
|
5
4
|
"license": "MIT",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "babel --root-mode upward src --out-dir dist",
|
|
13
|
-
"lint": "eslint --ignore-path ../../.gitignore .",
|
|
14
|
-
"postbuild": "oclif-dev manifest",
|
|
15
|
-
"readme": "oclif-dev readme",
|
|
16
|
-
"pretest": "node ../../scripts/install-browser",
|
|
17
|
-
"test": "cross-env NODE_ENV=test mocha",
|
|
18
|
-
"test:coverage": "nyc yarn test"
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/percy/cli",
|
|
8
|
+
"directory": "packages/cli-exec"
|
|
19
9
|
},
|
|
20
10
|
"publishConfig": {
|
|
21
11
|
"access": "public"
|
|
22
12
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=14"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"./dist"
|
|
18
|
+
],
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": "./dist/index.js",
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "node ../../scripts/build",
|
|
24
|
+
"lint": "eslint --ignore-path ../../.gitignore .",
|
|
25
|
+
"readme": "percy-cli-readme",
|
|
26
|
+
"test": "node ../../scripts/test",
|
|
27
|
+
"test:coverage": "yarn test --coverage"
|
|
26
28
|
},
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"exec": {
|
|
32
|
-
"description": "capture and upload snapshots"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
29
|
+
"@percy/cli": {
|
|
30
|
+
"commands": [
|
|
31
|
+
"./dist/exec.js"
|
|
32
|
+
]
|
|
35
33
|
},
|
|
36
34
|
"dependencies": {
|
|
37
|
-
"@percy/cli-command": "
|
|
38
|
-
"
|
|
39
|
-
"@percy/logger": "^1.0.0-beta.9",
|
|
40
|
-
"cross-spawn": "^7.0.1",
|
|
35
|
+
"@percy/cli-command": "1.0.0",
|
|
36
|
+
"cross-spawn": "^7.0.3",
|
|
41
37
|
"which": "^2.0.2"
|
|
42
38
|
},
|
|
43
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "6df509421a60144e4f9f5d59dc57a5675372a0b2"
|
|
44
40
|
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Exec = void 0;
|
|
7
|
-
|
|
8
|
-
var _cliCommand = _interopRequireWildcard(require("@percy/cli-command"));
|
|
9
|
-
|
|
10
|
-
var _core = _interopRequireDefault(require("@percy/core"));
|
|
11
|
-
|
|
12
|
-
var _logger = _interopRequireDefault(require("@percy/logger"));
|
|
13
|
-
|
|
14
|
-
var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
|
|
15
|
-
|
|
16
|
-
var _which = _interopRequireDefault(require("which"));
|
|
17
|
-
|
|
18
|
-
var _flags = _interopRequireDefault(require("../../flags"));
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
23
|
-
|
|
24
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
-
|
|
28
|
-
class Exec extends _cliCommand.default {
|
|
29
|
-
async run() {
|
|
30
|
-
var _this$percy;
|
|
31
|
-
|
|
32
|
-
let {
|
|
33
|
-
argv
|
|
34
|
-
} = this.parse(Exec);
|
|
35
|
-
let command = argv.shift(); // validate the passed command
|
|
36
|
-
|
|
37
|
-
if (!command) {
|
|
38
|
-
_logger.default.error('You must supply a command to run after --');
|
|
39
|
-
|
|
40
|
-
_logger.default.info('Example:');
|
|
41
|
-
|
|
42
|
-
_logger.default.info('$ percy exec -- echo "run your test suite"');
|
|
43
|
-
|
|
44
|
-
return this.exit(1);
|
|
45
|
-
} else if (!_which.default.sync(command, {
|
|
46
|
-
nothrow: true
|
|
47
|
-
})) {
|
|
48
|
-
_logger.default.error(`Error: command not found "${command}"`);
|
|
49
|
-
|
|
50
|
-
return this.exit(127);
|
|
51
|
-
} // attempt to start percy if enabled
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (this.isPercyEnabled()) {
|
|
55
|
-
try {
|
|
56
|
-
this.percy = await _core.default.start({
|
|
57
|
-
port: this.flags.port,
|
|
58
|
-
config: false,
|
|
59
|
-
...this.percyrc()
|
|
60
|
-
});
|
|
61
|
-
} catch (err) {
|
|
62
|
-
_logger.default.info(`Skipping visual tests - ${err.message}`);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
_logger.default.info(`Running "${[command].concat(argv).join(' ')}"`);
|
|
66
|
-
} // provide SDKs with useful env vars
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
let env = { ...process.env,
|
|
70
|
-
PERCY_CLI_API: (_this$percy = this.percy) === null || _this$percy === void 0 ? void 0 : _this$percy.apiAddress(),
|
|
71
|
-
PERCY_LOGLEVEL: _logger.default.loglevel()
|
|
72
|
-
}; // run the passed command async
|
|
73
|
-
|
|
74
|
-
let status = await new Promise((resolve, reject) => {
|
|
75
|
-
(0, _crossSpawn.default)(command, argv, {
|
|
76
|
-
stdio: 'inherit',
|
|
77
|
-
env
|
|
78
|
-
}).on('error', reject).on('close', resolve);
|
|
79
|
-
}); // forward status code
|
|
80
|
-
|
|
81
|
-
if (status) {
|
|
82
|
-
this.exit(status);
|
|
83
|
-
}
|
|
84
|
-
} // Called on error, interupt, or after running
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
async finally() {
|
|
88
|
-
var _this$percy2;
|
|
89
|
-
|
|
90
|
-
await ((_this$percy2 = this.percy) === null || _this$percy2 === void 0 ? void 0 : _this$percy2.stop());
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
exports.Exec = Exec;
|
|
96
|
-
|
|
97
|
-
_defineProperty(Exec, "description", 'Start and stop Percy around a supplied command');
|
|
98
|
-
|
|
99
|
-
_defineProperty(Exec, "strict", false);
|
|
100
|
-
|
|
101
|
-
_defineProperty(Exec, "flags", { ..._cliCommand.flags.logging,
|
|
102
|
-
..._cliCommand.flags.discovery,
|
|
103
|
-
..._cliCommand.flags.config,
|
|
104
|
-
..._flags.default
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
_defineProperty(Exec, "examples", ['$ percy exec -- echo "percy is running around this echo command"', '$ percy exec -- yarn test']);
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Ping = void 0;
|
|
7
|
-
|
|
8
|
-
var _cliCommand = _interopRequireWildcard(require("@percy/cli-command"));
|
|
9
|
-
|
|
10
|
-
var _utils = require("@percy/client/dist/utils");
|
|
11
|
-
|
|
12
|
-
var _logger = _interopRequireDefault(require("@percy/logger"));
|
|
13
|
-
|
|
14
|
-
var _flags = _interopRequireDefault(require("../../flags"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
|
-
class Ping extends _cliCommand.default {
|
|
25
|
-
async run() {
|
|
26
|
-
try {
|
|
27
|
-
let {
|
|
28
|
-
port
|
|
29
|
-
} = this.flags;
|
|
30
|
-
await (0, _utils.request)(`http://localhost:${port}/percy/healthcheck`, {
|
|
31
|
-
method: 'GET'
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
_logger.default.info('Percy is running');
|
|
35
|
-
} catch (err) {
|
|
36
|
-
_logger.default.error('Percy is not running');
|
|
37
|
-
|
|
38
|
-
_logger.default.debug(err);
|
|
39
|
-
|
|
40
|
-
this.exit(1);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
exports.Ping = Ping;
|
|
47
|
-
|
|
48
|
-
_defineProperty(Ping, "description", 'Pings a local running Percy snapshot server');
|
|
49
|
-
|
|
50
|
-
_defineProperty(Ping, "flags", { ..._cliCommand.flags.logging,
|
|
51
|
-
..._flags.default
|
|
52
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Start = void 0;
|
|
7
|
-
|
|
8
|
-
var _cliCommand = _interopRequireWildcard(require("@percy/cli-command"));
|
|
9
|
-
|
|
10
|
-
var _core = _interopRequireDefault(require("@percy/core"));
|
|
11
|
-
|
|
12
|
-
var _logger = _interopRequireDefault(require("@percy/logger"));
|
|
13
|
-
|
|
14
|
-
var _flags = _interopRequireDefault(require("../../flags"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
|
-
class Start extends _cliCommand.default {
|
|
25
|
-
async run() {
|
|
26
|
-
if (!this.isPercyEnabled()) {
|
|
27
|
-
_logger.default.info('Percy has been disabled. Not starting');
|
|
28
|
-
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
let percy = await _core.default.start({
|
|
33
|
-
port: this.flags.port,
|
|
34
|
-
config: false,
|
|
35
|
-
...this.percyrc()
|
|
36
|
-
}); // only stop when terminated
|
|
37
|
-
|
|
38
|
-
let stop = () => percy.stop();
|
|
39
|
-
|
|
40
|
-
process.on('SIGHUP', stop);
|
|
41
|
-
process.on('SIGINT', stop);
|
|
42
|
-
process.on('SIGTERM', stop);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
exports.Start = Start;
|
|
48
|
-
|
|
49
|
-
_defineProperty(Start, "description", 'Starts a local Percy snapshot server');
|
|
50
|
-
|
|
51
|
-
_defineProperty(Start, "flags", { ..._cliCommand.flags.logging,
|
|
52
|
-
..._cliCommand.flags.discovery,
|
|
53
|
-
..._cliCommand.flags.config,
|
|
54
|
-
..._flags.default
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
_defineProperty(Start, "examples", ['$ percy exec:start', '$ percy exec:start &> percy.log']);
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Stop = void 0;
|
|
7
|
-
|
|
8
|
-
var _cliCommand = _interopRequireWildcard(require("@percy/cli-command"));
|
|
9
|
-
|
|
10
|
-
var _utils = require("@percy/client/dist/utils");
|
|
11
|
-
|
|
12
|
-
var _logger = _interopRequireDefault(require("@percy/logger"));
|
|
13
|
-
|
|
14
|
-
var _flags = _interopRequireDefault(require("../../flags"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
|
-
class Stop extends _cliCommand.default {
|
|
25
|
-
async run() {
|
|
26
|
-
if (!this.isPercyEnabled()) {
|
|
27
|
-
_logger.default.info('Percy is disabled');
|
|
28
|
-
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
let {
|
|
34
|
-
port
|
|
35
|
-
} = this.flags;
|
|
36
|
-
await (0, _utils.request)(`http://localhost:${port}/percy/stop`, {
|
|
37
|
-
method: 'POST'
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
_logger.default.info('Percy has stopped');
|
|
41
|
-
} catch (err) {
|
|
42
|
-
_logger.default.error('Percy is not running');
|
|
43
|
-
|
|
44
|
-
_logger.default.debug(err);
|
|
45
|
-
|
|
46
|
-
this.exit(1);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
exports.Stop = Stop;
|
|
53
|
-
|
|
54
|
-
_defineProperty(Stop, "description", 'Stops a local running Percy snapshot server');
|
|
55
|
-
|
|
56
|
-
_defineProperty(Stop, "flags", { ..._cliCommand.flags.logging,
|
|
57
|
-
..._flags.default
|
|
58
|
-
});
|
package/dist/flags.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _cliCommand = require("@percy/cli-command");
|
|
9
|
-
|
|
10
|
-
var _default = {
|
|
11
|
-
port: _cliCommand.flags.integer({
|
|
12
|
-
char: 'p',
|
|
13
|
-
description: 'server port',
|
|
14
|
-
default: process.env.PERCY_CLI_PORT || 5338
|
|
15
|
-
})
|
|
16
|
-
};
|
|
17
|
-
exports.default = _default;
|
package/dist/index.js
DELETED
package/oclif.manifest.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":"1.0.0-beta.9","commands":{"exec":{"id":"exec","description":"Start and stop Percy around a supplied command","pluginName":"@percy/cli-exec","pluginType":"core","aliases":[],"examples":["$ percy exec -- echo \"percy is running around this echo command\"","$ percy exec -- yarn test"],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"log everything","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"log errors only","allowNo":false},"silent":{"name":"silent","type":"boolean","description":"log nothing","allowNo":false},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"allowed hostnames"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"asset discovery idle timeout"},"disable-asset-cache":{"name":"disable-asset-cache","type":"boolean","description":"disable asset discovery caches","allowNo":false},"config":{"name":"config","type":"option","char":"c","description":"configuration file path"},"port":{"name":"port","type":"option","char":"p","description":"server port","default":5338}},"args":[]},"exec:ping":{"id":"exec:ping","description":"Pings a local running Percy snapshot server","pluginName":"@percy/cli-exec","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"log everything","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"log errors only","allowNo":false},"silent":{"name":"silent","type":"boolean","description":"log nothing","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port","default":5338}},"args":[]},"exec:start":{"id":"exec:start","description":"Starts a local Percy snapshot server","pluginName":"@percy/cli-exec","pluginType":"core","aliases":[],"examples":["$ percy exec:start","$ percy exec:start &> percy.log"],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"log everything","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"log errors only","allowNo":false},"silent":{"name":"silent","type":"boolean","description":"log nothing","allowNo":false},"allowed-hostname":{"name":"allowed-hostname","type":"option","char":"h","description":"allowed hostnames"},"network-idle-timeout":{"name":"network-idle-timeout","type":"option","char":"t","description":"asset discovery idle timeout"},"disable-asset-cache":{"name":"disable-asset-cache","type":"boolean","description":"disable asset discovery caches","allowNo":false},"config":{"name":"config","type":"option","char":"c","description":"configuration file path"},"port":{"name":"port","type":"option","char":"p","description":"server port","default":5338}},"args":[]},"exec:stop":{"id":"exec:stop","description":"Stops a local running Percy snapshot server","pluginName":"@percy/cli-exec","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"log everything","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"log errors only","allowNo":false},"silent":{"name":"silent","type":"boolean","description":"log nothing","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port","default":5338}},"args":[]}}}
|