@nx/expo 17.0.4 → 17.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/.eslintrc.json +0 -3
  2. package/LICENSE +1 -1
  3. package/README.md +4 -9
  4. package/collection.json +0 -0
  5. package/docs/start-examples.md +0 -6
  6. package/executors.json +0 -5
  7. package/generators.json +2 -2
  8. package/migrations.json +6 -114
  9. package/package.json +16 -12
  10. package/plugins/metro-resolver.js +1 -4
  11. package/plugins/with-nx-metro.js +2 -6
  12. package/plugins/with-nx-webpack.d.ts +1 -1
  13. package/plugins/with-nx-webpack.js +4 -8
  14. package/src/executors/build/build.impl.js +1 -2
  15. package/src/executors/build/schema.json +1 -1
  16. package/src/executors/build-list/build-list.impl.js +3 -2
  17. package/src/executors/build-list/schema.json +1 -1
  18. package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +0 -4
  19. package/src/executors/ensure-symlink/ensure-symlink.impl.js +0 -4
  20. package/src/executors/ensure-symlink/schema.json +1 -1
  21. package/src/executors/export/export.impl.d.ts +0 -1
  22. package/src/executors/export/export.impl.js +15 -25
  23. package/src/executors/export/schema.d.ts +2 -4
  24. package/src/executors/export/schema.json +13 -14
  25. package/src/executors/install/install.impl.js +2 -0
  26. package/src/executors/install/schema.json +1 -1
  27. package/src/executors/prebuild/prebuild.impl.js +5 -11
  28. package/src/executors/prebuild/schema.json +1 -2
  29. package/src/executors/run/schema.json +1 -1
  30. package/src/executors/start/schema.json +1 -1
  31. package/src/executors/start/start.impl.js +1 -7
  32. package/src/executors/submit/schema.json +1 -1
  33. package/src/executors/submit/submit.impl.js +1 -2
  34. package/src/executors/sync-deps/schema.d.ts +0 -1
  35. package/src/executors/sync-deps/schema.json +1 -6
  36. package/src/executors/sync-deps/sync-deps.impl.d.ts +3 -4
  37. package/src/executors/sync-deps/sync-deps.impl.js +11 -33
  38. package/src/executors/update/schema.json +1 -1
  39. package/src/executors/update/update.impl.js +4 -7
  40. package/src/generators/application/application.js +7 -27
  41. package/src/generators/application/files/app.json.template +0 -2
  42. package/src/generators/application/files/eas.json.template +3 -0
  43. package/src/generators/application/files/metro.config.js.template +5 -1
  44. package/src/generators/application/files/src/app/App.tsx.template +13 -50
  45. package/src/generators/application/lib/add-detox.d.ts +3 -0
  46. package/src/generators/application/lib/add-detox.js +24 -0
  47. package/src/generators/application/lib/add-project.js +22 -20
  48. package/src/generators/application/lib/create-application-files.js +2 -0
  49. package/src/generators/application/lib/normalize-options.d.ts +0 -6
  50. package/src/generators/application/lib/normalize-options.js +1 -33
  51. package/src/generators/application/schema.d.ts +1 -2
  52. package/src/generators/application/schema.json +4 -4
  53. package/src/generators/component/files/__fileName__.tsx.template +1 -1
  54. package/src/generators/component/schema.d.ts +3 -3
  55. package/src/generators/component/schema.json +4 -4
  56. package/src/generators/init/init.d.ts +2 -3
  57. package/src/generators/init/init.js +40 -44
  58. package/src/generators/init/schema.d.ts +3 -3
  59. package/src/generators/init/schema.json +16 -11
  60. package/src/generators/library/files/lib/babel.config.json +17 -0
  61. package/src/generators/library/lib/normalize-options.js +0 -5
  62. package/src/generators/library/library.js +38 -52
  63. package/src/generators/library/schema.d.ts +0 -1
  64. package/src/generators/library/schema.json +2 -2
  65. package/src/migrations/{update-18-0-0/change-outputDir-export-target.d.ts → update-16-1-4/add-detox-app-json.d.ts} +1 -1
  66. package/src/migrations/update-16-1-4/add-detox-app-json.js +29 -0
  67. package/src/migrations/update-16-6-0/update-metro-config.js +5 -1
  68. package/src/migrations/update-16-9-0/remove-types-react-native.js +9 -2
  69. package/src/migrations/update-16-9-0/update-eas-cli-version.js +2 -1
  70. package/src/utils/add-jest.d.ts +1 -1
  71. package/src/utils/add-jest.js +5 -15
  72. package/src/utils/add-linting.d.ts +0 -1
  73. package/src/utils/add-linting.js +1 -1
  74. package/src/utils/find-all-npm-dependencies.js +2 -4
  75. package/src/utils/symlink-task.d.ts +2 -0
  76. package/src/utils/symlink-task.js +18 -0
  77. package/src/utils/versions.d.ts +15 -14
  78. package/src/utils/versions.js +16 -15
  79. package/docs/export-examples.md +0 -112
  80. package/plugin.d.ts +0 -1
  81. package/plugin.js +0 -6
  82. package/plugins/plugin.d.ts +0 -14
  83. package/plugins/plugin.js +0 -150
  84. package/src/executors/serve/lib/is-packager-running.d.ts +0 -1
  85. package/src/executors/serve/lib/is-packager-running.js +0 -15
  86. package/src/executors/serve/schema.d.ts +0 -7
  87. package/src/executors/serve/schema.json +0 -35
  88. package/src/executors/serve/serve.impl.d.ts +0 -11
  89. package/src/executors/serve/serve.impl.js +0 -105
  90. package/src/generators/application/files/webpack.config.js.template +0 -57
  91. package/src/generators/application/lib/add-e2e.d.ts +0 -3
  92. package/src/generators/application/lib/add-e2e.js +0 -86
  93. package/src/generators/library/files/lib/.babelrc.js.template +0 -21
  94. package/src/migrations/update-18-0-0/change-outputDir-export-target.js +0 -25
  95. package/src/migrations/update-18-0-0/remove-block-list.d.ts +0 -6
  96. package/src/migrations/update-18-0-0/remove-block-list.js +0 -28
  97. package/src/migrations/update-18-0-0/remove-eas-cli.d.ts +0 -12
  98. package/src/migrations/update-18-0-0/remove-eas-cli.js +0 -18
  99. package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +0 -6
  100. package/src/migrations/update-18-0-0/remove-symlink-target.js +0 -29
  101. package/src/utils/ensure-dependencies.d.ts +0 -2
  102. package/src/utils/ensure-dependencies.js +0 -24
  103. package/src/utils/has-expo-plugin.d.ts +0 -2
  104. package/src/utils/has-expo-plugin.js +0 -11
  105. package/src/utils/resolve-eas.d.ts +0 -1
  106. package/src/utils/resolve-eas.js +0 -36
  107. /package/src/generators/application/files/{.babelrc.js.template → babel.config.js.template} +0 -0
  108. /package/src/{utils → generators/init/lib}/init-root-babel-config.d.ts +0 -0
  109. /package/src/{utils → generators/init/lib}/init-root-babel-config.js +0 -0
