From f682c2ec95ccb728a68faf96617d13db2d7ea849 Mon Sep 17 00:00:00 2001 From: Emily Xiong Date: Wed, 25 Sep 2024 17:13:44 -0400 Subject: [PATCH] fix(expo): remove --force for install for yarn --- docs/generated/packages/expo/executors/install.json | 5 +++++ e2e/expo/src/expo-legacy.test.ts | 4 ++-- e2e/expo/src/expo.test.ts | 4 ++-- packages/expo/src/executors/install/install.impl.ts | 10 ++++++++-- packages/expo/src/executors/install/schema.d.ts | 1 + packages/expo/src/executors/install/schema.json | 5 +++++ 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/docs/generated/packages/expo/executors/install.json b/docs/generated/packages/expo/executors/install.json index 1c583fa41666a..bfc9c1982a2b2 100644 --- a/docs/generated/packages/expo/executors/install.json +++ b/docs/generated/packages/expo/executors/install.json @@ -27,6 +27,11 @@ "type": "boolean", "description": "Automatically update any invalid package versions", "default": false + }, + "force": { + "type": "boolean", + "description": "Force the installation of a package, even if it is already installed", + "default": false } }, "presets": [] diff --git a/e2e/expo/src/expo-legacy.test.ts b/e2e/expo/src/expo-legacy.test.ts index a9dada0671011..2d970e07b220a 100644 --- a/e2e/expo/src/expo-legacy.test.ts +++ b/e2e/expo/src/expo-legacy.test.ts @@ -146,14 +146,14 @@ describe('@nx/expo (legacy)', () => { it('should install', async () => { // run install command let installResults = await runCLIAsync( - `install ${appName} --no-interactive` + `install ${appName} --no-interactive --force` ); expect(installResults.combinedOutput).toContain( 'Successfully ran target install' ); installResults = await runCLIAsync( - `install ${appName} --packages=@react-native-async-storage/async-storage,react-native-image-picker --no-interactive` + `install ${appName} --force --packages=@react-native-async-storage/async-storage,react-native-image-picker --no-interactive` ); expect(installResults.combinedOutput).toContain( 'Successfully ran target install' diff --git a/e2e/expo/src/expo.test.ts b/e2e/expo/src/expo.test.ts index 1946dc3e289c0..d480ec85cbef7 100644 --- a/e2e/expo/src/expo.test.ts +++ b/e2e/expo/src/expo.test.ts @@ -117,14 +117,14 @@ describe('@nx/expo', () => { it('should install', async () => { // run install command let installResults = await runCLIAsync( - `install ${appName} --no-interactive` + `install ${appName} --force --no-interactive` ); expect(installResults.combinedOutput).toContain( 'Successfully ran target install' ); installResults = await runCLIAsync( - `install ${appName} --packages=@react-native-async-storage/async-storage,react-native-image-picker --no-interactive` + `install ${appName} --force --packages=@react-native-async-storage/async-storage,react-native-image-picker --no-interactive` ); expect(installResults.combinedOutput).toContain( 'Successfully ran target install' diff --git a/packages/expo/src/executors/install/install.impl.ts b/packages/expo/src/executors/install/install.impl.ts index a8f31a7ee22ea..52f6b8fb97a8b 100644 --- a/packages/expo/src/executors/install/install.impl.ts +++ b/packages/expo/src/executors/install/install.impl.ts @@ -42,8 +42,14 @@ export async function installAndUpdatePackageJson( ? options.packages.split(',') : options.packages ?? []; - // Use force in case there are any unmet peer dependencies. - await installAsync(packages, createInstallOptions(options), ['--force']); + await installAsync( + packages, + createInstallOptions({ + fix: options.fix, + check: options.check, + }), + createInstallOptions({ force: options.force }) + ); const projectRoot = context.projectsConfigurations.projects[context.projectName].root; diff --git a/packages/expo/src/executors/install/schema.d.ts b/packages/expo/src/executors/install/schema.d.ts index c2161b11ea176..2ca7be228e14f 100644 --- a/packages/expo/src/executors/install/schema.d.ts +++ b/packages/expo/src/executors/install/schema.d.ts @@ -4,4 +4,5 @@ export interface ExpoInstallOptions { packages?: string | string[]; // either a string separated by comma or a string array check?: boolean; // default is false fix?: boolean; // default is false + force?: boolean; // default is false } diff --git a/packages/expo/src/executors/install/schema.json b/packages/expo/src/executors/install/schema.json index ea1869992eae9..d1acb886b3761 100644 --- a/packages/expo/src/executors/install/schema.json +++ b/packages/expo/src/executors/install/schema.json @@ -29,6 +29,11 @@ "type": "boolean", "description": "Automatically update any invalid package versions", "default": false + }, + "force": { + "type": "boolean", + "description": "Force the installation of a package, even if it is already installed", + "default": false } } }