Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(react-native): add interactive schema option #9373

Merged
merged 1 commit into from Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions docs/generated/api-react-native/executors/run-android.md
Expand Up @@ -29,6 +29,14 @@ Type: `string`

Builds your app and starts it on a specific device/simulator with the given device id (listed by running "adb devices" on the command line).

### interactive

Default: `true`

Type: `boolean`

Run packager server in interactive mode.

### jetifier

Default: `true`
Expand All @@ -51,7 +59,7 @@ Default: `true`

Type: `boolean`

Starts the packager server
Starts the packager server.

### port

Expand All @@ -67,7 +75,7 @@ Default: `false`

Type: `boolean`

Resets metro cache
Resets metro cache.

### sync

Expand Down
12 changes: 10 additions & 2 deletions docs/generated/api-react-native/executors/run-ios.md
Expand Up @@ -25,13 +25,21 @@ Type: `boolean`

Runs 'pod install' for native modules before building iOS app.

### interactive

Default: `true`

Type: `boolean`

Run packager server in interactive mode.

### packager

Default: `true`

Type: `boolean`

Starts the packager server
Starts the packager server.

### port

Expand All @@ -47,7 +55,7 @@ Default: `false`

Type: `boolean`

Resets metro cache
Resets metro cache.

### scheme

Expand Down
8 changes: 8 additions & 0 deletions docs/generated/api-react-native/executors/start.md
Expand Up @@ -11,6 +11,14 @@ Options can be configured in `workspace.json` when defining the executor, or whe

## Options

### interactive

Default: `true`

Type: `boolean`

Run packager server in interactive mode.

### port

Default: `8081`
Expand Down
Expand Up @@ -40,6 +40,7 @@ export default async function* runAndroidExecutor(
runCliStart(context.root, projectRoot, {
port: options.port,
resetCache: options.resetCache,
interactive: options.interactive,
})
);
}
Expand Down Expand Up @@ -90,7 +91,14 @@ function runCliRunAndroid(
});
}

const nxOrStartOptions = ['sync', 'install', 'packager', 'port', 'resetCache'];
const nxOrStartOptions = [
'sync',
'install',
'packager',
'port',
'resetCache',
'interactive',
];

function createRunAndroidOptions(options) {
return Object.keys(options).reduce((acc, k) => {
Expand Down
5 changes: 3 additions & 2 deletions packages/react-native/src/executors/run-android/schema.d.ts
Expand Up @@ -10,6 +10,7 @@ export interface ReactNativeRunAndroidOptions {
sync: boolean;
port: number;
terminal?: string;
packager: boolean;
resetCache?: boolean;
packager: boolean; // default is true
resetCache: boolean; // default is false
interactive: boolean; // default is true
}
9 changes: 7 additions & 2 deletions packages/react-native/src/executors/run-android/schema.json
Expand Up @@ -53,13 +53,18 @@
},
"packager": {
"type": "boolean",
"description": "Starts the packager server",
"description": "Starts the packager server.",
"default": true
},
"resetCache": {
"type": "boolean",
"description": "Resets metro cache",
"description": "Resets metro cache.",
"default": false
},
"interactive": {
"type": "boolean",
"description": "Run packager server in interactive mode.",
"default": true
}
}
}
10 changes: 9 additions & 1 deletion packages/react-native/src/executors/run-ios/run-ios.impl.ts
Expand Up @@ -44,6 +44,7 @@ export default async function* runIosExecutor(
runCliStart(context.root, projectRoot, {
port: options.port,
resetCache: options.resetCache,
interactive: options.interactive,
})
);
}
Expand Down Expand Up @@ -94,7 +95,14 @@ function runCliRunIOS(
});
}

const nxOrStartOptions = ['sync', 'install', 'packager', 'port', 'resetCache'];
const nxOrStartOptions = [
'sync',
'install',
'packager',
'port',
'resetCache',
'interactive',
];

function createRunIOSOptions(options) {
return Object.keys(options).reduce((acc, k) => {
Expand Down
5 changes: 3 additions & 2 deletions packages/react-native/src/executors/run-ios/schema.d.ts
Expand Up @@ -5,9 +5,10 @@ export interface ReactNativeRunIosOptions {
scheme: string;
simulator: string;
device: string;
packager: boolean;
packager: boolean; // default is true
install?: boolean;
sync?: boolean;
terminal?: string;
resetCache?: boolean;
resetCache: boolean; // default is false
interactive: boolean; // default is true
}
9 changes: 7 additions & 2 deletions packages/react-native/src/executors/run-ios/schema.json
Expand Up @@ -45,13 +45,18 @@
},
"packager": {
"type": "boolean",
"description": "Starts the packager server",
"description": "Starts the packager server.",
"default": true
},
"resetCache": {
"type": "boolean",
"description": "Resets metro cache",
"description": "Resets metro cache.",
"default": false
},
"interactive": {
"type": "boolean",
"description": "Run packager server in interactive mode.",
"default": true
}
}
}
3 changes: 2 additions & 1 deletion packages/react-native/src/executors/start/schema.d.ts
@@ -1,4 +1,5 @@
export interface ReactNativeStartOptions {
port: number;
resetCache?: boolean;
resetCache: boolean; // default is false
interactive: boolean; // default is true
}
5 changes: 5 additions & 0 deletions packages/react-native/src/executors/start/schema.json
Expand Up @@ -15,6 +15,11 @@
"type": "boolean",
"description": "Resets metro cache.",
"default": false
},
"interactive": {
"type": "boolean",
"description": "Run packager server in interactive mode.",
"default": true
}
}
}
4 changes: 4 additions & 0 deletions packages/react-native/src/executors/start/start.impl.ts
Expand Up @@ -107,6 +107,10 @@ function createStartOptions(options) {
if (options[k] === true) {
acc.push(`--reset-cache`);
}
} else if (k === 'interactive') {
if (options[k] === false) {
acc.push(`--no-interactive`);
}
} else {
acc.push(`--${k}`, options[k]);
}
Expand Down