-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bundling): Add support to rollup for babelUpwardRootMode" (#17422)…
…" (#17427)
- Loading branch information
Showing
10 changed files
with
111 additions
and
4 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
2 changes: 1 addition & 1 deletion
2
packages/expo/src/generators/library/files/lib/tsconfig.json.template
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
2 changes: 1 addition & 1 deletion
2
packages/react-native/src/generators/library/files/lib/tsconfig.json__tmpl__
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
58 changes: 58 additions & 0 deletions
58
...3-3-add-babel-upward-root-mode-flag/update-16-3-3-add-babel-upward-root-mode-flag.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,58 @@ | ||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; | ||
import { | ||
addProjectConfiguration, | ||
readProjectConfiguration, | ||
Tree, | ||
} from '@nx/devkit'; | ||
import addBabelUpwardRootModeFlag from './update-16-3-3-add-babel-upward-root-mode-flag'; | ||
|
||
describe('16.3.0 migration (add babelUpwardRootMode flag)', () => { | ||
let tree: Tree; | ||
|
||
beforeEach(async () => { | ||
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); | ||
}); | ||
|
||
it('should add the babelUpwardRootMode flag to rollup projects', async () => { | ||
addProjectConfiguration(tree, 'app1', { | ||
root: 'apps/app1', | ||
targets: { | ||
build: { | ||
executor: '@nx/rollup:rollup', | ||
options: {}, | ||
}, | ||
}, | ||
}); | ||
addProjectConfiguration(tree, 'app2', { | ||
root: 'apps/app2', | ||
targets: { | ||
build: { | ||
executor: '@nx/rollup:rollup', | ||
options: { | ||
babelUpwardRootMode: false, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
addProjectConfiguration(tree, 'app3', { | ||
root: 'apps/app3', | ||
targets: { | ||
build: { | ||
executor: '@nx/esbuild:esbuild', | ||
options: {}, | ||
}, | ||
}, | ||
}); | ||
|
||
await addBabelUpwardRootModeFlag(tree); | ||
|
||
const app1 = readProjectConfiguration(tree, 'app1'); | ||
const app2 = readProjectConfiguration(tree, 'app2'); | ||
const app3 = readProjectConfiguration(tree, 'app3'); | ||
|
||
expect(app1.targets['build'].options.babelUpwardRootMode).toBeTruthy(); | ||
expect(app2.targets['build'].options.babelUpwardRootMode).toBeFalsy(); | ||
expect(app3.targets['build'].options.babelUpwardRootMode).toBeUndefined(); | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
...e-16-3-3-add-babel-upward-root-mode-flag/update-16-3-3-add-babel-upward-root-mode-flag.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,32 @@ | ||
import { | ||
formatFiles, | ||
readProjectConfiguration, | ||
Tree, | ||
updateProjectConfiguration, | ||
} from '@nx/devkit'; | ||
import { forEachExecutorOptions } from '@nx/devkit/src/generators/executor-options-utils'; | ||
import { RollupExecutorOptions } from '../../executors/rollup/schema'; | ||
|
||
export default async function (tree: Tree) { | ||
forEachExecutorOptions<RollupExecutorOptions>( | ||
tree, | ||
'@nx/rollup:rollup', | ||
( | ||
options: RollupExecutorOptions, | ||
projectName, | ||
targetName, | ||
_configurationName | ||
) => { | ||
if (options.babelUpwardRootMode !== undefined) { | ||
return; | ||
} | ||
|
||
const projectConfiguration = readProjectConfiguration(tree, projectName); | ||
projectConfiguration.targets[targetName].options.babelUpwardRootMode = | ||
true; | ||
updateProjectConfiguration(tree, projectName, projectConfiguration); | ||
} | ||
); | ||
|
||
await formatFiles(tree); | ||
} |
bbb64f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev
nx-five.vercel.app