@nx/expo 16.8.0-beta.3 → 16.8.0-beta.5

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 (46) hide show
  1. package/package.json +10 -10
  2. package/plugins/metro-resolver.js +4 -5
  3. package/plugins/with-nx-metro.js +23 -27
  4. package/plugins/with-nx-webpack.js +34 -38
  5. package/src/executors/build/build.impl.js +21 -24
  6. package/src/executors/build-list/build-list.impl.js +14 -17
  7. package/src/executors/download/download.impl.js +46 -48
  8. package/src/executors/ensure-symlink/ensure-symlink.impl.js +4 -7
  9. package/src/executors/export/export.impl.js +12 -15
  10. package/src/executors/install/install.impl.js +13 -16
  11. package/src/executors/prebuild/prebuild.impl.js +17 -20
  12. package/src/executors/run/run.impl.js +25 -28
  13. package/src/executors/start/start.impl.js +15 -18
  14. package/src/executors/submit/submit.impl.js +10 -13
  15. package/src/executors/sync-deps/sync-deps.impl.js +32 -37
  16. package/src/executors/update/update.impl.js +13 -16
  17. package/src/generators/application/application.js +23 -21
  18. package/src/generators/application/lib/add-detox.js +16 -7
  19. package/src/generators/application/lib/add-project.js +1 -1
  20. package/src/generators/application/lib/create-application-files.js +6 -2
  21. package/src/generators/application/lib/normalize-options.js +24 -17
  22. package/src/generators/component/component.js +11 -11
  23. package/src/generators/component/lib/normalize-options.js +36 -37
  24. package/src/generators/init/init.js +27 -24
  25. package/src/generators/init/lib/add-git-ignore-entry.js +1 -2
  26. package/src/generators/library/lib/normalize-options.js +23 -20
  27. package/src/generators/library/library.js +95 -79
  28. package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.js +18 -22
  29. package/src/migrations/update-14-1-2/add-eject-target-14-1-2.js +11 -15
  30. package/src/migrations/update-14-4-3/add-eas-build-target.js +26 -30
  31. package/src/migrations/update-14-5-1/add-eas-update-target.js +12 -16
  32. package/src/migrations/update-15-0-3/add-new-expo-cli-targets.js +44 -48
  33. package/src/migrations/update-15-0-3/change-jest-preset.js +17 -21
  34. package/src/migrations/update-15-8-3/change-webpack-to-metro.js +18 -23
  35. package/src/migrations/update-16-0-0/add-jest-expo.js +15 -19
  36. package/src/migrations/update-16-0-0/remove-deprecated-targets.js +23 -27
  37. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
  38. package/src/migrations/update-16-1-4/add-detox-app-json.js +20 -24
  39. package/src/migrations/update-16-1-4/update-eas-scripts.js +9 -7
  40. package/src/migrations/update-16-2-2/add-submit-target.js +12 -16
  41. package/src/migrations/update-16-6-0/add-depends-on.js +11 -15
  42. package/src/migrations/update-16-6-0/update-metro-config.js +11 -15
  43. package/src/utils/add-jest.js +19 -22
  44. package/src/utils/add-linting.js +27 -30
  45. package/src/utils/find-all-npm-dependencies.js +1 -2
  46. package/src/utils/symlink-task.js +1 -1
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.expoInitSchematic = exports.updateDependencies = exports.expoInitGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const versions_1 = require("../../utils/versions");
7
6
  const jest_1 = require("@nx/jest");
@@ -9,29 +8,33 @@ const detox_1 = require("@nx/detox");
9
8
  const js_1 = require("@nx/js");
10
9
  const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
11
10
  const init_root_babel_config_1 = require("./lib/init-root-babel-config");
