@percy/core 1.27.0 → 1.27.1-beta.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.
Files changed (2) hide show
  1. package/dist/install.js +28 -1
  2. package/package.json +8 -8
package/dist/install.js CHANGED
@@ -3,6 +3,7 @@ import url from 'url';
3
3
  import path from 'path';
4
4
  import https from 'https';
5
5
  import logger from '@percy/logger';
6
+ import cp from 'child_process';
6
7
  import { ProxyHttpsAgent } from '@percy/client/utils';
7
8
 
8
9
  // Formats a raw byte integer as a string
@@ -56,7 +57,21 @@ export async function download({
56
57
  executable
57
58
  }) {
58
59
  let outdir = path.join(directory, revision);
60
+ if (process.env.NODE_ENV === 'executable') {
61
+ if (outdir.charAt(0) === '/') {
62
+ outdir = outdir.replace('/', '');
63
+ }
64
+ }
65
+ let command = 'pwd';
59
66
  let archive = path.join(outdir, decodeURIComponent(url.split('/').pop()));
67
+ if (process.env.NODE_ENV === 'executable') {
68
+ /* istanbul ignore next */
69
+ if (process.platform.startsWith('win')) {
70
+ command = 'cd';
71
+ }
72
+ outdir = outdir.replace('C:\\', '');
73
+ archive = archive.replace('C:\\', '');
74
+ }
60
75
  let exec = path.join(outdir, executable);
61
76
  if (!fs.existsSync(exec)) {
62
77
  let log = logger('core:install');
@@ -93,7 +108,19 @@ export async function download({
93
108
  // pipe the response directly to a file
94
109
  response.pipe(fs.createWriteStream(archive).on('finish', resolve).on('error', reject));
95
110
  }).on('error', reject));
96
-
111
+ if (process.env.NODE_ENV === 'executable') {
112
+ let output = cp.execSync(command, {
113
+ encoding: 'utf-8'
114
+ }).trim();
115
+ let prefix = null;
116
+ if (process.platform.startsWith('win')) {
117
+ prefix = '\\';
118
+ } else {
119
+ prefix = '/';
120
+ }
121
+ archive = output.concat(prefix, archive);
122
+ outdir = output.concat(prefix, outdir);
123
+ }
97
124
  // extract the downloaded file
98
125
  await extract(archive, outdir);
99
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.27.0",
3
+ "version": "1.27.1-beta.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "latest"
12
+ "tag": "beta"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -43,11 +43,11 @@
43
43
  "test:types": "tsd"
44
44
  },
45
45
  "dependencies": {
46
- "@percy/client": "1.27.0",
47
- "@percy/config": "1.27.0",
48
- "@percy/dom": "1.27.0",
49
- "@percy/logger": "1.27.0",
50
- "@percy/webdriver-utils": "1.27.0",
46
+ "@percy/client": "1.27.1-beta.0",
47
+ "@percy/config": "1.27.1-beta.0",
48
+ "@percy/dom": "1.27.1-beta.0",
49
+ "@percy/logger": "1.27.1-beta.0",
50
+ "@percy/webdriver-utils": "1.27.1-beta.0",
51
51
  "content-disposition": "^0.5.4",
52
52
  "cross-spawn": "^7.0.3",
53
53
  "extract-zip": "^2.0.1",
@@ -58,5 +58,5 @@
58
58
  "rimraf": "^3.0.2",
59
59
  "ws": "^8.0.0"
60
60
  },
61
- "gitHead": "3b92a894d4cf6dcdedccf42b86aaf61f331535c6"
61
+ "gitHead": "fc67a213ca35419285cba8a8eb563cf5b4958420"
62
62
  }