chore(expo): remove deprecated targets and expo-cli (#16076)

This commit is contained in:
Emily Xiong 2023-04-14 11:26:29 -04:00 committed by GitHub
parent 3e45445e26
commit a42cc57354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 43 additions and 1342 deletions

View File

@ -4513,62 +4513,6 @@
"isExternal": false,
"disableCollapsible": false
},
{
"id": "build-ios",
"path": "/packages/expo/executors/build-ios",
"name": "build-ios",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "build-android",
"path": "/packages/expo/executors/build-android",
"name": "build-android",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "build-web",
"path": "/packages/expo/executors/build-web",
"name": "build-web",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "build-status",
"path": "/packages/expo/executors/build-status",
"name": "build-status",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "publish",
"path": "/packages/expo/executors/publish",
"name": "publish",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "publish-set",
"path": "/packages/expo/executors/publish-set",
"name": "publish-set",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "rollback",
"path": "/packages/expo/executors/rollback",
"name": "rollback",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "run",
"path": "/packages/expo/executors/run",

View File

@ -737,69 +737,6 @@
"path": "/packages/expo/executors/download",
"type": "executor"
},
"/packages/expo/executors/build-ios": {
"description": "Build and sign a standalone IPA for the Apple App Store",
"file": "generated/packages/expo/executors/build-ios.json",
"hidden": false,
"name": "build-ios",
"originalFilePath": "/packages/expo/src/executors/build-ios/schema.json",
"path": "/packages/expo/executors/build-ios",
"type": "executor"
},
"/packages/expo/executors/build-android": {
"description": "Build and sign a standalone APK or App Bundle for the Google Play Store",
"file": "generated/packages/expo/executors/build-android.json",
"hidden": false,
"name": "build-android",
"originalFilePath": "/packages/expo/src/executors/build-android/schema.json",
"path": "/packages/expo/executors/build-android",
"type": "executor"
},
"/packages/expo/executors/build-web": {
"description": "Build the web app for production",
"file": "generated/packages/expo/executors/build-web.json",
"hidden": false,
"name": "build-web",
"originalFilePath": "/packages/expo/src/executors/build-web/schema.json",
"path": "/packages/expo/executors/build-web",
"type": "executor"
},
"/packages/expo/executors/build-status": {
"description": "Get the status of the latest build for the project",
"file": "generated/packages/expo/executors/build-status.json",
"hidden": false,
"name": "build-status",
"originalFilePath": "/packages/expo/src/executors/build-status/schema.json",
"path": "/packages/expo/executors/build-status",
"type": "executor"
},
"/packages/expo/executors/publish": {
"description": "Deploy a project to Expo hosting",
"file": "generated/packages/expo/executors/publish.json",
"hidden": false,
"name": "publish",
"originalFilePath": "/packages/expo/src/executors/publish/schema.json",
"path": "/packages/expo/executors/publish",
"type": "executor"
},
"/packages/expo/executors/publish-set": {
"description": "Specify the channel to serve a published release",
"file": "generated/packages/expo/executors/publish-set.json",
"hidden": false,
"name": "publish-set",
"originalFilePath": "/packages/expo/src/executors/publish-set/schema.json",
"path": "/packages/expo/executors/publish-set",
"type": "executor"
},
"/packages/expo/executors/rollback": {
"description": "Undo an update to a channel",
"file": "generated/packages/expo/executors/rollback.json",
"hidden": false,
"name": "rollback",
"originalFilePath": "/packages/expo/src/executors/rollback/schema.json",
"path": "/packages/expo/executors/rollback",
"type": "executor"
},
"/packages/expo/executors/run": {
"description": "Run the Android app binary locally or run the iOS app binary locally",
"file": "generated/packages/expo/executors/run.json",

View File

@ -724,69 +724,6 @@
"path": "expo/executors/download",
"type": "executor"
},
{
"description": "Build and sign a standalone IPA for the Apple App Store",
"file": "generated/packages/expo/executors/build-ios.json",
"hidden": false,
"name": "build-ios",
"originalFilePath": "/packages/expo/src/executors/build-ios/schema.json",
"path": "expo/executors/build-ios",
"type": "executor"
},
{
"description": "Build and sign a standalone APK or App Bundle for the Google Play Store",
"file": "generated/packages/expo/executors/build-android.json",
"hidden": false,
"name": "build-android",
"originalFilePath": "/packages/expo/src/executors/build-android/schema.json",
"path": "expo/executors/build-android",
"type": "executor"
},
{
"description": "Build the web app for production",
"file": "generated/packages/expo/executors/build-web.json",
"hidden": false,
"name": "build-web",
"originalFilePath": "/packages/expo/src/executors/build-web/schema.json",
"path": "expo/executors/build-web",
"type": "executor"
},
{
"description": "Get the status of the latest build for the project",
"file": "generated/packages/expo/executors/build-status.json",
"hidden": false,
"name": "build-status",
"originalFilePath": "/packages/expo/src/executors/build-status/schema.json",
"path": "expo/executors/build-status",
"type": "executor"
},
{
"description": "Deploy a project to Expo hosting",
"file": "generated/packages/expo/executors/publish.json",
"hidden": false,
"name": "publish",
"originalFilePath": "/packages/expo/src/executors/publish/schema.json",
"path": "expo/executors/publish",
"type": "executor"
},
{
"description": "Specify the channel to serve a published release",
"file": "generated/packages/expo/executors/publish-set.json",
"hidden": false,
"name": "publish-set",
"originalFilePath": "/packages/expo/src/executors/publish-set/schema.json",
"path": "expo/executors/publish-set",
"type": "executor"
},
{
"description": "Undo an update to a channel",
"file": "generated/packages/expo/executors/rollback.json",
"hidden": false,
"name": "rollback",
"originalFilePath": "/packages/expo/src/executors/rollback/schema.json",
"path": "expo/executors/rollback",
"type": "executor"
},
{
"description": "Run the Android app binary locally or run the iOS app binary locally",
"file": "generated/packages/expo/executors/run.json",

View File

@ -84,17 +84,6 @@
"offline": {
"type": "boolean",
"description": "Allows this command to run while offline"
},
"sentTo": {
"type": "string",
"description": "An email address to send a link to",
"alias": "s",
"x-deprecated": "This option will be removed in v16. It is no longer supported by @expo/cli."
},
"webpack": {
"type": "boolean",
"description": "Start a Webpack dev server for the web app.",
"x-deprecated": "This option will be removed in v16. It is no longer supported by @expo/cli."
}
},
"examplesFile": "`project.json`:\n\n```json\n{\n \"name\": \"mobile\",\n //...\n \"targets\": {\n //...\n \"start\": {\n \"executor\": \"@nrwl/expo:start\",\n \"options\": {\n \"port\": 8081\n }\n }\n //...\n }\n}\n```\n\n```shell\nnx run mobile:start\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Specify starting on platform\" %}\nThe `ios`, `android` and `web` option allows you to start the server on different platforms.\n\nOpens your app in Expo Go in a currently running iOS simulator on your computer:\n\n```json\n \"start\": {\n \"executor\": \"@nrwl/expo:start\",\n \"options\": {\n \"port\": 8081,\n \"ios\": true\n }\n }\n```\n\nOpens your app in Expo Go on a connected Android device\n\n```json\n \"start\": {\n \"executor\": \"@nrwl/expo:start\",\n \"options\": {\n \"port\": 8081,\n \"android\": true\n }\n }\n```\n\nOpens your app in a web browser:\n\n```json\n \"start\": {\n \"executor\": \"@nrwl/expo:start\",\n \"options\": {\n \"port\": 8081,\n \"web\": true\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Specify the host\" %}\nThe `host` option allows you to specify the type of host to use. `lan` uses the local network; `tunnel` ues any network by tunnel through ngrok; `localhost` connects to the dev server over localhost.\n\n```json\n \"start\": {\n \"executor\": \"@nrwl/expo:start\",\n \"options\": {\n \"port\": 8081,\n \"host\": \"localhost\"\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Starts the server with cache reset\" %}\n\nThe `clear` option allows you to remove Metro bundler cache.\n\n```json\n \"start\": {\n \"executor\": \"@nrwl/expo:start\",\n \"options\": {\n \"port\": 8081,\n \"clear\": true\n }\n }\n```\n\n{% /tab %}\n{% /tabs %}\n\n---\n",

