Skip to content

Commit

Permalink
feat(expo): add submit executor (#17372)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi authored Jun 5, 2023
1 parent 2d76993 commit 1bc7965
Show file tree
Hide file tree
Showing 38 changed files with 484 additions and 46 deletions.
8 changes: 8 additions & 0 deletions docs/generated/manifests/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -4808,6 +4808,14 @@
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "submit",
"path": "/packages/expo/executors/submit",
"name": "submit",
"children": [],
"isExternal": false,
"disableCollapsible": false
}
],
"isExternal": false,
Expand Down
9 changes: 9 additions & 0 deletions docs/generated/manifests/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,15 @@
"originalFilePath": "/packages/expo/src/executors/export/schema.json",
"path": "/packages/expo/executors/export",
"type": "executor"
},
"/packages/expo/executors/submit": {
"description": "Submit app binary to App Store and/or Play Store",
"file": "generated/packages/expo/executors/submit.json",
"hidden": false,
"name": "submit",
"originalFilePath": "/packages/expo/src/executors/submit/schema.json",
"path": "/packages/expo/executors/submit",
"type": "executor"
}
},
"generators": {
Expand Down
9 changes: 9 additions & 0 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,15 @@
"originalFilePath": "/packages/expo/src/executors/export/schema.json",
"path": "expo/executors/export",
"type": "executor"
},
{
"description": "Submit app binary to App Store and/or Play Store",
"file": "generated/packages/expo/executors/submit.json",
"hidden": false,
"name": "submit",
"originalFilePath": "/packages/expo/src/executors/submit/schema.json",
"path": "expo/executors/submit",
"type": "executor"
}
],
"generators": [
Expand Down
15 changes: 10 additions & 5 deletions docs/generated/packages/expo/executors/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"title": "Expo EAS Build executor",
"description": "Start an EAS build for your expo project.",
"type": "object",
"presets": [
{ "name": "Build for a specific platform", "keys": ["platform"] },
{ "name": "Build using a specific profile", "keys": ["profile"] },
{ "name": "Run build locally", "keys": ["local"] },
{ "name": "Clear cache before the build", "keys": ["clearCache"] }
],
"properties": {
"platform": {
"enum": ["ios", "android", "all"],
Expand All @@ -28,10 +34,10 @@
"examples": ["production", "development", "preview"],
"x-priority": "important"
},
"nonInteractive": {
"interactive": {
"type": "boolean",
"description": "Run command in non-interactive mode",
"default": false
"description": "Run command in interactive mode",
"default": true
},
"local": {
"type": "boolean",
Expand Down Expand Up @@ -63,8 +69,7 @@
"examples": ["production", "development", "preview"]
}
},
"required": [],
"presets": []
"required": []
},
"description": "Start an EAS build for your expo project",
"aliases": [],
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/expo/executors/prebuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"install": {
"type": "boolean",
"description": "Installing npm packages and CocoaPods.",
"default": false,
"default": true,
"x-priority": "internal"
},
"platform": {
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/expo/executors/run.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"install": {
"type": "boolean",
"description": "Should install missing dependencies before building.",
"description": "Installing npm packages and CocoaPods before building.",
"default": true
},
"buildCache": {
Expand Down
5 changes: 5 additions & 0 deletions docs/generated/packages/expo/executors/start.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
"offline": {
"type": "boolean",
"description": "Allows this command to run while offline"
},
"sync": {
"type": "boolean",
"description": "Syncs npm dependencies to package.json (for React Native autolink).",
"default": true
}
},
"examplesFile": "`project.json`:\n\n```json\n{\n \"name\": \"mobile\",\n //...\n \"targets\": {\n //...\n \"start\": {\n \"executor\": \"@nx/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\": \"@nx/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\": \"@nx/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\": \"@nx/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\": \"@nx/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\": \"@nx/expo:start\",\n \"options\": {\n \"port\": 8081,\n \"clear\": true\n }\n }\n```\n\n{% /tab %}\n{% /tabs %}\n\n---\n",
Expand Down
57 changes: 57 additions & 0 deletions docs/generated/packages/expo/executors/submit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "submit",
"implementation": "/packages/expo/src/executors/submit/submit.impl.ts",
"schema": {
"$schema": "http://json-schema.org/schema",
"version": 2,
"title": "EXPO EAS Submit Executor",
"description": "Submit app binary to App Store and/or Play Store.",
"type": "object",
"presets": [
{ "name": "Submit for a specific platform", "keys": ["platform"] },
{ "name": "Submit using a specific profile", "keys": ["profile"] }
],
"properties": {
"profile": {
"type": "string",
"description": "Name of the build profile from eas.json. Defaults to \"production\" if defined in eas.json.",
"examples": ["production", "development", "preview"],
"x-priority": "important"
},
"platform": {
"enum": ["ios", "android", "all"],
"alias": "p",
"description": "The platform to build the app, example values: ios, android, all.",
"x-priority": "important"
},
"id": { "type": "string", "description": "Build ID to submit" },
"path": {
"type": "string",
"description": "Path to the .apk/.aab/.ipa file"
},
"url": {
"type": "string",
"description": "URL to the .apk/.aab/.ipa file, app archive url"
},
"latest": {
"type": "boolean",
"description": "Submit the latest build for specified platform"
},
"interactive": {
"type": "boolean",
"description": "Run command in interactive mode",
"default": true
},
"wait": {
"type": "boolean",
"description": "Wait for build(s) to complete",
"default": true
}
}
},
"description": "Submit app binary to App Store and/or Play Store",
"aliases": [],
"hidden": false,
"path": "/packages/expo/src/executors/submit/schema.json",
"type": "executor"
}
13 changes: 8 additions & 5 deletions docs/generated/packages/expo/executors/update.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"title": "Expo EAS Update executor",
"description": "Start an EAS update for your expo project.",
"type": "object",
"presets": [
{ "name": "Update for a specific platform", "keys": ["platform"] },
{ "name": "Update from a specific branch", "keys": ["branch"] }
],
"properties": {
"branch": {
"type": "string",
Expand Down Expand Up @@ -52,14 +56,13 @@
"type": "string",
"description": "File containing the PEM-encoded private key corresponding to the certificate in expo-updates' configuration. Defaults to a file named \"private-key.pem\" in the certificate's directory."
},
"nonInteractive": {
"interactive": {
"type": "boolean",
"description": "Run command in non-interactive mode",
"default": false
"description": "Run command in interactive mode",
"default": true
}
},
"required": [],
"presets": []
"required": []
},
"description": "Start an EAS update for your expo project",
"aliases": [],
Expand Down
10 changes: 10 additions & 0 deletions packages/expo/executors.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
"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"
},
"submit": {
"implementation": "./src/executors/submit/submit.impl",
"schema": "./src/executors/submit/schema.json",
"description": "Submit app binary to App Store and/or Play Store"
}
},
"builders": {
Expand Down Expand Up @@ -111,6 +116,11 @@
"implementation": "./src/executors/export/compat",
"schema": "./src/executors/export/schema.json",
"description": "Export the JavaScript and assets for your app using Metro/webpack bundler"
},
"submit": {
"implementation": "./src/executors/submit/compat",
"schema": "./src/executors/submit/schema.json",
"description": "Submit app binary to App Store and/or Play Store"
}
}
}
21 changes: 21 additions & 0 deletions packages/expo/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,27 @@
"alwaysAddToPackageJson": false
}
}
},
"16.2.2": {
"version": "16.2.2-beta.0",
"packages": {
"expo": {
"version": "^48.0.17",
"alwaysAddToPackageJson": false
},
"eas-cli": {
"version": "~3.13.2",
"alwaysAddToPackageJson": false
},
"react-native": {
"version": "0.71.8",
"alwaysAddToPackageJson": false
},
"@types/react-native": {
"version": "0.71.7",
"alwaysAddToPackageJson": false
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@nx/webpack": "file:../webpack"
},
"peerDependencies": {
"expo": "^48.0.16"
"expo": "^48.0.17"
},
"builders": "./executors.json",
"ng-update": {
Expand Down
5 changes: 5 additions & 0 deletions packages/expo/src/executors/build/build.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ function createBuildOptions(options: ExpoEasBuildOptions) {
return Object.keys(options).reduce((acc, k) => {
const v = options[k];
if (typeof v === 'boolean') {
if (k === 'interactive') {
if (v === false) {
acc.push('--non-interactive'); // when is false, the flag is --non-interactive
}
}
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}`);
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/src/executors/build/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export interface ExpoEasBuildOptions {
platform: 'ios' | 'android' | 'all';
profile?: string;
nonInteractive: boolean; // default is false
interactive: boolean; // default is true
local: boolean; // default is false
output?: string;
wait: boolean; // default is true
Expand Down
24 changes: 21 additions & 3 deletions packages/expo/src/executors/build/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@
"title": "Expo EAS Build executor",
"description": "Start an EAS build for your expo project.",
"type": "object",
"presets": [
{
"name": "Build for a specific platform",
"keys": ["platform"]
},
{
"name": "Build using a specific profile",
"keys": ["profile"]
},
{
"name": "Run build locally",
"keys": ["local"]
},
{
"name": "Clear cache before the build",
"keys": ["clearCache"]
}
],
"properties": {
"platform": {
"enum": ["ios", "android", "all"],
Expand All @@ -25,10 +43,10 @@
"examples": ["production", "development", "preview"],
"x-priority": "important"
},
"nonInteractive": {
"interactive": {
"type": "boolean",
"description": "Run command in non-interactive mode",
"default": false
"description": "Run command in interactive mode",
"default": true
},
"local": {
"type": "boolean",
Expand Down
4 changes: 1 addition & 3 deletions packages/expo/src/executors/prebuild/prebuild.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ export default async function* prebuildExecutor(
await prebuildAsync(context.root, projectRoot, options);

if (options.install) {
await installAsync(context.root, { fix: true });
await installAsync(context.root, {});
if (options.platform === 'ios') {
await podInstall(join(context.root, projectRoot, 'ios'));
}
} else {
await installAsync(context.root, {});
}

yield {
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/src/executors/prebuild/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"install": {
"type": "boolean",
"description": "Installing npm packages and CocoaPods.",
"default": false,
"default": true,
"x-priority": "internal"
},
"platform": {
Expand Down
9 changes: 2 additions & 7 deletions packages/expo/src/executors/run/run.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,12 @@ export default async function* runExecutor(
clean: options.clean,
});
}

if (options.install) {
await installAsync(context.root, {
fix: true,
});
await installAsync(context.root, {});
if (options.platform === 'ios') {
await podInstall(join(context.root, projectRoot, 'ios'));
}
} else {
await installAsync(context.root, {
check: true,
});
}

try {
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/src/executors/run/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"install": {
"type": "boolean",
"description": "Should install missing dependencies before building.",
"description": "Installing npm packages and CocoaPods before building.",
"default": true
},
"buildCache": {
Expand Down
3 changes: 3 additions & 0 deletions packages/expo/src/executors/start/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ export interface ExpoStartOptions {
localhost?: boolean;
tunnel?: boolean;
offline?: boolean;

// nx options
sync?: boolean; // default is true
}
5 changes: 5 additions & 0 deletions packages/expo/src/executors/start/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
"offline": {
"type": "boolean",
"description": "Allows this command to run while offline"
},
"sync": {
"type": "boolean",
"description": "Syncs npm dependencies to package.json (for React Native autolink).",
"default": true
}
},
"examplesFile": "../../../docs/start-examples.md"
Expand Down
Loading

1 comment on commit 1bc7965

@vercel
Copy link

@vercel vercel bot commented on 1bc7965 Jun 5, 2023

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-five.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.