Skip to content

Commit

Permalink
feat(expo): depcrecate expo-cli and use @expo/cli instead
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi committed Oct 25, 2022
1 parent dd9ecc4 commit 650072e
Show file tree
Hide file tree
Showing 51 changed files with 765 additions and 1,028 deletions.
866 changes: 1 addition & 865 deletions docs/generated/packages/expo.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/generated/packages/react-native.json
Expand Up @@ -725,6 +725,7 @@
},
"platform": {
"enum": ["ios", "android"],
"alias": "p",
"description": "Platform to build for."
},
"transformer": {
Expand Down
19 changes: 1 addition & 18 deletions docs/packages.json
Expand Up @@ -133,24 +133,7 @@
"description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
"path": "generated/packages/expo.json",
"schemas": {
"executors": [
"update",
"build",
"build-list",
"download",
"build-ios",
"build-android",
"build-web",
"build-status",
"publish",
"publish-set",
"rollback",
"run",
"start",
"sync-deps",
"ensure-symlink",
"eject"
],
"executors": [],
"generators": ["init", "application", "library", "component"]
}
},
Expand Down
7 changes: 6 additions & 1 deletion e2e/expo/src/expo.test.ts
Expand Up @@ -16,7 +16,7 @@ describe('expo', () => {
);
afterEach(() => cleanupProject());

it('should test, lint', async () => {
it('should test, lint and export', async () => {
const appName = uniq('my-app');
const libName = uniq('lib');
const componentName = uniq('component');
Expand All @@ -41,5 +41,10 @@ describe('expo', () => {

const libLintResults = await runCLIAsync(`lint ${libName}`);
expect(libLintResults.combinedOutput).toContain('All files pass linting.');

const exportResults = await runCLIAsync(`export ${appName}`);
expect(exportResults.combinedOutput).toContain(
'Export was successful. Your exported files can be found'
);
}, 1000000);
});
30 changes: 30 additions & 0 deletions packages/expo/executors.json
Expand Up @@ -79,6 +79,21 @@
"implementation": "./src/executors/eject/eject.impl",
"schema": "./src/executors/eject/schema.json",
"description": "Create native iOS and Android project files."
},
"prebuild": {
"implementation": "./src/executors/prebuild/prebuild.impl",
"schema": "./src/executors/prebuild/schema.json",
"description": "Create native iOS and Android project files for building natively."
},
"install": {
"implementation": "./src/executors/install/install.impl",
"schema": "./src/executors/install/schema.json",
"description": "Install a module or other package to a project."
},
"export": {
"implementation": "./src/executors/export/export.impl",
"schema": "./src/executors/export/schema.json",
"description": "Export the JavaScript and assets for your app using Metro/webpack bundler"
}
},
"builders": {
Expand Down Expand Up @@ -161,6 +176,21 @@
"implementation": "./src/executors/eject/compat",
"schema": "./src/executors/eject/schema.json",
"description": "Create native iOS and Android project files."
},
"prebuild": {
"implementation": "./src/executors/prebuild/compat",
"schema": "./src/executors/prebuild/schema.json",
"description": "Create native iOS and Android project files for building natively."
},
"install": {
"implementation": "./src/executors/install/compat",
"schema": "./src/executors/install/schema.json",
"description": "Install a module or other package to a project."
},
"export": {
"implementation": "./src/executors/export/compat",
"schema": "./src/executors/export/schema.json",
"description": "Export the JavaScript and assets for your app using Metro/webpack bundler"
}
}
}
23 changes: 23 additions & 0 deletions packages/expo/migrations.json
Expand Up @@ -29,6 +29,12 @@
"cli": "nx",
"description": "Change jest config preset tof expo projects",
"factory": "./src/migrations/update-15-0-3/change-jest-preset"
},
"add-new-expo-cli-targets": {
"version": "15.0.3-beta.0",
"cli": "nx",
"description": "Add targets for @expo/cli and replace eject target",
"factory": "./src/migrations/update-15-0-3/add-new-expo-cli-targets"
}
},
"packageJsonUpdates": {
Expand Down Expand Up @@ -456,6 +462,23 @@
"@testing-library/jest-native": {
"version": "5.0.0",
"alwaysAddToPackageJson": false
},
"expo": {
"version": "46.0.16",
"alwaysAddToPackageJson": false
},
"expo-cli": {
"version": "6.0.6",
"alwaysAddToPackageJson": false
},
"eas-cli": {
"version": "2.4.1",
"alwaysAddToPackageJson": false
},
"@expo/cli": {
"version": "0.3.2",
"alwaysAddToPackageJson": false,
"addToPackageJson": "devDependencies"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/expo/package.json
Expand Up @@ -31,7 +31,7 @@
"@nrwl/jest": "file:../jest",
"@nrwl/linter": "file:../linter",
"@nrwl/react": "file:../react",
"@nrwl/web": "file:../web",
"@nrwl/webpack": "file:../webpack",
"@nrwl/workspace": "file:../workspace",
"@svgr/webpack": "^6.1.2",
"chalk": "^4.1.0",
Expand All @@ -44,7 +44,7 @@
"tsconfig-paths-webpack-plugin": "^3.5.2"
},
"peerDependencies": {
"expo": "^46.0.13"
"expo": "^46.0.16"
},
"builders": "./executors.json",
"ng-update": {
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/plugins/with-nx-webpack.ts
Expand Up @@ -12,7 +12,7 @@ export async function withNxWebpack(config) {
test: /\.(mjs|[jt]sx?)$/,
exclude: /node_modules/,
use: {
loader: require.resolve('@nrwl/web/src/utils/web-babel-loader.js'),
loader: require.resolve('@nrwl/webpack/src/utils/web-babel-loader.js'),
options: {
presets: [
[
Expand Down
12 changes: 10 additions & 2 deletions packages/expo/src/executors/build-android/build-android.impl.ts
@@ -1,4 +1,4 @@
import { ExecutorContext, names } from '@nrwl/devkit';
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';

Expand All @@ -20,12 +20,20 @@ export default async function* buildAndroidExecutor(
options: ExpoBuildAndroidOptions,
context: ExecutorContext
): AsyncGenerator<ReactNativeBuildOutput> {
logger.warn(
'@nrwl/expo:build-android is deprecated and will be removed in Nx 16. Please switch to expo:prebuild and expo:build.'
);
const projectRoot = context.workspace.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);
if (options.sync) {
displayNewlyAddedDepsMessage(
context.projectName,
await syncDeps(context.projectName, projectRoot)
await syncDeps(
context.projectName,
projectRoot,
context.root,
context.projectGraph
)
);
}

Expand Down
12 changes: 10 additions & 2 deletions packages/expo/src/executors/build-ios/build-ios.impl.ts
@@ -1,4 +1,4 @@
import { ExecutorContext, names } from '@nrwl/devkit';
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';

Expand All @@ -19,12 +19,20 @@ export default async function* buildIosExecutor(
options: ExpoBuildIOSOptions,
context: ExecutorContext
): AsyncGenerator<ExpoRunOutput> {
logger.warn(
'@nrwl/expo:build-status is deprecated and will be removed in Nx 16. Please switch to expo:prebuild and expo:build.'
);
const projectRoot = context.workspace.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);
if (options.sync) {
displayNewlyAddedDepsMessage(
context.projectName,
await syncDeps(context.projectName, projectRoot)
await syncDeps(
context.projectName,
projectRoot,
context.root,
context.projectGraph
)
);
}

Expand Down
4 changes: 3 additions & 1 deletion packages/expo/src/executors/build-list/build-list.impl.ts
Expand Up @@ -39,7 +39,9 @@ function createBuildListOptions(options: ExpoEasBuildListOptions): string[] {
return Object.keys(options).reduce((acc, k) => {
const v = options[k];
if (!nxOptions.includes(k)) {
if (typeof v === 'boolean') {
if (k === 'nonInteractive') {
acc.push(`--non-interactive`);
} else if (typeof v === 'boolean') {
if (v === true) {
// when true, does not need to pass the value true, just need to pass the flag in camel case
acc.push(`--${names(k).propertyName}`);
Expand Down
1 change: 1 addition & 0 deletions packages/expo/src/executors/build-list/schema.d.ts
Expand Up @@ -2,6 +2,7 @@
// options from https://github.com/expo/eas-cli/blob/main/packages/eas-cli/src/commands/build/list.ts
export interface ExpoEasBuildListOptions {
platform: 'ios' | 'android' | 'all';
nonInteractive?: boolean;
json?: boolean;
// status and distribution enum from https://github.com/expo/eas-cli/blob/main/packages/eas-cli/src/build/types.ts
status?:
Expand Down
4 changes: 4 additions & 0 deletions packages/expo/src/executors/build-list/schema.json
Expand Up @@ -17,6 +17,10 @@
"type": "boolean",
"description": "Enable JSON output, non-JSON messages will be printed to stderr"
},
"nonInteractive": {
"type": "boolean",
"description": "Run the command in non-interactive mode."
},
"status": {
"enum": [
"new",
Expand Down
@@ -1,4 +1,4 @@
import { ExecutorContext, names } from '@nrwl/devkit';
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';

Expand All @@ -16,6 +16,10 @@ export default async function* buildStatusExecutor(
options: ExpoBuildStatusOptions,
context: ExecutorContext
): AsyncGenerator<ReactNativeBuildOutput> {
logger.warn(
'@nrwl/expo:build-status is deprecated and will be removed in Nx 16. Please switch to expo:build-list.'
);

const projectRoot = context.workspace.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);

Expand Down
6 changes: 5 additions & 1 deletion packages/expo/src/executors/build-web/build-web.impl.ts
@@ -1,4 +1,4 @@
import { ExecutorContext, names } from '@nrwl/devkit';
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';

Expand All @@ -16,6 +16,10 @@ export default async function* buildWebExecutor(
options: ExpoBuildWebOptions,
context: ExecutorContext
): AsyncGenerator<ReactNativeBuildOutput> {
logger.warn(
'@nrwl/expo:build-web is deprecated and will be removed in Nx 16. Please switch to expo:export --bundler webpack.'
);

const projectRoot = context.workspace.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);

Expand Down
1 change: 1 addition & 0 deletions packages/expo/src/executors/download/download.impl.ts
Expand Up @@ -83,6 +83,7 @@ export function getBuild(
) {
const buildList = runCliBuildList(workspaceRoot, projectRoot, {
...options,
nonInteractive: true,
json: true,
status: 'finished',
limit: 1,
Expand Down
5 changes: 0 additions & 5 deletions packages/expo/src/executors/eject/compat.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/expo/src/executors/eject/schema.d.ts

This file was deleted.

23 changes: 0 additions & 23 deletions packages/expo/src/executors/eject/schema.json

This file was deleted.

5 changes: 5 additions & 0 deletions packages/expo/src/executors/export/compat.ts
@@ -0,0 +1,5 @@
import { convertNxExecutor } from '@nrwl/devkit';

import exportExecutor from './export.impl';

export default convertNxExecutor(exportExecutor);

0 comments on commit 650072e

Please sign in to comment.