forked from nrwl/nx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(expo): fix unable to build expo local for yarn 4 (nrwl#26992)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes nrwl#22631
- Loading branch information
1 parent
50c7eba
commit 33e88dc
Showing
13 changed files
with
188 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/expo/src/migrations/update-19-7-0/remove-eas-pre-install.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; | ||
import update from './remove-eas-pre-install'; | ||
import { addProjectConfiguration, Tree } from '@nx/devkit'; | ||
|
||
describe('Remove eas-build-pre-install script from app package.json', () => { | ||
let tree: Tree; | ||
|
||
beforeEach(async () => { | ||
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); | ||
addProjectConfiguration(tree, 'product', { | ||
root: 'apps/product', | ||
}); | ||
}); | ||
|
||
it('should not throw an error if package.json does not exist', () => { | ||
expect(() => update(tree)).not.toThrow(); | ||
}); | ||
|
||
it('should not throw an error if there is no scripts in package.json', () => { | ||
tree.write('apps/product/package.json', JSON.stringify({})); | ||
expect(() => update(tree)).not.toThrow(); | ||
}); | ||
|
||
it('should remove eas-build-pre-install script', async () => { | ||
tree.write( | ||
'apps/product/package.json', | ||
JSON.stringify({ | ||
scripts: { | ||
'eas-build-pre-install': 'echo "Hello World!"', | ||
}, | ||
}) | ||
); | ||
await update(tree); | ||
expect(tree.read('apps/product/package.json').toString()).not.toContain( | ||
'eas-build-pre-install' | ||
); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
packages/expo/src/migrations/update-19-7-0/remove-eas-pre-install.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Tree, getProjects, logger, updateJson } from '@nx/devkit'; | ||
import { join } from 'path'; | ||
|
||
/** | ||
* Remove eas-build-pre-install script from app's package.json. | ||
* This script causes an issue with Yarn 4. | ||
*/ | ||
export default function update(tree: Tree) { | ||
const projects = getProjects(tree); | ||
|
||
for (const [_, config] of projects.entries()) { | ||
const packageJsonPath = join(config.root, 'package.json'); | ||
if (!tree.exists(packageJsonPath)) { | ||
continue; | ||
} | ||
updateJson(tree, join(config.root, 'package.json'), (packageJson) => { | ||
if (packageJson.scripts?.['eas-build-pre-install']) { | ||
delete packageJson.scripts['eas-build-pre-install']; | ||
} | ||
return packageJson; | ||
}); | ||
} | ||
} |