View File

@ -20,41 +20,6 @@
"schema": "./src/executors/download/schema.json",
"description": "Download an EAS build"
},
"build-ios": {
"implementation": "./src/executors/build-ios/build-ios.impl",
"schema": "./src/executors/build-ios/schema.json",
"description": "Build and sign a standalone IPA for the Apple App Store"
},
"build-android": {
"implementation": "./src/executors/build-android/build-android.impl",
"schema": "./src/executors/build-android/schema.json",
"description": "Build and sign a standalone APK or App Bundle for the Google Play Store"
},
"build-web": {
"implementation": "./src/executors/build-web/build-web.impl",
"schema": "./src/executors/build-web/schema.json",
"description": "Build the web app for production"
},
"build-status": {
"implementation": "./src/executors/build-status/build-status.impl",
"schema": "./src/executors/build-status/schema.json",
"description": "Get the status of the latest build for the project"
},
"publish": {
"implementation": "./src/executors/publish/publish.impl",
"schema": "./src/executors/publish/schema.json",
"description": "Deploy a project to Expo hosting"
},
"publish-set": {
"implementation": "./src/executors/publish-set/publish-set.impl",
"schema": "./src/executors/publish-set/schema.json",
"description": "Specify the channel to serve a published release"
},
"rollback": {
"implementation": "./src/executors/rollback/rollback.impl",
"schema": "./src/executors/rollback/schema.json",
"description": "Undo an update to a channel"
},
"run": {
"implementation": "./src/executors/run/run.impl",
"schema": "./src/executors/run/schema.json",
@ -112,41 +77,6 @@
"schema": "./src/executors/download/schema.json",
"description": "Download an EAS build"
},
"build-ios": {
"implementation": "./src/executors/build-ios/compat",
"schema": "./src/executors/build-ios/schema.json",
"description": "Build and sign a standalone IPA for the Apple App Store"
},
"build-android": {
"implementation": "./src/executors/build-android/compat",
"schema": "./src/executors/build-android/schema.json",
"description": "Build and sign a standalone APK or App Bundle for the Google Play Store"
},
"build-web": {
"implementation": "./src/executors/build-web/compat",
"schema": "./src/executors/build-web/schema.json",
"description": "Build the web app for production"
},
"build-status": {
"implementation": "./src/executors/build-status/compat",
"schema": "./src/executors/build-status/schema.json",
"description": "Get the status of the latest build for the project"
},
"publish": {
"implementation": "./src/executors/publish/compat",
"schema": "./src/executors/publish/schema.json",
"description": "Deploy a project to Expo hosting"
},
"publish-set": {
"implementation": "./src/executors/publish-set/compat",
"schema": "./src/executors/publish-set/schema.json",
"description": "Specify the channel to serve a published release"
},
"rollback": {
"implementation": "./src/executors/rollback/compat",
"schema": "./src/executors/rollback/schema.json",
"description": "Undo an update to a channel"
},
"run": {
"implementation": "./src/executors/run/compat",
"schema": "./src/executors/run/schema.json",

View File

@ -41,6 +41,12 @@
"cli": "nx",
"description": "Change webpack to metro in expo projects",
"factory": "./src/migrations/update-15-8-3/change-webpack-to-metro"
},
"remove-deprecated-expo-targets": {
"version": "16.0.0-beta.0",
"cli": "nx",
"description": "Remove deprecated expo targets",
"factory": "./src/migrations/update-16-0-0/remove-deprecated-targets"
}
},
"packageJsonUpdates": {

View File

@ -1,97 +0,0 @@
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
import { ExpoBuildAndroidOptions } from './schema';
import {
displayNewlyAddedDepsMessage,
syncDeps,
} from '../sync-deps/sync-deps.impl';
export interface ReactNativeBuildOutput {
success: boolean;
}
let childProcess: ChildProcess;
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.projectsConfigurations.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);
if (options.sync) {
displayNewlyAddedDepsMessage(
context.projectName,
await syncDeps(
context.projectName,
projectRoot,
context.root,
context.projectGraph
)
);
}
try {
await runCliBuild(context.root, projectRoot, options);
yield { success: true };
} finally {
if (childProcess) {
childProcess.kill();
}
}
}
function runCliBuild(
workspaceRoot: string,
projectRoot: string,
options: ExpoBuildAndroidOptions
) {
return new Promise((resolve, reject) => {
childProcess = fork(
join(workspaceRoot, './node_modules/expo-cli/bin/expo.js'),
['build:android', ...createRunOptions(options)],
{ cwd: join(workspaceRoot, projectRoot), env: process.env }
);
// Ensure the child process is killed when the parent exits
process.on('exit', () => childProcess.kill());
process.on('SIGTERM', () => childProcess.kill());
childProcess.on('error', (err) => {
reject(err);
});
childProcess.on('exit', (code) => {
if (code === 0) {
resolve(code);
} else {
reject(code);
}
});
});
}
const nxOptions = ['sync'];
function createRunOptions(options: ExpoBuildAndroidOptions) {
return Object.keys(options).reduce((acc, k) => {
const v = options[k];
if (!nxOptions.includes(k)) {
if (typeof v === 'boolean') {
if (v === true) {
// when true, does not need to pass the value true, just need to pass the flag in kebob case
acc.push(`--${names(k).fileName}`);
}
} else {
acc.push(`--${names(k).fileName}`, v);
}
}
return acc;
}, []);
}

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nrwl/devkit';
import buildAndroidExecutor from './build-android.impl';
export default convertNxExecutor(buildAndroidExecutor);

