build-strap 5.0.4-dev.105 → 5.0.4-dev.115

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-strap",
3
- "version": "5.0.4-dev.105",
3
+ "version": "5.0.4-dev.115",
4
4
  "description": "Node scripts for building things",
5
5
  "license": "MIT",
6
6
  "authors": [
package/src/env.js CHANGED
@@ -66,7 +66,10 @@ export const readShellEnvVar = async (name, { refreshEnv = true, envFile = shell
66
66
  throw new Error(`Could not find shell env file: ${envFile}`);
67
67
  }
68
68
  try {
69
- return (await spawn(shell, ['-c', `${refreshEnv ? `source ${envFile} && ` : ''}printenv ${name}`], {
69
+ return (await spawn(shell, [
70
+ '-c',
71
+ `${refreshEnv ? `source ${envFile} > /dev/null 2>&1 && ` : ''}printenv ${name}`,
72
+ ], {
70
73
  captureOutput: true,
71
74
  env: {
72
75
  ...process.env,
package/src/macos.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export declare const mountDmg: (dmgPath: string, mountPath: string) => Promise<void>;
2
2
  export declare const unmountDmg: (mountPath: string) => Promise<void>;
3
3
  export declare const ensureXcodeCmdInstalled: (ignoreNonMac?: boolean) => Promise<void>;
4
+ export declare const ensureRosettaInstalled: (ignoreNonMac?: boolean) => Promise<void>;
package/src/macos.js CHANGED
@@ -34,3 +34,15 @@ export const ensureXcodeCmdInstalled = async (ignoreNonMac = true) => {
34
34
  });
35
35
  }
36
36
  };
37
+ export const ensureRosettaInstalled = async (ignoreNonMac = true) => {
38
+ if (!isMac()) {
39
+ if (!ignoreNonMac) {
40
+ throw new Error('Cannot install Rosetta on non-macOS');
41
+ }
42
+ return;
43
+ }
44
+ if (!(await fs.pathExists('/usr/libexec/rosetta'))) {
45
+ buildLog('Installing Rosetta...');
46
+ await spawn('softwareupdate', ['--install-rosetta', '--agree-to-license']);
47
+ }
48
+ };