@nx/expo 17.0.3 → 17.0.4

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 +3 -0
  2. package/LICENSE +1 -1
  3. package/README.md +9 -4
  4. package/docs/export-examples.md +112 -0
  5. package/docs/start-examples.md +6 -0
  6. package/executors.json +5 -0
  7. package/generators.json +2 -2
  8. package/migrations.json +114 -6
  9. package/package.json +12 -16
  10. package/plugin.d.ts +1 -0
  11. package/plugin.js +6 -0
  12. package/plugins/metro-resolver.js +4 -1
  13. package/plugins/plugin.d.ts +14 -0
  14. package/plugins/plugin.js +150 -0
  15. package/plugins/with-nx-metro.js +6 -2
  16. package/plugins/with-nx-webpack.d.ts +1 -1
  17. package/plugins/with-nx-webpack.js +8 -4
  18. package/src/executors/build/build.impl.js +2 -1
  19. package/src/executors/build/schema.json +1 -1
  20. package/src/executors/build-list/build-list.impl.js +2 -3
  21. package/src/executors/build-list/schema.json +1 -1
  22. package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +4 -0
  23. package/src/executors/ensure-symlink/ensure-symlink.impl.js +4 -0
  24. package/src/executors/ensure-symlink/schema.json +1 -1
  25. package/src/executors/export/export.impl.d.ts +1 -0
  26. package/src/executors/export/export.impl.js +25 -15
  27. package/src/executors/export/schema.d.ts +4 -2
  28. package/src/executors/export/schema.json +14 -13
  29. package/src/executors/install/install.impl.js +0 -2
  30. package/src/executors/install/schema.json +1 -1
  31. package/src/executors/prebuild/prebuild.impl.js +11 -5
  32. package/src/executors/prebuild/schema.json +2 -1
  33. package/src/executors/run/schema.json +1 -1
  34. package/src/executors/serve/lib/is-packager-running.d.ts +1 -0
  35. package/src/executors/serve/lib/is-packager-running.js +15 -0
  36. package/src/executors/serve/schema.d.ts +7 -0
  37. package/src/executors/serve/schema.json +35 -0
  38. package/src/executors/serve/serve.impl.d.ts +11 -0
  39. package/src/executors/serve/serve.impl.js +105 -0
  40. package/src/executors/start/schema.json +1 -1
  41. package/src/executors/start/start.impl.js +7 -1
  42. package/src/executors/submit/schema.json +1 -1
  43. package/src/executors/submit/submit.impl.js +2 -1
  44. package/src/executors/sync-deps/schema.d.ts +1 -0
  45. package/src/executors/sync-deps/schema.json +6 -1
  46. package/src/executors/sync-deps/sync-deps.impl.d.ts +4 -3
  47. package/src/executors/sync-deps/sync-deps.impl.js +33 -11
  48. package/src/executors/update/schema.json +1 -1
  49. package/src/executors/update/update.impl.js +7 -4
  50. package/src/generators/application/application.js +27 -7
  51. package/src/generators/application/files/app.json.template +2 -0
  52. package/src/generators/application/files/eas.json.template +0 -3
  53. package/src/generators/application/files/metro.config.js.template +1 -5
  54. package/src/generators/application/files/src/app/App.tsx.template +50 -13
  55. package/src/generators/application/files/webpack.config.js.template +57 -0
  56. package/src/generators/application/lib/add-e2e.d.ts +3 -0
  57. package/src/generators/application/lib/add-e2e.js +86 -0
  58. package/src/generators/application/lib/add-project.js +20 -22
  59. package/src/generators/application/lib/create-application-files.js +0 -2
  60. package/src/generators/application/lib/normalize-options.d.ts +6 -0
  61. package/src/generators/application/lib/normalize-options.js +33 -1
  62. package/src/generators/application/schema.d.ts +2 -1
  63. package/src/generators/application/schema.json +4 -4
  64. package/src/generators/component/files/__fileName__.tsx.template +1 -1
  65. package/src/generators/component/schema.d.ts +3 -3
  66. package/src/generators/component/schema.json +4 -4
  67. package/src/generators/init/init.d.ts +3 -2
  68. package/src/generators/init/init.js +44 -40
  69. package/src/generators/init/schema.d.ts +3 -3
  70. package/src/generators/init/schema.json +11 -16
  71. package/src/generators/library/files/lib/.babelrc.js.template +21 -0
  72. package/src/generators/library/lib/normalize-options.js +5 -0
  73. package/src/generators/library/library.js +52 -38
  74. package/src/generators/library/schema.d.ts +1 -0
  75. package/src/generators/library/schema.json +2 -2
  76. package/src/migrations/update-16-6-0/update-metro-config.js +1 -5
  77. package/src/migrations/update-16-9-0/remove-types-react-native.js +2 -9
  78. package/src/migrations/update-16-9-0/update-eas-cli-version.js +1 -2
  79. package/src/migrations/{update-16-1-4/add-detox-app-json.d.ts → update-18-0-0/change-outputDir-export-target.d.ts} +1 -1
  80. package/src/migrations/update-18-0-0/change-outputDir-export-target.js +25 -0
  81. package/src/migrations/update-18-0-0/remove-block-list.d.ts +6 -0
  82. package/src/migrations/update-18-0-0/remove-block-list.js +28 -0
  83. package/src/migrations/update-18-0-0/remove-eas-cli.d.ts +12 -0
  84. package/src/migrations/update-18-0-0/remove-eas-cli.js +18 -0
  85. package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +6 -0
  86. package/src/migrations/update-18-0-0/remove-symlink-target.js +29 -0
  87. package/src/utils/add-jest.d.ts +1 -1
  88. package/src/utils/add-jest.js +15 -5
  89. package/src/utils/add-linting.d.ts +1 -0
  90. package/src/utils/add-linting.js +1 -1
  91. package/src/utils/ensure-dependencies.d.ts +2 -0
  92. package/src/utils/ensure-dependencies.js +24 -0
  93. package/src/utils/find-all-npm-dependencies.js +4 -2
  94. package/src/utils/has-expo-plugin.d.ts +2 -0
  95. package/src/utils/has-expo-plugin.js +11 -0
  96. package/src/utils/resolve-eas.d.ts +1 -0
  97. package/src/utils/resolve-eas.js +36 -0
  98. package/src/utils/versions.d.ts +14 -15
  99. package/src/utils/versions.js +15 -16
  100. package/collection.json +0 -0
  101. package/src/generators/application/lib/add-detox.d.ts +0 -3
  102. package/src/generators/application/lib/add-detox.js +0 -24
  103. package/src/generators/library/files/lib/babel.config.json +0 -17
  104. package/src/migrations/update-16-1-4/add-detox-app-json.js +0 -29
  105. package/src/utils/symlink-task.d.ts +0 -2
  106. package/src/utils/symlink-task.js +0 -18
  107. /package/src/generators/application/files/{babel.config.js.template → .babelrc.js.template} +0 -0
  108. /package/src/{generators/init/lib → utils}/init-root-babel-config.d.ts +0 -0
  109. /package/src/{generators/init/lib → utils}/init-root-babel-config.js +0 -0