12
- function expoInitGenerator(host, schema) {
13
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
- (0, add_git_ignore_entry_1.addGitIgnoreEntry)(host);
15
- (0, init_root_babel_config_1.initRootBabelConfig)(host);
16
- const tasks = [];
17
- tasks.push(yield (0, js_1.initGenerator)(host, Object.assign(Object.assign({}, schema), { skipFormat: true })));
18
- if (!schema.skipPackageJson) {
19
- tasks.push(moveDependency(host));
20
- tasks.push(updateDependencies(host));
21
- }
22
- if (!schema.unitTestRunner || schema.unitTestRunner === 'jest') {
23
- const jestTask = yield (0, jest_1.jestInitGenerator)(host, schema);
24
- tasks.push(jestTask);
25
- }
26
- if (!schema.e2eTestRunner || schema.e2eTestRunner === 'detox') {
27
- const detoxTask = yield (0, detox_1.detoxInitGenerator)(host, Object.assign(Object.assign({}, schema), { skipFormat: true }));
28
- tasks.push(detoxTask);
29
- }
30
- if (!schema.skipFormat) {
31
- yield (0, devkit_1.formatFiles)(host);
32
- }
33
- return (0, devkit_1.runTasksInSerial)(...tasks);
34
- });
11
+ async function expoInitGenerator(host, schema) {
12
+ (0, add_git_ignore_entry_1.addGitIgnoreEntry)(host);
13
+ (0, init_root_babel_config_1.initRootBabelConfig)(host);
14
+ const tasks = [];
15
+ tasks.push(await (0, js_1.initGenerator)(host, {
16
+ ...schema,
17
+ skipFormat: true,
18
+ }));
19
+ if (!schema.skipPackageJson) {
20
+ tasks.push(moveDependency(host));
21
+ tasks.push(updateDependencies(host));
22
+ }
23
+ if (!schema.unitTestRunner || schema.unitTestRunner === 'jest') {
24
+ const jestTask = await (0, jest_1.jestInitGenerator)(host, schema);
25
+ tasks.push(jestTask);
26
+ }
27
+ if (!schema.e2eTestRunner || schema.e2eTestRunner === 'detox') {
28
+ const detoxTask = await (0, detox_1.detoxInitGenerator)(host, {
29
+ ...schema,
30
+ skipFormat: true,
31
+ });
32
+ tasks.push(detoxTask);
33
+ }
34
+ if (!schema.skipFormat) {
35
+ await (0, devkit_1.formatFiles)(host);
36
+ }
37
+ return (0, devkit_1.runTasksInSerial)(...tasks);
35
38
  }
36
39
  exports.expoInitGenerator = expoInitGenerator;
37
40
  function updateDependencies(host) {
@@ -4,12 +4,11 @@ exports.addGitIgnoreEntry = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const gitignore_entries_1 = require("./gitignore-entries");
6
6
  function addGitIgnoreEntry(host) {
7
- var _a;
8
7
  if (!host.exists('.gitignore')) {
9
8
  devkit_1.logger.warn(`Couldn't find .gitignore file to update`);
10
9
  return;
11
10
  }
12
- let content = (_a = host.read('.gitignore')) === null || _a === void 0 ? void 0 : _a.toString('utf-8').trimEnd();
11
+ let content = host.read('.gitignore')?.toString('utf-8').trimEnd();
13
12
  if (!/\.expo\/$/gm.test(content)) {
14
13
  content = `${content}\n${gitignore_entries_1.gitIgnoreEntriesForExpo}\n`;
15
14
  }
@@ -1,27 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
- function normalizeOptions(host, options) {
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- const { projectName, names: projectNames, projectRoot, importPath, } = yield (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
9
- name: options.name,
10
- projectType: 'library',
11
- directory: options.directory,
12
- importPath: options.importPath,
13
- projectNameAndRootFormat: options.projectNameAndRootFormat,
14
- callingGenerator: '@nx/expo:library',
15
- });
16
- const parsedTags = options.tags
17
- ? options.tags.split(',').map((s) => s.trim())
18
- : [];
19
- const appMain = options.js ? 'src/index.js' : 'src/index.ts';
20
- const normalized = Object.assign(Object.assign({}, options), { fileName: projectName, routePath: `/${projectNames.projectSimpleName}`, name: projectName, projectRoot,
21
- parsedTags,
22
- importPath,
23
- appMain });
24
- return normalized;
5
+ async function normalizeOptions(host, options) {
6
+ const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
7
+ name: options.name,
8
+ projectType: 'library',
9
+ directory: options.directory,
10
+ importPath: options.importPath,
11
+ projectNameAndRootFormat: options.projectNameAndRootFormat,
12
+ callingGenerator: '@nx/expo:library',
25
13
  });
14
+ const parsedTags = options.tags
15
+ ? options.tags.split(',').map((s) => s.trim())
16
+ : [];
17
+ const appMain = options.js ? 'src/index.js' : 'src/index.ts';
18
+ const normalized = {
19
+ ...options,
20
+ fileName: projectName,
21
+ routePath: `/${projectNames.projectSimpleName}`,
22
+ name: projectName,
23
+ projectRoot,
24
+ parsedTags,
25
+ importPath,
26
+ appMain,
27
+ };
28
+ return normalized;
26
29
  }
