@expo/package-manager 0.0.48 → 0.0.49

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.
@@ -1,4 +1,4 @@
1
- import { SpawnOptions } from '@expo/spawn-async';
1
+ import { SpawnOptions, SpawnResult } from '@expo/spawn-async';
2
2
  import { Ora } from 'ora';
3
3
  import { PackageManager } from './PackageManager';
4
4
  export declare type CocoaPodsErrorCode = 'NON_INTERACTIVE' | 'NO_CLI' | 'COMMAND_FAILED';
@@ -9,7 +9,7 @@ export declare class CocoaPodsError extends Error {
9
9
  readonly isPackageManagerError = true;
10
10
  constructor(message: string, code: CocoaPodsErrorCode, cause?: Error | undefined);
11
11
  }
12
- export declare function extractMissingDependencyError(error: string): [string, string] | null;
12
+ export declare function extractMissingDependencyError(errorOutput: string): [string, string] | null;
13
13
  export declare class CocoaPodsPackageManager implements PackageManager {
14
14
  options: SpawnOptions;
15
15
  private silent;
@@ -29,12 +29,20 @@ export declare class CocoaPodsPackageManager implements PackageManager {
29
29
  silent?: boolean;
30
30
  });
31
31
  get name(): string;
32
+ /** Runs `pod install` and attempts to automatically run known troubleshooting steps automatically. */
32
33
  installAsync({ spinner }?: {
33
34
  spinner?: Ora;
34
35
  }): Promise<void>;
35
36
  isCLIInstalledAsync(): Promise<boolean>;
36
37
  installCLIAsync(): Promise<boolean>;
38
+ handleInstallErrorAsync({ error, shouldUpdate, updatedPackages, spinner, }: {
39
+ error: any;
40
+ spinner?: Ora;
41
+ shouldUpdate?: boolean;
42
+ updatedPackages?: string[];
43
+ }): Promise<SpawnResult>;
37
44
  private _installAsync;
45
+ private runInstallTypeCommandAsync;
38
46
  addAsync(...names: string[]): Promise<void>;
39
47
  addDevAsync(...names: string[]): Promise<void>;
40
48
  versionAsync(): Promise<string>;
@@ -42,5 +50,23 @@ export declare class CocoaPodsPackageManager implements PackageManager {
42
50
  removeLockfileAsync(): Promise<void>;
43
51
  cleanAsync(): Promise<void>;
44
52
  private podRepoUpdateAsync;
45
- private _runAsync;
53
+ _runAsync(args: string[]): Promise<SpawnResult>;
46
54
  }
55
+ export declare function getPodUpdateMessage(output: string): {
56
+ updatePackage: string | null;
57
+ shouldUpdateRepo: boolean;
58
+ };
59
+ export declare function getPodRepoUpdateMessage(errorOutput: string): {
60
+ updatePackage: string | null;
61
+ shouldUpdateRepo: boolean;
62
+ message: string;
63
+ };
64
+ /**
65
+ * Format the CocoaPods CLI install error.
66
+ *
67
+ * @param error Error from CocoaPods CLI `pod install` command.
68
+ * @returns
69
+ */
70
+ export declare function getImprovedPodInstallError(error: SpawnResult & Error, { cwd }: {
71
+ cwd?: string;
72
+ }): Error;
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CocoaPodsPackageManager = exports.extractMissingDependencyError = exports.CocoaPodsError = void 0;
6
+ exports.getImprovedPodInstallError = exports.getPodRepoUpdateMessage = exports.getPodUpdateMessage = exports.CocoaPodsPackageManager = exports.extractMissingDependencyError = exports.CocoaPodsError = void 0;
7
7
  const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  const fs_1 = require("fs");
10
+ const os_1 = __importDefault(require("os"));
10
11
  const path_1 = __importDefault(require("path"));
11
12
  const PackageManager_1 = require("./PackageManager");
12
13
  class CocoaPodsError extends Error {
@@ -19,9 +20,9 @@ class CocoaPodsError extends Error {
19
20
  }
20
21
  }
21
22
  exports.CocoaPodsError = CocoaPodsError;
