@nx/expo 20.0.0-beta.4 → 20.0.0-beta.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 (34) hide show
  1. package/migrations.json +0 -262
  2. package/package.json +9 -10
  3. package/project.json +0 -3
  4. package/src/executors/install/install.impl.js +4 -2
  5. package/src/executors/install/schema.d.ts +1 -0
  6. package/src/executors/install/schema.json +5 -0
  7. package/src/generators/application/application.js +2 -0
  8. package/src/generators/application/lib/add-e2e.js +0 -1
  9. package/src/generators/application/lib/normalize-options.js +2 -3
  10. package/src/generators/application/schema.d.ts +2 -4
  11. package/src/generators/application/schema.json +10 -15
  12. package/src/generators/component/lib/normalize-options.d.ts +1 -0
  13. package/src/generators/component/lib/normalize-options.js +4 -5
  14. package/src/generators/component/schema.d.ts +2 -4
  15. package/src/generators/component/schema.json +11 -15
  16. package/src/generators/init/init.js +2 -0
  17. package/src/generators/library/lib/normalize-options.js +1 -1
  18. package/src/generators/library/library.js +2 -0
  19. package/src/generators/library/schema.d.ts +2 -4
  20. package/src/generators/library/schema.json +6 -12
  21. package/src/migrations/update-16-0-0/remove-deprecated-targets.d.ts +0 -5
  22. package/src/migrations/update-16-0-0/remove-deprecated-targets.js +0 -32
  23. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
  24. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
  25. package/src/migrations/update-16-1-4/update-eas-scripts.d.ts +0 -5
  26. package/src/migrations/update-16-1-4/update-eas-scripts.js +0 -34
  27. package/src/migrations/update-16-6-0/add-depends-on.d.ts +0 -6
  28. package/src/migrations/update-16-6-0/add-depends-on.js +0 -29
  29. package/src/migrations/update-16-6-0/update-metro-config.d.ts +0 -6
  30. package/src/migrations/update-16-6-0/update-metro-config.js +0 -65
  31. package/src/migrations/update-16-9-0/remove-types-react-native.d.ts +0 -7
  32. package/src/migrations/update-16-9-0/remove-types-react-native.js +0 -13
  33. package/src/migrations/update-16-9-0/update-eas-cli-version.d.ts +0 -2
  34. package/src/migrations/update-16-9-0/update-eas-cli-version.js +0 -17