View File

@ -1,13 +0,0 @@
// options from https://docs.expo.dev/workflow/expo-cli/#expo-buildandroid
export interface ExpoBuildAndroidOptions {
clearCredentials?: boolean;
type?: 'app-bundle' | 'apk';
releaseChannel?: string;
noPublish?: boolean;
noWait?: boolean;
keystorePath?: string;
keystoreAlias?: string;
publicUrl?: string;
skipWorkflowCheck?: boolean;
sync: boolean; // default is true
}

View File

@ -1,58 +0,0 @@
{
"version": 2,
"outputCapture": "direct-nodejs",
"$schema": "http://json-schema.org/schema",
"$id": "NxExpoBuildAndroid",
"cli": "nx",
"title": "Expo Android Build executor",
"description": "Build and sign a standalone APK or App Bundle for the Google Play Store.",
"type": "object",
"properties": {
"clearCredentials": {
"type": "boolean",
"description": "Clear all credentials stored on Expo servers.",
"alias": "c"
},
"type": {
"enum": ["app-bundle", "apk"],
"description": "Type of build: [app-bundle⎮apk].",
"alias": "t",
"x-priority": "important"
},
"releaseChannel": {
"type": "string",
"description": "Pull from specified release channel."
},
"noPublish": {
"type": "boolean",
"description": "Disable automatic publishing before building."
},
"noWait": {
"type": "boolean",
"description": "Exit immediately after scheduling build."
},
"keystorePath": {
"type": "string",
"description": "Path to your Keystore: *.jks."
},
"keystoreAlias": {
"type": "string",
"description": "Keystore Alias"
},
"publicUrl": {
"type": "string",
"description": "The URL of an externally hosted manifest (for self-hosted apps)."
},
"skipWorkflowCheck": {
"type": "boolean",
"description": "Skip warning about build service bare workflow limitations."
},
"sync": {
"type": "boolean",
"description": "Syncs npm dependencies to package.json (for React Native autolink).",
"default": true,
"x-priority": "internal"
}
},
"required": []
}