22
- function extractMissingDependencyError(error) {
23
+ function extractMissingDependencyError(errorOutput) {
23
24
  // [!] Unable to find a specification for `expo-dev-menu-interface` depended upon by `expo-dev-launcher`
24
- const results = error.match(/Unable to find a specification for ['"`]([\w-_\d\s]+)['"`] depended upon by ['"`]([\w-_\d\s]+)['"`]/);
25
+ const results = errorOutput.match(/Unable to find a specification for ['"`]([\w-_\d\s]+)['"`] depended upon by ['"`]([\w-_\d\s]+)['"`]/);
25
26
  if (results) {
26
27
  return [results[1], results[2]];
27
28
  }
@@ -33,11 +34,9 @@ class CocoaPodsPackageManager {
33
34
  this.silent = !!silent;
34
35
  this.options = {
35
36
  cwd,
36
- ...(silent
37
- ? { stdio: 'pipe' }
38
- : {
39
- stdio: ['inherit', 'inherit', 'pipe'],
40
- }),
37
+ // We use pipe by default instead of inherit so that we can capture stderr/stdout and process it for errors.
38
+ // Later we'll also pipe the stdout/stderr to the terminal when silent is false.
39
+ stdio: 'pipe',
41
40
  };
42
41
  }
43
42
  static getPodProjectRoot(projectRoot) {
@@ -139,6 +138,7 @@ class CocoaPodsPackageManager {
139
138
  get name() {
140
139
  return 'CocoaPods';
141
140
  }
141
+ /** Runs `pod install` and attempts to automatically run known troubleshooting steps automatically. */
142
142
  async installAsync({ spinner } = {}) {
143
143
  await this._installAsync({ spinner });
144
144
  }
@@ -151,83 +151,78 @@ class CocoaPodsPackageManager {
151
151
  spawnOptions: this.options,
152
152
  });
153
153
  }
154
- async _installAsync({ spinner, shouldUpdate = true, } = {}) {
155
- var _a;
154
+ async handleInstallErrorAsync({ error, shouldUpdate = true, updatedPackages = [], spinner, }) {
155
+ // Unknown errors are rethrown.
156
+ if (!error.output) {
157
+ throw error;
158
+ }
159
+ // To emulate a `pod install --repo-update` error, enter your `ios/Podfile.lock` and change one of `PODS` version numbers to some lower value.
160
+ // const isPodRepoUpdateError = shouldPodRepoUpdate(output);
161
+ if (!shouldUpdate) {
162
+ // If we can't automatically fix the error, we'll just rethrow it with some known troubleshooting info.
163
+ throw getImprovedPodInstallError(error, {
164
+ cwd: this.options.cwd,
165
+ });
166
+ }
167
+ // Collect all of the spawn info.
168
+ const errorOutput = error.output.join(os_1.default.EOL).trim();
169
+ // Extract useful information from the error message and push it to the spinner.
170
+ const { updatePackage, shouldUpdateRepo } = getPodUpdateMessage(errorOutput);
171
+ if (!updatePackage || updatedPackages.includes(updatePackage)) {
172
+ // `pod install --repo-update`...
173
+ // Attempt to install again but this time with install --repo-update enabled.
174
+ return await this._installAsync({
175
+ spinner,
176
+ shouldRepoUpdate: true,
177
+ // Include a boolean to ensure pod install --repo-update isn't invoked in the unlikely case where the pods fail to update.
178
+ shouldUpdate: false,
179
+ updatedPackages,
180
+ });
181
+ }
182
+ // Store the package we should update to prevent a loop.
183
+ updatedPackages.push(updatePackage);
184
+ // If a single package is broken, we'll try to update it.
185
+ // You can manually test this by changing a version number in your `Podfile.lock`.
186
+ // Attempt `pod update <package> <--no-repo-update>` and then try again.
187
+ return await this.runInstallTypeCommandAsync(['update', updatePackage, shouldUpdateRepo ? '' : '--no-repo-update'].filter(Boolean), {
188
+ formatWarning() {
189
+ const updateMessage = `Failed to update ${chalk_1.default.bold(updatePackage)}. Attempting to update the repo instead.`;
190
+ return updateMessage;
191
+ },
192
+ spinner,
193
+ updatedPackages,
194
+ });
195
+ // // If update succeeds, we'll try to install again (skipping `pod install --repo-update`).
196
+ // return await this._installAsync({
197
+ // spinner,
198
+ // shouldUpdate: false,
199
+ // updatedPackages,
200
+ // });
201
+ }
202
+ async _installAsync({ shouldRepoUpdate, ...props } = {}) {
203
+ return await this.runInstallTypeCommandAsync(['install', shouldRepoUpdate ? '--repo-update' : ''].filter(Boolean), {
204
+ formatWarning(error) {
205
+ // Extract useful information from the error message and push it to the spinner.
206
+ return getPodRepoUpdateMessage(error.output.join(os_1.default.EOL).trim()).message;
207
+ },
208
+ ...props,
209
+ });
210
+ }
211
+ async runInstallTypeCommandAsync(command, { formatWarning, ...props } = {}) {
156
212
  try {
157
- return await this._runAsync(['install']);
213
+ return await this._runAsync(command);
158
214
  }
159
215
  catch (error) {
160
- const output = error.output.join('\n').trim();
161
- const isPodRepoUpdateError = output.includes('pod repo update');
162
- // When pods are outdated, they'll throw an error informing you to run "pod repo update"
163
- // Attempt to run that command and try installing again.
164
- if (isPodRepoUpdateError && shouldUpdate) {
165
- const warningInfo = extractMissingDependencyError(output);
166
- let message;
167
- if (warningInfo) {
168
- message = `Couldn't install: ${warningInfo[1]} » ${chalk_1.default.underline(warningInfo[0])}.`;
169
- }
170
- else {
171
- message = `Couldn't install Pods.`;
172
- }
173
- message += ` Updating the Pods project and trying again...`;
174
- if (spinner) {
175
- spinner.text = chalk_1.default.bold(message);
176
- }
177
- !this.silent && console.warn(chalk_1.default.yellow(message));
178
- await this.podRepoUpdateAsync();
179
- // Include a boolean to ensure pod repo update isn't invoked in the unlikely case where the pods fail to update.
180
- return await this._installAsync({ spinner, shouldUpdate: false });
181
- }
182
- else {
183
- const cwd = this.options.cwd || process.cwd();
184
- if (error.stdout.match(/No [`'"]Podfile[`'"] found in the project directory/)) {
185
- error.message = `No Podfile found in directory: ${cwd}. Ensure CocoaPods is setup any try again.`;
186
- }
187
- else if (isPodRepoUpdateError) {
188
- const warningInfo = extractMissingDependencyError(output);
189
- let reason;
190
- if (warningInfo) {
191
- reason = `Couldn't install: ${warningInfo[1]} » ${chalk_1.default.underline(warningInfo[0])}`;
192
- }
193
- else {
194
- reason = `This is often due to native package versions mismatching`;
195
- }
196
- let solution;
197
- if (warningInfo === null || warningInfo === void 0 ? void 0 : warningInfo[0]) {
198
- // If the missing package is named `expo-dev-menu`, `react-native`, etc. then it might not be installed in the project.
199
- if (warningInfo[0].match(/^(?:@?expo|@?react)(-|\/)/)) {
200
- solution = `Ensure the node module "${warningInfo[0]}" is installed in your project, then run \`npx pod-install\` to try again.`;
201
- }
202
- else {
203
- solution = `Ensure the CocoaPod "${warningInfo[0]}" is installed in your project, then run \`npx pod-install\` to try again.`;
204
- }
205
- }
206
- else {
207
- solution = `Try deleting the \`ios/Pods\` folder or the \`ios/Podfile.lock\` file and running \`npx pod-install\` to resolve.`;
208
- }
209
- error.message = `${reason}. ${solution}`;
210
- throw new CocoaPodsError('Command `pod repo update` failed.', 'COMMAND_FAILED', error);
216
+ if (formatWarning) {
217
+ const warning = formatWarning(error);
218
+ if (props.spinner) {
219
+ props.spinner.text = chalk_1.default.bold(warning);
211
220
  }
212
- else {
213
- let stderr = error.stderr.trim();
214
- // CocoaPods CLI prints the useful error to stdout...
215
- const usefulError = (_a = error.stdout.match(/\[!\]\s((?:.|\n)*)/)) === null || _a === void 0 ? void 0 : _a[1];
216
- // If there is a useful error message then prune the less useful info.
217
- if (usefulError) {
218
- // Delete unhelpful CocoaPods CLI error message.
219
- if (error.message.match(/pod exited with non-zero code: 1/)) {
220
- error.message = null;
221
- }
222
- // Remove `<PBXResourcesBuildPhase UUID=`13B07F8E1A680F5B00A75B9A`>` type errors when useful messages exist.
223
- if (stderr.match(/PBXResourcesBuildPhase/)) {
224
- stderr = null;
225
- }
226
- }
227
- error.message = [usefulError, error.message, stderr].filter(Boolean).join('\n');
221
+ if (!this.silent) {
222
+ console.warn(chalk_1.default.yellow(warning));
228
223
  }
229
- throw new CocoaPodsError('Command `pod install` failed.', 'COMMAND_FAILED', error);
230
224
  }
225
+ return await this.handleInstallErrorAsync({ error, ...props });
231
226
  }
232
227
  }
233
228
  async addAsync(...names) {
@@ -257,15 +252,138 @@ class CocoaPodsPackageManager {
257
252
  }
258
253
  catch (error) {
259
254
  error.message = error.message || ((_a = error.stderr) !== null && _a !== void 0 ? _a : error.stdout);
260
- throw new CocoaPodsError('The command `pod repo update` failed', 'COMMAND_FAILED', error);
255
+ throw new CocoaPodsError('The command `pod install --repo-update` failed', 'COMMAND_FAILED', error);
261
256
  }
262
257
  }
258
+ // Exposed for testing
263
259
  async _runAsync(args) {
264
260
  if (!this.silent) {
265
261
  console.log(`> pod ${args.join(' ')}`);
266
262
  }
267
- return spawn_async_1.default('pod', [...args], this.options);
263
+ const promise = spawn_async_1.default('pod', [
264
+ ...args,
265
+ // Enables colors while collecting output.
266
+ '--ansi',
267
+ ], {
268
+ // Add the cwd and other options to the spawn options.
269
+ ...this.options,
270
+ // We use pipe by default instead of inherit so that we can capture stderr/stdout and process it for errors.
271
+ // This is particularly required for the `pod install --repo-update` error.
272
+ // Later we'll also pipe the stdout/stderr to the terminal when silent is false,
273
+ // currently this means we lose out on the ansi colors unless passing the `--ansi` flag to every command.
274
+ stdio: 'pipe',
275
+ });
276
+ if (!this.silent) {
277
+ // If not silent, pipe the stdout/stderr to the terminal.
278
+ // We only do this when the `stdio` is set to `pipe` (collect the results for parsing), `inherit` won't contain `promise.child`.
279
+ if (promise.child.stdout) {
280
+ promise.child.stdout.pipe(process.stdout);
281
+ }
282
+ }
283
+ return await promise;
268
284
  }
269
285
  }
270
286
  exports.CocoaPodsPackageManager = CocoaPodsPackageManager;
287
+ /** When pods are outdated, they'll throw an error informing you to run "pod install --repo-update" */
288
+ function shouldPodRepoUpdate(errorOutput) {
289
+ const output = errorOutput;
290
+ const isPodRepoUpdateError = output.includes('pod repo update') || output.includes('--no-repo-update');
291
+ return isPodRepoUpdateError;
292
+ }
293
+ function getPodUpdateMessage(output) {
294
+ var _a;
295
+ const props = output.match(/run ['"`]pod update ([\w-_\d/]+)( --no-repo-update)?['"`] to apply changes/);
296
+ return {
297
+ updatePackage: (_a = props === null || props === void 0 ? void 0 : props[1]) !== null && _a !== void 0 ? _a : null,
298
+ shouldUpdateRepo: !(props === null || props === void 0 ? void 0 : props[2]),
299
+ };
300
+ }
301
+ exports.getPodUpdateMessage = getPodUpdateMessage;
302
+ function getPodRepoUpdateMessage(errorOutput) {
303
+ const warningInfo = extractMissingDependencyError(errorOutput);
304
+ const brokenPackage = getPodUpdateMessage(errorOutput);
305
+ let message;
306
+ if (warningInfo) {
307
+ message = `Couldn't install: ${warningInfo[1]} » ${chalk_1.default.underline(warningInfo[0])}.`;
308
+ }
309
+ else if (brokenPackage === null || brokenPackage === void 0 ? void 0 : brokenPackage.updatePackage) {
310
+ message = `Couldn't install: ${brokenPackage === null || brokenPackage === void 0 ? void 0 : brokenPackage.updatePackage}.`;
311
+ }
312
+ else {
313
+ message = `Couldn't install Pods.`;
314
+ }
315
+ message += ` Updating the Pods project and trying again...`;
316
+ return { message, ...brokenPackage };
317
+ }
318
+ exports.getPodRepoUpdateMessage = getPodRepoUpdateMessage;
319
+ /**
320
+ * Format the CocoaPods CLI install error.
321
+ *
322
+ * @param error Error from CocoaPods CLI `pod install` command.
323
+ * @returns
324
+ */
325
+ function getImprovedPodInstallError(error, { cwd = process.cwd() }) {
326
+ var _a, _b;
327
+ // Collect all of the spawn info.
328
+ const errorOutput = error.output.join(os_1.default.EOL).trim();
329
+ if (error.stdout.match(/No [`'"]Podfile[`'"] found in the project directory/)) {
330
+ // Ran pod install but no Podfile was found.
331
+ error.message = `No Podfile found in directory: ${cwd}. Ensure CocoaPods is setup any try again.`;
332
+ }
333
+ else if (shouldPodRepoUpdate(errorOutput)) {
334
+ // Ran pod install but the install --repo-update step failed.
335
+ const warningInfo = extractMissingDependencyError(errorOutput);
336
+ let reason;
337
+ if (warningInfo) {
338
+ reason = `Couldn't install: ${warningInfo[1]} » ${chalk_1.default.underline(warningInfo[0])}`;
339
+ }
340
+ else {
341
+ reason = `This is often due to native package versions mismatching`;
342
+ }
343
+ // Attempt to provide a helpful message about the missing NPM dependency (containing a CocoaPod) since React Native
344
+ // developers will almost always be using autolinking and not interacting with CocoaPods directly.
345
+ let solution;
346
+ if (warningInfo === null || warningInfo === void 0 ? void 0 : warningInfo[0]) {
347
+ // If the missing package is named `expo-dev-menu`, `react-native`, etc. then it might not be installed in the project.
348
+ if (warningInfo[0].match(/^(?:@?expo|@?react)(-|\/)/)) {
349
+ solution = `Ensure the node module "${warningInfo[0]}" is installed in your project, then run 'npx pod-install' to try again.`;
350
+ }
351
+ else {
352
+ solution = `Ensure the CocoaPod "${warningInfo[0]}" is installed in your project, then run 'npx pod-install' to try again.`;
353
+ }
354
+ }
355
+ else {
356
+ // Brute force
357
+ solution = `Try deleting the 'ios/Pods' folder or the 'ios/Podfile.lock' file and running 'npx pod-install' to resolve.`;
358
+ }
359
+ error.message = `${reason}. ${solution}`;
360
+ // Attempt to provide the troubleshooting info from CocoaPods CLI at the bottom of the error message.
361
+ if (error.stdout) {
362
+ const cocoapodsDebugInfo = error.stdout.split(os_1.default.EOL);
363
+ // The troubleshooting info starts with `[!]`, capture everything after that.
364
+ const firstWarning = cocoapodsDebugInfo.findIndex(v => v.startsWith('[!]'));
365
+ if (firstWarning !== -1) {
366
+ const warning = cocoapodsDebugInfo.slice(firstWarning).join(os_1.default.EOL);
367
+ error.message += `\n\n${chalk_1.default.gray(warning)}`;
368
+ }
369
+ }
370
+ return new CocoaPodsError('Command `pod install --repo-update` failed.', 'COMMAND_FAILED', error);
371
+ }
372
+ else {
373
+ let stderr = error.stderr.trim();
374
+ // CocoaPods CLI prints the useful error to stdout...
375
+ const usefulError = (_a = error.stdout.match(/\[!\]\s((?:.|\n)*)/)) === null || _a === void 0 ? void 0 : _a[1];
376
+ // If there is a useful error message then prune the less useful info.
377
+ if (usefulError) {
378
+ // Delete unhelpful CocoaPods CLI error message.
379
+ if ((_b = error.message) === null || _b === void 0 ? void 0 : _b.match(/pod exited with non-zero code: 1/)) {
380
+ error.message = '';
381
+ }
382
+ stderr = null;
383
+ }
384
+ error.message = [usefulError, error.message, stderr].filter(Boolean).join('\n');
385
+ }
386
+ return new CocoaPodsError('Command `pod install` failed.', 'COMMAND_FAILED', error);
387
+ }
388
+ exports.getImprovedPodInstallError = getImprovedPodInstallError;
271
389
  //# sourceMappingURL=CocoaPodsPackageManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CocoaPodsPackageManager.js","sourceRoot":"","sources":["../src/CocoaPodsPackageManager.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA0E;AAC1E,kDAA0B;AAC1B,2BAAgC;AAEhC,gDAAwB;AAExB,qDAAkE;AAIlE,MAAa,cAAe,SAAQ,KAAK;IAIvC,YAAY,OAAe,EAAS,IAAwB,EAAS,KAAa;QAChF,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,eAAe,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QADhC,SAAI,G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AAK,CAAC,UAAU;QACd,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACnC,CAAC;IAED,UAAU;IACF,KAAK,CAAC,kBAAkB;;QAC9B,IAAI;YACF,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;SAC1C;QAAC,OAAO,KAAK,EAAE;YACd,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,MAAA,KAAK,CAAC,MAAM,mCAAI,KAAK,CAAC,MAAM,CAAC,CAAC;YAEhE,MAAM,IAAI,cAAc,CAAC,sCAAsC,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;SAC3F;IACH,CAAC;IAEO,KAAK,CAAC,SAAS,CAAC,IAAc;QACpC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SACxC;QACD,OAAO,qBAAU,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;CACF;AAjSD,0DAiSC","sourcesContent":["import spawnAsync, { SpawnOptions, SpawnResult } from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { Ora } from 'ora';\nimport path from 'path';\n\nimport { PackageManager, spawnSudoAsync } from './PackageManager';\n\nexport type CocoaPodsErrorCode = 'NON_INTERACTIVE' | 'NO_CLI' | 'COMMAND_FAILED';\n\nexport class CocoaPodsError extends Error {\n readonly name = 'CocoaPodsError';\n readonly isPackageManagerError = true;\n\n constructor(message: string, public code: CocoaPodsErrorCode, public cause?: Error) {\n super(cause ? `${message}\\n└─ Cause: ${cause.message}` : message);\n }\n}\n\nexport function extractMissingDependencyError(error: string): [string, string] | null {\n // [!] Unable to find a specification for `expo-dev-menu-interface` depended upon by `expo-dev-launcher`\n const results = error.match(\n /Unable to find a specification for ['\"`]([\\w-_\\d\\s]+)['\"`] depended upon by ['\"`]([\\w-_\\d\\s]+)['\"`]/\n );\n if (results) {\n return [results[1], results[2]];\n }\n return null;\n}\n\nexport class CocoaPodsPackageManager implements PackageManager {\n options: SpawnOptions;\n\n private silent: boolean;\n\n static getPodProjectRoot(projectRoot: string): string | null {\n if (CocoaPodsPackageManager.isUsingPods(projectRoot)) return projectRoot;\n const iosProject = path.join(projectRoot, 'ios');\n if (CocoaPodsPackageManager.isUsingPods(iosProject)) return iosProject;\n const macOsProject = path.join(projectRoot, 'macos');\n if (CocoaPodsPackageManager.isUsingPods(macOsProject)) return macOsProject;\n return null;\n }\n\n static isUsingPods(projectRoot: string): boolean {\n return existsSync(path.join(projectRoot, 'Podfile'));\n }\n\n static async gemInstallCLIAsync(\n nonInteractive: boolean = false,\n spawnOptions: SpawnOptions = { stdio: 'inherit' }\n ): Promise<void> {\n const options = ['install', 'cocoapods', '--no-document'];\n\n try {\n // In case the user has run sudo before running the command we can properly install CocoaPods without prompting for an interaction.\n await spawnAsync('gem', options, spawnOptions);\n } catch (error) {\n if (nonInteractive) {\n throw new CocoaPodsError(\n 'Failed to install CocoaPods CLI with gem (recommended)',\n 'COMMAND_FAILED',\n error\n );\n }\n // If the user doesn't have permission then we can prompt them to use sudo.\n await spawnSudoAsync(['gem', ...options], spawnOptions);\n }\n }\n\n static async brewLinkCLIAsync(spawnOptions: SpawnOptions = { stdio: 'inherit' }): Promise<void> {\n await spawnAsync('brew', ['link', 'cocoapods'], spawnOptions);\n }\n\n static async brewInstallCLIAsync(\n spawnOptions: SpawnOptions = { stdio: 'inherit' }\n ): Promise<void> {\n await spawnAsync('brew', ['install', 'cocoapods'], spawnOptions);\n }\n\n static async installCLIAsync({\n nonInteractive = false,\n spawnOptions = { stdio: 'inherit' },\n }: {\n nonInteractive?: boolean;\n spawnOptions?: SpawnOptions;\n }): Promise<boolean> {\n if (!spawnOptions) {\n spawnOptions = { stdio: 'inherit' };\n }\n const silent = !!spawnOptions.ignoreStdio;\n\n try {\n !silent && console.log(`\\u203A Attempting to install CocoaPods CLI with Gem`);\n await CocoaPodsPackageManager.gemInstallCLIAsync(nonInteractive, spawnOptions);\n !silent && console.log(`\\u203A Successfully installed CocoaPods CLI with Gem`);\n return true;\n } catch (error) {\n if (!silent) {\n console.log(chalk.yellow(`\\u203A Failed to install CocoaPods CLI with Gem`));\n console.log(chalk.red(error.stderr ?? error.message));\n console.log(`\\u203A Attempting to install CocoaPods CLI with Homebrew`);\n }\n try {\n await CocoaPodsPackageManager.brewInstallCLIAsync(spawnOptions);\n if (!(await CocoaPodsPackageManager.isCLIInstalledAsync(spawnOptions))) {\n try {\n await CocoaPodsPackageManager.brewLinkCLIAsync(spawnOptions);\n // Still not available after linking? Bail out\n if (!(await CocoaPodsPackageManager.isCLIInstalledAsync(spawnOptions))) {\n throw new CocoaPodsError(\n 'CLI could not be installed automatically with gem or Homebrew, please install CocoaPods manually and try again',\n 'NO_CLI',\n error\n );\n }\n } catch (error) {\n throw new CocoaPodsError(\n 'Homebrew installation appeared to succeed but CocoaPods CLI not found in PATH and unable to link.',\n 'NO_CLI',\n error\n );\n }\n }\n\n !silent && console.log(`\\u203A Successfully installed CocoaPods CLI with Homebrew`);\n return true;\n } catch (error) {\n !silent &&\n console.warn(\n chalk.yellow(\n `\\u203A Failed to install CocoaPods with Homebrew. Please install CocoaPods CLI manually and try again.`\n )\n );\n throw new CocoaPodsError(\n `Failed to install CocoaPods with Homebrew. Please install CocoaPods CLI manually and try again.`,\n 'NO_CLI',\n error\n );\n }\n }\n }\n\n static isAvailable(projectRoot: string, silent: boolean): boolean {\n if (process.platform !== 'darwin') {\n !silent && console.log(chalk.red('CocoaPods is only supported on macOS machines'));\n return false;\n }\n if (!CocoaPodsPackageManager.isUsingPods(projectRoot)) {\n !silent && console.log(chalk.yellow('CocoaPods is not supported in this project'));\n return false;\n }\n return true;\n }\n\n static async isCLIInstalledAsync(\n spawnOptions: SpawnOptions = { stdio: 'inherit' }\n ): Promise<boolean> {\n try {\n await spawnAsync('pod', ['--version'], spawnOptions);\n return true;\n } catch {\n return false;\n }\n }\n\n constructor({ cwd, silent }: { cwd: string; silent?: boolean }) {\n this.silent = !!silent;\n this.options = {\n cwd,\n ...(silent\n ? { stdio: 'pipe' }\n : {\n stdio: ['inherit', 'inherit', 'pipe'],\n }),\n };\n }\n\n get name() {\n return 'CocoaPods';\n }\n\n async installAsync({ spinner }: { spinner?: Ora } = {}) {\n await this._installAsync({ spinner });\n }\n\n public isCLIInstalledAsync() {\n return CocoaPodsPackageManager.isCLIInstalledAsync(this.options);\n }\n\n public installCLIAsync() {\n return CocoaPodsPackageManager.installCLIAsync({\n nonInteractive: true,\n spawnOptions: this.options,\n });\n }\n\n private async _installAsync({\n spinner,\n shouldUpdate = true,\n }: { spinner?: Ora; shouldUpdate?: boolean } = {}): Promise<SpawnResult> {\n try {\n return await this._runAsync(['install']);\n } catch (error) {\n const output = error.output.join('\\n').trim();\n\n const isPodRepoUpdateError = output.includes('pod repo update');\n // When pods are outdated, they'll throw an error informing you to run \"pod repo update\"\n // Attempt to run that command and try installing again.\n if (isPodRepoUpdateError && shouldUpdate) {\n const warningInfo = extractMissingDependencyError(output);\n let message: string;\n if (warningInfo) {\n message = `Couldn't install: ${warningInfo[1]} » ${chalk.underline(warningInfo[0])}.`;\n } else {\n message = `Couldn't install Pods.`;\n }\n message += ` Updating the Pods project and trying again...`;\n if (spinner) {\n spinner.text = chalk.bold(message);\n }\n !this.silent && console.warn(chalk.yellow(message));\n await this.podRepoUpdateAsync();\n // Include a boolean to ensure pod repo update isn't invoked in the unlikely case where the pods fail to update.\n return await this._installAsync({ spinner, shouldUpdate: false });\n } else {\n const cwd = this.options.cwd || process.cwd();\n if (error.stdout.match(/No [`'\"]Podfile[`'\"] found in the project directory/)) {\n error.message = `No Podfile found in directory: ${cwd}. Ensure CocoaPods is setup any try again.`;\n } else if (isPodRepoUpdateError) {\n const warningInfo = extractMissingDependencyError(output);\n let reason: string;\n if (warningInfo) {\n reason = `Couldn't install: ${warningInfo[1]} » ${chalk.underline(warningInfo[0])}`;\n } else {\n reason = `This is often due to native package versions mismatching`;\n }\n\n let solution: string;\n if (warningInfo?.[0]) {\n // If the missing package is named `expo-dev-menu`, `react-native`, etc. then it might not be installed in the project.\n if (warningInfo[0].match(/^(?:@?expo|@?react)(-|\\/)/)) {\n solution = `Ensure the node module \"${warningInfo[0]}\" is installed in your project, then run \\`npx pod-install\\` to try again.`;\n } else {\n solution = `Ensure the CocoaPod \"${warningInfo[0]}\" is installed in your project, then run \\`npx pod-install\\` to try again.`;\n }\n } else {\n solution = `Try deleting the \\`ios/Pods\\` folder or the \\`ios/Podfile.lock\\` file and running \\`npx pod-install\\` to resolve.`;\n }\n error.message = `${reason}. ${solution}`;\n throw new CocoaPodsError('Command `pod repo update` failed.', 'COMMAND_FAILED', error);\n } else {\n let stderr = error.stderr.trim();\n\n // CocoaPods CLI prints the useful error to stdout...\n const usefulError = error.stdout.match(/\\[!\\]\\s((?:.|\\n)*)/)?.[1];\n\n // If there is a useful error message then prune the less useful info.\n if (usefulError) {\n // Delete unhelpful CocoaPods CLI error message.\n if (error.message.match(/pod exited with non-zero code: 1/)) {\n error.message = null;\n }\n // Remove `<PBXResourcesBuildPhase UUID=`13B07F8E1A680F5B00A75B9A`>` type errors when useful messages exist.\n if (stderr.match(/PBXResourcesBuildPhase/)) {\n stderr = null;\n }\n }\n\n error.message = [usefulError, error.message, stderr].filter(Boolean).join('\\n');\n }\n\n throw new CocoaPodsError('Command `pod install` failed.', 'COMMAND_FAILED', error);\n }\n }\n }\n\n async addAsync(...names: string[]) {\n throw new Error('Unimplemented');\n }\n\n async addDevAsync(...names: string[]) {\n throw new Error('Unimplemented');\n }\n\n async versionAsync() {\n const { stdout } = await spawnAsync('pod', ['--version'], this.options);\n return stdout.trim();\n }\n\n async getConfigAsync(key: string): Promise<string> {\n throw new Error('Unimplemented');\n }\n\n async removeLockfileAsync() {\n throw new Error('Unimplemented');\n }\n\n async cleanAsync() {\n throw new Error('Unimplemented');\n }\n\n // Private\n private async podRepoUpdateAsync(): Promise<void> {\n try {\n await this._runAsync(['repo', 'update']);\n } catch (error) {\n error.message = error.message || (error.stderr ?? error.stdout);\n\n throw new CocoaPodsError('The command `pod repo update` failed', 'COMMAND_FAILED', error);\n }\n }\n\n private async _runAsync(args: string[]): Promise<SpawnResult> {\n if (!this.silent) {\n console.log(`> pod ${args.join(' ')}`);\n }\n return spawnAsync('pod', [...args], this.options);\n }\n}\n"]}
1
+ {"version":3,"file":"CocoaPodsPackageManager.js","sourceRoot":"","sources":["../src/CocoaPodsPackageManager.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA0E;AAC1E,kDAA0B;AAC1B,2BAAgC;AAEhC,4CAAoB;AACpB,gDAAwB;AAExB,qDAAkE;AAIlE,MAAa,cAAe,SAAQ,KAAK;IAIvC,YAAY,OAAe,EAAS,IAAwB,EAAS,KAAa;QAChF,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,eAAe,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QADhC,SAAI,GAAJ,IAAI,CAAoB;QAAS,UAAK,GAAL,KAAK,CAAQ;QAHzE,SAAI,GAAG,gBAAgB,CAAC;QACxB,0BAAqB,GAAG,IAAI,CAAC;IAItC,CAAC;CACF;AAPD,wCAOC;AAED,SAAgB,6BAA6B,CAAC,WAAmB;IAC/D,wGAAwG;IACxG,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAC/B,qGAAqG,CACtG,CAAC;IACF,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;KACjC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AATD,sEASC;AAED,MAAa,uBAAuB;IAwIlC,YAAY,EAAE,GAAG,EAAE,MAAM,EAAqC;QAC5D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KACjF;IAED,OAAO,IAAI,cAAc,CAAC,+BAA+B,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;AACtF,CAAC;AAtED,gEAsEC","sourcesContent":["import spawnAsync, { SpawnOptions, SpawnResult } from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { existsSync } from 'fs';\nimport { Ora } from 'ora';\nimport os from 'os';\nimport path from 'path';\n\nimport { PackageManager, spawnSudoAsync } from './PackageManager';\n\nexport type CocoaPodsErrorCode = 'NON_INTERACTIVE' | 'NO_CLI' | 'COMMAND_FAILED';\n\nexport class CocoaPodsError extends Error {\n readonly name = 'CocoaPodsError';\n readonly isPackageManagerError = true;\n\n constructor(message: string, public code: CocoaPodsErrorCode, public cause?: Error) {\n super(cause ? `${message}\\n└─ Cause: ${cause.message}` : message);\n }\n}\n\nexport function extractMissingDependencyError(errorOutput: string): [string, string] | null {\n // [!] Unable to find a specification for `expo-dev-menu-interface` depended upon by `expo-dev-launcher`\n const results = errorOutput.match(\n /Unable to find a specification for ['\"`]([\\w-_\\d\\s]+)['\"`] depended upon by ['\"`]([\\w-_\\d\\s]+)['\"`]/\n );\n if (results) {\n return [results[1], results[2]];\n }\n return null;\n}\n\nexport class CocoaPodsPackageManager implements PackageManager {\n options: SpawnOptions;\n\n private silent: boolean;\n\n static getPodProjectRoot(projectRoot: string): string | null {\n if (CocoaPodsPackageManager.isUsingPods(projectRoot)) return projectRoot;\n const iosProject = path.join(projectRoot, 'ios');\n if (CocoaPodsPackageManager.isUsingPods(iosProject)) return iosProject;\n const macOsProject = path.join(projectRoot, 'macos');\n if (CocoaPodsPackageManager.isUsingPods(macOsProject)) return macOsProject;\n return null;\n }\n\n static isUsingPods(projectRoot: string): boolean {\n return existsSync(path.join(projectRoot, 'Podfile'));\n }\n\n static async gemInstallCLIAsync(\n nonInteractive: boolean = false,\n spawnOptions: SpawnOptions = { stdio: 'inherit' }\n ): Promise<void> {\n const options = ['install', 'cocoapods', '--no-document'];\n\n try {\n // In case the user has run sudo before running the command we can properly install CocoaPods without prompting for an interaction.\n await spawnAsync('gem', options, spawnOptions);\n } catch (error: any) {\n if (nonInteractive) {\n throw new CocoaPodsError(\n 'Failed to install CocoaPods CLI with gem (recommended)',\n 'COMMAND_FAILED',\n error\n );\n }\n // If the user doesn't have permission then we can prompt them to use sudo.\n await spawnSudoAsync(['gem', ...options], spawnOptions);\n }\n }\n\n static async brewLinkCLIAsync(spawnOptions: SpawnOptions = { stdio: 'inherit' }): Promise<void> {\n await spawnAsync('brew', ['link', 'cocoapods'], spawnOptions);\n }\n\n static async brewInstallCLIAsync(\n spawnOptions: SpawnOptions = { stdio: 'inherit' }\n ): Promise<void> {\n await spawnAsync('brew', ['install', 'cocoapods'], spawnOptions);\n }\n\n static async installCLIAsync({\n nonInteractive = false,\n spawnOptions = { stdio: 'inherit' },\n }: {\n nonInteractive?: boolean;\n spawnOptions?: SpawnOptions;\n }): Promise<boolean> {\n if (!spawnOptions) {\n spawnOptions = { stdio: 'inherit' };\n }\n const silent = !!spawnOptions.ignoreStdio;\n\n try {\n !silent && console.log(`\\u203A Attempting to install CocoaPods CLI with Gem`);\n await CocoaPodsPackageManager.gemInstallCLIAsync(nonInteractive, spawnOptions);\n !silent && console.log(`\\u203A Successfully installed CocoaPods CLI with Gem`);\n return true;\n } catch (error: any) {\n if (!silent) {\n console.log(chalk.yellow(`\\u203A Failed to install CocoaPods CLI with Gem`));\n console.log(chalk.red(error.stderr ?? error.message));\n console.log(`\\u203A Attempting to install CocoaPods CLI with Homebrew`);\n }\n try {\n await CocoaPodsPackageManager.brewInstallCLIAsync(spawnOptions);\n if (!(await CocoaPodsPackageManager.isCLIInstalledAsync(spawnOptions))) {\n try {\n await CocoaPodsPackageManager.brewLinkCLIAsync(spawnOptions);\n // Still not available after linking? Bail out\n if (!(await CocoaPodsPackageManager.isCLIInstalledAsync(spawnOptions))) {\n throw new CocoaPodsError(\n 'CLI could not be installed automatically with gem or Homebrew, please install CocoaPods manually and try again',\n 'NO_CLI',\n error\n );\n }\n } catch (error: any) {\n throw new CocoaPodsError(\n 'Homebrew installation appeared to succeed but CocoaPods CLI not found in PATH and unable to link.',\n 'NO_CLI',\n error\n );\n }\n }\n\n !silent && console.log(`\\u203A Successfully installed CocoaPods CLI with Homebrew`);\n return true;\n } catch (error: any) {\n !silent &&\n console.warn(\n chalk.yellow(\n `\\u203A Failed to install CocoaPods with Homebrew. Please install CocoaPods CLI manually and try again.`\n )\n );\n throw new CocoaPodsError(\n `Failed to install CocoaPods with Homebrew. Please install CocoaPods CLI manually and try again.`,\n 'NO_CLI',\n error\n );\n }\n }\n }\n\n static isAvailable(projectRoot: string, silent: boolean): boolean {\n if (process.platform !== 'darwin') {\n !silent && console.log(chalk.red('CocoaPods is only supported on macOS machines'));\n return false;\n }\n if (!CocoaPodsPackageManager.isUsingPods(projectRoot)) {\n !silent && console.log(chalk.yellow('CocoaPods is not supported in this project'));\n return false;\n }\n return true;\n }\n\n static async isCLIInstalledAsync(\n spawnOptions: SpawnOptions = { stdio: 'inherit' }\n ): Promise<boolean> {\n try {\n await spawnAsync('pod', ['--version'], spawnOptions);\n return true;\n } catch {\n return false;\n }\n }\n\n constructor({ cwd, silent }: { cwd: string; silent?: boolean }) {\n this.silent = !!silent;\n this.options = {\n cwd,\n // We use pipe by default instead of inherit so that we can capture stderr/stdout and process it for errors.\n // Later we'll also pipe the stdout/stderr to the terminal when silent is false.\n stdio: 'pipe',\n };\n }\n\n get name() {\n return 'CocoaPods';\n }\n\n /** Runs `pod install` and attempts to automatically run known troubleshooting steps automatically. */\n async installAsync({ spinner }: { spinner?: Ora } = {}) {\n await this._installAsync({ spinner });\n }\n\n public isCLIInstalledAsync() {\n return CocoaPodsPackageManager.isCLIInstalledAsync(this.options);\n }\n\n public installCLIAsync() {\n return CocoaPodsPackageManager.installCLIAsync({\n nonInteractive: true,\n spawnOptions: this.options,\n });\n }\n\n async handleInstallErrorAsync({\n error,\n shouldUpdate = true,\n updatedPackages = [],\n spinner,\n }: {\n error: any;\n spinner?: Ora;\n shouldUpdate?: boolean;\n updatedPackages?: string[];\n }) {\n // Unknown errors are rethrown.\n if (!error.output) {\n throw error;\n }\n\n // To emulate a `pod install --repo-update` error, enter your `ios/Podfile.lock` and change one of `PODS` version numbers to some lower value.\n // const isPodRepoUpdateError = shouldPodRepoUpdate(output);\n if (!shouldUpdate) {\n // If we can't automatically fix the error, we'll just rethrow it with some known troubleshooting info.\n throw getImprovedPodInstallError(error, {\n cwd: this.options.cwd,\n });\n }\n\n // Collect all of the spawn info.\n const errorOutput = error.output.join(os.EOL).trim();\n\n // Extract useful information from the error message and push it to the spinner.\n const { updatePackage, shouldUpdateRepo } = getPodUpdateMessage(errorOutput);\n\n if (!updatePackage || updatedPackages.includes(updatePackage)) {\n // `pod install --repo-update`...\n // Attempt to install again but this time with install --repo-update enabled.\n return await this._installAsync({\n spinner,\n shouldRepoUpdate: true,\n // Include a boolean to ensure pod install --repo-update isn't invoked in the unlikely case where the pods fail to update.\n shouldUpdate: false,\n updatedPackages,\n });\n }\n // Store the package we should update to prevent a loop.\n updatedPackages.push(updatePackage);\n\n // If a single package is broken, we'll try to update it.\n // You can manually test this by changing a version number in your `Podfile.lock`.\n\n // Attempt `pod update <package> <--no-repo-update>` and then try again.\n return await this.runInstallTypeCommandAsync(\n ['update', updatePackage, shouldUpdateRepo ? '' : '--no-repo-update'].filter(Boolean),\n {\n formatWarning() {\n const updateMessage = `Failed to update ${chalk.bold(\n updatePackage\n )}. Attempting to update the repo instead.`;\n return updateMessage;\n },\n spinner,\n updatedPackages,\n }\n );\n // // If update succeeds, we'll try to install again (skipping `pod install --repo-update`).\n // return await this._installAsync({\n // spinner,\n // shouldUpdate: false,\n // updatedPackages,\n // });\n }\n\n private async _installAsync({\n shouldRepoUpdate,\n ...props\n }: {\n spinner?: Ora;\n shouldUpdate?: boolean;\n updatedPackages?: string[];\n shouldRepoUpdate?: boolean;\n } = {}): Promise<SpawnResult> {\n return await this.runInstallTypeCommandAsync(\n ['install', shouldRepoUpdate ? '--repo-update' : ''].filter(Boolean),\n {\n formatWarning(error: any) {\n // Extract useful information from the error message and push it to the spinner.\n return getPodRepoUpdateMessage(error.output.join(os.EOL).trim()).message;\n },\n ...props,\n }\n );\n }\n\n private async runInstallTypeCommandAsync(\n command: string[],\n {\n formatWarning,\n ...props\n }: {\n formatWarning?: (error: Error) => string;\n spinner?: Ora;\n shouldUpdate?: boolean;\n updatedPackages?: string[];\n } = {}\n ): Promise<SpawnResult> {\n try {\n return await this._runAsync(command);\n } catch (error: any) {\n if (formatWarning) {\n const warning = formatWarning(error);\n if (props.spinner) {\n props.spinner.text = chalk.bold(warning);\n }\n if (!this.silent) {\n console.warn(chalk.yellow(warning));\n }\n }\n\n return await this.handleInstallErrorAsync({ error, ...props });\n }\n }\n\n async addAsync(...names: string[]) {\n throw new Error('Unimplemented');\n }\n\n async addDevAsync(...names: string[]) {\n throw new Error('Unimplemented');\n }\n\n async versionAsync() {\n const { stdout } = await spawnAsync('pod', ['--version'], this.options);\n return stdout.trim();\n }\n\n async getConfigAsync(key: string): Promise<string> {\n throw new Error('Unimplemented');\n }\n\n async removeLockfileAsync() {\n throw new Error('Unimplemented');\n }\n\n async cleanAsync() {\n throw new Error('Unimplemented');\n }\n\n // Private\n private async podRepoUpdateAsync(): Promise<void> {\n try {\n await this._runAsync(['repo', 'update']);\n } catch (error: any) {\n error.message = error.message || (error.stderr ?? error.stdout);\n\n throw new CocoaPodsError(\n 'The command `pod install --repo-update` failed',\n 'COMMAND_FAILED',\n error\n );\n }\n }\n\n // Exposed for testing\n async _runAsync(args: string[]): Promise<SpawnResult> {\n if (!this.silent) {\n console.log(`> pod ${args.join(' ')}`);\n }\n const promise = spawnAsync(\n 'pod',\n [\n ...args,\n // Enables colors while collecting output.\n '--ansi',\n ],\n {\n // Add the cwd and other options to the spawn options.\n ...this.options,\n // We use pipe by default instead of inherit so that we can capture stderr/stdout and process it for errors.\n // This is particularly required for the `pod install --repo-update` error.\n\n // Later we'll also pipe the stdout/stderr to the terminal when silent is false,\n // currently this means we lose out on the ansi colors unless passing the `--ansi` flag to every command.\n stdio: 'pipe',\n }\n );\n\n if (!this.silent) {\n // If not silent, pipe the stdout/stderr to the terminal.\n // We only do this when the `stdio` is set to `pipe` (collect the results for parsing), `inherit` won't contain `promise.child`.\n if (promise.child.stdout) {\n promise.child.stdout.pipe(process.stdout);\n }\n }\n\n return await promise;\n }\n}\n\n/** When pods are outdated, they'll throw an error informing you to run \"pod install --repo-update\" */\nfunction shouldPodRepoUpdate(errorOutput: string) {\n const output = errorOutput;\n const isPodRepoUpdateError =\n output.includes('pod repo update') || output.includes('--no-repo-update');\n return isPodRepoUpdateError;\n}\n\nexport function getPodUpdateMessage(output: string) {\n const props = output.match(\n /run ['\"`]pod update ([\\w-_\\d/]+)( --no-repo-update)?['\"`] to apply changes/\n );\n\n return {\n updatePackage: props?.[1] ?? null,\n shouldUpdateRepo: !props?.[2],\n };\n}\n\nexport function getPodRepoUpdateMessage(errorOutput: string) {\n const warningInfo = extractMissingDependencyError(errorOutput);\n const brokenPackage = getPodUpdateMessage(errorOutput);\n\n let message: string;\n if (warningInfo) {\n message = `Couldn't install: ${warningInfo[1]} » ${chalk.underline(warningInfo[0])}.`;\n } else if (brokenPackage?.updatePackage) {\n message = `Couldn't install: ${brokenPackage?.updatePackage}.`;\n } else {\n message = `Couldn't install Pods.`;\n }\n message += ` Updating the Pods project and trying again...`;\n return { message, ...brokenPackage };\n}\n\n/**\n * Format the CocoaPods CLI install error.\n *\n * @param error Error from CocoaPods CLI `pod install` command.\n * @returns\n */\nexport function getImprovedPodInstallError(\n error: SpawnResult & Error,\n { cwd = process.cwd() }: { cwd?: string }\n): Error {\n // Collect all of the spawn info.\n const errorOutput = error.output.join(os.EOL).trim();\n\n if (error.stdout.match(/No [`'\"]Podfile[`'\"] found in the project directory/)) {\n // Ran pod install but no Podfile was found.\n error.message = `No Podfile found in directory: ${cwd}. Ensure CocoaPods is setup any try again.`;\n } else if (shouldPodRepoUpdate(errorOutput)) {\n // Ran pod install but the install --repo-update step failed.\n const warningInfo = extractMissingDependencyError(errorOutput);\n let reason: string;\n if (warningInfo) {\n reason = `Couldn't install: ${warningInfo[1]} » ${chalk.underline(warningInfo[0])}`;\n } else {\n reason = `This is often due to native package versions mismatching`;\n }\n\n // Attempt to provide a helpful message about the missing NPM dependency (containing a CocoaPod) since React Native\n // developers will almost always be using autolinking and not interacting with CocoaPods directly.\n let solution: string;\n if (warningInfo?.[0]) {\n // If the missing package is named `expo-dev-menu`, `react-native`, etc. then it might not be installed in the project.\n if (warningInfo[0].match(/^(?:@?expo|@?react)(-|\\/)/)) {\n solution = `Ensure the node module \"${warningInfo[0]}\" is installed in your project, then run 'npx pod-install' to try again.`;\n } else {\n solution = `Ensure the CocoaPod \"${warningInfo[0]}\" is installed in your project, then run 'npx pod-install' to try again.`;\n }\n } else {\n // Brute force\n solution = `Try deleting the 'ios/Pods' folder or the 'ios/Podfile.lock' file and running 'npx pod-install' to resolve.`;\n }\n error.message = `${reason}. ${solution}`;\n\n // Attempt to provide the troubleshooting info from CocoaPods CLI at the bottom of the error message.\n if (error.stdout) {\n const cocoapodsDebugInfo = error.stdout.split(os.EOL);\n // The troubleshooting info starts with `[!]`, capture everything after that.\n const firstWarning = cocoapodsDebugInfo.findIndex(v => v.startsWith('[!]'));\n if (firstWarning !== -1) {\n const warning = cocoapodsDebugInfo.slice(firstWarning).join(os.EOL);\n error.message += `\\n\\n${chalk.gray(warning)}`;\n }\n }\n return new CocoaPodsError(\n 'Command `pod install --repo-update` failed.',\n 'COMMAND_FAILED',\n error\n );\n } else {\n let stderr: string | null = error.stderr.trim();\n\n // CocoaPods CLI prints the useful error to stdout...\n const usefulError = error.stdout.match(/\\[!\\]\\s((?:.|\\n)*)/)?.[1];\n\n // If there is a useful error message then prune the less useful info.\n if (usefulError) {\n // Delete unhelpful CocoaPods CLI error message.\n if (error.message?.match(/pod exited with non-zero code: 1/)) {\n error.message = '';\n }\n stderr = null;\n }\n\n error.message = [usefulError, error.message, stderr].filter(Boolean).join('\\n');\n }\n\n return new CocoaPodsError('Command `pod install` failed.', 'COMMAND_FAILED', error);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/package-manager",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "A library for installing and finding packages in a node project",
5
5
  "main": "build",
6
6
  "scripts": {