@@ -4,15 +4,17 @@ exports.prebuildAsync = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const child_process_1 = require("child_process");
6
6
  const path_1 = require("path");
7
+ const ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
7
8
  const pod_install_task_1 = require("../../utils/pod-install-task");
8
9
  const install_impl_1 = require("../install/install.impl");
9
10
  let childProcess;
10
11
  async function* prebuildExecutor(options, context) {
11
12
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
13
+ (0, ensure_node_modules_symlink_1.ensureNodeModulesSymlink)(context.root, projectRoot);
12
14
  try {
13
15
  await prebuildAsync(context.root, projectRoot, options);
14
16
  if (options.install) {
15
- await (0, install_impl_1.installAsync)(devkit_1.workspaceRoot, {});
17
+ await (0, install_impl_1.installAsync)(context.root, {});
16
18
  if (options.platform === 'ios') {
17
19
  (0, pod_install_task_1.podInstall)((0, path_1.join)(context.root, projectRoot, 'ios'));
18
20
  }
@@ -48,21 +50,13 @@ function prebuildAsync(workspaceRoot, projectRoot, options) {
48
50
  });
49
51
  }
50
52
  exports.prebuildAsync = prebuildAsync;
51
- const nxOptions = ['install', 'interactive']; // interactive is passed in by e2e tests
53
+ const nxOptions = ['install', 'interactive'];
52
54
  // options from https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/prebuild/index.ts
53
55
  function createPrebuildOptions(options) {
54
56
  return Object.keys(options).reduce((acc, k) => {
55
57
  if (!nxOptions.includes(k)) {
56
58
  const v = options[k];
57
- if (typeof v === 'boolean') {
58
- if (v === true) {
59
- // when true, does not need to pass the value true, just need to pass the flag in kebob case
60
- acc.push(`--${(0, devkit_1.names)(k).fileName}`);
61
- }
62
- }
63
- else {
64
- acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
65
- }
59
+ acc.push(`--${(0, devkit_1.names)(k).fileName}=${v}`);
66
60
  }
67
61
  return acc;
68
62
  }, []);
@@ -3,7 +3,7 @@
3
3
  "version": 2,
4
4
  "outputCapture": "direct-nodejs",
5
5
  "$id": "NxExpoPrebuild",
6
- "$schema": "https://json-schema.org/schema",
6
+ "$schema": "http://json-schema.org/schema",
7
7
  "title": "Expo Prebuild",
8
8
  "description": "Create native iOS and Android project files for building natively.",
9
9
  "type": "object",
@@ -31,6 +31,5 @@
31
31
  "description": "Project template to clone from. File path pointing to a local tar file or a github repo"
32
32
  }
33
33
  },