View File

@ -1,97 +0,0 @@
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
import {
displayNewlyAddedDepsMessage,
syncDeps,
} from '../sync-deps/sync-deps.impl';
import { ExpoBuildIOSOptions } from './schema';
export interface ExpoRunOutput {
success: boolean;
}
let childProcess: ChildProcess;
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.projectsConfigurations.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);
if (options.sync) {
displayNewlyAddedDepsMessage(
context.projectName,
await syncDeps(
context.projectName,
projectRoot,
context.root,
context.projectGraph
)
);
}
try {
await runCliBuildIOS(context.root, projectRoot, options);
yield { success: true };
} finally {
if (childProcess) {
childProcess.kill();
}
}
}
function runCliBuildIOS(
workspaceRoot: string,
projectRoot: string,
options: ExpoBuildIOSOptions
) {
return new Promise((resolve, reject) => {
childProcess = fork(
join(workspaceRoot, './node_modules/expo-cli/bin/expo.js'),
['build:ios', ...createRunOptions(options)],
{ cwd: join(workspaceRoot, projectRoot), env: process.env }
);
// Ensure the child process is killed when the parent exits
process.on('exit', () => childProcess.kill());
process.on('SIGTERM', () => childProcess.kill());
childProcess.on('error', (err) => {
reject(err);
});
childProcess.on('exit', (code) => {
if (code === 0) {
resolve(code);
} else {
reject(code);
}
});
});
}
const nxOptions = ['sync'];
function createRunOptions(options: ExpoBuildIOSOptions) {
return Object.keys(options).reduce((acc, k) => {
const v = options[k];
if (!nxOptions.includes(k)) {
if (typeof v === 'boolean') {
if (v === true) {
// when true, does not need to pass the value true, just need to pass the flag in kebob case
acc.push(`--${names(k).fileName}`);
}
} else {
acc.push(`--${names(k).fileName}`, v);
}
}
return acc;
}, []);
}

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nrwl/devkit';
import buildIosExecutor from './build-ios.impl';
export default convertNxExecutor(buildIosExecutor);

View File

@ -1,23 +0,0 @@
// options from https://docs.expo.dev/workflow/expo-cli/#expo-buildios
export interface ExpoBuildIOSOptions {
clearCredentials?: boolean;
clearDistCert?: boolean;
clearPushKey?: boolean;
clearnPushCert?: boolean;
clearProvisioningProfile?: boolean;
revokeCredentials?: boolean;
appleId?: string;
type: 'archive' | 'simulator';
releaseChannel?: string;
noPublish?: boolean;
noWait?: boolean;
teamId?: string;
dishP12Path?: string;
pushId?: string;
pushP8Path?: string;
provisioningProfile?: string;
publicUrl?: string;
skipCredentialsCheck?: boolean;
skipWorkflowCheck?: boolean;
sync: boolean; // default is true
}

View File

@ -1,95 +0,0 @@
{
"version": 2,
"outputCapture": "direct-nodejs",
"$schema": "http://json-schema.org/schema",
"$id": "NxExpoBuildIOS",
"cli": "nx",
"title": "Expo iOS Build executor",
"description": "Build and sign a standalone IPA for the Apple App Store.",
"type": "object",
"properties": {
"clearCredentials": {
"type": "boolean",
"description": "Clear all credentials stored on Expo servers.",
"alias": "c"
},
"clearDistCert": {
"type": "boolean",
"description": "Remove Distribution Certificate stored on Expo servers."
},
"clearPushKey": {
"type": "boolean",
"description": "Remove Push Notifications Key stored on Expo servers."
},
"clearPushCert": {
"type": "boolean",
"description": "Remove Push Notifications Certificate stored on Expo servers. Use of Push Notifications Certificates is deprecated."
},
"clearProvisioningProfile": {
"type": "boolean",
"description": "Remove Provisioning Profile stored on Expo servers."
},
"revokeCredentials": {
"type": "boolean",
"description": "Revoke credentials on developer.apple.com, select appropriate using --clear-* options.",
"alias": "r"
},
"appleId": {
"type": "string",
"description": "Apple ID username (please also set the Apple ID password as EXPO_APPLE_PASSWORD environment variable)."
},
"type": {
"enum": ["archive", "simulator"],
"description": "Type of build: [archive⎮simulator].",
"alias": "t",
"x-priority": "important"
},
"releaseChannel": {
"type": "string",
"description": "Pull from specified release channel."
},
"noPublish": {
"type": "boolean",
"description": "Disable automatic publishing before building."
},
"noWait": {
"type": "boolean",
"description": "Exit immediately after scheduling build."
},
"teamId": {
"type": "string",
"description": "Apple Team ID."
},
"distP12Path": {
"type": "string",
"description": "Path to your Distribution Certificate P12 (set password as EXPO_IOS_DIST_P12_PASSWORD environment variable)."
},
"pushP8Path": {
"type": "string",
"description": "Path to your Push Key .p8 file."
},
"provisioningProfilePath": {
"type": "string",
"description": "Path to your Provisioning Profile."
},
"publicUrl": {
"type": "string",
"description": "The URL of an externally hosted manifest (for self-hosted apps)."
},
"skipCredentialsCheck": {
"type": "boolean",
"description": "Skip checking credentials."
},
"skipWorkflowCheck": {
"type": "boolean",
"description": "Skip warning about build service bare workflow limitations."
},
"sync": {
"type": "boolean",
"description": "Syncs npm dependencies to package.json (for React Native autolink).",
"default": true,
"x-priority": "internal"
}
},
"required": []
}

