Skip to content

Commit

Permalink
feat(react-native): add interactive schema option (nrwl#9373)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi authored and sidmonta committed Apr 2, 2022
1 parent d2667b9 commit eb2a715
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 15 deletions.
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 @@ -54,13 +54,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 @@ -46,13 +46,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

0 comments on commit eb2a715

Please sign in to comment.