34
- "required": ["platform"],
35
34
  "examplesFile": "../../../docs/prebuild-examples.md"
36
35
  }
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "cli": "nx",
5
5
  "$id": "NxExpoRun",
6
- "$schema": "https://json-schema.org/schema",
6
+ "$schema": "http://json-schema.org/schema",
7
7
  "title": "Run iOS or Android application",
8
8
  "description": "Run Expo target options.",
9
9
  "type": "object",
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "cli": "nx",
5
5
  "$id": "NxExpoStart",
6
- "$schema": "https://json-schema.org/schema",
6
+ "$schema": "http://json-schema.org/schema",
7
7
  "title": "Packager Server for Expo",
8
8
  "description": "Packager Server target options.",
9
9
  "type": "object",
@@ -25,13 +25,7 @@ async function* startExecutor(options, context) {
25
25
  exports.default = startExecutor;
26
26
  function startAsync(workspaceRoot, projectRoot, options) {
27
27
  return new Promise((resolve, reject) => {
28
- childProcess = (0, child_process_1.fork)(require.resolve('@expo/cli/build/bin/cli'), ['start', ...createStartOptions(options)], {
29
- cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
30
- env: {
31
- RCT_METRO_PORT: options.port.toString(),
32
- ...process.env,
33
- },
34
- });
28
+ childProcess = (0, child_process_1.fork)(require.resolve('@expo/cli/build/bin/cli'), ['start', ...createStartOptions(options)], { cwd: (0, path_1.resolve)(workspaceRoot, projectRoot), env: process.env });
35
29
  // Ensure the child process is killed when the parent exits
36
30
  process.on('exit', () => childProcess.kill());
37
31
  process.on('SIGTERM', () => childProcess.kill());
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
4
  "title": "EXPO EAS Submit Executor",
5
5
  "description": "Submit app binary to App Store and/or Play Store.",
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const devkit_1 = require("@nx/devkit");
4
4
  const path_1 = require("path");
5
5
  const child_process_1 = require("child_process");
6
- const resolve_eas_1 = require("../../utils/resolve-eas");
7
6
  let childProcess;
8
7
  async function* submitExecutor(options, context) {
9
8
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
@@ -20,7 +19,7 @@ async function* submitExecutor(options, context) {
20
19
  exports.default = submitExecutor;
21
20
  function runCliSubmit(workspaceRoot, projectRoot, options) {
22
21
  return new Promise((resolve, reject) => {
23
- childProcess = (0, child_process_1.fork)((0, resolve_eas_1.resolveEas)(workspaceRoot), ['submit', ...createSubmitOptions(options)], {
22
+ childProcess = (0, child_process_1.fork)(require.resolve('eas-cli/bin/run'), ['submit', ...createSubmitOptions(options)], {
24
23
  cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
25
24
  env: process.env,
26
25
  });
@@ -1,5 +1,4 @@
1
1
  export interface ExpoSyncDepsOptions {
2
2
  include: string[] | string; // default is an empty array []
3
3
  exclude: string[] | string; // default is an empty array []
4
- all: boolean; // default is false
5
4
  }
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "cli": "nx",
5
5
  "$id": "NxExpoSyncDeps",
6
- "$schema": "https://json-schema.org/schema",
6
+ "$schema": "http://json-schema.org/schema",
7
7
  "title": "Sync Deps for Expo",
8
8
  "description": "Updates package.json with project dependencies.",
9
9
  "type": "object",
@@ -23,11 +23,6 @@
23
23
  },
24
24
  "default": [],
25
25
  "description": "An array of npm packages to exclude."
26
- },
27
- "all": {
28
- "type": "boolean",
29
- "description": "Copy all dependencies and devDependencies from the workspace root package.json.",
30
- "default": false
31
26
  }
32
27
  }
33
28
  }
@@ -1,9 +1,8 @@
1
1
  import { ExecutorContext, ProjectGraph } from '@nx/devkit';
2
2
  import { ExpoSyncDepsOptions } from './schema';
3
- import { PackageJson } from 'nx/src/utils/package-json';
4
- export interface ReactNativeSyncDepsOutput {
3
+ export interface ExpoSyncDepsOutput {
5
4
  success: boolean;
6
5
  }
7
- export default function syncDepsExecutor(options: ExpoSyncDepsOptions, context: ExecutorContext): AsyncGenerator<ReactNativeSyncDepsOutput>;
8
- export declare function syncDeps(projectName: string, projectPackageJson: PackageJson, projectPackageJsonPath: string, workspacePackageJson: PackageJson, projectGraph?: ProjectGraph, include?: string[], exclude?: string[], all?: boolean): Promise<string[]>;
6
+ export default function syncDepsExecutor(options: ExpoSyncDepsOptions, context: ExecutorContext): AsyncGenerator<ExpoSyncDepsOutput>;
7
+ export declare function syncDeps(projectName: string, projectRoot: string, workspaceRoot: string, projectGraph: ProjectGraph, include?: string[], exclude?: string[]): Promise<string[]>;
9
8
  export declare function displayNewlyAddedDepsMessage(projectName: string, deps: string[]): void;
@@ -7,29 +7,22 @@ const devkit_1 = require("@nx/devkit");
7
7
  const find_all_npm_dependencies_1 = require("../../utils/find-all-npm-dependencies");
8
8
  async function* syncDepsExecutor(options, context) {
9
9
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
10
- const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
11
- const projectPackageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
12
- const workspacePackageJson = (0, devkit_1.readJsonFile)(workspacePackageJsonPath);
13
- const projectPackageJson = (0, devkit_1.readJsonFile)(projectPackageJsonPath);
14
- displayNewlyAddedDepsMessage(context.projectName, await syncDeps(context.projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, context.projectGraph, typeof options.include === 'string'
10
+ displayNewlyAddedDepsMessage(context.projectName, await syncDeps(context.projectName, projectRoot, context.root, context.projectGraph, typeof options.include === 'string'
15
11
  ? options.include.split(',')
16
12
  : options.include, typeof options.exclude === 'string'
17
13
  ? options.exclude.split(',')
18
- : options.exclude, options.all));
14
+ : options.exclude));
19
15
  yield { success: true };
20
16
  }
21
17
  exports.default = syncDepsExecutor;
22
- async function syncDeps(projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, projectGraph = (0, devkit_1.readCachedProjectGraph)(), include = [], exclude = [], all = false) {
23
- let npmDeps = all
24
- ? Object.keys(workspacePackageJson.dependencies || {})
25
- : (0, find_all_npm_dependencies_1.findAllNpmDependencies)(projectGraph, projectName);
26
- let npmDevdeps = all
27
- ? Object.keys(workspacePackageJson.devDependencies || {})
28
- : [];
18
+ async function syncDeps(projectName, projectRoot, workspaceRoot, projectGraph, include = [], exclude = []) {
19
+ let npmDeps = (0, find_all_npm_dependencies_1.findAllNpmDependencies)(projectGraph, projectName);
20
+ const packageJsonPath = (0, path_1.join)(workspaceRoot, projectRoot, 'package.json');
21
+ const packageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
29
22
  const newDeps = [];
30
23
  let updated = false;
31
- if (!projectPackageJson.dependencies) {
32
- projectPackageJson.dependencies = {};
24
+ if (!packageJson.dependencies) {
25
+ packageJson.dependencies = {};
33
26
  updated = true;
34
27
  }
35
28
  if (include && include.length) {
@@ -38,30 +31,15 @@ async function syncDeps(projectName, projectPackageJson, projectPackageJsonPath,
38
31
  if (exclude && exclude.length) {
39
32
  npmDeps = npmDeps.filter((dep) => !exclude.includes(dep));
40
33
  }
41
- if (!projectPackageJson.devDependencies) {
42
- projectPackageJson.devDependencies = {};
43
- }
44
- if (!projectPackageJson.dependencies) {
45
- projectPackageJson.dependencies = {};
46
- }
47
34
  npmDeps.forEach((dep) => {
48
- if (!projectPackageJson.dependencies[dep] &&
49
- !projectPackageJson.devDependencies[dep]) {
50
- projectPackageJson.dependencies[dep] = '*';
51
- newDeps.push(dep);
52
- updated = true;
53
- }
54
- });
55
- npmDevdeps.forEach((dep) => {
56
- if (!projectPackageJson.dependencies[dep] &&
57
- !projectPackageJson.devDependencies[dep]) {
58
- projectPackageJson.devDependencies[dep] = '*';
35
+ if (!packageJson.dependencies[dep]) {
36
+ packageJson.dependencies[dep] = '*';
59
37
  newDeps.push(dep);
60
38
  updated = true;
61
39
  }
62
40
  });
63
41
  if (updated) {
64
- (0, devkit_1.writeJsonFile)(projectPackageJsonPath, projectPackageJson);
42
+ (0, devkit_1.writeJsonFile)(packageJsonPath, packageJson);
65
43
  }
66
44
  return newDeps;
67
45
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 2,
3
3
  "outputCapture": "direct-nodejs",
4
- "$schema": "https://json-schema.org/schema",
4
+ "$schema": "http://json-schema.org/schema",
5
5
  "$id": "NxExpoEasUpdate",
6
6
  "cli": "nx",
7
7
  "title": "Expo EAS Update executor",
@@ -3,18 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const devkit_1 = require("@nx/devkit");
4
4
  const path_1 = require("path");
5
5
  const child_process_1 = require("child_process");
6
- const resolve_eas_1 = require("../../utils/resolve-eas");
6
+ const ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
7
7
  const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
8
8
  const install_impl_1 = require("../install/install.impl");
9
9
  let childProcess;
10
10
  async function* buildExecutor(options, context) {
11
11
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
12
- const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
13
- const projectPackageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
14
- const workspacePackageJson = (0, devkit_1.readJsonFile)(workspacePackageJsonPath);
15
- const projectPackageJson = (0, devkit_1.readJsonFile)(projectPackageJsonPath);
16
12
  await (0, install_impl_1.installAsync)(context.root, { packages: ['expo-updates'] });
17
- (0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, await (0, sync_deps_impl_1.syncDeps)(context.projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, context.projectGraph, ['expo-updates']));
13
+ (0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, await (0, sync_deps_impl_1.syncDeps)(context.projectName, projectRoot, context.root, context.projectGraph, ['expo-updates']));
14
+ (0, ensure_node_modules_symlink_1.ensureNodeModulesSymlink)(context.root, projectRoot);
18
15
  try {
19
16
  await runCliUpdate(context.root, projectRoot, options);
20
17
  yield { success: true };
@@ -28,7 +25,7 @@ async function* buildExecutor(options, context) {
28
25
  exports.default = buildExecutor;
29
26
  function runCliUpdate(workspaceRoot, projectRoot, options) {
30
27
  return new Promise((resolve, reject) => {
31
- childProcess = (0, child_process_1.fork)((0, resolve_eas_1.resolveEas)(workspaceRoot), ['update', ...createUpdateOptions(options)], { cwd: (0, path_1.resolve)(workspaceRoot, projectRoot), env: process.env });
28
+ childProcess = (0, child_process_1.fork)(require.resolve('eas-cli/bin/run'), ['update', ...createUpdateOptions(options)], { cwd: (0, path_1.resolve)(workspaceRoot, projectRoot), env: process.env });
32
29
  // Ensure the child process is killed when the parent exits
33
30
  process.on('exit', () => childProcess.kill());
34
31
  process.on('SIGTERM', () => childProcess.kill());
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.expoApplicationGeneratorInternal = exports.expoApplicationGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const js_1 = require("@nx/js");
5
+ const symlink_task_1 = require("../../utils/symlink-task");
6
6
  const add_linting_1 = require("../../utils/add-linting");
7
7
  const add_jest_1 = require("../../utils/add-jest");
8
8
  const normalize_options_1 = require("./lib/normalize-options");
@@ -10,13 +10,9 @@ const init_1 = require("../init/init");
10
10
  const add_project_1 = require("./lib/add-project");
11
11
  const create_application_files_1 = require("./lib/create-application-files");
12
12
  const add_eas_scripts_1 = require("./lib/add-eas-scripts");
13
- const add_e2e_1 = require("./lib/add-e2e");
14
- const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
15
- const init_root_babel_config_1 = require("../../utils/init-root-babel-config");
16
- const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
13
+ const add_detox_1 = require("./lib/add-detox");
17
14
  async function expoApplicationGenerator(host, schema) {
18
15
  return await expoApplicationGeneratorInternal(host, {
19
- addPlugin: false,
20
16
  projectNameAndRootFormat: 'derived',
21
17
  ...schema,
22
18
  });
@@ -24,20 +20,9 @@ async function expoApplicationGenerator(host, schema) {
24
20
  exports.expoApplicationGenerator = expoApplicationGenerator;
25
21
  async function expoApplicationGeneratorInternal(host, schema) {
26
22
  const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
27
- const tasks = [];
28
- const jsInitTask = await (0, js_1.initGenerator)(host, {
29
- ...schema,
30
- skipFormat: true,
31
- });
32
- tasks.push(jsInitTask);
33
- const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
34
- tasks.push(initTask);
35
- if (!options.skipPackageJson) {
36
- tasks.push((0, ensure_dependencies_1.ensureDependencies)(host));
37
- }
38
- (0, init_root_babel_config_1.initRootBabelConfig)(host);
39
23
  (0, create_application_files_1.createApplicationFiles)(host, options);
40
24
  (0, add_project_1.addProject)(host, options);
25
+ const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
41
26
  const lintTask = await (0, add_linting_1.addLinting)(host, {
42
27
  ...options,
43
28
  projectRoot: options.appProjectRoot,
@@ -45,19 +30,14 @@ async function expoApplicationGeneratorInternal(host, schema) {
45
30
  (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
46
31
  ],
47
32
  });
48
- tasks.push(lintTask);
49
- const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson, options.addPlugin);
50
- tasks.push(jestTask);
51
- const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
52
- tasks.push(e2eTask);
33
+ const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson);
34
+ const detoxTask = await (0, add_detox_1.addDetox)(host, options);
35
+ const symlinkTask = (0, symlink_task_1.runSymlink)(host.root, options.appProjectRoot);
53
36
  (0, add_eas_scripts_1.addEasScripts)(host);
54
37
  if (!options.skipFormat) {
55
38
  await (0, devkit_1.formatFiles)(host);
56
39
  }
57
- tasks.push(() => {
58
- (0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
59
- });
60
- return (0, devkit_1.runTasksInSerial)(...tasks);
40
+ return (0, devkit_1.runTasksInSerial)(initTask, lintTask, jestTask, detoxTask, symlinkTask);
61
41
  }
62
42
  exports.expoApplicationGeneratorInternal = expoApplicationGeneratorInternal;
63
43
  exports.default = expoApplicationGenerator;
@@ -30,7 +30,6 @@
30
30
  "bundler": "metro"
31
31
  },
32
32
  "plugins": [
33
- <% if (e2eTestRunner === 'detox') { %>
34
33
  [
35
34
  "@config-plugins/detox",
36
35
  {
@@ -38,7 +37,6 @@
38
37
  "subdomains": ["10.0.2.2", "localhost"]
39
38
  }
40
39
  ]
41
- <% } %>
42
40
  ]
43
41
  }
44
42
  }
@@ -21,5 +21,8 @@
21
21
  },
22
22
  "submit": {
23
23
  "production": {}
24
+ },
25
+ "cli": {
26
+ "version": ">= <%= easCliVersion.replace('~', '') %>"
24
27
  }
25
28
  }
@@ -1,6 +1,7 @@
1
1
  const { withNxMetro } = require('@nx/expo');
2
2
  const { getDefaultConfig } = require('@expo/metro-config');
3
3
  const { mergeConfig } = require('metro-config');
4
+ const exclusionList = require('metro-config/src/defaults/exclusionList');
4
5
 
5
6
  const defaultConfig = getDefaultConfig(__dirname);
6
7
  const { assetExts, sourceExts } = defaultConfig.resolver;
@@ -17,7 +18,10 @@ const customConfig = {
17
18
  },
18
19
  resolver: {
19
20
  assetExts: assetExts.filter((ext) => ext !== 'svg'),
20
- sourceExts: [...sourceExts, 'cjs', 'mjs', 'svg'],
21
+ sourceExts: [...sourceExts, 'svg'],
22
+ blockList: exclusionList([/^(?!.*node_modules).*\/dist\/.*/]),
23
+ // unstable_enableSymlinks: true,
24
+ // unstable_enablePackageExports: true,
21
25
  },
22
26
  };
23
27
 
@@ -10,7 +10,7 @@ import {
10
10
  TouchableOpacity,
11
11
  Linking,
12
12
  } from 'react-native';
13
- import Svg, { G, Path } from 'react-native-svg';
13
+ import Svg, { Path } from 'react-native-svg';
14
14
 
15
15
  export const App = () => {
16
16
  const [whatsNextYCoord, setWhatsNextYCoord] = useState<number>(0);
@@ -19,10 +19,7 @@ export const App = () => {
19
19
  return (
20
20
  <>
21
21
  <StatusBar barStyle="dark-content" />
22
- <SafeAreaView
23
- style={{
24
- flex: 1,
25
- }}>
22
+ <SafeAreaView>
26
23
  <ScrollView
27
24
  ref={(ref) => {
28
25
  scrollViewRef.current = ref;
@@ -32,7 +29,7 @@ export const App = () => {
32
29
  >
33
30
  <View style={styles.section}>
34
31
  <Text style={styles.textLg}>Hello there,</Text>
35
- <Text style={[styles.textXL, styles.appTitleText]} testID="heading" role="heading">
32
+ <Text style={[styles.textXL, styles.appTitleText]} testID="heading">
36
33
  Welcome <%= displayName %> 👋
37
34
  </Text>
38
35
  </View>
@@ -311,14 +308,11 @@ export const App = () => {
311
308
  Install Nx Console for VSCode
312
309
  </Text>
313
310
  <Text style={[styles.textXS, styles.textLight]}>
314
- The official VSCode extension for Nx.
311
+ The official VSCode plugin for Nx.
315
312
  </Text>
316
313
  </View>
317
314
  </View>
318
315
  </TouchableOpacity>
319
- </View>
320
-
321
- <View style={[styles.section, styles.shadowBox]}>
322
316
  <TouchableOpacity
323
317
  onPress={() =>
324
318
  Linking.openURL(
@@ -327,20 +321,13 @@ export const App = () => {
327
321
  }
328
322
  >
329
323
  <View style={[styles.listItem, styles.learning]}>
330
- <Svg width={48} height={48} viewBox="20 20 60 60">
331
- <Path d="m22.5 22.5h60v60h-60z" />
332
- <G fill="#fff">
333
- <Path d="m29.03 71.25h22.5v3.75h-22.5z" />
334
- <Path d="m28.09 38 1.67-1.58a1.88 1.88 0 0 0 1.47.87c.64 0 1.06-.44 1.06-1.31v-5.98h2.58v6a3.48 3.48 0 0 1 -.87 2.6 3.56 3.56 0 0 1 -2.57.95 3.84 3.84 0 0 1 -3.34-1.55z" />
335
- <Path d="m36 30h7.53v2.19h-5v1.44h4.49v2h-4.42v1.49h5v2.21h-7.6z" />
336
- <Path d="m47.23 32.29h-2.8v-2.29h8.21v2.27h-2.81v7.1h-2.6z" />
337
- <Path d="m29.13 43.08h4.42a3.53 3.53 0 0 1 2.55.83 2.09 2.09 0 0 1 .6 1.53 2.16 2.16 0 0 1 -1.44 2.09 2.27 2.27 0 0 1 1.86 2.29c0 1.61-1.31 2.59-3.55 2.59h-4.44zm5 2.89c0-.52-.42-.8-1.18-.8h-1.29v1.64h1.24c.79 0 1.25-.26 1.25-.81zm-.9 2.66h-1.57v1.73h1.62c.8 0 1.24-.31 1.24-.86 0-.5-.4-.87-1.27-.87z" />
338
- <Path d="m38 43.08h4.1a4.19 4.19 0 0 1 3 1 2.93 2.93 0 0 1 .9 2.19 3 3 0 0 1 -1.93 2.89l2.24 3.27h-3l-1.88-2.84h-.87v2.84h-2.56zm4 4.5c.87 0 1.39-.43 1.39-1.11 0-.75-.54-1.12-1.4-1.12h-1.44v2.26z" />
339
- <Path d="m49.59 43h2.5l4 9.44h-2.79l-.67-1.69h-3.63l-.67 1.69h-2.71zm2.27 5.73-1-2.65-1.06 2.65z" />
340
- <Path d="m56.46 43.05h2.6v9.37h-2.6z" />
341
- <Path d="m60.06 43.05h2.42l3.37 5v-5h2.57v9.37h-2.26l-3.53-5.14v5.14h-2.57z" />
342
- <Path d="m68.86 51 1.45-1.73a4.84 4.84 0 0 0 3 1.13c.71 0 1.08-.24 1.08-.65 0-.4-.31-.6-1.59-.91-2-.46-3.53-1-3.53-2.93 0-1.74 1.37-3 3.62-3a5.89 5.89 0 0 1 3.86 1.25l-1.26 1.84a4.63 4.63 0 0 0 -2.62-.92c-.63 0-.94.25-.94.6 0 .42.32.61 1.63.91 2.14.46 3.44 1.16 3.44 2.91 0 1.91-1.51 3-3.79 3a6.58 6.58 0 0 1 -4.35-1.5z" />
343
- </G>
324
+ <Svg
325
+ width={48}
326
+ height={48}
327
+ fill="rgba(0, 122, 204, 1)"
328
+ viewBox="0 0 24 24"
329
+ >
330
+ <Path d="M0 0v24h24V0zm3.723 3.111h5v1.834h-1.39v6.277h1.39v1.834h-5v-1.834h1.444V4.945H3.723zm11.055 0H17v6.5c0 .612-.055 1.111-.222 1.556-.167.444-.39.777-.723 1.11-.277.279-.666.557-1.11.668a3.933 3.933 0 0 1-1.445.278c-.778 0-1.444-.167-1.944-.445a4.81 4.81 0 0 1-1.279-1.056l1.39-1.555c.277.334.555.555.833.722.277.167.611.278.945.278.389 0 .721-.111 1-.389.221-.278.333-.667.333-1.278zM2.222 19.5h9V21h-9z" />
344
331
  </Svg>
345
332
  <View style={styles.listItemTextContainer}>
346
333
  <Text
@@ -387,7 +374,7 @@ export const App = () => {
387
374
  </View>
388
375
  </View>
389
376
  <View style={styles.codeBlock}>
390
- <Text style={[styles.monospace]}>nx connect</Text>
377
+ <Text style={[styles.monospace]}>nx connect-to-nx-cloud</Text>
391
378
  </View>
392
379
  </View>
393
380
  </TouchableOpacity>
@@ -475,33 +462,9 @@ export const App = () => {
475
462
  @nx/expo:component \
476
463
  </Text>
477
464
  <Text style={[styles.textXS, styles.monospace]}>
478
- ui/src/lib/button
465
+ button --project ui
479
466
  </Text>
480
467
  </View>
481
- <View style={styles.listItem}>
482
- <Svg
483
- width={24}
484
- height={24}
485
- stroke="#000000"
486
- fill="none"
487
- viewBox="0 0 24 24"
488
- >
489
- <Path
490
- strokeLinecap="round"
491
- strokeLinejoin="round"
492
- strokeWidth="2"
493
- d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
494
- />
495
- </Svg>
496
- <View style={styles.listItemTextContainer}>
497
- <Text style={styles.textSm}>
498
- View project details
499
- </Text>
500
- </View>
501
- </View>
502
- <View style={[styles.codeBlock, styles.marginBottomLg]}>
503
- <Text style={[styles.textXS, styles.monospace]}>nx show project <%= displayName %> --web</Text>
504
- </View>
505
468
  <View style={styles.listItem}>
506
469
  <Svg
507
470
  width={24}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function addDetox(host: Tree, options: NormalizedSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addDetox = void 0;
4
+ const detox_1 = require("@nx/detox");
5
+ const eslint_1 = require("@nx/eslint");
6
+ async function addDetox(host, options) {
7
+ if (options?.e2eTestRunner !== 'detox') {
8
+ return () => { };
9
+ }
10
+ return (0, detox_1.detoxApplicationGenerator)(host, {
11
+ ...options,
12
+ linter: eslint_1.Linter.EsLint,
13
+ e2eName: `${options.projectName}-e2e`,
14
+ e2eDirectory: `${options.appProjectRoot}-e2e`,
15
+ projectNameAndRootFormat: 'as-provided',
16
+ appProject: options.projectName,
17
+ appDisplayName: options.displayName,
18
+ appName: options.name,
19
+ framework: 'expo',
20
+ setParserOptionsProject: options.setParserOptionsProject,
21
+ skipFormat: true,
22
+ });
23
+ }
24
+ exports.addDetox = addDetox;
@@ -2,19 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addProject = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
6
- const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
7
5
  function addProject(host, options) {
8
- const nxJson = (0, devkit_1.readNxJson)(host);
9
- const hasPlugin = (0, has_expo_plugin_1.hasExpoPlugin)(host);
10
- if (!hasPlugin) {
11
- (0, add_build_target_defaults_1.addBuildTargetDefaults)(host, '@nx/expo:build');
12
- }
13
6
  const projectConfiguration = {
14
7
  root: options.appProjectRoot,
15
8
  sourceRoot: `${options.appProjectRoot}/src`,
16
9
  projectType: 'application',
17
- targets: hasPlugin ? {} : getTargets(options),
10
+ targets: { ...getTargets(options) },
18
11
  tags: options.parsedTags,
19
12
  };
20
13
  (0, devkit_1.addProjectConfiguration)(host, options.projectName, projectConfiguration, options.standaloneConfig);
@@ -24,33 +17,33 @@ function getTargets(options) {
24
17
  const architect = {};
25
18
  architect.start = {
26
19
  executor: '@nx/expo:start',
27
- dependsOn: ['sync-deps'],
28
- options: {},
20
+ dependsOn: ['ensure-symlink', 'sync-deps'],
21
+ options: {
22
+ port: 8081,
23
+ },
29
24
  };
30
25
  architect.serve = {
31
- executor: '@nx/expo:serve',
32
- dependsOn: ['sync-deps'],
26
+ executor: 'nx:run-commands',
33
27
  options: {
34
- port: 4200,
28
+ command: `nx start ${options.projectName}`,
35
29
  },
36
30
  };
37
31
  architect['run-ios'] = {
38
32
  executor: '@nx/expo:run',
39
- dependsOn: ['sync-deps'],
33
+ dependsOn: ['ensure-symlink', 'sync-deps'],
40
34
  options: {
41
35
  platform: 'ios',
42
36
  },
43
37
  };
44
38
  architect['run-android'] = {
45
39
  executor: '@nx/expo:run',
46
- dependsOn: ['sync-deps'],
40
+ dependsOn: ['ensure-symlink', 'sync-deps'],
47
41
  options: {
48
42
  platform: 'android',
49
43
  },
50
44
  };
51
45
  architect['build'] = {
52
46
  executor: '@nx/expo:build',
53
- dependsOn: ['sync-deps'],
54
47
  options: {},
55
48
  };
56
49
  architect['submit'] = {
@@ -65,9 +58,13 @@ function getTargets(options) {
65
58
  executor: '@nx/expo:sync-deps',
66
59
  options: {},
67
60
  };
61
+ architect['ensure-symlink'] = {
62
+ executor: '@nx/expo:ensure-symlink',
63
+ options: {},
64
+ };
68
65
  architect['prebuild'] = {
69
66
  executor: '@nx/expo:prebuild',
70
- dependsOn: ['sync-deps'],
67
+ dependsOn: ['ensure-symlink', 'sync-deps'],
71
68
  options: {},
72
69
  };
73
70
  architect['install'] = {
@@ -80,11 +77,16 @@ function getTargets(options) {
80
77
  };
81
78
  architect['export'] = {
82
79
  executor: '@nx/expo:export',
83
- dependsOn: ['sync-deps'],
84
- outputs: ['{options.outputDir}'],
80
+ dependsOn: ['ensure-symlink', 'sync-deps'],
85
81
  options: {
86
82
  platform: 'all',
87
- outputDir: `dist/${options.appProjectRoot}`,
83
+ outputDir: `${(0, devkit_1.offsetFromRoot)(options.appProjectRoot)}dist/${options.appProjectRoot}`,
84
+ },
85
+ };
86
+ architect['export-web'] = {
87
+ executor: '@nx/expo:export',
88
+ options: {
89
+ bundler: 'metro',
88
90
  },
89
91
  };
90
92
  return architect;