View File

@ -1,79 +0,0 @@
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
import { ExpoBuildStatusOptions } from './schema';
export interface ReactNativeBuildOutput {
success: boolean;
}
let childProcess: ChildProcess;
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.projectsConfigurations.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);
try {
await runCliBuild(context.root, projectRoot, options);
yield { success: true };
} finally {
if (childProcess) {
childProcess.kill();
}
}
}
function runCliBuild(
workspaceRoot: string,
projectRoot: string,
options: ExpoBuildStatusOptions
) {
return new Promise((resolve, reject) => {
childProcess = fork(
join(workspaceRoot, './node_modules/expo-cli/bin/expo.js'),
['build:status', ...createRunOptions(options)],
{ cwd: join(workspaceRoot, projectRoot), env: process.env }
);
// Ensure the child process is killed when the parent exits
process.on('exit', () => childProcess.kill());
process.on('SIGTERM', () => childProcess.kill());
childProcess.on('error', (err) => {
reject(err);
});
childProcess.on('exit', (code) => {
if (code === 0) {
resolve(code);
} else {
reject(code);
}
});
});
}
function createRunOptions(options) {
return Object.keys(options).reduce((acc, k) => {
const v = options[k];
if (typeof v === 'boolean') {
if (v === true) {
// when true, does not need to pass the value true, just need to pass the flag in kebob case
acc.push(`--${names(k).fileName}`);
}
} else {
acc.push(`--${names(k).fileName}`, v);
}
return acc;
}, []);
}

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nrwl/devkit';
import buildStatusExecutor from './build-status.impl';
export default convertNxExecutor(buildStatusExecutor);

View File

@ -1,4 +0,0 @@
// options from https://docs.expo.dev/workflow/expo-cli/#expo-buildweb
export interface ExpoBuildStatusOptions {
publicUrl: string;
}

View File

@ -1,17 +0,0 @@
{
"version": 2,
"outputCapture": "direct-nodejs",
"$schema": "http://json-schema.org/schema",
"$id": "NxExpoBuildStatus",
"cli": "nx",
"title": "Expo web Build executor",
"description": "Get the status of the latest build for the project.",
"type": "object",
"properties": {
"publicUrl": {
"type": "string",
"description": "The URL of an externally hosted manifest (for self-hosted apps)."
}
},
"required": []
}

View File

@ -1,79 +0,0 @@
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
import { ExpoBuildWebOptions } from './schema';
export interface ReactNativeBuildOutput {
success: boolean;
}
let childProcess: ChildProcess;
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-web.'
);
const projectRoot =
context.projectsConfigurations.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);
try {
await runCliBuild(context.root, projectRoot, options);
yield { success: true };
} finally {
if (childProcess) {
childProcess.kill();
}
}
}
function runCliBuild(
workspaceRoot: string,
projectRoot: string,
options: ExpoBuildWebOptions
) {
return new Promise((resolve, reject) => {
childProcess = fork(
join(workspaceRoot, './node_modules/expo-cli/bin/expo.js'),
['build:web', ...createRunOptions(options)],
{ cwd: join(workspaceRoot, projectRoot), env: process.env }
);
// Ensure the child process is killed when the parent exits
process.on('exit', () => childProcess.kill());
process.on('SIGTERM', () => childProcess.kill());
childProcess.on('error', (err) => {
reject(err);
});
childProcess.on('exit', (code) => {
if (code === 0) {
resolve(code);
} else {
reject(code);
}
});
});
}
function createRunOptions(options) {
return Object.keys(options).reduce((acc, k) => {
const v = options[k];
if (typeof v === 'boolean') {
if (v === true) {
// when true, does not need to pass the value true, just need to pass the flag in kebob case
acc.push(`--${names(k).fileName}`);
}
} else {
acc.push(`--${names(k).fileName}`, v);
}
return acc;
}, []);
}

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nrwl/devkit';
import buildWebExecutor from './build-web.impl';
export default convertNxExecutor(buildWebExecutor);

View File

