@nx/expo 19.7.3 → 19.8.0-beta.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/expo",
3
- "version": "19.7.3",
3
+ "version": "19.8.0-beta.0",
4
4
  "private": false,
5
5
  "description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
6
6
  "keywords": [
@@ -28,7 +28,7 @@
28
28
  "main": "./index",
29
29
  "types": "index.d.ts",
30
30
  "dependencies": {
31
- "@nx/devkit": "19.7.3",
31
+ "@nx/devkit": "19.8.0-beta.0",
32
32
  "chalk": "^4.1.0",
33
33
  "enhanced-resolve": "^5.8.3",
34
34
  "fs-extra": "^11.1.0",
@@ -37,13 +37,13 @@
37
37
  "node-fetch": "^2.6.7",
38
38
  "tslib": "^2.3.0",
39
39
  "tsconfig-paths": "^4.1.2",
40
- "@nx/jest": "19.7.3",
41
- "@nx/js": "19.7.3",
42
- "@nx/eslint": "19.7.3",
43
- "@nx/react": "19.7.3",
44
- "@nx/web": "19.7.3",
45
- "@nx/webpack": "19.7.3",
46
- "@nrwl/expo": "19.7.3"
40
+ "@nx/jest": "19.8.0-beta.0",
41
+ "@nx/js": "19.8.0-beta.0",
42
+ "@nx/eslint": "19.8.0-beta.0",
43
+ "@nx/react": "19.8.0-beta.0",
44
+ "@nx/web": "19.8.0-beta.0",
45
+ "@nx/webpack": "19.8.0-beta.0",
46
+ "@nrwl/expo": "19.8.0-beta.0"
47
47
  },
48
48
  "executors": "./executors.json",
49
49
  "ng-update": {
@@ -5,4 +5,3 @@ export interface ExpoInstallOutput {
5
5
  }
6
6
  export default function installExecutor(options: ExpoInstallOptions, context: ExecutorContext): AsyncGenerator<ExpoInstallOutput>;
7
7
  export declare function installAndUpdatePackageJson(context: ExecutorContext, options: ExpoInstallOptions): Promise<void>;
8
- export declare function installAsync(workspaceRoot: string, options: ExpoInstallOptions): Promise<number>;
@@ -2,10 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = installExecutor;
4
4
  exports.installAndUpdatePackageJson = installAndUpdatePackageJson;
5
- exports.installAsync = installAsync;
6
5
  const devkit_1 = require("@nx/devkit");
7
6
  const fileutils_1 = require("nx/src/utils/fileutils");
8
- const child_process_1 = require("child_process");
9
7
  const path_1 = require("path");
10
8
  const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
11
9
  let childProcess;
@@ -23,54 +21,31 @@ async function* installExecutor(options, context) {
23
21
  }
24
22
  }
25
23
  async function installAndUpdatePackageJson(context, options) {
26
- await installAsync(context.root, options);
24
+ const { installAsync } = require('@expo/cli/build/src/install/installAsync');
25
+ const packages = typeof options.packages === 'string'
26
+ ? options.packages.split(',')
27
+ : options.packages ?? [];
28
+ // Use force in case there are any unmet peer dependencies.
29
+ await installAsync(packages, createInstallOptions(options), ['--force']);
27
30
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
28
31
  const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
29
32
  const projectPackageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
30
33
  const workspacePackageJson = (0, fileutils_1.readJsonFile)(workspacePackageJsonPath);
31
34
  const projectPackageJson = (0, fileutils_1.readJsonFile)(projectPackageJsonPath);
32
- const packages = typeof options.packages === 'string'
33
- ? options.packages.split(',')
34
- : options.packages;
35
35
  (0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, await (0, sync_deps_impl_1.syncDeps)(context.projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, context.projectGraph, packages));
36
36
  }
37
- function installAsync(workspaceRoot, options) {
38
- return new Promise((resolve, reject) => {
39
- childProcess = (0, child_process_1.fork)(require.resolve('@expo/cli/build/bin/cli'), ['install', ...createInstallOptions(options)], { cwd: workspaceRoot, env: process.env });
40
- // Ensure the child process is killed when the parent exits
41
- process.on('exit', () => childProcess.kill());
42
- process.on('SIGTERM', () => childProcess.kill());
43
- childProcess.on('error', (err) => {
44
- reject(err);
45
- });
46
- childProcess.on('exit', (code) => {
47
- if (code === 0) {
48
- resolve(code);
49
- }
50
- else {
51
- reject(code);
52
- }
53
- });
54
- });
55
- }
56
37
  // options from https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/install/index.ts
57
38
  function createInstallOptions(options) {
58
39
  return Object.keys(options).reduce((acc, k) => {
59
40
  const v = options[k];
60
- if (k === 'packages') {
61
- const packages = typeof v === 'string' ? v.split(',') : v;
62
- acc.push(...packages);
41
+ if (typeof v === 'boolean') {
42
+ if (v === true) {
43
+ // when true, does not need to pass the value true, just need to pass the flag in kebob case
44
+ acc.push(`--${(0, devkit_1.names)(k).fileName}`);
45
+ }
63
46
  }
64
47
  else {
65
- if (typeof v === 'boolean') {
66
- if (v === true) {
67
- // when true, does not need to pass the value true, just need to pass the flag in kebob case
68
- acc.push(`--${(0, devkit_1.names)(k).fileName}`);
69
- }
70
- }
71
- else {
72
- acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
73
- }
48
+ acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
74
49
  }
75
50
  return acc;
76
51
  }, []);
@@ -6,14 +6,14 @@ const devkit_1 = require("@nx/devkit");
6
6
  const child_process_1 = require("child_process");
7
7
  const path_1 = require("path");
8
8
  const pod_install_task_1 = require("../../utils/pod-install-task");
9
- const install_impl_1 = require("../install/install.impl");
10
9
  let childProcess;
11
10
  async function* prebuildExecutor(options, context) {
12
11
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
13
12
  try {
14
13
  await prebuildAsync(context.root, projectRoot, options);
15
14
  if (options.install) {
16
- await (0, install_impl_1.installAsync)(devkit_1.workspaceRoot, {});
15
+ const { installAsync, } = require('@expo/cli/build/src/install/installAsync');
16
+ await installAsync([], {});
17
17
  if (options.platform === 'ios') {
18
18
  (0, pod_install_task_1.podInstall)((0, path_1.join)(context.root, projectRoot, 'ios'));
19
19
  }
@@ -8,7 +8,6 @@ const os_1 = require("os");
8
8
  const fs_extra_1 = require("fs-extra");
9
9
  const prebuild_impl_1 = require("../prebuild/prebuild.impl");
10
10
  const pod_install_task_1 = require("../../utils/pod-install-task");
11
- const install_impl_1 = require("../install/install.impl");
12
11
  let childProcess;
13
12
  async function* runExecutor(options, context) {
14
13
  if ((0, os_1.platform)() !== 'darwin' && options.platform === 'ios') {
@@ -23,7 +22,8 @@ async function* runExecutor(options, context) {
23
22
  });
24
23
  }
25
24
  if (options.install) {
26
- await (0, install_impl_1.installAsync)(context.root, {});
25
+ const { installAsync, } = require('@expo/cli/build/src/install/installAsync');
26
+ await installAsync([], {});
27
27
  if (options.platform === 'ios') {
28
28
  (0, pod_install_task_1.podInstall)((0, path_1.join)(context.root, projectRoot, 'ios'));
29
29
  }
@@ -95,7 +95,7 @@ async function convertToInferred(tree, options) {
95
95
  },
96
96
  ], options.project);
97
97
  if (migratedProjects.size === 0) {
98
- throw new Error('Could not find any targets to migrate.');
98
+ throw new executor_to_plugin_migrator_1.NoTargetsToMigrateError();
99
99
  }
100
100
  if (!options.skipFormat) {
101
101
  await (0, devkit_1.formatFiles)(tree);
@@ -5,6 +5,7 @@ const eslint_1 = require("@nx/eslint");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const lint_1 = require("@nx/react/src/utils/lint");
7
7
  const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
8
+ const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
8
9
  async function addLinting(host, options) {
9
10
  if (options.linter === eslint_1.Linter.None) {
10
11
  return () => { };
@@ -20,7 +21,21 @@ async function addLinting(host, options) {
20
21
  });
21
22
  tasks.push(lintTask);
22
23
  if ((0, eslint_file_1.isEslintConfigSupported)(host)) {
23
- (0, eslint_file_1.addExtendsToLintConfig)(host, options.projectRoot, 'plugin:@nx/react');
24
+ if ((0, flat_config_1.useFlatConfig)(host)) {
25
+ (0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(host, options.projectRoot, 'flat/react');
26
+ // Add an empty rules object to users know how to add/override rules
27
+ (0, eslint_file_1.addOverrideToLintConfig)(host, options.projectRoot, {
28
+ files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
29
+ rules: {},
30
+ });
31
+ }
32
+ else {
33
+ const addExtendsTask = (0, eslint_file_1.addExtendsToLintConfig)(host, options.projectRoot, {
34
+ name: 'plugin:@nx/react',
35
+ needCompatFixup: true,
36
+ });
37
+ tasks.push(addExtendsTask);
38
+ }
24
39
  (0, eslint_file_1.addIgnoresToLintConfig)(host, options.projectRoot, [
25
40
  '.expo',
26
41
  'web-build',