27
30
  exports.normalizeOptions = normalizeOptions;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.expoLibrarySchematic = exports.expoLibraryGeneratorInternal = exports.expoLibraryGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const js_1 = require("@nx/js");
7
6
  const init_1 = require("../init/init");
@@ -9,100 +8,117 @@ const add_linting_1 = require("../../utils/add-linting");
9
8
  const add_jest_1 = require("../../utils/add-jest");
10
9
  const versions_1 = require("../../utils/versions");
11
10
  const normalize_options_1 = require("./lib/normalize-options");
12
- function expoLibraryGenerator(host, schema) {
13
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
- return yield expoLibraryGeneratorInternal(host, Object.assign({ projectNameAndRootFormat: 'derived' }, schema));
11
+ async function expoLibraryGenerator(host, schema) {
12
+ return await expoLibraryGeneratorInternal(host, {
13
+ projectNameAndRootFormat: 'derived',
14
+ ...schema,
15
15
  });
16
16
  }
17
17
  exports.expoLibraryGenerator = expoLibraryGenerator;
18
- function expoLibraryGeneratorInternal(host, schema) {
19
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
- const options = yield (0, normalize_options_1.normalizeOptions)(host, schema);
21
- if (options.publishable === true && !schema.importPath) {
22
- 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)`);
23
- }
24
- const tasks = [];
25
- const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { skipFormat: true, e2eTestRunner: 'none' }));
26
- tasks.push(initTask);
27
- const addProjectTask = yield addProject(host, options);
28
- if (addProjectTask) {
29
- tasks.push(addProjectTask);
30
- }
31
- createFiles(host, options);
32
- const lintTask = yield (0, add_linting_1.addLinting)(host, Object.assign(Object.assign({}, options), { projectName: options.name, tsConfigPaths: [
33
- (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
34
- ] }));
35
- tasks.push(lintTask);
36
- const jestTask = yield (0, add_jest_1.addJest)(host, options.unitTestRunner, options.name, options.projectRoot, options.js, options.skipPackageJson);
37
- tasks.push(jestTask);
38
- if (options.publishable || options.buildable) {
39
- updateLibPackageNpmScope(host, options);
40
- }
41
- if (!options.skipTsConfig) {
42
- (0, js_1.addTsConfigPath)(host, options.importPath, [
43
- (0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
44
- ]);
45
- }
46
- if (!options.skipFormat) {
47
- yield (0, devkit_1.formatFiles)(host);
48
- }
49
- return (0, devkit_1.runTasksInSerial)(...tasks);
18
+ async function expoLibraryGeneratorInternal(host, schema) {
19
+ const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
20
+ if (options.publishable === true && !schema.importPath) {
21
+ 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)`);
22
+ }
23
+ const tasks = [];
24
+ const initTask = await (0, init_1.default)(host, {
25
+ ...options,
26
+ skipFormat: true,
27
+ e2eTestRunner: 'none',
28
+ });
29
+ tasks.push(initTask);
30
+ const addProjectTask = await addProject(host, options);
31
+ if (addProjectTask) {
32
+ tasks.push(addProjectTask);
33
+ }
34
+ createFiles(host, options);
35
+ const lintTask = await (0, add_linting_1.addLinting)(host, {
36
+ ...options,
37
+ projectName: options.name,
38
+ tsConfigPaths: [
39
+ (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
40
+ ],
50
41
  });
42
+ tasks.push(lintTask);
43
+ const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.name, options.projectRoot, options.js, options.skipPackageJson);
44
+ tasks.push(jestTask);
45
+ if (options.publishable || options.buildable) {
46
+ updateLibPackageNpmScope(host, options);
47
+ }
48
+ if (!options.skipTsConfig) {
49
+ (0, js_1.addTsConfigPath)(host, options.importPath, [
50
+ (0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
51
+ ]);
52
+ }
53
+ if (!options.skipFormat) {
54
+ await (0, devkit_1.formatFiles)(host);
55
+ }
56
+ return (0, devkit_1.runTasksInSerial)(...tasks);
51
57
  }