@ -1,6 +0,0 @@
// options from https://docs.expo.dev/workflow/expo-cli/#expo-buildweb
export interface ExpoBuildWebOptions {
clear?: boolean;
noPwa?: boolean;
dev?: boolean;
}

View File

@ -1,26 +0,0 @@
{
"version": 2,
"outputCapture": "direct-nodejs",
"$schema": "http://json-schema.org/schema",
"$id": "NxExpoBuildWeb",
"cli": "nx",
"title": "Expo web Build executor",
"description": "Build the web app for production.",
"type": "object",
"properties": {
"clear": {
"type": "boolean",
"description": "Clear all cached build files and assets.",
"alias": "c"
},
"noPwa": {
"type": "boolean",
"description": "Prevent webpack from generating the manifest.json and injecting meta into the index.html head."
},
"dev": {
"type": "boolean",
"description": "Turns dev flag on before bundling"
}
},
"required": []
}

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nrwl/devkit';
import publishSetExecutor from './publish-set.impl';
export default convertNxExecutor(publishSetExecutor);

View File

@ -1,81 +0,0 @@
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
import { ExpoPublishSetOptions } from './schema';
export interface ExpoPublishSetOutput {
success: boolean;
}
let childProcess: ChildProcess;
export default async function* publishSetExecutor(
options: ExpoPublishSetOptions,
context: ExecutorContext
): AsyncGenerator<ExpoPublishSetOutput> {
logger.warn(
'@nrwl/expo:publish-set is deprecated and will be removed in Nx 16.'
);
const projectRoot =
context.projectsConfigurations.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);
try {
await runCliPublishSet(context.root, projectRoot, options);
yield { success: true };
} finally {
if (childProcess) {
childProcess.kill();
}
}
}
function runCliPublishSet(
workspaceRoot: string,
projectRoot: string,
options: ExpoPublishSetOptions
) {
return new Promise((resolve, reject) => {
childProcess = fork(
join(workspaceRoot, './node_modules/expo-cli/bin/expo.js'),
['publish:set', ...createPublishSetOptions(options)],
{
cwd: projectRoot,
}
);
// Ensure the child process is killed when the parent exits
process.on('exit', () => childProcess.kill());
process.on('SIGTERM', () => childProcess.kill());
childProcess.on('error', (err) => {
reject(err);
});
childProcess.on('exit', (code) => {
if (code === 0) {
resolve(code);
} else {
reject(code);
}
});
});
}
function createPublishSetOptions(options: ExpoPublishSetOptions) {
return Object.keys(options).reduce((acc, k) => {
const v = options[k];
if (typeof v === 'boolean') {
if (v === true) {
// when true, does not need to pass the value true, just need to pass the flag in kebob case
acc.push(`--${names(k).fileName}`);
}
} else {
acc.push(`--${names(k).fileName}`, v);
}
return acc;
}, []);
}

View File

@ -1,6 +0,0 @@
// options from https://docs.expo.dev/workflow/expo-cli/#expo-publishrollback
export interface ExpoPublishSetOptions {
releaseChannel: string;
sdkVersion: string;
platform?: 'ios' | 'android';
}

View File

@ -1,21 +0,0 @@
{
"version": 2,
"outputCapture": "direct-nodejs",
"cli": "nx",
"$id": "NxExpoPublishSet",
"$schema": "http://json-schema.org/schema",
"title": "Set Publish Channel for Expo",
"description": "Specify the channel to serve a published release.",
"type": "object",
"properties": {
"releaseChannel": {
"type": "string",
"description": "The release channel to publish to."
},
"publishId": {
"type": "string",
"description": "The id of the published release to serve from the channel."
}
},
"required": ["releaseChannel", "publishId"]
}

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nrwl/devkit';
import publishExecutor from './publish.impl';
export default convertNxExecutor(publishExecutor);

View File

@ -1,102 +0,0 @@
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
import {
displayNewlyAddedDepsMessage,
syncDeps,
} from '../sync-deps/sync-deps.impl';
import { ExpoPublishOptions } from './schema';
export interface ExpoPublishOutput {
success: boolean;
}
let childProcess: ChildProcess;
export default async function* publishExecutor(
options: ExpoPublishOptions,
context: ExecutorContext
): AsyncGenerator<ExpoPublishOutput> {
logger.warn('@nrwl/expo:publish is deprecated and will be removed in Nx 16.');
const projectRoot =
context.projectsConfigurations.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);
if (options.sync) {
displayNewlyAddedDepsMessage(
context.projectName,
await syncDeps(
context.projectName,
projectRoot,
context.root,
context.projectGraph
)
);
}
try {
await runCliPublish(context.root, projectRoot, options);
yield { success: true };
} finally {
if (childProcess) {
childProcess.kill();
}
}
}
function runCliPublish(
workspaceRoot: string,
projectRoot: string,
options: ExpoPublishOptions
) {
return new Promise((resolve, reject) => {
childProcess = fork(
join(workspaceRoot, './node_modules/expo-cli/bin/expo.js'),
[
'publish',
join(workspaceRoot, projectRoot),
...createPublishOptions(options),
],
{
cwd: projectRoot,
}
);
// Ensure the child process is killed when the parent exits
process.on('exit', () => childProcess.kill());
process.on('SIGTERM', () => childProcess.kill());
childProcess.on('error', (err) => {
reject(err);
});
childProcess.on('exit', (code) => {
if (code === 0) {
resolve(code);
} else {
reject(code);
}
});
});
}
const nxOptions = ['sync'];
function createPublishOptions(options: ExpoPublishOptions) {
return Object.keys(options).reduce((acc, k) => {
const v = options[k];
if (!nxOptions.includes(k)) {
if (typeof v === 'boolean') {
if (v === true) {
// when true, does not need to pass the value true, just need to pass the flag in kebob case
acc.push(`--${names(k).fileName}`);
}
} else {
acc.push(`--${names(k).fileName}`, v);
}
}
return acc;
}, []);
}

