Isaac Mann afa5eb59fa
docs(core): document the @nrwl => @nx rescope (#16403)
Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2023-04-27 18:14:59 -04:00

90 lines
6.0 KiB
JSON

{
"name": "bundle",
"implementation": "/packages/react-native/src/executors/bundle/bundle.impl.ts",
"schema": {
"version": 2,
"outputCapture": "direct-nodejs",
"cli": "nx",
"$id": "NxReactNativeBundle",
"$schema": "http://json-schema.org/schema",
"title": "Offline JS Bundle for React Native",
"description": "JS Bundle target options.",
"type": "object",
"presets": [
{ "name": "Bundle for a specific platform", "keys": ["platform"] },
{ "name": "Bundle a development build", "keys": ["dev"] },
{ "name": "Bundle to a specific output path", "keys": ["bundleOutput"] },
{ "name": "Bundle without global cache", "keys": ["resetCache"] }
],
"properties": {
"entryFile": {
"type": "string",
"description": "The entry file relative to project root.",
"x-completion-type": "file",
"x-completion-glob": "main@(.js|.ts)"
},
"platform": {
"enum": ["ios", "android"],
"alias": "p",
"description": "Platform to build for."
},
"transformer": {
"type": "string",
"description": "Specify a custom transformer to be used."
},
"dev": {
"type": "boolean",
"description": "Generate a development build.",
"default": true
},
"minify": {
"type": "boolean",
"description": "Allows overriding whether bundle is minified."
},
"bundleOutput": {
"type": "string",
"description": "The output path of the generated files.",
"x-completion-type": "directory"
},
"maxWorkers": {
"type": "number",
"description": "The number of workers we should parallelize the transformer on."
},
"sourcemapOutput": {
"type": "string",
"description": "File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map."
},
"sourcemapSourcesRoot": {
"type": "string",
"description": "Path to make sourcemaps sources entries relative to, ex. /root/dir."
},
"sourcemapUseAbsolutePath": {
"type": "boolean",
"description": "Report SourceMapURL using its full path.",
"default": false
},
"assetsDest": {
"type": "string",
"description": "Directory name where to store assets referenced in the bundle."
},
"resetCache": {
"type": "boolean",
"description": "Removes cached files.",
"default": false
},
"readGlobalCache": {
"type": "boolean",
"description": "Try to fetch transformed JS code from the global cache, if configured.",
"default": false
}
},
"required": ["platform", "entryFile", "bundleOutput"],
"examplesFile": "`project.json`:\n\n```json\n{\n \"name\": \"mobile\",\n //...\n \"targets\": {\n //...\n \"bundle-ios\": {\n \"executor\": \"@nx/react-native:bundle\",\n \"outputs\": [\"{projectRoot}/build\"],\n \"options\": {\n \"entryFile\": \"src/main.tsx\",\n \"platform\": \"ios\",\n \"bundleOutput\": \"dist/apps/mobile/ios/main.jsbundle\"\n }\n },\n \"bundle-android\": {\n \"executor\": \"@nx/react-native:bundle\",\n \"options\": {\n \"entryFile\": \"src/main.tsx\",\n \"platform\": \"android\",\n \"bundleOutput\": \"dist/apps/mobile/android/main.jsbundle\"\n }\n }\n }\n}\n```\n\n```bash\nnx run mobile:bundle-ios\nnx run mobile:bundle-android\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Bundle with sourcemap\" %}\nThe `sourcemapOutput` option allows you to specify the path of the source map relative to app folder:\n\n```json\n \"bundle-ios\": {\n \"executor\": \"@nx/react-native:bundle\",\n \"options\": {\n \"entryFile\": \"src/main.tsx\",\n \"platform\": \"ios\",\n \"bundleOutput\": \"dist/apps/mobile/ios/main.jsbundle\",\n \"sourcemapOutput\": \"../../dist/apps/mobile/ios/main.map\",\n }\n },\n \"bundle-android\": {\n \"executor\": \"@nx/react-native:bundle\",\n \"options\": {\n \"entryFile\": \"src/main.tsx\",\n \"platform\": \"android\",\n \"bundleOutput\": \"dist/apps/mobile/android/main.jsbundle\",\n \"sourcemapOutput\": \"../../dist/apps/mobile/android/main.map\",\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Create a dev/release bundle\" %}\n\nThe `dev` option determines whether to create a dev or release bundle. The default value is `true`, by setting it as `false`, warnings are disabled and the bundle is minified.\n\n```json\n \"bundle-ios\": {\n \"executor\": \"@nx/react-native:bundle\",\n \"options\": {\n \"entryFile\": \"src/main.tsx\",\n \"platform\": \"ios\",\n \"bundleOutput\": \"dist/apps/mobile/ios/main.jsbundle\",\n \"dev\": false\n }\n },\n \"bundle-android\": {\n \"executor\": \"@nx/react-native:bundle\",\n \"options\": {\n \"entryFile\": \"src/main.tsx\",\n \"platform\": \"android\",\n \"bundleOutput\": \"dist/apps/mobile/android/main.jsbundle\",\n \"dev\": false\n }\n }\n```\n\n{% /tab %}\n{% tab label=\"Create a minified bundle\" %}\n\nThe `minify` option allows you to create a minified bundle:\n\n```json\n \"bundle-ios\": {\n \"executor\": \"@nx/react-native:bundle\",\n \"options\": {\n \"entryFile\": \"src/main.tsx\",\n \"platform\": \"ios\",\n \"bundleOutput\": \"dist/apps/mobile/ios/main.jsbundle\",\n \"minify\": true\n }\n },\n \"bundle-android\": {\n \"executor\": \"@nx/react-native:bundle\",\n \"options\": {\n \"entryFile\": \"src/main.tsx\",\n \"platform\": \"android\",\n \"bundleOutput\": \"dist/apps/mobile/android/main.jsbundle\",\n \"minify\": true\n }\n }\n```\n\n{% /tab %}\n{% /tabs %}\n\n---\n"
},
"description": "Builds the JavaScript bundle for offline use.",
"aliases": [],
"hidden": false,
"path": "/packages/react-native/src/executors/bundle/schema.json",
"type": "executor"
}