52
58
  exports.expoLibraryGeneratorInternal = expoLibraryGeneratorInternal;
53
- function addProject(host, options) {
54
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
55
- const targets = {};
56
- let task;
57
- if (options.publishable || options.buildable) {
58
- const { rollupInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rollup', versions_1.nxVersion);
59
- const external = [
60
- 'react/jsx-runtime',
61
- 'react-native',
62
- 'react',
63
- 'react-dom',
64
- ];
65
- targets.build = {
66
- executor: '@nx/rollup:rollup',
67
- outputs: ['{options.outputPath}'],
68
- options: {
69
- outputPath: `dist/${options.projectRoot}`,
70
- tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
71
- project: `${options.projectRoot}/package.json`,
72
- entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`),
73
- external,
74
- rollupConfig: `@nx/react/plugins/bundle-rollup`,
75
- assets: [
76
- {
77
- glob: `${options.projectRoot}/README.md`,
78
- input: '.',
79
- output: '.',
80
- },
81
- ],
82
- },
83
- };
84
- task = yield rollupInitGenerator(host, Object.assign(Object.assign({}, options), { skipFormat: true }));
85
- }
86
- (0, devkit_1.addProjectConfiguration)(host, options.name, {
87
- root: options.projectRoot,
88
- sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
89
- projectType: 'library',
90
- tags: options.parsedTags,
91
- targets,
92
- });
93
- return task;
59
+ async function addProject(host, options) {
60
+ const targets = {};
61
+ let task;
62
+ if (options.publishable || options.buildable) {
63
+ const { rollupInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rollup', versions_1.nxVersion);
64
+ const external = [
65
+ 'react/jsx-runtime',
66
+ 'react-native',
67
+ 'react',
68
+ 'react-dom',
69
+ ];
70
+ targets.build = {
71
+ executor: '@nx/rollup:rollup',
72
+ outputs: ['{options.outputPath}'],
73
+ options: {
74
+ outputPath: `dist/${options.projectRoot}`,
75
+ tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
76
+ project: `${options.projectRoot}/package.json`,
77
+ entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`),
78
+ external,
79
+ rollupConfig: `@nx/react/plugins/bundle-rollup`,
80
+ assets: [
81
+ {
82
+ glob: `${options.projectRoot}/README.md`,
83
+ input: '.',
84
+ output: '.',
85
+ },
86
+ ],
87
+ },
88
+ };
89
+ task = await rollupInitGenerator(host, { ...options, skipFormat: true });
90
+ }
91
+ (0, devkit_1.addProjectConfiguration)(host, options.name, {
92
+ root: options.projectRoot,
93
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
94
+ projectType: 'library',
95
+ tags: options.parsedTags,
96
+ targets,
94
97
  });
98
+ return task;
95
99
  }