View File

@ -1,10 +0,0 @@
// options from https://docs.expo.dev/workflow/expo-cli/#expo-publish
export interface ExpoPublishOptions {
quiet: boolean; // default is false
sendTo?: string;
clear: boolean; // default is false
target: 'managed' | 'bare';
maxWorkers?: number;
releaseChannel: string; // default is 'default'
sync: boolean; // default is true
}

View File

@ -1,45 +0,0 @@
{
"version": 2,
"outputCapture": "direct-nodejs",
"cli": "nx",
"$id": "NxExpoPublish",
"$schema": "http://json-schema.org/schema",
"title": "Publish for Expo",
"description": "Deploy a project to Expo hosting.",
"type": "object",
"properties": {
"quiet": {
"type": "boolean",
"description": "Suppress verbose output from the Metro bundler",
"default": false,
"alias": "q"
},
"sendTo": {
"type": "string",
"description": "A phone number or email address to send a link to",
"alias": "s"
},
"clear": {
"type": "boolean",
"description": "Clear the Metro bundler cache",
"default": false,
"alias": "c"
},
"target": {
"enum": ["managed", "bare"],
"default": "managed",
"description": "Target environment for which this publish is intended. Options are managed or bare.",
"alias": "t",
"x-priority": "important"
},
"maxWorkers": {
"type": "number",
"description": "Maximum number of tasks to allow Metro to spawn"
},
"releaseChannel": {
"type": "string",
"description": "The release channel to publish to. Default is 'default'.",
"default": "default"
}
}
}

View File

@ -1,5 +0,0 @@
import { convertNxExecutor } from '@nrwl/devkit';
import rollbackExecutor from './rollback.impl';
export default convertNxExecutor(rollbackExecutor);

View File

@ -1,81 +0,0 @@
import { ExecutorContext, logger, names } from '@nrwl/devkit';
import { join } from 'path';
import { ChildProcess, fork } from 'child_process';
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
import { ExpoRollbackOptions } from './schema';
export interface ExpoRollbackOutput {
success: boolean;
}
let childProcess: ChildProcess;
export default async function* rollbackExecutor(
options: ExpoRollbackOptions,
context: ExecutorContext
): AsyncGenerator<ExpoRollbackOutput> {
logger.warn(
'@nrwl/expo:rollback is deprecated and will be removed in Nx 16.'
);
const projectRoot =
context.projectsConfigurations.projects[context.projectName].root;
ensureNodeModulesSymlink(context.root, projectRoot);
try {
await runCliRollback(context.root, projectRoot, options);
yield { success: true };
} finally {
if (childProcess) {
childProcess.kill();
}
}
}
function runCliRollback(
workspaceRoot: string,
projectRoot: string,
options: ExpoRollbackOptions
) {
return new Promise((resolve, reject) => {
childProcess = fork(
join(workspaceRoot, './node_modules/expo-cli/bin/expo.js'),
['publish:rollback', ...createRollbackOptions(options)],
{
cwd: projectRoot,
}
);
// Ensure the child process is killed when the parent exits
process.on('exit', () => childProcess.kill());
process.on('SIGTERM', () => childProcess.kill());
childProcess.on('error', (err) => {
reject(err);
});
childProcess.on('exit', (code) => {
if (code === 0) {
resolve(code);
} else {
reject(code);
}
});
});
}
function createRollbackOptions(options: ExpoRollbackOptions) {
return Object.keys(options).reduce((acc, k) => {
const v = options[k];
if (typeof v === 'boolean') {
if (v === true) {
// when true, does not need to pass the value true, just need to pass the flag in kebob case
acc.push(`--${names(k).fileName}`);
}
} else {
acc.push(`--${names(k).fileName}`, v);
}
return acc;
}, []);
}

View File

@ -1,6 +0,0 @@
// options from https://docs.expo.dev/workflow/expo-cli/#expo-publishrollback
export interface ExpoRollbackOptions {
releaseChannel: string;
sdkVersion: string;
platform?: 'ios' | 'android';
}

View File