package/migrations.json CHANGED
@@ -1,47 +1,5 @@
1
1
  {
2
2
  "generators": {
3
- "remove-deprecated-expo-targets": {
4
- "version": "16.0.0-beta.0",
5
- "cli": "nx",
6
- "description": "Remove deprecated expo targets",
7
- "factory": "./src/migrations/update-16-0-0/remove-deprecated-targets"
8
- },
9
- "update-16-0-0-add-nx-packages": {
10
- "cli": "nx",
11
- "version": "16.0.0-beta.1",
12
- "description": "Replace @nrwl/expo with @nx/expo",
13
- "implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
14
- },
15
- "update-eas-scripts-16-1-4": {
16
- "cli": "nx",
17
- "version": "16.1.4-beta.0",
18
- "description": "Update package.json eas build lifecycle scripts",
19
- "implementation": "./src/migrations/update-16-1-4/update-eas-scripts"
20
- },
21
- "update-16-6-0-add-dependsOn": {
22
- "cli": "nx",
23
- "version": "16.6.0-beta.0",
24
- "description": "Add dependsOn like ensure-symlink or sync-deps to targets",
25
- "implementation": "./src/migrations/update-16-6-0/add-depends-on"
26
- },
27
- "update-16-6-0-update-metro-config": {
28
- "cli": "nx",
29
- "version": "16.6.0-beta.0",
30
- "description": "Update metro.config.js to use the new metro config format",
31
- "implementation": "./src/migrations/update-16-6-0/update-metro-config"
32
- },
33
- "update-16-9-0-remove-types-react-native": {
34
- "cli": "nx",
35
- "version": "16.9.0-beta.1",
36
- "description": "Remove @types/react-native from package.json",
37
- "implementation": "./src/migrations/update-16-9-0/remove-types-react-native"
38
- },
39
- "update-16-9-0-update-eas-json-cli-version": {
40
- "cli": "nx",
41
- "version": "16.9.0-beta.1",
42
- "description": "Update eas.json cli version",
43
- "implementation": "./src/migrations/update-16-9-0/update-eas-cli-version"
44
- },
45
3
  "update-18-0-0-remove-block-list": {
46
4
  "cli": "nx",
47
5
  "version": "18.0.0-beta.0",
@@ -86,226 +44,6 @@
86
44
  }
87
45
  },
88
46
  "packageJsonUpdates": {
89
- "16.0.0": {
90
- "version": "16.0.0-beta.0",
91
- "packages": {
92
- "expo": {
93
- "version": "48.0.11",
94
- "alwaysAddToPackageJson": false
95
- },
96
- "react-native": {
97
- "version": "0.71.6",
98
- "alwaysAddToPackageJson": false
99
- },
100
- "@types/react-native": {
101
- "version": "0.71.6",
102
- "alwaysAddToPackageJson": false
103
- },
104
- "eas-cli": {
105
- "version": "~3.10.0",
106
- "alwaysAddToPackageJson": false
107
- },
108
- "@expo/cli": {
109
- "version": "~0.7.0",
110
- "alwaysAddToPackageJson": false
111
- },
112
- "@testing-library/react-native": {
113
- "version": "12.0.1",
114
- "alwaysAddToPackageJson": false
115
- },
116
- "jest-expo": {
117
- "version": "~48.0.2",
118
- "alwaysAddToPackageJson": false,
119
- "addToPackageJson": "devDependencies"
120
- }
121
- }
122
- },
123
- "16.0.2": {
124
- "version": "16.0.2-beta.0",
125
- "packages": {
126
- "expo": {
127
- "version": "48.0.15",
128
- "alwaysAddToPackageJson": false
129
- },
130
- "react-native": {
131
- "version": "0.71.7",
132
- "alwaysAddToPackageJson": false
133
- },
134
- "eas-cli": {
135
- "version": "~3.10.2",
136
- "alwaysAddToPackageJson": false
137
- },
138
- "@expo/cli": {
139
- "version": "~0.7.1",
140
- "alwaysAddToPackageJson": false
141
- },
142
- "expo-splash-screen": {
143
- "version": "~0.18.2",
144
- "alwaysAddToPackageJson": false
145
- }
146
- }
147
- },
148
- "16.1.5": {
149
- "version": "16.1.5-beta.0",
150
- "packages": {
151
- "expo": {
152
- "version": "^48.0.16",
153
- "alwaysAddToPackageJson": false
154
- },
155
- "eas-cli": {
156
- "version": "~3.12.0",
157
- "alwaysAddToPackageJson": false
158
- },
159
- "@testing-library/react-native": {
160
- "version": "12.1.2",
161
- "alwaysAddToPackageJson": false
162
- }
163
- }
164
- },
165
- "16.2.2": {
166
- "version": "16.2.2-beta.0",
167
- "packages": {
168
- "expo": {
169
- "version": "^48.0.17",
170
- "alwaysAddToPackageJson": false
171
- },
172
- "eas-cli": {
173
- "version": "~3.13.2",
174
- "alwaysAddToPackageJson": false
175
- },
176
- "react-native": {
177
- "version": "0.71.8",
178
- "alwaysAddToPackageJson": false
179
- },
180
- "@types/react-native": {
181
- "version": "0.71.7",
182
- "alwaysAddToPackageJson": false
183
- }
184
- }
185
- },
186
- "16.4.0": {
187
- "version": "16.4.0-beta.5",
188
- "packages": {
189
- "expo": {
190
- "version": "^48.0.19",
191
- "alwaysAddToPackageJson": false
192
- },
193
- "eas-cli": {
194
- "version": "~3.13.3",
195
- "alwaysAddToPackageJson": false
196
- },
197
- "@expo/cli": {
198
- "version": "~0.7.3",
199
- "alwaysAddToPackageJson": false
200
- }
201
- }
202
- },
203
- "16.6.0": {
204
- "version": "16.6.0-beta.0",
205
- "packages": {
206
- "expo": {
207
- "version": "^49.0.3",
208
- "alwaysAddToPackageJson": false
209
- },
210
- "@expo/metro-config": {
211
- "version": "~0.10.6",
212
- "alwaysAddToPackageJson": false
213
- },
214
- "expo-splash-screen": {
215
- "version": "~0.20.4",
216
- "alwaysAddToPackageJson": false
217
- },
218
- "expo-status-bar": {
219
- "version": "~1.6.0",
220
- "alwaysAddToPackageJson": false
221
- },
222
- "@expo/cli": {
223
- "version": "~0.10.10",
224
- "alwaysAddToPackageJson": false
225
- },
226
- "eas-cli": {
227
- "version": "~3.15.0",
228
- "alwaysAddToPackageJson": false
229
- },
230
- "babel-preset-expo": {
231
- "version": "~9.5.0",
232
- "alwaysAddToPackageJson": false
233
- },
234
- "jest-expo": {
235
- "version": "~49.0.0",
236
- "alwaysAddToPackageJson": false
237
- },
238
- "metro-resolver": {
239
- "version": "0.76.7",
240
- "alwaysAddToPackageJson": false
241
- },
242
- "metro": {
243
- "version": "0.76.7",
244
- "alwaysAddToPackageJson": false
245
- },
246
- "react-native": {
247
- "version": "0.72.3",
248
- "alwaysAddToPackageJson": false
249
- },
250
- "@types/react-native": {
251
- "version": "0.72.2",
252
- "alwaysAddToPackageJson": false
253
- },
254
- "react-native-web": {
255
- "version": "~0.19.6",
256
- "alwaysAddToPackageJson": false
257
- },
258
- "react-native-svg": {
259
- "version": "13.9.0",
260
- "alwaysAddToPackageJson": false
261
- }
262
- }
263
- },
264
- "16.9.0": {
265
- "version": "16.9.0-beta.1",
266
- "packages": {
267
- "expo": {
268
- "version": "49.0.10",
269
- "alwaysAddToPackageJson": false
270
- },
271
- "@expo/metro-config": {
272
- "version": "~0.10.7",
273
- "alwaysAddToPackageJson": false
274
- },
275
- "expo-splash-screen": {
276
- "version": "~0.20.5",
277
- "alwaysAddToPackageJson": false
278
- },
279
- "@expo/cli": {
280
- "version": "~0.10.12",
281
- "alwaysAddToPackageJson": false
282
- },
283
- "eas-cli": {
284
- "version": "~5.2.0",
285
- "alwaysAddToPackageJson": false
286
- },
287
- "babel-preset-expo": {
288
- "version": "~9.5.2",
289
- "alwaysAddToPackageJson": false
290
- },
291
- "react-native": {
292
- "version": "0.72.4",
293
- "alwaysAddToPackageJson": false
294
- },
295
- "react-native-web": {
296
- "version": "~0.19.8",
297
- "alwaysAddToPackageJson": false
298
- },
299
- "@testing-library/react-native": {
300
- "version": "~12.3.0",
301
- "alwaysAddToPackageJson": false
302
- },
303
- "@testing-library/jest-native": {
304
- "version": "~5.4.3",
305
- "alwaysAddToPackageJson": false
306
- }
307
- }
308
- },
309
47
  "17.1.0": {
310
48
  "version": "17.1.0-beta.0",
311
49
  "packages": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/expo",
3
- "version": "20.0.0-beta.4",
3
+ "version": "20.0.0-beta.6",
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,21 +28,20 @@
28
28
  "main": "./index",
29
29
  "types": "index.d.ts",
30
30
  "dependencies": {
31
- "@nx/devkit": "20.0.0-beta.4",
32
- "@nx/eslint": "20.0.0-beta.4",
33
- "@nx/jest": "20.0.0-beta.4",
34
- "@nx/js": "20.0.0-beta.4",
35
- "@nx/react": "20.0.0-beta.4",
36
- "@nx/web": "20.0.0-beta.4",
37
- "@nx/webpack": "20.0.0-beta.4",
31
+ "@nx/devkit": "20.0.0-beta.6",
32
+ "@nx/eslint": "20.0.0-beta.6",
33
+ "@nx/jest": "20.0.0-beta.6",
34
+ "@nx/js": "20.0.0-beta.6",
35
+ "@nx/react": "20.0.0-beta.6",
36
+ "@nx/web": "20.0.0-beta.6",
37
+ "@nx/webpack": "20.0.0-beta.6",
38
38
  "enhanced-resolve": "^5.8.3",
39
39
  "metro-config": "~0.80.4",
40
40
  "metro-resolver": "~0.80.4",
41
41
  "node-fetch": "^2.6.7",
42
42
  "picocolors": "^1.1.0",
43
43
  "tsconfig-paths": "^4.1.2",
44
- "tslib": "^2.3.0",
45
- "@nrwl/expo": "20.0.0-beta.4"
44
+ "tslib": "^2.3.0"
46
45
  },
47
46
  "executors": "./executors.json",
48
47
  "ng-update": {
package/project.json CHANGED
@@ -50,9 +50,6 @@
50
50
  "options": {
51
51
  "command": "node ./scripts/copy-readme.js expo"
52
52
  }
53
- },
54
- "add-extra-dependencies": {
55
- "command": "node ./scripts/add-dependency-to-build.js expo @nrwl/expo"
56
53
  }
57
54
  },
58
55
  "tags": []
@@ -25,8 +25,10 @@ async function installAndUpdatePackageJson(context, options) {
25
25
  const packages = typeof options.packages === 'string'
26
26
  ? options.packages.split(',')
27
27
  : options.packages ?? [];
28
- // Use force in case there are any unmet peer dependencies.
29
- await installAsync(packages, createInstallOptions(options), ['--force']);
28
+ await installAsync(packages, createInstallOptions({
29
+ fix: options.fix,
30
+ check: options.check,
31
+ }), createInstallOptions({ force: options.force }));
30
32
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
31
33
  const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
32
34
  const projectPackageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
@@ -4,4 +4,5 @@ export interface ExpoInstallOptions {
4
4
  packages?: string | string[]; // either a string separated by comma or a string array
5
5
  check?: boolean; // default is false
6
6
  fix?: boolean; // default is false
7
+ force?: boolean; // default is false
7
8
  }
@@ -29,6 +29,11 @@
29
29
  "type": "boolean",
30
30
  "description": "Automatically update any invalid package versions",
31
31
  "default": false
32
+ },
33
+ "force": {
34
+ "type": "boolean",
35
+ "description": "Force the installation of a package, even if it is already installed",
36
+ "default": false
32
37
  }
33
38
  }
34
39
  }
