Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(expo): change force to be an option for yarn #28115

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/generated/packages/expo/executors/install.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
Expand Down
4 changes: 2 additions & 2 deletions e2e/expo/src/expo-legacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions e2e/expo/src/expo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 8 additions & 2 deletions packages/expo/src/executors/install/install.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions packages/expo/src/executors/install/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 5 additions & 0 deletions packages/expo/src/executors/install/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}