@nx/expo 17.3.0-beta.4 → 17.3.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.
- package/package.json +9 -9
- package/plugins/plugin.d.ts +1 -0
- package/plugins/plugin.js +10 -12
- package/src/generators/application/lib/add-project.js +6 -3
- package/src/generators/init/init.d.ts +1 -1
- package/src/generators/init/init.js +7 -10
- package/src/generators/init/schema.d.ts +1 -0
- package/src/generators/init/schema.json +6 -0
- package/src/generators/library/library.js +2 -0
- package/src/utils/has-expo-plugin.d.ts +2 -0
- package/src/utils/has-expo-plugin.js +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/expo",
|
|
3
|
-
"version": "17.3.0-beta.
|
|
3
|
+
"version": "17.3.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": [
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"tslib": "^2.3.0",
|
|
35
35
|
"tsconfig-paths": "^4.1.2",
|
|
36
36
|
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
37
|
-
"@nx/detox": "17.3.0-beta.
|
|
38
|
-
"@nx/devkit": "17.3.0-beta.
|
|
39
|
-
"@nx/jest": "17.3.0-beta.
|
|
40
|
-
"@nx/js": "17.3.0-beta.
|
|
41
|
-
"@nx/eslint": "17.3.0-beta.
|
|
42
|
-
"@nx/react": "17.3.0-beta.
|
|
43
|
-
"@nx/webpack": "17.3.0-beta.
|
|
44
|
-
"@nrwl/expo": "17.3.0-beta.
|
|
37
|
+
"@nx/detox": "17.3.0-beta.6",
|
|
38
|
+
"@nx/devkit": "17.3.0-beta.6",
|
|
39
|
+
"@nx/jest": "17.3.0-beta.6",
|
|
40
|
+
"@nx/js": "17.3.0-beta.6",
|
|
41
|
+
"@nx/eslint": "17.3.0-beta.6",
|
|
42
|
+
"@nx/react": "17.3.0-beta.6",
|
|
43
|
+
"@nx/webpack": "17.3.0-beta.6",
|
|
44
|
+
"@nrwl/expo": "17.3.0-beta.6"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"expo": ">= 49.0.0",
|
package/plugins/plugin.d.ts
CHANGED
package/plugins/plugin.js
CHANGED
|
@@ -30,7 +30,6 @@ exports.createNodes = [
|
|
|
30
30
|
// Do not create a project if package.json or project.json or metro.config.js isn't there.
|
|
31
31
|
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
32
32
|
if (!siblingFiles.includes('package.json') ||
|
|
33
|
-
!siblingFiles.includes('project.json') ||
|
|
34
33
|
!siblingFiles.includes('metro.config.js')) {
|
|
35
34
|
return {};
|
|
36
35
|
}
|
|
@@ -59,16 +58,17 @@ function buildExpoTargets(projectRoot, options, context) {
|
|
|
59
58
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
60
59
|
const targets = {
|
|
61
60
|
[options.startTargetName]: {
|
|
62
|
-
|
|
61
|
+
executor: `@nx/expo:start`,
|
|
62
|
+
},
|
|
63
|
+
[options.serveTargetName]: {
|
|
64
|
+
command: `expo start --web`,
|
|
63
65
|
options: { cwd: projectRoot },
|
|
64
66
|
},
|
|
65
67
|
[options.runIosTargetName]: {
|
|
66
|
-
|
|
67
|
-
options: { cwd: projectRoot },
|
|
68
|
+
executor: `@nx/expo:run-ios`,
|
|
68
69
|
},
|
|
69
70
|
[options.runAndroidTargetName]: {
|
|
70
|
-
|
|
71
|
-
options: { cwd: projectRoot },
|
|
71
|
+
executor: `@nx/expo:run-android`,
|
|
72
72
|
},
|
|
73
73
|
[options.exportTargetName]: {
|
|
74
74
|
command: `expo export`,
|
|
@@ -91,18 +91,15 @@ function buildExpoTargets(projectRoot, options, context) {
|
|
|
91
91
|
options: { cwd: devkit_1.workspaceRoot }, // install at workspace root
|
|
92
92
|
},
|
|
93
93
|
[options.prebuildTargetName]: {
|
|
94
|
-
|
|
95
|
-
options: { cwd: projectRoot },
|
|
94
|
+
executor: `@nx/expo:prebuild`,
|
|
96
95
|
},
|
|
97
96
|
[options.buildTargetName]: {
|
|
98
|
-
|
|
99
|
-
options: { cwd: projectRoot },
|
|
97
|
+
executor: `@nx/expo:build`,
|
|
100
98
|
dependsOn: [`^${options.buildTargetName}`],
|
|
101
99
|
inputs: getInputs(namedInputs),
|
|
102
100
|
},
|
|
103
101
|
[options.submitTargetName]: {
|
|
104
|
-
|
|
105
|
-
options: { cwd: projectRoot },
|
|
102
|
+
executor: `@nx/expo:submit`,
|
|
106
103
|
dependsOn: [`^${options.submitTargetName}`],
|
|
107
104
|
inputs: getInputs(namedInputs),
|
|
108
105
|
},
|
|
@@ -148,6 +145,7 @@ function load(path) {
|
|
|
148
145
|
function normalizeOptions(options) {
|
|
149
146
|
options ??= {};
|
|
150
147
|
options.startTargetName ??= 'start';
|
|
148
|
+
options.serveTargetName ??= 'serve';
|
|
151
149
|
options.runIosTargetName ??= 'run-ios';
|
|
152
150
|
options.runAndroidTargetName ??= 'run-android';
|
|
153
151
|
options.exportTargetName ??= 'export';
|
|
@@ -2,11 +2,14 @@
|
|
|
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) {
|
|
6
8
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
7
|
-
const hasPlugin =
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
}
|
|
10
13
|
const projectConfiguration = {
|
|
11
14
|
root: options.appProjectRoot,
|
|
12
15
|
sourceRoot: `${options.appProjectRoot}/src`,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from './schema';
|
|
3
3
|
export declare function expoInitGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
|
-
export declare function updateDependencies(host: Tree): GeneratorCallback;
|
|
4
|
+
export declare function updateDependencies(host: Tree, schema: Schema): GeneratorCallback;
|
|
5
5
|
export default expoInitGenerator;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateDependencies = exports.expoInitGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("../../utils/versions");
|
|
6
|
+
const has_expo_plugin_1 = require("../../utils/has-expo-plugin");
|
|
6
7
|
const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
|
|
7
8
|
async function expoInitGenerator(host, schema) {
|
|
8
9
|
(0, add_git_ignore_entry_1.addGitIgnoreEntry)(host);
|
|
@@ -12,7 +13,7 @@ async function expoInitGenerator(host, schema) {
|
|
|
12
13
|
const tasks = [];
|
|
13
14
|
if (!schema.skipPackageJson) {
|
|
14
15
|
tasks.push(moveDependency(host));
|
|
15
|
-
tasks.push(updateDependencies(host));
|
|
16
|
+
tasks.push(updateDependencies(host, schema));
|
|
16
17
|
}
|
|
17
18
|
if (!schema.skipFormat) {
|
|
18
19
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -20,7 +21,7 @@ async function expoInitGenerator(host, schema) {
|
|
|
20
21
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
21
22
|
}
|
|
22
23
|
exports.expoInitGenerator = expoInitGenerator;
|
|
23
|
-
function updateDependencies(host) {
|
|
24
|
+
function updateDependencies(host, schema) {
|
|
24
25
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
25
26
|
react: versions_1.reactVersion,
|
|
26
27
|
'react-dom': versions_1.reactDomVersion,
|
|
@@ -30,7 +31,7 @@ function updateDependencies(host) {
|
|
|
30
31
|
'@nx/expo': versions_1.nxVersion,
|
|
31
32
|
'@expo/cli': versions_1.expoCliVersion,
|
|
32
33
|
'eas-cli': versions_1.easCliVersion,
|
|
33
|
-
});
|
|
34
|
+
}, undefined, schema.keepExistingVersions);
|
|
34
35
|
}
|
|
35
36
|
exports.updateDependencies = updateDependencies;
|
|
36
37
|
function moveDependency(host) {
|
|
@@ -38,14 +39,10 @@ function moveDependency(host) {
|
|
|
38
39
|
}
|
|
39
40
|
function addPlugin(host) {
|
|
40
41
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (typeof plugin === 'string'
|
|
44
|
-
? plugin === '@nx/expo/plugin'
|
|
45
|
-
: plugin.plugin === '@nx/expo/plugin') {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
42
|
+
if ((0, has_expo_plugin_1.hasExpoPlugin)(host)) {
|
|
43
|
+
return;
|
|
48
44
|
}
|
|
45
|
+
nxJson.plugins ??= [];
|
|
49
46
|
nxJson.plugins.push({
|
|
50
47
|
plugin: '@nx/expo/plugin',
|
|
51
48
|
options: {
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"type": "boolean",
|
|
16
16
|
"default": false,
|
|
17
17
|
"description": "Do not add dependencies to `package.json`."
|
|
18
|
+
},
|
|
19
|
+
"keepExistingVersions": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"x-priority": "internal",
|
|
22
|
+
"description": "Keep existing dependencies versions",
|
|
23
|
+
"default": false
|
|
18
24
|
}
|
|
19
25
|
},
|
|
20
26
|
"required": []
|
|
@@ -10,6 +10,7 @@ const versions_1 = require("../../utils/versions");
|
|
|
10
10
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
11
11
|
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
12
12
|
const init_root_babel_config_1 = require("../../utils/init-root-babel-config");
|
|
13
|
+
const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
|
|
13
14
|
async function expoLibraryGenerator(host, schema) {
|
|
14
15
|
return await expoLibraryGeneratorInternal(host, {
|
|
15
16
|
projectNameAndRootFormat: 'derived',
|
|
@@ -82,6 +83,7 @@ async function addProject(host, options) {
|
|
|
82
83
|
skipFormat: true,
|
|
83
84
|
});
|
|
84
85
|
const external = ['react/jsx-runtime', 'react-native', 'react', 'react-dom'];
|
|
86
|
+
(0, add_build_target_defaults_1.addBuildTargetDefaults)(host, '@nx/rollup:rollup');
|
|
85
87
|
project.targets.build = {
|
|
86
88
|
executor: '@nx/rollup:rollup',
|
|
87
89
|
outputs: ['{options.outputPath}'],
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasExpoPlugin = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function hasExpoPlugin(tree) {
|
|
6
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
return !!nxJson.plugins?.some((p) => typeof p === 'string'
|
|
8
|
+
? p === '@nx/expo/plugin'
|
|
9
|
+
: p.plugin === '@nx/expo/plugin');
|
|
10
|
+
}
|
|
11
|
+
exports.hasExpoPlugin = hasExpoPlugin;
|