96
100
  function updateTsConfig(tree, options) {
97
101
  (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.json'), (json) => {
98
102
  if (options.strict) {
99
- json.compilerOptions = Object.assign(Object.assign({}, json.compilerOptions), { forceConsistentCasingInFileNames: true, strict: true, noImplicitReturns: true, noFallthroughCasesInSwitch: true });
103
+ json.compilerOptions = {
104
+ ...json.compilerOptions,
105
+ forceConsistentCasingInFileNames: true,
106
+ strict: true,
107
+ noImplicitReturns: true,
108
+ noFallthroughCasesInSwitch: true,
109
+ };
100
110
  }
101
111
  return json;
102
112
  });
103
113
  }
104
114
  function createFiles(host, options) {
105
- (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/lib'), options.projectRoot, Object.assign(Object.assign(Object.assign({}, options), (0, devkit_1.names)(options.name)), { tmpl: '', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot) }));
115
+ (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/lib'), options.projectRoot, {
116
+ ...options,
117
+ ...(0, devkit_1.names)(options.name),
118
+ tmpl: '',
119
+ offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot),
120
+ rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot),
121
+ });
106
122
  if (!options.publishable && !options.buildable) {
107
123
  host.delete(`${options.projectRoot}/package.json`);
108
124
  }
@@ -1,34 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  /**
6
5
  * Add projectRoot and watchFolders options in metro.config.js
7
6
  * @param tree
8
7
  */
9
- function update(tree) {
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- const projects = (0, devkit_1.getProjects)(tree);
12
- projects.forEach((project) => {
13
- var _a, _b;
14
- const metroConfigPath = `${project.root}/metro.config.js`;
15
- if (((_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.executor) !== '@nrwl/react-native:start' ||
16
- !tree.exists(metroConfigPath))
8
+ async function update(tree) {
9
+ const projects = (0, devkit_1.getProjects)(tree);
10
+ projects.forEach((project) => {
11
+ const metroConfigPath = `${project.root}/metro.config.js`;
12
+ if (project.targets?.start?.executor !== '@nrwl/react-native:start' ||
13
+ !tree.exists(metroConfigPath))
14
+ return;
15
+ try {
16
+ const metroConfigContent = tree.read(metroConfigPath, 'utf-8');
17
+ if (metroConfigContent.includes('projectRoot: __dirname')) {
17
18
  return;
18
- try {
19
- const metroConfigContent = tree.read(metroConfigPath, 'utf-8');
20
- if (metroConfigContent.includes('projectRoot: __dirname')) {
21
- return;
22
- }
23
- if (metroConfigContent.includes('projectRoot'))
24
- return;
25
- tree.write(metroConfigPath, metroConfigContent.replace('debug: ', 'projectRoot: __dirname, watchFolders: [], debug: '));
26
19
  }
27
- catch (_c) {
28
- devkit_1.logger.error((0, devkit_1.stripIndents) `Unable to update ${metroConfigPath} for project ${project.root}.`);
29
- }
30
- });
31
- yield (0, devkit_1.formatFiles)(tree);
20
+ if (metroConfigContent.includes('projectRoot'))
21
+ return;
22
+ tree.write(metroConfigPath, metroConfigContent.replace('debug: ', 'projectRoot: __dirname, watchFolders: [], debug: '));
23
+ }
24
+ catch {
25
+ devkit_1.logger.error((0, devkit_1.stripIndents) `Unable to update ${metroConfigPath} for project ${project.root}.`);
26
+ }
32
27
  });
28
+ await (0, devkit_1.formatFiles)(tree);
33
29
  }
34
30
  exports.default = update;
@@ -1,24 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  /**
6
5
  * Add eject to targets for expo app
7
6
  */
8
- function update(tree) {
9
- var _a, _b;
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- const projects = (0, devkit_1.getProjects)(tree);
12
- for (const [name, config] of projects.entries()) {
13
- if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a['start']) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/expo:start') {
14
- config.targets['eject'] = {
15
- executor: '@nrwl/expo:eject',
16
- options: {},
17
- };
18
- }
19
- (0, devkit_1.updateProjectConfiguration)(tree, name, config);
7
+ async function update(tree) {
8
+ const projects = (0, devkit_1.getProjects)(tree);
9
+ for (const [name, config] of projects.entries()) {
10
+ if (config.targets?.['start']?.executor === '@nrwl/expo:start') {
11
+ config.targets['eject'] = {
12
+ executor: '@nrwl/expo:eject',
13
+ options: {},
14
+ };
20
15
  }
21
- yield (0, devkit_1.formatFiles)(tree);
22
- });
16
+ (0, devkit_1.updateProjectConfiguration)(tree, name, config);
17
+ }
18
+ await (0, devkit_1.formatFiles)(tree);
23
19
  }
24
20
  exports.default = update;
@@ -1,41 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const path_1 = require("path");
6
5
  /**
7
6
  * Add eas build and build-list target for expo
8
7
  */
9
- function update(tree) {
10
- var _a, _b;
11
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
- const projects = (0, devkit_1.getProjects)(tree);
13
- for (const [name, config] of projects.entries()) {
14
- if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a['start']) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/expo:start') {
15
- if (!config.targets['build']) {
16
- config.targets['build'] = {
17
- executor: '@nrwl/expo:build',
18
- options: {},
19
- };
20
- }
21
- if (!config.targets['build-list']) {
22
- config.targets['build-list'] = {
23
- executor: '@nrwl/expo:build-list',
24
- options: {},
25
- };
26
- }
27
- if (!config.targets['download']) {
28
- config.targets['download'] = {
29
- executor: '@nrwl/expo:download',
30
- options: {
31
- output: (0, path_1.join)(config.root, 'dist'),
32
- },
33
- };
34
- }
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
+ if (!config.targets['build']) {
13
+ config.targets['build'] = {
14
+ executor: '@nrwl/expo:build',
15
+ options: {},
16
+ };
17
+ }
18
+ if (!config.targets['build-list']) {
19
+ config.targets['build-list'] = {
20
+ executor: '@nrwl/expo:build-list',
21
+ options: {},
22
+ };
23
+ }
24
+ if (!config.targets['download']) {
25
+ config.targets['download'] = {
26
+ executor: '@nrwl/expo:download',
27
+ options: {
28
+ output: (0, path_1.join)(config.root, 'dist'),
29
+ },
30
+ };
35
31
  }
36
- (0, devkit_1.updateProjectConfiguration)(tree, name, config);
37
32
  }
38
- yield (0, devkit_1.formatFiles)(tree);
39
- });
33
+ (0, devkit_1.updateProjectConfiguration)(tree, name, config);
34
+ }
35
+ await (0, devkit_1.formatFiles)(tree);
40
36
  }