@ -1,25 +0,0 @@
{
"version": 2,
"outputCapture": "direct-nodejs",
"cli": "nx",
"$id": "NxExpoRollback",
"$schema": "http://json-schema.org/schema",
"title": "Rollback Publish Command for Expo",
"description": "Undo an update to a channel.",
"type": "object",
"properties": {
"releaseChannel": {
"type": "string",
"description": "The release channel to publish to."
},
"sdkVersion": {
"type": "string",
"description": "The sdk version to rollback."
},
"platform": {
"enum": ["ios", "android"],
"description": "The platform to rollback."
}
},
"required": ["releaseChannel", "sdkVersion"]
}

View File

@ -19,12 +19,4 @@ export interface ExpoStartOptions {
localhost?: boolean;
tunnel?: boolean;
offline?: boolean;
/**
* @deprecated
*/
sendTo?: string; // deprecated from @expo/cli
/**
* @deprecated
*/
webpack?: boolean; // deprecated from @expo/cli
}

View File

@ -87,17 +87,6 @@
"offline": {
"type": "boolean",
"description": "Allows this command to run while offline"
},
"sentTo": {
"type": "string",
"description": "An email address to send a link to",
"alias": "s",
"x-deprecated": "This option will be removed in v16. It is no longer supported by @expo/cli."
},
"webpack": {
"type": "boolean",
"description": "Start a Webpack dev server for the web app.",
"x-deprecated": "This option will be removed in v16. It is no longer supported by @expo/cli."
}
},
"examplesFile": "../../../docs/start-examples.md"

View File

@ -72,30 +72,6 @@ function getTargets(options: NormalizedSchema) {
},
};
// @deprecated, no longer supported in @expo/cli
architect['build-ios'] = {
executor: '@nrwl/expo:build-ios',
options: {},
};
// @deprecated, no longer supported in @expo/cli
architect['build-android'] = {
executor: '@nrwl/expo:build-android',
options: {},
};
// @deprecated, no longer supported in @expo/cli
architect['build-web'] = {
executor: '@nrwl/expo:build-web',
options: {},
};
// @deprecated, no longer supported in @expo/cli
architect['build-status'] = {
executor: '@nrwl/expo:build-web',
options: {},
};
architect['sync-deps'] = {
executor: '@nrwl/expo:sync-deps',
options: {},
@ -106,37 +82,11 @@ function getTargets(options: NormalizedSchema) {
options: {},
};
// @deprecated, no longer supported in @expo/cli
architect['publish'] = {
executor: '@nrwl/expo:publish',
options: {},
};
// @deprecated, no longer supported in @expo/cli
architect['publish-set'] = {
executor: '@nrwl/expo:publish-set',
options: {},
};
// @deprecated, no longer supported in @expo/cli
architect['rollback'] = {
executor: '@nrwl/expo:rollback',
options: {},
};
architect['prebuild'] = {
executor: '@nrwl/expo:prebuild',
options: {},
};
// @deprecated, no longer supported in @expo/cli
architect['eject'] = {
executor: 'nx:run-commands',
options: {
command: `nx prebuild ${options.name}`,
},
};
architect['install'] = {
executor: '@nrwl/expo:install',
options: {},

View File

@ -10,7 +10,6 @@ import {
import { Schema } from './schema';
import {
babelPresetExpoVersion,
deprecatedExpoCliVersion,
easCliVersion,
expoCliVersion,
expoMetroConfigVersion,
@ -101,7 +100,6 @@ export function updateDependencies(host: Tree) {
'react-test-renderer': reactTestRendererVersion,
'@testing-library/react-native': testingLibraryReactNativeVersion,
'@testing-library/jest-native': testingLibraryJestNativeVersion,
'expo-cli': deprecatedExpoCliVersion,
'@expo/cli': expoCliVersion,
'eas-cli': easCliVersion,
'babel-preset-expo': babelPresetExpoVersion,

View File

@ -11,7 +11,6 @@ import {
* - change target export-web
* - delete webpack.config.js
* - delete @expo/webpack-config dependency
* - add target update
*/
export default async function update(tree: Tree) {
const projects = getProjects(tree);

View File

@ -0,0 +1,37 @@
import {
Tree,
formatFiles,
getProjects,
updateProjectConfiguration,
} from '@nrwl/devkit';
/**
* Remove deprecated @expo/cli targets
*/
export default async function update(tree: Tree) {
const projects = getProjects(tree);
for (const [name, config] of projects.entries()) {
if (config.targets?.['start']?.executor === '@nrwl/expo:start') {
const targetsToDelete = [
'build-ios',
'build-android',
'build-web',
'build-status',
'publish',
'publish-set',
'rollback',
'eject',
];
targetsToDelete.forEach((target) => {
if (config.targets[target]) {
delete config.targets[target];
}
});
}
updateProjectConfiguration(tree, name, config);
}
await formatFiles(tree);
}

View File

@ -4,7 +4,6 @@ export const expoVersion = '48.0.6';
export const expoMetroConfigVersion = '0.7.1';
export const expoSplashScreenVersion = '~0.18.1';
export const expoStatusBarVersion = '~1.4.4';
export const deprecatedExpoCliVersion = '6.3.2'; // expo-cli
export const expoCliVersion = '0.6.2'; // @expo/cli
export const easCliVersion = '3.7.2';
export const babelPresetExpoVersion = '~9.3.0';