@percy/cli-build 1.9.1 → 1.10.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 CHANGED
@@ -6,6 +6,7 @@ Commands for interacting with Percy builds
6
6
  <!-- commands -->
7
7
  * [`percy build:finalize`](#percy-buildfinalize)
8
8
  * [`percy build:wait`](#percy-buildwait)
9
+ * [`percy build:id`](#percy-buildid)
9
10
 
10
11
  ### `percy build:finalize`
11
12
 
@@ -48,4 +49,22 @@ Examples:
48
49
  $ percy build:wait --build 2222222
49
50
  $ percy build:wait --project org/project --commit HEAD
50
51
  ```
52
+
53
+ ### `percy build:id`
54
+
55
+ Prints the build ID from a locally running Percy process
56
+
57
+ ```
58
+ Usage:
59
+ $ percy build:id [options]
60
+
61
+ Percy options:
62
+ -P, --port [number] Local CLI server port (default: 5338)
63
+
64
+ Global options:
65
+ -v, --verbose Log everything
66
+ -q, --quiet Log errors only
67
+ -s, --silent Log nothing
68
+ -h, --help Display command help
69
+ ```
51
70
  <!-- commandsstop -->
package/dist/build.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import command from '@percy/cli-command';
2
2
  import finalize from './finalize.js';
3
3
  import wait from './wait.js';
4
+ import id from './id.js';
4
5
  export const build = command('build', {
5
6
  description: 'Finalize and wait on Percy builds',
6
- commands: [finalize, wait]
7
+ commands: [finalize, wait, id]
7
8
  });
8
9
  export default build;
package/dist/id.js ADDED
@@ -0,0 +1,42 @@
1
+ import command from '@percy/cli-command';
2
+ import flags from '@percy/cli-command/flags';
3
+ export const id = command('id', {
4
+ description: 'Prints the build ID from a locally running Percy process',
5
+ flags: [flags.port],
6
+ percy: true
7
+ }, async function* ({
8
+ flags,
9
+ percy,
10
+ log,
11
+ exit
12
+ }) {
13
+ var _build;
14
+
15
+ if (!percy) exit(0, 'Percy is disabled');
16
+ let {
17
+ request
18
+ } = await import('@percy/cli-command/utils');
19
+ let ping = `http://localhost:${flags.port}/percy/healthcheck`;
20
+ let build = null;
21
+
22
+ try {
23
+ ({
24
+ build
25
+ } = await request(ping, {
26
+ retryNotFound: true,
27
+ noProxy: true
28
+ }));
29
+ } catch (err) {
30
+ log.error('Percy is not running');
31
+ log.debug(err);
32
+ exit(1);
33
+ }
34
+
35
+ if ((_build = build) !== null && _build !== void 0 && _build.id) {
36
+ log.stdout.write(build.id.toString());
37
+ } else {
38
+ log.error('Unable to find local build information');
39
+ exit(1);
40
+ }
41
+ });
42
+ export default id;
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default, build } from './build.js';
2
2
  export { finalize } from './finalize.js';
3
- export { wait } from './wait.js';
3
+ export { wait } from './wait.js';
4
+ export { id } from './id.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/cli-build",
3
- "version": "1.9.1",
3
+ "version": "1.10.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,7 +32,7 @@
32
32
  ]
33
33
  },
34
34
  "dependencies": {
35
- "@percy/cli-command": "1.9.1"
35
+ "@percy/cli-command": "1.10.0"
36
36
  },
37
- "gitHead": "b2ff5100698488c8bf8c681972f4f2b9a1e2055f"
37
+ "gitHead": "a6934eda4fc3b84845ae606d7f5a901f25e0a56f"
38
38
  }