41
37
  exports.default = update;
@@ -1,26 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  /**
6
5
  * Add eas update target for expo
7
6
  */
8
- function update(tree) {
9
- var _a, _b;
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- const projects = (0, devkit_1.getProjects)(tree);
12
- for (const [name, config] of projects.entries()) {
13
- if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a['start']) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/expo:start') {
14
- if (!config.targets['update']) {
15
- config.targets['update'] = {
16
- executor: '@nrwl/expo:update',
17
- options: {},
18
- };
19
- }
20
- (0, devkit_1.updateProjectConfiguration)(tree, name, config);
7
+ async function update(tree) {
8
+ const projects = (0, devkit_1.getProjects)(tree);
9
+ for (const [name, config] of projects.entries()) {
10
+ if (config.targets?.['start']?.executor === '@nrwl/expo:start') {
11
+ if (!config.targets['update']) {
12
+ config.targets['update'] = {
13
+ executor: '@nrwl/expo:update',
14
+ options: {},
15
+ };
21
16
  }
17
+ (0, devkit_1.updateProjectConfiguration)(tree, name, config);
22
18
  }
23
- yield (0, devkit_1.formatFiles)(tree);
24
- });
19
+ }
20
+ await (0, devkit_1.formatFiles)(tree);
25
21
  }
26
22
  exports.default = update;