@@ -4,6 +4,7 @@ exports.expoApplicationGenerator = expoApplicationGenerator;
4
4
  exports.expoApplicationGeneratorInternal = expoApplicationGeneratorInternal;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
8
  const add_linting_1 = require("../../utils/add-linting");
8
9
  const add_jest_1 = require("../../utils/add-jest");
9
10
  const normalize_options_1 = require("./lib/normalize-options");
@@ -22,6 +23,7 @@ async function expoApplicationGenerator(host, schema) {
22
23
  });
23
24
  }
24
25
  async function expoApplicationGeneratorInternal(host, schema) {
26
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'expo', 'application');
25
27
  const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
26
28
  const tasks = [];
27
29
  const jsInitTask = await (0, js_1.initGenerator)(host, {
@@ -104,7 +104,6 @@ async function addE2e(tree, options) {
104
104
  ...options,
105
105
  e2eName: options.e2eProjectName,
106
106
  e2eDirectory: options.e2eProjectRoot,
107
- projectNameAndRootFormat: 'as-provided',
108
107
  appProject: options.projectName,
109
108
  appDisplayName: options.displayName,
110
109
  appName: options.name,
@@ -4,13 +4,12 @@ exports.normalizeOptions = normalizeOptions;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
6
  async function normalizeOptions(host, options) {
7
- const { projectName: appProjectName, names: projectNames, projectRoot: appProjectRoot, projectNameAndRootFormat, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
7
+ await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
8
+ const { projectName: appProjectName, names: projectNames, projectRoot: appProjectRoot, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
8
9
  name: options.name,
9
10
  projectType: 'application',
10
11
  directory: options.directory,
11
- projectNameAndRootFormat: options.projectNameAndRootFormat,
12
12
  });
13
- options.projectNameAndRootFormat = projectNameAndRootFormat;
14
13
  const nxJson = (0, devkit_1.readNxJson)(host);
15
14
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
16
15
  nxJson.useInferencePlugins !== false;
@@ -1,13 +1,11 @@
1
- import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
1
  import type { Linter, LinterType } from '@nx/eslint';
3
2
 
4
3
  export interface Schema {
5
- name: string;
4
+ directory: string;
5
+ name?: string;
6
6
  displayName?: string;
7
7
  style?: string;
8
8
  skipFormat: boolean; // default is false
9
- directory?: string;
10
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
11
9
  tags?: string;
12
10
  unitTestRunner: 'jest' | 'none'; // default is jest
13
11
  classComponent?: boolean;
@@ -15,29 +15,24 @@
15
15
  ],
16
16
  "type": "object",
17
17
  "properties": {
18
- "name": {
19
- "description": "The name of the application.",
18
+ "directory": {
19
+ "description": "The directory of the new application.",
20
20
  "type": "string",
21
21
  "$default": {
22
22
  "$source": "argv",
23
23
  "index": 0
24
24
  },
25
- "x-prompt": "What name would you like to use for the application?",
26
- "pattern": "^[a-zA-Z][^:]*$"
27
- },
28
- "displayName": {
29
- "description": "The display name to show in the application. Defaults to name.",
30
- "type": "string"
25
+ "x-prompt": "Which directory do you want to create the application in?"
31
26
  },
32
- "directory": {
33
- "description": "The directory of the new application.",
27
+ "name": {
28
+ "description": "The name of the application.",
34
29
  "type": "string",
30
+ "pattern": "^[a-zA-Z][^:]*$",
35
31
  "x-priority": "important"
36
32
  },
37
- "projectNameAndRootFormat": {
38
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
39
- "type": "string",
40
- "enum": ["as-provided", "derived"]
33
+ "displayName": {
34
+ "description": "The display name to show in the application. Defaults to name.",
35
+ "type": "string"
41
36
  },
42
37
  "skipFormat": {
43
38
  "description": "Skip formatting files",
@@ -90,5 +85,5 @@
90
85
  "default": false
91
86
  }
92
87
  },
93
- "required": ["name"]
88
+ "required": ["directory"]
94
89
  }
@@ -1,6 +1,7 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { Schema } from '../schema';
3
3
  export interface NormalizedSchema extends Schema {
4
+ directory: string;
4
5
  projectSourceRoot: string;
5
6
  fileName: string;
6
7
  className: string;
@@ -5,10 +5,9 @@ const devkit_1 = require("@nx/devkit");
5
5
  const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
6
6
  async function normalizeOptions(host, options) {
7
7
  assertValidOptions(options);
8
- const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(host, {
8
+ const { artifactName: name, fileName, filePath, directory, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(host, {
9
9
  name: options.name,
10
- directory: options.directory,
11
- nameAndDirectoryFormat: options.nameAndDirectoryFormat,
10
+ path: options.path,
12
11
  fileExtension: 'tsx',
13
12
  });
14
13
  const project = (0, devkit_1.getProjects)(host).get(projectName);
@@ -34,8 +33,8 @@ function assertValidOptions(options) {
34
33
  if (options.name.indexOf(s) !== -1) {
35
34
  const [name, ...rest] = options.name.split(s).reverse();
36
35
  let suggestion = rest.map((x) => x.toLowerCase()).join(s);
37
- if (options.directory) {
38
- suggestion = `${options.directory}${s}${suggestion}`;
36
+ if (options.path) {
37
+ suggestion = `${options.path}${s}${suggestion}`;
39
38
  }
40
39
  throw new Error(`Found "${s}" in the component name. Did you mean to use the --directory option (e.g. \`nx g c ${name} --directory ${suggestion}\`)?`);
41
40
  }
@@ -1,11 +1,9 @@
1
- import type { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
-
3
1
  /**
4
2
  * Same as the @nx/react library schema, except it removes keys: style, routing, globalCss
5
3
  */
6
4
  export interface Schema {
7
- name: string;
8
- directory?: string;
5
+ path: string;
6
+ name?: string;
9
7
  skipFormat: boolean; // default is false
10
8
  skipTests: boolean; // default is false
11
9
  export: boolean; // default is false
@@ -6,22 +6,28 @@
6
6
  "type": "object",
7
7
  "examples": [
8
8
  {
9
- "command": "g @nx/expo:component my-component --directory=mylib/my-component",
9
+ "command": "g @nx/expo:component mylib/my-component --name my-component",
10
10
  "description": "Generate a component in the mylib library"
11
11
  },
12
12
  {
13
- "command": "g @nx/expo:component my-component --directory=mylib/my-component --classComponent",
13
+ "command": "g @nx/expo:component mylib/my-component --name my-component --classComponent",
14
14
  "description": "Generate a class component in the mylib library"
15
15
  }
16
16
  ],
17
17
  "properties": {
18
- "name": {
18
+ "path": {
19
19
  "type": "string",
20
- "description": "The name of the component.",
20
+ "description": "Path where the component will be generated.",
21
21
  "$default": {
22
22
  "$source": "argv",
23
23
  "index": 0
24
24
  },
25
+ "x-prompt": "Where should the component be generated?",
26
+ "x-priority": "important"
27
+ },
28
+ "name": {
29
+ "type": "string",
30
+ "description": "The name of the component.",
25
31
  "x-prompt": "What name would you like to use for the component?"
26
32
  },
27
33
  "js": {
@@ -40,16 +46,6 @@
40
46
  "description": "When true, does not create \"spec.ts\" test files for the new component.",
41
47
  "default": false
42
48
  },
43
- "directory": {
44
- "type": "string",
45
- "description": "The directory at which to create the component file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the project root.",
46
- "x-priority": "important"
47
- },
48
- "nameAndDirectoryFormat": {
49
- "description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
50
- "type": "string",
51
- "enum": ["as-provided", "derived"]
52
- },
53
49
  "export": {
54
50
  "type": "boolean",
55
51
  "description": "When true, the component is exported from the project index.ts (if it exists).",
@@ -64,5 +60,5 @@
64
60
  "default": false
65
61
  }
66
62
  },
67
- "required": ["name"]
63
+ "required": ["path"]
68
64
  }
@@ -5,6 +5,7 @@ exports.expoInitGeneratorInternal = expoInitGeneratorInternal;
5
5
  exports.updateDependencies = updateDependencies;
6
6
  const devkit_1 = require("@nx/devkit");
7
7
  const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
8
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
9
  const plugin_1 = require("../../../plugins/plugin");
9
10
  const versions_1 = require("../../utils/versions");
10
11
  const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
@@ -12,6 +13,7 @@ function expoInitGenerator(tree, schema) {
12
13
  return expoInitGeneratorInternal(tree, { addPlugin: false, ...schema });
13
14
  }
14
15
  async function expoInitGeneratorInternal(host, schema) {
16
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'expo', 'init');
15
17
  const nxJson = (0, devkit_1.readNxJson)(host);
16
18
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
17
19
  nxJson.useInferencePlugins !== false;
@@ -4,12 +4,12 @@ exports.normalizeOptions = normalizeOptions;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
6
  async function normalizeOptions(host, options) {
7
+ await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
7
8
  const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
8
9
  name: options.name,
9
10
  projectType: 'library',
10
11
  directory: options.directory,
11
12
  importPath: options.importPath,
12
- projectNameAndRootFormat: options.projectNameAndRootFormat,
13
13
  });
14
14
  const nxJson = (0, devkit_1.readNxJson)(host);
15
15
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
@@ -4,6 +4,7 @@ exports.expoLibraryGenerator = expoLibraryGenerator;
4
4
  exports.expoLibraryGeneratorInternal = expoLibraryGeneratorInternal;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
8
  const init_1 = require("../init/init");
8
9
  const add_linting_1 = require("../../utils/add-linting");
9
10
  const add_jest_1 = require("../../utils/add-jest");
@@ -20,6 +21,7 @@ async function expoLibraryGenerator(host, schema) {
20
21
  });
21
22
  }
22
23
  async function expoLibraryGeneratorInternal(host, schema) {
24
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'expo', 'library');
23
25
  const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
24
26
  if (options.publishable === true && !schema.importPath) {
25
27
  throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
@@ -1,13 +1,11 @@
1
- import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
1
  import type { Linter, LinterType } from '@nx/eslint';
3
2
 
4
3
  /**
5
4
  * Same as the @nx/react library schema, except it removes keys: style, component, routing, appProject
6
5
  */
7
6
  export interface Schema {
8
- name: string;
9
- directory?: string;
10
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
7
+ directory: string;
8
+ name?: string;
11
9
  skipTsConfig: boolean; // default is false
12
10
  skipFormat: boolean; // default is false
13
11
  tags?: string;
@@ -11,26 +11,20 @@
11
11
  }
12
12
  ],
13
13
  "properties": {
14
- "name": {
14
+ "directory": {
15
15
  "type": "string",
16
- "description": "Library name",
16
+ "description": "A directory where the lib is placed.",
17
17
  "$default": {
18
18
  "$source": "argv",
19
19
  "index": 0
20
20
  },
21
- "x-prompt": "What name would you like to use for the library?",
22
- "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
21
+ "x-prompt": "Which directory do you want to create the library in?"
23
22
  },
24
- "directory": {
23
+ "name": {
25
24
  "type": "string",
26
- "description": "A directory where the lib is placed.",
25
+ "description": "Library name",
27
26
  "x-priority": "important"
28
27
  },
29
- "projectNameAndRootFormat": {
30
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
31
- "type": "string",
32
- "enum": ["as-provided", "derived"]
33
- },
34
28
  "linter": {
35
29
  "description": "The tool to use for running lint checks.",
36
30
  "type": "string",
@@ -94,5 +88,5 @@
94
88
  "default": false
95
89
  }
96
90
  },
97
- "required": ["name"]
91
+ "required": ["directory"]
98
92
  }
@@ -1,5 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- /**
3
- * Remove deprecated @expo/cli targets
4
- */
5
- export default function update(tree: Tree): Promise<void>;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = update;
4
- const devkit_1 = require("@nx/devkit");
5
- /**
6
- * Remove deprecated @expo/cli targets
7
- */
8
- async function update(tree) {
9
- const projects = (0, devkit_1.getProjects)(tree);
10
- for (const [name, config] of projects.entries()) {
11
- if (config.targets?.['start']?.executor === '@nrwl/expo:start' ||
12
- config.targets?.['start']?.executor === '@nx/expo:start') {
13
- const targetsToDelete = [
14
- 'build-ios',
15
- 'build-android',
16
- 'build-web',
17
- 'build-status',
18
- 'publish',
19
- 'publish-set',
20
- 'rollback',
21
- 'eject',
22
- ];
23
- targetsToDelete.forEach((target) => {
24
- if (config.targets[target]) {
25
- delete config.targets[target];
26
- }
27
- });
28
- (0, devkit_1.updateProjectConfiguration)(tree, name, config);
29
- }
30
- }
31
- await (0, devkit_1.formatFiles)(tree);
32
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function replacePackage(tree: Tree): Promise<void>;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = replacePackage;
4
- const devkit_1 = require("@nx/devkit");
5
- const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
6
- async function replacePackage(tree) {
7
- await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/expo', '@nx/expo');
8
- await (0, devkit_1.formatFiles)(tree);
9
- }
@@ -1,5 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- /**
3
- * Update app's package.json to use eas-build-post-install scripts.
4
- */
5
- export default function update(tree: Tree): void;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = update;
4
- const devkit_1 = require("@nx/devkit");
5
- const add_eas_scripts_1 = require("../../generators/application/lib/add-eas-scripts");
6
- const path_1 = require("path");
7
- /**
8
- * Update app's package.json to use eas-build-post-install scripts.
9
- */
10
- function update(tree) {
11
- const projects = (0, devkit_1.getProjects)(tree);
12
- for (const [name, config] of projects.entries()) {
13
- if (config.targets?.['start']?.executor === '@nrwl/expo:start' ||
14
- config.targets?.['start']?.executor === '@nx/expo:start') {
15
- try {
16
- (0, add_eas_scripts_1.addEasScripts)(tree);
17
- (0, devkit_1.updateJson)(tree, (0, path_1.join)(config.root, 'package.json'), (packageJson) => {
18
- if (packageJson.scripts?.['postinstall']) {
19
- delete packageJson.scripts['postinstall'];
20
- }
21
- const offset = (0, devkit_1.offsetFromRoot)(config.root);
22
- packageJson.scripts = {
23
- ...packageJson.scripts,
24
- 'eas-build-post-install': `cd ${offset} && node tools/scripts/eas-build-post-install.mjs . ${config.root}`,
25
- };
26
- return packageJson;
27
- });
28
- }
29
- catch {
30
- devkit_1.logger.error(`Unable to update package.json for project ${name}.`);
31
- }
32
- }
33
- }
34
- }
@@ -1,6 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- /**
3
- * This migration adds dependsOn to project.json.
4
- *
5
- */
6
- export default function update(tree: Tree): Promise<void>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = update;
4
- const devkit_1 = require("@nx/devkit");
5
- /**
6
- * This migration adds dependsOn to project.json.
7
- *
8
- */
9
- async function update(tree) {
10
- const projects = (0, devkit_1.getProjects)(tree);
11
- for (const [name, config] of projects.entries()) {
12
- if (config.targets?.['start']?.executor === '@nx/expo:start') {
13
- config.targets['start'].dependsOn = ['ensure-symlink', 'sync-deps'];
14
- }
15
- if (config.targets?.['run-ios']?.executor === '@nx/expo:run') {
16
- config.targets['run-ios'].dependsOn = ['ensure-symlink', 'sync-deps'];
17
- }
18
- if (config.targets?.['run-android']?.executor === '@nx/expo:run') {
19
- config.targets['run-android'].dependsOn = ['ensure-symlink', 'sync-deps'];
20
- }
21
- if (config.targets?.['prebuild']?.executor === '@nx/expo:prebuild') {
22
- config.targets['prebuild'].dependsOn = ['ensure-symlink', 'sync-deps'];
23
- }
24
- if (config.targets?.['export']?.executor === '@nx/expo:export') {
25
- config.targets['export'].dependsOn = ['ensure-symlink', 'sync-deps'];
26
- }
27
- (0, devkit_1.updateProjectConfiguration)(tree, name, config);
28
- }
29
- }
@@ -1,6 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- /**
3
- * This migration updates metro.config.js to export config as a default.
4
- *
5
- */
6
- export default function update(tree: Tree): Promise<void>;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = update;
4
- const devkit_1 = require("@nx/devkit");
5
- const path_1 = require("path");
6
- /**
7
- * This migration updates metro.config.js to export config as a default.
8
- *
9
- */
10
- async function update(tree) {
11
- const projects = (0, devkit_1.getProjects)(tree);
12
- for (const [_, config] of projects.entries()) {
13
- if (config.targets?.['start']?.executor === '@nx/expo:start') {
14
- if (tree.exists((0, path_1.join)(config.root, 'metro.config.js'))) {
15
- const oldConfig = tree
16
- .read((0, path_1.join)(config.root, 'metro.config.js'))
17
- .toString();
18
- tree.write((0, path_1.join)(config.root, 'metro-v71.config.js'), oldConfigComment + oldConfig);
19
- tree.write((0, path_1.join)(config.root, 'metro.config.js'), content);
20
- }
21
- }
22
- }
23
- }
24
- const oldConfigComment = `/**
25
- * Old custom configuration for React Native v0.71.
26
- * From @react-native/metro-config 0.72.1, it is no longer necessary to use a config function to access the complete default config.
27
- * Please port your custom configuration to metro.config.js.
28
- * Please see https://docs.expo.dev/guides/customizing-metro/ to learn about configuration.
29
- */
30
- `;
31
- const content = `
32
- const { withNxMetro } = require('@nx/expo');
33
- const { getDefaultConfig } = require('@expo/metro-config');
34
- const { mergeConfig } = require('metro-config');
35
-
36
- const defaultConfig = getDefaultConfig(__dirname);
37
- const { assetExts, sourceExts } = defaultConfig.resolver;
38
-
39
- /**
40
- * Metro configuration
41
- * https://facebook.github.io/metro/docs/configuration
42
- *
43
- * @type {import('metro-config').MetroConfig}
44
- */
45
- const customConfig = {
46
- transformer: {
47
- babelTransformerPath: require.resolve('react-native-svg-transformer'),
48
- },
49
- resolver: {
50
- assetExts: assetExts.filter((ext) => ext !== 'svg'),
51
- sourceExts: [...sourceExts, 'cjs', 'mjs', 'svg'],
52
- },
53
- };
54
-
55
-
56
- module.exports = withNxMetro(mergeConfig(defaultConfig, customConfig), {
57
- // Change this to true to see debugging info.
58
- // Useful if you have issues resolving modules
59
- debug: false,
60
- // all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx', 'json'
61
- extensions: [],
62
- // Specify folders to watch, in addition to Nx defaults (workspace libraries and node_modules)
63
- watchFolders: [],
64
- });
65
- `;
@@ -1,7 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- /**
3
- * Remove @types/react-native package since it is no longer required. It would be a part of react native package.
4
- * @param tree
5
- * @returns
6
- */
7
- export default function update(tree: Tree): Promise<void>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = update;
4
- const devkit_1 = require("@nx/devkit");
5
- /**
6
- * Remove @types/react-native package since it is no longer required. It would be a part of react native package.
7
- * @param tree
8
- * @returns
9
- */
10
- async function update(tree) {
11
- (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], ['@types/react-native']);
12
- await (0, devkit_1.formatFiles)(tree);
13
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function update(tree: Tree): Promise<void>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = update;
4
- const devkit_1 = require("@nx/devkit");
5
- async function update(tree) {
6
- const projects = (0, devkit_1.getProjects)(tree);
7
- for (const [name, config] of projects.entries()) {
8
- if (config.targets?.['start']?.executor === '@nx/expo:start') {
9
- (0, devkit_1.updateJson)(tree, `${config.root}/eas.json`, (easJson) => {
10
- if (easJson?.cli?.version) {
11
- easJson.cli.version = `>= 5`;
12
- }
13
- return easJson;
14
- });
15
- }
16
- }
17
- }