Revert "[Do not merge]: feat(bundling): Add support to rollup for babelUpwardRootMode" (#17422)
This commit is contained in:
parent
b8cfbcc625
commit
1bba7490a1
@ -150,11 +150,6 @@
|
|||||||
"default": "babel",
|
"default": "babel",
|
||||||
"description": "Which compiler to use."
|
"description": "Which compiler to use."
|
||||||
},
|
},
|
||||||
"babelUpwardRootMode": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Whether to set rootmode to upward. See https://babeljs.io/docs/en/options#rootmode",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"javascriptEnabled": {
|
"javascriptEnabled": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Sets `javascriptEnabled` option for less loader",
|
"description": "Sets `javascriptEnabled` option for less loader",
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { join, normalize, sep } from 'path';
|
|||||||
import { ChildProcess, fork } from 'child_process';
|
import { ChildProcess, fork } from 'child_process';
|
||||||
|
|
||||||
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
|
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
|
||||||
import { unzipBuild } from '../download/download.impl';
|
import { copyBuildFile, unzipBuild } from '../download/download.impl';
|
||||||
|
|
||||||
import { ExpoEasBuildOptions } from './schema';
|
import { ExpoEasBuildOptions } from './schema';
|
||||||
import { removeSync } from 'fs-extra';
|
import { removeSync } from 'fs-extra';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "<%= rootTsConfigPath %>",
|
"extends": "<%= rootTsConfigPath %>",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-native",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"allowSyntheticDefaultImports": true
|
"allowSyntheticDefaultImports": true
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "<%= rootTsConfigPath %>",
|
"extends": "<%= rootTsConfigPath %>",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-native",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"allowSyntheticDefaultImports": true
|
"allowSyntheticDefaultImports": true
|
||||||
|
|||||||
@ -11,12 +11,6 @@
|
|||||||
"version": "16.0.0-beta.1",
|
"version": "16.0.0-beta.1",
|
||||||
"description": "Replace @nrwl/rollup with @nx/rollup",
|
"description": "Replace @nrwl/rollup with @nx/rollup",
|
||||||
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
||||||
},
|
|
||||||
"update-16-3-1-add-babel-upward-root-mode-flag": {
|
|
||||||
"cli": "nx",
|
|
||||||
"version": "16-3-1-beta.0",
|
|
||||||
"description": "Add babelUpwardRootMode if not already defined",
|
|
||||||
"implementation": "./src/migrations/update-16-3-1-add-babel-upward-root-mode-flag/update-16-3-1-add-babel-upward-root-mode-flag"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packageJsonUpdates": {}
|
"packageJsonUpdates": {}
|
||||||
|
|||||||
@ -255,7 +255,7 @@ export function createRollupOptions(
|
|||||||
isModern: true,
|
isModern: true,
|
||||||
},
|
},
|
||||||
cwd: join(context.root, sourceRoot),
|
cwd: join(context.root, sourceRoot),
|
||||||
rootMode: options.babelUpwardRootMode ? 'upward' : undefined,
|
rootMode: 'upward',
|
||||||
babelrc: true,
|
babelrc: true,
|
||||||
extensions: fileExtensions,
|
extensions: fileExtensions,
|
||||||
babelHelpers: 'bundled',
|
babelHelpers: 'bundled',
|
||||||
|
|||||||
@ -32,5 +32,4 @@ export interface RollupExecutorOptions {
|
|||||||
javascriptEnabled?: boolean;
|
javascriptEnabled?: boolean;
|
||||||
generateExportsField?: boolean;
|
generateExportsField?: boolean;
|
||||||
skipTypeCheck?: boolean;
|
skipTypeCheck?: boolean;
|
||||||
babelUpwardRootMode?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,11 +137,6 @@
|
|||||||
"default": "babel",
|
"default": "babel",
|
||||||
"description": "Which compiler to use."
|
"description": "Which compiler to use."
|
||||||
},
|
},
|
||||||
"babelUpwardRootMode": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Whether to set rootmode to upward. See https://babeljs.io/docs/en/options#rootmode",
|
|
||||||
"default": false
|
|
||||||
},
|
|
||||||
"javascriptEnabled": {
|
"javascriptEnabled": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Sets `javascriptEnabled` option for less loader",
|
"description": "Sets `javascriptEnabled` option for less loader",
|
||||||
|
|||||||
@ -1,58 +0,0 @@
|
|||||||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
||||||
import {
|
|
||||||
addProjectConfiguration,
|
|
||||||
readProjectConfiguration,
|
|
||||||
Tree,
|
|
||||||
} from '@nx/devkit';
|
|
||||||
import addBabelUpwardRootModeFlag from './update-16-3-1-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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user