-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(expo): remove deprecated webpack. (nrwl#26137)
config.js <!-- 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` --> ## 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#26118 nrwl#25291 nrwl#23233
- Loading branch information
Showing
5 changed files
with
63 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
57 changes: 0 additions & 57 deletions
57
packages/expo/src/generators/application/files/webpack.config.js.template
This file was deleted.
Oops, something went wrong.
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
30 changes: 30 additions & 0 deletions
30
packages/expo/src/migrations/update-19-2-0/remove-deprecated-webpack-config.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,30 @@ | ||
import { addProjectConfiguration, Tree } from '@nx/devkit'; | ||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; | ||
import update from './remove-deprecated-webpack-config'; | ||
|
||
describe('remove-deprecated-webpack-config', () => { | ||
let tree: Tree; | ||
|
||
beforeEach(async () => { | ||
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); | ||
addProjectConfiguration(tree, 'product', { | ||
root: 'apps/product', | ||
sourceRoot: 'apps/product/src', | ||
targets: { | ||
start: { | ||
executor: '@nx/expo:start', | ||
}, | ||
}, | ||
}); | ||
tree.write( | ||
`apps/product/webpack.config.js`, | ||
'module.exports = { /* webpack config */ };' | ||
); | ||
}); | ||
|
||
it(`should remove webpack.config.js`, async () => { | ||
await update(tree); | ||
|
||
expect(tree.exists('apps/product/webpack.config.js')).toBe(false); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
packages/expo/src/migrations/update-19-2-0/remove-deprecated-webpack-config.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,19 @@ | ||
import { Tree, getProjects } from '@nx/devkit'; | ||
import { removeSync } from 'fs-extra'; | ||
import { join } from 'path'; | ||
|
||
/** | ||
* This function removes the deprecated webpack.config.js file from projects that use the expo:start executor | ||
* @param tree | ||
*/ | ||
export default async function update(tree: Tree) { | ||
const projects = getProjects(tree); | ||
|
||
for (const [_, config] of projects.entries()) { | ||
if (config.targets?.['start']?.executor === '@nx/expo:start') { | ||
if (tree.exists(join(config.root, 'webpack.config.js'))) { | ||
tree.delete(join(config.root, 'webpack.config.js')); | ||
} | ||
} | ||
} | ||
} |