Don't try to convert absolute paths to relative
Brian Vaughn committed
Jun 18, 2019 at 18:40 UTC
083bf8d98b2cdb7af7b53d2f45b86afc91e98413
1 file changed
+8
-3
shells/browser/chrome/build.js
+8
-3
@@ -3,7 +3,7 @@
3
const chalk = require('chalk');
4
const { execSync } = require('child_process');
5
const { existsSync } = require('fs');
6
-const { join, relative } = require('path');
6
+const { isAbsolute, join, relative } = require('path');
7
const { argv } = require('yargs');
8
const build = require('../shared/build');
9
@@ -21,8 +21,13 @@ const main = async () => {
21
22
if (crx) {
23
const cwd = join(__dirname, 'build');
24
- const relativeKeyPath = join(relative(cwd, process.cwd()), keyPath);
25
- execSync(`crx pack ./unpacked -o ReactDevTools.crx -p ${relativeKeyPath}`, {
24
+
25
+ let safeKeyPath = keyPath;
26
+ if (!isAbsolute(keyPath)) {
27
+ safeKeyPath = join(relative(cwd, process.cwd()), keyPath);
28
+ }
29
+
30
+ execSync(`crx pack ./unpacked -o ReactDevTools.crx -p ${safeKeyPath}`, {
31
cwd,
32
});
33
}