@@ -7,22 +7,29 @@ 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
- displayNewlyAddedDepsMessage(context.projectName, await syncDeps(context.projectName, projectRoot, context.root, context.projectGraph, typeof options.include === 'string'
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'
11
15
  ? options.include.split(',')
12
16
  : options.include, typeof options.exclude === 'string'
13
17
  ? options.exclude.split(',')
14
- : options.exclude));
18
+ : options.exclude, options.all));
15
19
  yield { success: true };
16
20
  }
17
21
  exports.default = syncDepsExecutor;
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);
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
+ : [];
22
29
  const newDeps = [];
23
30
  let updated = false;
24
- if (!packageJson.dependencies) {
25
- packageJson.dependencies = {};
31
+ if (!projectPackageJson.dependencies) {
32
+ projectPackageJson.dependencies = {};
26
33
  updated = true;
27
34
  }
28
35
  if (include && include.length) {
@@ -31,15 +38,30 @@ async function syncDeps(projectName, projectRoot, workspaceRoot, projectGraph, i
31
38
  if (exclude && exclude.length) {
32
39
  npmDeps = npmDeps.filter((dep) => !exclude.includes(dep));
33
40
  }
41
+ if (!projectPackageJson.devDependencies) {
42
+ projectPackageJson.devDependencies = {};
43
+ }
44
+ if (!projectPackageJson.dependencies) {
45
+ projectPackageJson.dependencies = {};
46
+ }
34
47
  npmDeps.forEach((dep) => {
35
- if (!packageJson.dependencies[dep]) {
36
- packageJson.dependencies[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] = '*';
37
59
  newDeps.push(dep);
38
60
  updated = true;
39
61
  }
40
62
  });
41
63
  if (updated) {
42
- (0, devkit_1.writeJsonFile)(packageJsonPath, packageJson);
64
+ (0, devkit_1.writeJsonFile)(projectPackageJsonPath, projectPackageJson);
43
65
  }
44
66
  return newDeps;
45
67
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 2,
3
3
  "outputCapture": "direct-nodejs",
4
- "$schema": "http://json-schema.org/schema",
4
+ "$schema": "https://json-schema.org/schema",
5
5
  "$id": "NxExpoEasUpdate",
6
6
  "cli": "nx",
7
7
  "title": "Expo EAS Update executor",
@@ -3,15 +3,18 @@ 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 ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
6
+ const resolve_eas_1 = require("../../utils/resolve-eas");
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);
12
16
  await (0, install_impl_1.installAsync)(context.root, { packages: ['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);
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']));
15
18
  try {
16
19
  await runCliUpdate(context.root, projectRoot, options);
17
20
  yield { success: true };
@@ -25,7 +28,7 @@ async function* buildExecutor(options, context) {
25
28
  exports.default = buildExecutor;
26
29
  function runCliUpdate(workspaceRoot, projectRoot, options) {
27
30
  return new Promise((resolve, reject) => {
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 });
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 });
29
32
  // Ensure the child process is killed when the parent exits
30
33
  process.on('exit', () => childProcess.kill());
31
34
  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 symlink_task_1 = require("../../utils/symlink-task");
5
+ const js_1 = require("@nx/js");
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,9 +10,13 @@ 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_detox_1 = require("./lib/add-detox");
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");
14
17
  async function expoApplicationGenerator(host, schema) {
15
18
  return await expoApplicationGeneratorInternal(host, {
19
+ addPlugin: false,
16
20
  projectNameAndRootFormat: 'derived',
17
21
  ...schema,
18
22
  });
@@ -20,9 +24,20 @@ async function expoApplicationGenerator(host, schema) {
20
24
  exports.expoApplicationGenerator = expoApplicationGenerator;
21
25
  async function expoApplicationGeneratorInternal(host, schema) {
22
26
  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);
23
39
  (0, create_application_files_1.createApplicationFiles)(host, options);
24
40
  (0, add_project_1.addProject)(host, options);
25
- const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
26
41
  const lintTask = await (0, add_linting_1.addLinting)(host, {
27
42
  ...options,
28
43
  projectRoot: options.appProjectRoot,
@@ -30,14 +45,19 @@ async function expoApplicationGeneratorInternal(host, schema) {
30
45
  (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
31
46
  ],
32
47
  });
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);
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);
36
53
  (0, add_eas_scripts_1.addEasScripts)(host);
37
54
  if (!options.skipFormat) {
38
55
  await (0, devkit_1.formatFiles)(host);
39
56
  }
40
- return (0, devkit_1.runTasksInSerial)(initTask, lintTask, jestTask, detoxTask, symlinkTask);
57
+ tasks.push(() => {
58
+ (0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
59
+ });
60
+ return (0, devkit_1.runTasksInSerial)(...tasks);
41
61
  }
42
62
  exports.expoApplicationGeneratorInternal = expoApplicationGeneratorInternal;
43
63
  exports.default = expoApplicationGenerator;
@@ -30,6 +30,7 @@
30
30
  "bundler": "metro"
31
31
  },
32
32
  "plugins": [
33
+ <% if (e2eTestRunner === 'detox') { %>
33
34
  [
34
35
  "@config-plugins/detox",
35
36
  {
@@ -37,6 +38,7 @@
37
38
  "subdomains": ["10.0.2.2", "localhost"]
38
39
  }
39
40
  ]
41
+ <% } %>
40
42
  ]
41
43
  }
42
44
  }
@@ -21,8 +21,5 @@
21
21
  },
22
22
  "submit": {
23
23
  "production": {}
24
- },
25
- "cli": {
26
- "version": ">= <%= easCliVersion.replace('~', '') %>"
27
24
  }
28
25
  }
@@ -1,7 +1,6 @@
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');
5
4
 
6
5
  const defaultConfig = getDefaultConfig(__dirname);
7
6
  const { assetExts, sourceExts } = defaultConfig.resolver;
@@ -18,10 +17,7 @@ const customConfig = {
18
17
  },
19
18
  resolver: {
20
19
  assetExts: assetExts.filter((ext) => ext !== 'svg'),
21
- sourceExts: [...sourceExts, 'svg'],
22
- blockList: exclusionList([/^(?!.*node_modules).*\/dist\/.*/]),
23
- // unstable_enableSymlinks: true,
24
- // unstable_enablePackageExports: true,
20
+ sourceExts: [...sourceExts, 'cjs', 'mjs', 'svg'],
25
21
  },
26
22
  };
27
23
 
@@ -10,7 +10,7 @@ import {
10
10
  TouchableOpacity,
11
11
  Linking,
12
12
  } from 'react-native';
13
- import Svg, { Path } from 'react-native-svg';
13
+ import Svg, { G, Path } from 'react-native-svg';
14
14
 
15
15
  export const App = () => {
16
16
  const [whatsNextYCoord, setWhatsNextYCoord] = useState<number>(0);
@@ -19,7 +19,10 @@ export const App = () => {
19
19
  return (
20
20
  <>
21
21
  <StatusBar barStyle="dark-content" />
22
- <SafeAreaView>
22
+ <SafeAreaView
23
+ style={{
24
+ flex: 1,
25
+ }}>
23
26
  <ScrollView
24
27
  ref={(ref) => {
25
28
  scrollViewRef.current = ref;
@@ -29,7 +32,7 @@ export const App = () => {
29
32
  >
30
33
  <View style={styles.section}>
31
34
  <Text style={styles.textLg}>Hello there,</Text>
32
- <Text style={[styles.textXL, styles.appTitleText]} testID="heading">
35
+ <Text style={[styles.textXL, styles.appTitleText]} testID="heading" role="heading">
33
36
  Welcome <%= displayName %> 👋
34
37
  </Text>
35
38
  </View>
@@ -308,11 +311,14 @@ export const App = () => {
308
311
  Install Nx Console for VSCode
309
312
  </Text>
310
313
  <Text style={[styles.textXS, styles.textLight]}>
311
- The official VSCode plugin for Nx.
314
+ The official VSCode extension for Nx.
312
315
  </Text>
313
316
  </View>
314
317
  </View>
315
318
  </TouchableOpacity>
319
+ </View>
320
+
321
+ <View style={[styles.section, styles.shadowBox]}>
316
322
  <TouchableOpacity
317
323
  onPress={() =>
318
324
  Linking.openURL(
@@ -321,13 +327,20 @@ export const App = () => {
321
327
  }
322
328
  >
323
329
  <View style={[styles.listItem, styles.learning]}>
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" />
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>
331
344
  </Svg>
332
345
  <View style={styles.listItemTextContainer}>
333
346
  <Text
@@ -374,7 +387,7 @@ export const App = () => {
374
387
  </View>
375
388
  </View>
376
389
  <View style={styles.codeBlock}>
377
- <Text style={[styles.monospace]}>nx connect-to-nx-cloud</Text>
390
+ <Text style={[styles.monospace]}>nx connect</Text>
378
391
  </View>
379
392
  </View>
380
393
  </TouchableOpacity>
@@ -462,9 +475,33 @@ export const App = () => {
462
475
  @nx/expo:component \
463
476
  </Text>
464
477
  <Text style={[styles.textXS, styles.monospace]}>
465
- button --project ui
478
+ ui/src/lib/button
466
479
  </Text>
467
480
  </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>
468
505
  <View style={styles.listItem}>
469
506
  <Svg
470
507
  width={24}
@@ -0,0 +1,57 @@
1
+ const createExpoWebpackConfigAsync = require('@expo/webpack-config');
2
+ const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');
3
+ const { resolve } = require('path');
4
+
5
+ /**
6
+ * @deprecated use bundler: 'metro' instead
7
+ */
8
+ module.exports = async function (env, argv) {
9
+ const config = await createExpoWebpackConfigAsync(env, argv);
10
+
11
+ // Customize the config before returning it.
12
+ // add additional rule to load files under libs
13
+ const rules = config.module.rules.find((rule) =>
14
+ Array.isArray(rule.oneOf)
15
+ )?.oneOf;
16
+ if (rules) {
17
+ rules.push({
18
+ test: /\.(mjs|[jt]sx?)$/,
19
+ exclude: /node_modules/,
20
+ use: {
21
+ loader: require.resolve('@nx/webpack/src/utils/web-babel-loader.js'),
22
+ options: {
23
+ presets: [
24
+ [
25
+ '@nx/react/babel',
26
+ {
27
+ runtime: 'automatic',
28
+ },
29
+ ],
30
+ ],
31
+ },
32
+ },
33
+ });
34
+ }
35
+
36
+ if (!config.resolve) {
37
+ config.resolve = {};
38
+ }
39
+ if (!config.resolve.plugins) {
40
+ config.resolve.plugins = [];
41
+ }
42
+ const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
43
+ const tsConfigPath = resolve(__dirname, 'tsconfig.json');
44
+ config.resolve.plugins.push(
45
+ new TsconfigPathsPlugin({
46
+ configFile: tsConfigPath,
47
+ extensions,
48
+ })
49
+ );
50
+ config.resolve.fallback = {
51
+ ...config.resolve.fallback,
52
+ crypto: require.resolve('crypto-browserify'),
53
+ stream: require.resolve('stream-browserify'),
54
+ };
55
+
56
+ return config;
57
+ };
@@ -0,0 +1,3 @@
1
+ import type { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function addE2e(tree: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addE2e = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const web_1 = require("@nx/web");
6
+ const versions_1 = require("../../../utils/versions");
7
+ const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
8
+ async function addE2e(tree, options) {
9
+ const hasPlugin = (0, has_expo_plugin_1.hasExpoPlugin)(tree);
10
+ switch (options.e2eTestRunner) {
11
+ case 'cypress': {
12
+ const hasNxExpoPlugin = (0, has_expo_plugin_1.hasExpoPlugin)(tree);
13
+ if (!hasNxExpoPlugin) {
14
+ await (0, web_1.webStaticServeGenerator)(tree, {
15
+ buildTarget: `${options.projectName}:export`,
16
+ targetName: 'serve-static',
17
+ });
18
+ }
19
+ const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
20
+ (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
21
+ projectType: 'application',
22
+ root: options.e2eProjectRoot,
23
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
24
+ targets: {},
25
+ implicitDependencies: [options.projectName],
26
+ tags: [],
27
+ });
28
+ return await configurationGenerator(tree, {
29
+ ...options,
30
+ project: options.e2eProjectName,
31
+ directory: 'src',
32
+ // the name and root are already normalized, instruct the generator to use them as is
33
+ bundler: 'none',
34
+ skipFormat: true,
35
+ devServerTarget: `${options.projectName}:${options.e2eWebServerTarget}`,
36
+ port: options.e2ePort,
37
+ baseUrl: options.e2eWebServerAddress,
38
+ ciWebServerCommand: hasNxExpoPlugin
39
+ ? `nx run ${options.projectName}:serve-static`
40
+ : undefined,
41
+ jsx: true,
42
+ rootProject: options.rootProject,
43
+ });
44
+ }
45
+ case 'playwright': {
46
+ const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
47
+ (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
48
+ projectType: 'application',
49
+ root: options.e2eProjectRoot,
50
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
51
+ targets: {},
52
+ implicitDependencies: [options.projectName],
53
+ });
54
+ return configurationGenerator(tree, {
55
+ project: options.e2eProjectName,
56
+ skipFormat: true,
57
+ skipPackageJson: options.skipPackageJson,
58
+ directory: 'src',
59
+ js: false,
60
+ linter: options.linter,
61
+ setParserOptionsProject: options.setParserOptionsProject,
62
+ webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.name}`,
63
+ webServerAddress: options.e2eWebServerAddress,
64
+ rootProject: options.rootProject,
65
+ });
66
+ }
67
+ case 'detox':
68
+ const { detoxApplicationGenerator } = (0, devkit_1.ensurePackage)('@nx/detox', versions_1.nxVersion);
69
+ return detoxApplicationGenerator(tree, {
70
+ ...options,
71
+ e2eName: options.e2eProjectName,
72
+ e2eDirectory: options.e2eProjectRoot,
73
+ projectNameAndRootFormat: 'as-provided',
74
+ appProject: options.projectName,
75
+ appDisplayName: options.displayName,
76
+ appName: options.name,
77
+ framework: 'expo',
78
+ setParserOptionsProject: options.setParserOptionsProject,
79
+ skipFormat: true,
80
+ });
81
+ case 'none':
82
+ default:
83
+ return () => { };
84
+ }
85
+ }
86
+ exports.addE2e = addE2e;
@@ -2,12 +2,19 @@
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");
5
7
  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
+ }
6
13
  const projectConfiguration = {
7
14
  root: options.appProjectRoot,
8
15
  sourceRoot: `${options.appProjectRoot}/src`,
9
16
  projectType: 'application',
10
- targets: { ...getTargets(options) },
17
+ targets: hasPlugin ? {} : getTargets(options),
11
18
  tags: options.parsedTags,
12
19
  };
13
20
  (0, devkit_1.addProjectConfiguration)(host, options.projectName, projectConfiguration, options.standaloneConfig);
@@ -17,33 +24,33 @@ function getTargets(options) {
17
24
  const architect = {};
18
25
  architect.start = {
19
26
  executor: '@nx/expo:start',
20
- dependsOn: ['ensure-symlink', 'sync-deps'],
21
- options: {
22
- port: 8081,
23
- },
27
+ dependsOn: ['sync-deps'],
28
+ options: {},
24
29
  };
25
30
  architect.serve = {
26
- executor: 'nx:run-commands',
31
+ executor: '@nx/expo:serve',
32
+ dependsOn: ['sync-deps'],
27
33
  options: {
28
- command: `nx start ${options.projectName}`,
34
+ port: 4200,
29
35
  },
30
36
  };
31
37
  architect['run-ios'] = {
32
38
  executor: '@nx/expo:run',
33
- dependsOn: ['ensure-symlink', 'sync-deps'],
39
+ dependsOn: ['sync-deps'],
34
40
  options: {
35
41
  platform: 'ios',
36
42
  },
37
43
  };
38
44
  architect['run-android'] = {
39
45
  executor: '@nx/expo:run',
40
- dependsOn: ['ensure-symlink', 'sync-deps'],
46
+ dependsOn: ['sync-deps'],
41
47
  options: {
42
48
  platform: 'android',
43
49
  },
44
50
  };
45
51
  architect['build'] = {
46
52
  executor: '@nx/expo:build',
53
+ dependsOn: ['sync-deps'],
47
54
  options: {},
48
55
  };
49
56
  architect['submit'] = {
@@ -58,13 +65,9 @@ function getTargets(options) {
58
65
  executor: '@nx/expo:sync-deps',
59
66
  options: {},
60
67
  };
61
- architect['ensure-symlink'] = {
62
- executor: '@nx/expo:ensure-symlink',
63
- options: {},
64
- };
65
68
  architect['prebuild'] = {
66
69
  executor: '@nx/expo:prebuild',
67
- dependsOn: ['ensure-symlink', 'sync-deps'],
70
+ dependsOn: ['sync-deps'],
68
71
  options: {},
69
72
  };
70
73
  architect['install'] = {
@@ -77,16 +80,11 @@ function getTargets(options) {
77
80
  };
78
81
  architect['export'] = {
79
82
  executor: '@nx/expo:export',
80
- dependsOn: ['ensure-symlink', 'sync-deps'],
83
+ dependsOn: ['sync-deps'],
84
+ outputs: ['{options.outputDir}'],
81
85
  options: {
82
86
  platform: 'all',
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',
87
+ outputDir: `dist/${options.appProjectRoot}`,
90
88
  },
91
89
  };
92
90
  return architect;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createApplicationFiles = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const path_1 = require("path");
6
- const versions_1 = require("../../../utils/versions");
7
6
  function createApplicationFiles(host, options) {
8
7
  const packageManagerLockFile = {
9
8
  npm: 'package-lock.json',
@@ -17,7 +16,6 @@ function createApplicationFiles(host, options) {
17
16
  offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
18
17
  packageManager,
19
18
  packageLockFile,
20
- easCliVersion: versions_1.easCliVersion,
21
19
  });
22
20
  if (options.unitTestRunner === 'none') {
23
21
  host.delete((0, path_1.join)(options.appProjectRoot, `App.spec.tsx`));
@@ -6,5 +6,11 @@ export interface NormalizedSchema extends Schema {
6
6
  appProjectRoot: string;
7
7
  lowerCaseName: string;
8
8
  parsedTags: string[];
9
+ rootProject: boolean;
10
+ e2eProjectName: string;
11
+ e2eProjectRoot: string;
12
+ e2eWebServerAddress: string;
13
+ e2eWebServerTarget: string;
14
+ e2ePort: number;
9
15
  }
10
16
  export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;