@nx/expo 21.0.0-beta.1 → 21.0.0-beta.11
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/migrations.json +0 -114
- package/package.json +8 -8
- package/project.json +2 -5
- package/src/generators/application/application.js +6 -5
- package/src/generators/application/lib/add-e2e.js +28 -54
- package/src/generators/application/lib/add-project.js +21 -18
- package/src/generators/application/lib/create-application-files.js +1 -10
- package/src/generators/application/lib/normalize-options.d.ts +3 -1
- package/src/generators/application/lib/normalize-options.js +10 -5
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +4 -0
- package/src/generators/component/component.js +3 -1
- package/src/generators/component/lib/normalize-options.d.ts +1 -0
- package/src/generators/component/lib/normalize-options.js +1 -0
- package/src/generators/init/init.js +1 -1
- package/src/generators/library/files/lib/README.md +2 -2
- package/src/generators/library/lib/normalize-options.d.ts +3 -3
- package/src/generators/library/lib/normalize-options.js +6 -5
- package/src/generators/library/library.js +98 -81
- package/src/generators/library/schema.d.ts +1 -0
- package/src/generators/library/schema.json +4 -0
- package/src/utils/add-linting.js +1 -1
- package/src/generators/library/files/lib/package.json.template +0 -5
- package/src/migrations/update-18-0-0/change-outputDir-export-target.d.ts +0 -5
- package/src/migrations/update-18-0-0/change-outputDir-export-target.js +0 -25
- package/src/migrations/update-18-0-0/remove-block-list.d.ts +0 -6
- package/src/migrations/update-18-0-0/remove-block-list.js +0 -28
- package/src/migrations/update-18-0-0/remove-eas-cli.d.ts +0 -12
- package/src/migrations/update-18-0-0/remove-eas-cli.js +0 -18
- package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +0 -6
- package/src/migrations/update-18-0-0/remove-symlink-target.js +0 -29
package/migrations.json
CHANGED
|
@@ -1,29 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generators": {
|
|
3
|
-
"update-18-0-0-remove-block-list": {
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"version": "18.0.0-beta.0",
|
|
6
|
-
"description": "Remove blockList in metro.config.js",
|
|
7
|
-
"implementation": "./src/migrations/update-18-0-0/remove-block-list"
|
|
8
|
-
},
|
|
9
|
-
"update-18-0-0-remove-symlink-target": {
|
|
10
|
-
"cli": "nx",
|
|
11
|
-
"version": "18.0.0-beta.0",
|
|
12
|
-
"description": "Remove symlink target in project.json",
|
|
13
|
-
"implementation": "./src/migrations/update-18-0-0/remove-symlink-target"
|
|
14
|
-
},
|
|
15
|
-
"update-18-0-0-remove-eas-cli": {
|
|
16
|
-
"cli": "nx",
|
|
17
|
-
"version": "18.0.0-beta.0",
|
|
18
|
-
"description": "Remove eas-cli from package.json",
|
|
19
|
-
"implementation": "./src/migrations/update-18-0-0/remove-eas-cli"
|
|
20
|
-
},
|
|
21
|
-
"update-18-0-0-remove-offset-export-outputDir": {
|
|
22
|
-
"cli": "nx",
|
|
23
|
-
"version": "18.0.0-beta.0",
|
|
24
|
-
"description": "Remove the offset from the outputDir of the export target",
|
|
25
|
-
"implementation": "./src/migrations/update-18-0-0/change-outputDir-export-target"
|
|
26
|
-
},
|
|
27
3
|
"update-19-0-0-change-webpack-to-metro": {
|
|
28
4
|
"version": "19.0.0-beta.9",
|
|
29
5
|
"cli": "nx",
|
|
@@ -44,96 +20,6 @@
|
|
|
44
20
|
}
|
|
45
21
|
},
|
|
46
22
|
"packageJsonUpdates": {
|
|
47
|
-
"17.1.0": {
|
|
48
|
-
"version": "17.1.0-beta.0",
|
|
49
|
-
"packages": {
|
|
50
|
-
"expo": {
|
|
51
|
-
"version": "49.0.16",
|
|
52
|
-
"alwaysAddToPackageJson": false
|
|
53
|
-
},
|
|
54
|
-
"@expo/cli": {
|
|
55
|
-
"version": "~0.10.13",
|
|
56
|
-
"alwaysAddToPackageJson": false
|
|
57
|
-
},
|
|
58
|
-
"react-native": {
|
|
59
|
-
"version": "0.72.6",
|
|
60
|
-
"alwaysAddToPackageJson": false
|
|
61
|
-
},
|
|
62
|
-
"react-native-web": {
|
|
63
|
-
"version": "~0.19.9",
|
|
64
|
-
"alwaysAddToPackageJson": false
|
|
65
|
-
},
|
|
66
|
-
"metro-resolver": {
|
|
67
|
-
"version": "0.76.8",
|
|
68
|
-
"alwaysAddToPackageJson": false
|
|
69
|
-
},
|
|
70
|
-
"metro": {
|
|
71
|
-
"version": "0.76.8",
|
|
72
|
-
"alwaysAddToPackageJson": false
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"18.0.0": {
|
|
77
|
-
"version": "18.0.0-beta.0",
|
|
78
|
-
"packages": {
|
|
79
|
-
"expo": {
|
|
80
|
-
"version": "50.0.1",
|
|
81
|
-
"alwaysAddToPackageJson": false
|
|
82
|
-
},
|
|
83
|
-
"expo-splash-screen": {
|
|
84
|
-
"version": "~0.26.1",
|
|
85
|
-
"alwaysAddToPackageJson": false
|
|
86
|
-
},
|
|
87
|
-
"expo-status-bar": {
|
|
88
|
-
"version": "~1.11.1",
|
|
89
|
-
"alwaysAddToPackageJson": false
|
|
90
|
-
},
|
|
91
|
-
"@expo/cli": {
|
|
92
|
-
"version": "~0.16.5",
|
|
93
|
-
"alwaysAddToPackageJson": false
|
|
94
|
-
},
|
|
95
|
-
"babel-preset-expo": {
|
|
96
|
-
"version": "~10.0.0",
|
|
97
|
-
"alwaysAddToPackageJson": false
|
|
98
|
-
},
|
|
99
|
-
"@types/react": {
|
|
100
|
-
"version": "~18.2.45",
|
|
101
|
-
"alwaysAddToPackageJson": false
|
|
102
|
-
},
|
|
103
|
-
"react-native": {
|
|
104
|
-
"version": "~0.73.2",
|
|
105
|
-
"alwaysAddToPackageJson": false
|
|
106
|
-
},
|
|
107
|
-
"react-native-web": {
|
|
108
|
-
"version": "~0.19.9",
|
|
109
|
-
"alwaysAddToPackageJson": false
|
|
110
|
-
},
|
|
111
|
-
"@expo/metro-config": {
|
|
112
|
-
"version": "~0.17.3",
|
|
113
|
-
"alwaysAddToPackageJson": false
|
|
114
|
-
},
|
|
115
|
-
"@expo/metro-runtime": {
|
|
116
|
-
"version": "~3.1.1",
|
|
117
|
-
"addToPackageJson": "devDependencies"
|
|
118
|
-
},
|
|
119
|
-
"react-native-svg-transformer": {
|
|
120
|
-
"version": "1.2.0",
|
|
121
|
-
"alwaysAddToPackageJson": false
|
|
122
|
-
},
|
|
123
|
-
"react-native-svg": {
|
|
124
|
-
"version": "14.1.0",
|
|
125
|
-
"alwaysAddToPackageJson": false
|
|
126
|
-
},
|
|
127
|
-
"@testing-library/react-native": {
|
|
128
|
-
"version": "~12.4.2",
|
|
129
|
-
"alwaysAddToPackageJson": false
|
|
130
|
-
},
|
|
131
|
-
"jest-expo": {
|
|
132
|
-
"version": "~50.0.1",
|
|
133
|
-
"alwaysAddToPackageJson": false
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
23
|
"19.0.0": {
|
|
138
24
|
"version": "19.0.0-beta.7",
|
|
139
25
|
"packages": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/expo",
|
|
3
|
-
"version": "21.0.0-beta.
|
|
3
|
+
"version": "21.0.0-beta.11",
|
|
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,13 +28,13 @@
|
|
|
28
28
|
"main": "./index",
|
|
29
29
|
"types": "index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nx/devkit": "21.0.0-beta.
|
|
32
|
-
"@nx/eslint": "21.0.0-beta.
|
|
33
|
-
"@nx/jest": "21.0.0-beta.
|
|
34
|
-
"@nx/js": "21.0.0-beta.
|
|
35
|
-
"@nx/react": "21.0.0-beta.
|
|
36
|
-
"@nx/web": "21.0.0-beta.
|
|
37
|
-
"@nx/webpack": "21.0.0-beta.
|
|
31
|
+
"@nx/devkit": "21.0.0-beta.11",
|
|
32
|
+
"@nx/eslint": "21.0.0-beta.11",
|
|
33
|
+
"@nx/jest": "21.0.0-beta.11",
|
|
34
|
+
"@nx/js": "21.0.0-beta.11",
|
|
35
|
+
"@nx/react": "21.0.0-beta.11",
|
|
36
|
+
"@nx/web": "21.0.0-beta.11",
|
|
37
|
+
"@nx/webpack": "21.0.0-beta.11",
|
|
38
38
|
"enhanced-resolve": "^5.8.3",
|
|
39
39
|
"metro-config": "~0.80.4",
|
|
40
40
|
"metro-resolver": "~0.80.4",
|
package/project.json
CHANGED
|
@@ -45,11 +45,8 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"build": {
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"options": {
|
|
51
|
-
"command": "node ./scripts/copy-readme.js expo"
|
|
52
|
-
}
|
|
48
|
+
"outputs": ["{workspaceRoot}/build/packages/expo/README.md"],
|
|
49
|
+
"command": "node ./scripts/copy-readme.js expo"
|
|
53
50
|
}
|
|
54
51
|
},
|
|
55
52
|
"tags": []
|
|
@@ -20,6 +20,7 @@ const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
|
20
20
|
async function expoApplicationGenerator(host, schema) {
|
|
21
21
|
return await expoApplicationGeneratorInternal(host, {
|
|
22
22
|
addPlugin: false,
|
|
23
|
+
useProjectJson: true,
|
|
23
24
|
...schema,
|
|
24
25
|
});
|
|
25
26
|
}
|
|
@@ -42,6 +43,11 @@ async function expoApplicationGeneratorInternal(host, schema) {
|
|
|
42
43
|
(0, init_root_babel_config_1.initRootBabelConfig)(host);
|
|
43
44
|
await (0, create_application_files_1.createApplicationFiles)(host, options);
|
|
44
45
|
(0, add_project_1.addProject)(host, options);
|
|
46
|
+
// If we are using the new TS solution
|
|
47
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
48
|
+
if (options.isTsSolutionSetup) {
|
|
49
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
50
|
+
}
|
|
45
51
|
const lintTask = await (0, add_linting_1.addLinting)(host, {
|
|
46
52
|
...options,
|
|
47
53
|
projectRoot: options.appProjectRoot,
|
|
@@ -63,11 +69,6 @@ async function expoApplicationGeneratorInternal(host, schema) {
|
|
|
63
69
|
}, options.linter === 'eslint'
|
|
64
70
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
65
71
|
: undefined);
|
|
66
|
-
// If we are using the new TS solution
|
|
67
|
-
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
68
|
-
if (options.useTsSolution) {
|
|
69
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
70
|
-
}
|
|
71
72
|
(0, sort_fields_1.sortPackageJsonFields)(host, options.appProjectRoot);
|
|
72
73
|
if (!options.skipFormat) {
|
|
73
74
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addE2e = addE2e;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
5
6
|
const web_1 = require("@nx/web");
|
|
6
|
-
const versions_1 = require("../../../utils/versions");
|
|
7
7
|
const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
|
|
8
|
-
const
|
|
9
|
-
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
10
|
-
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
11
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
+
const versions_1 = require("../../../utils/versions");
|
|
12
9
|
async function addE2e(tree, options) {
|
|
13
10
|
const hasPlugin = (0, has_expo_plugin_1.hasExpoPlugin)(tree);
|
|
14
11
|
if (!hasPlugin) {
|
|
@@ -21,17 +18,15 @@ async function addE2e(tree, options) {
|
|
|
21
18
|
switch (options.e2eTestRunner) {
|
|
22
19
|
case 'cypress': {
|
|
23
20
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
});
|
|
21
|
+
const packageJson = {
|
|
22
|
+
name: options.e2eProjectName,
|
|
23
|
+
version: '0.0.1',
|
|
24
|
+
private: true,
|
|
25
|
+
};
|
|
26
|
+
if (!options.useProjectJson) {
|
|
27
|
+
packageJson.nx = {
|
|
28
|
+
implicitDependencies: [options.projectName],
|
|
29
|
+
};
|
|
35
30
|
}
|
|
36
31
|
else {
|
|
37
32
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
@@ -43,6 +38,9 @@ async function addE2e(tree, options) {
|
|
|
43
38
|
tags: [],
|
|
44
39
|
});
|
|
45
40
|
}
|
|
41
|
+
if (!options.useProjectJson || options.isTsSolutionSetup) {
|
|
42
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
43
|
+
}
|
|
46
44
|
const e2eTask = await configurationGenerator(tree, {
|
|
47
45
|
...options,
|
|
48
46
|
project: options.e2eProjectName,
|
|
@@ -61,34 +59,19 @@ async function addE2e(tree, options) {
|
|
|
61
59
|
jsx: true,
|
|
62
60
|
rootProject: options.rootProject,
|
|
63
61
|
});
|
|
64
|
-
if (options.addPlugin ||
|
|
65
|
-
(0, devkit_1.readNxJson)(tree).plugins?.find((p) => typeof p === 'string'
|
|
66
|
-
? p === '@nx/cypress/plugin'
|
|
67
|
-
: p.plugin === '@nx/cypress/plugin')) {
|
|
68
|
-
let buildTarget = '^export';
|
|
69
|
-
if (hasPlugin) {
|
|
70
|
-
const matchingExpoPlugin = await (0, find_plugin_for_config_file_1.findPluginForConfigFile)(tree, '@nx/expo/plugin', (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'app.json'));
|
|
71
|
-
if (matchingExpoPlugin && typeof matchingExpoPlugin !== 'string') {
|
|
72
|
-
buildTarget = `^${matchingExpoPlugin.options?.exportTargetName ?? 'export'}`;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
await (0, target_defaults_utils_1.addE2eCiTargetDefaults)(tree, '@nx/cypress/plugin', buildTarget, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, `cypress.config.${options.js ? 'js' : 'ts'}`));
|
|
76
|
-
}
|
|
77
62
|
return e2eTask;
|
|
78
63
|
}
|
|
79
64
|
case 'playwright': {
|
|
80
65
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
});
|
|
66
|
+
const packageJson = {
|
|
67
|
+
name: options.e2eProjectName,
|
|
68
|
+
version: '0.0.1',
|
|
69
|
+
private: true,
|
|
70
|
+
};
|
|
71
|
+
if (!options.useProjectJson) {
|
|
72
|
+
packageJson.nx = {
|
|
73
|
+
implicitDependencies: [options.projectName],
|
|
74
|
+
};
|
|
92
75
|
}
|
|
93
76
|
else {
|
|
94
77
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
@@ -97,8 +80,12 @@ async function addE2e(tree, options) {
|
|
|
97
80
|
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
98
81
|
targets: {},
|
|
99
82
|
implicitDependencies: [options.projectName],
|
|
83
|
+
tags: [],
|
|
100
84
|
});
|
|
101
85
|
}
|
|
86
|
+
if (!options.useProjectJson || options.isTsSolutionSetup) {
|
|
87
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
88
|
+
}
|
|
102
89
|
const e2eTask = await configurationGenerator(tree, {
|
|
103
90
|
project: options.e2eProjectName,
|
|
104
91
|
skipFormat: true,
|
|
@@ -112,19 +99,6 @@ async function addE2e(tree, options) {
|
|
|
112
99
|
rootProject: options.rootProject,
|
|
113
100
|
addPlugin: options.addPlugin,
|
|
114
101
|
});
|
|
115
|
-
if (options.addPlugin ||
|
|
116
|
-
(0, devkit_1.readNxJson)(tree).plugins?.find((p) => typeof p === 'string'
|
|
117
|
-
? p === '@nx/playwright/plugin'
|
|
118
|
-
: p.plugin === '@nx/playwright/plugin')) {
|
|
119
|
-
let buildTarget = '^export';
|
|
120
|
-
if (hasPlugin) {
|
|
121
|
-
const matchingExpoPlugin = await (0, find_plugin_for_config_file_1.findPluginForConfigFile)(tree, '@nx/expo/plugin', (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'app.json'));
|
|
122
|
-
if (matchingExpoPlugin && typeof matchingExpoPlugin !== 'string') {
|
|
123
|
-
buildTarget = `^${matchingExpoPlugin.options?.exportTargetName ?? 'export'}`;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
await (0, target_defaults_utils_1.addE2eCiTargetDefaults)(tree, '@nx/playwright/plugin', buildTarget, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, `playwright.config.ts`));
|
|
127
|
-
}
|
|
128
102
|
return e2eTask;
|
|
129
103
|
}
|
|
130
104
|
case 'detox':
|
|
@@ -135,7 +109,7 @@ async function addE2e(tree, options) {
|
|
|
135
109
|
e2eDirectory: options.e2eProjectRoot,
|
|
136
110
|
appProject: options.projectName,
|
|
137
111
|
appDisplayName: options.displayName,
|
|
138
|
-
appName: options.
|
|
112
|
+
appName: options.simpleName,
|
|
139
113
|
framework: 'expo',
|
|
140
114
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
141
115
|
skipFormat: true,
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addProject = addProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
|
|
6
5
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
7
|
-
const
|
|
8
|
-
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
6
|
+
const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
|
|
9
7
|
function addProject(host, options) {
|
|
10
|
-
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
11
8
|
const hasPlugin = (0, has_expo_plugin_1.hasExpoPlugin)(host);
|
|
12
9
|
if (!hasPlugin) {
|
|
13
10
|
(0, target_defaults_utils_1.addBuildTargetDefaults)(host, '@nx/expo:build');
|
|
@@ -19,24 +16,30 @@ function addProject(host, options) {
|
|
|
19
16
|
targets: hasPlugin ? {} : getTargets(options),
|
|
20
17
|
tags: options.parsedTags,
|
|
21
18
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
const packageJson = {
|
|
20
|
+
name: options.importPath,
|
|
21
|
+
version: '0.0.1',
|
|
22
|
+
private: true,
|
|
23
|
+
};
|
|
24
|
+
if (!options.useProjectJson) {
|
|
25
|
+
if (options.importPath !== options.projectName) {
|
|
26
|
+
packageJson.nx = { name: options.projectName };
|
|
27
|
+
}
|
|
28
|
+
if (!hasPlugin) {
|
|
29
|
+
packageJson.nx ??= {};
|
|
30
|
+
packageJson.nx.targets = getTargets(options);
|
|
31
|
+
}
|
|
32
|
+
if (options.parsedTags?.length) {
|
|
33
|
+
packageJson.nx ??= {};
|
|
34
|
+
packageJson.nx.tags = options.parsedTags;
|
|
35
|
+
}
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
38
|
(0, devkit_1.addProjectConfiguration)(host, options.projectName, projectConfiguration, options.standaloneConfig);
|
|
39
39
|
}
|
|
40
|
+
if (!options.useProjectJson || options.isTsSolutionSetup) {
|
|
41
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
42
|
+
}
|
|
40
43
|
}
|
|
41
44
|
function getTargets(options) {
|
|
42
45
|
const architect = {};
|
|
@@ -2,17 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createApplicationFiles = createApplicationFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path_1 = require("path");
|
|
6
5
|
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
6
|
+
const path_1 = require("path");
|
|
7
7
|
async function createApplicationFiles(host, options) {
|
|
8
|
-
const packageManagerLockFile = {
|
|
9
|
-
npm: 'package-lock.json',
|
|
10
|
-
yarn: 'yarn.lock',
|
|
11
|
-
pnpm: 'pnpm-lock.yaml',
|
|
12
|
-
bun: 'bun.lockb',
|
|
13
|
-
};
|
|
14
8
|
const packageManager = (0, devkit_1.detectPackageManager)(host.root);
|
|
15
|
-
const packageLockFile = packageManagerLockFile[packageManager];
|
|
16
9
|
const onBoardingStatus = await (0, onboarding_1.createNxCloudOnboardingURLForWelcomeApp)(host, options.nxCloudToken);
|
|
17
10
|
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
18
11
|
(await (0, onboarding_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
@@ -20,14 +13,12 @@ async function createApplicationFiles(host, options) {
|
|
|
20
13
|
...options,
|
|
21
14
|
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
|
|
22
15
|
packageManager,
|
|
23
|
-
packageLockFile,
|
|
24
16
|
});
|
|
25
17
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/nx-welcome/${onBoardingStatus}`), options.appProjectRoot, {
|
|
26
18
|
...options,
|
|
27
19
|
connectCloudUrl,
|
|
28
20
|
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
|
|
29
21
|
packageManager,
|
|
30
|
-
packageLockFile,
|
|
31
22
|
});
|
|
32
23
|
if (options.unitTestRunner === 'none') {
|
|
33
24
|
host.delete((0, path_1.join)(options.appProjectRoot, `App.spec.tsx`));
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from '../schema';
|
|
3
|
-
export interface NormalizedSchema extends Schema {
|
|
3
|
+
export interface NormalizedSchema extends Omit<Schema, 'name' | 'useTsSolution'> {
|
|
4
4
|
className: string;
|
|
5
|
+
simpleName: string;
|
|
5
6
|
projectName: string;
|
|
6
7
|
appProjectRoot: string;
|
|
8
|
+
importPath: string;
|
|
7
9
|
lowerCaseName: string;
|
|
8
10
|
parsedTags: string[];
|
|
9
11
|
rootProject: boolean;
|
|
@@ -5,8 +5,8 @@ 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
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
7
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0, project_name_and_root_utils_1.
|
|
9
|
-
const { projectName
|
|
8
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
|
9
|
+
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
10
10
|
name: options.name,
|
|
11
11
|
projectType: 'application',
|
|
12
12
|
directory: options.directory,
|
|
@@ -15,27 +15,32 @@ async function normalizeOptions(host, options) {
|
|
|
15
15
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
16
16
|
nxJson.useInferencePlugins !== false;
|
|
17
17
|
options.addPlugin ??= addPluginDefault;
|
|
18
|
-
const { className } = (0, devkit_1.names)(
|
|
18
|
+
const { className } = (0, devkit_1.names)(projectName);
|
|
19
19
|
const parsedTags = options.tags
|
|
20
20
|
? options.tags.split(',').map((s) => s.trim())
|
|
21
21
|
: [];
|
|
22
22
|
const rootProject = appProjectRoot === '.';
|
|
23
|
+
const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
24
|
+
const appProjectName = !isTsSolutionSetup || options.name ? projectName : importPath;
|
|
25
|
+
const useProjectJson = options.useProjectJson ?? !isTsSolutionSetup;
|
|
23
26
|
const e2eProjectName = rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
24
27
|
const e2eProjectRoot = rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
25
28
|
return {
|
|
26
29
|
...options,
|
|
27
30
|
unitTestRunner: options.unitTestRunner || 'jest',
|
|
28
31
|
e2eTestRunner: options.e2eTestRunner || 'none',
|
|
29
|
-
|
|
32
|
+
simpleName: projectNames.projectSimpleName,
|
|
30
33
|
className,
|
|
31
34
|
lowerCaseName: className.toLowerCase(),
|
|
32
35
|
displayName: options.displayName || className,
|
|
33
36
|
projectName: appProjectName,
|
|
34
37
|
appProjectRoot,
|
|
38
|
+
importPath,
|
|
35
39
|
parsedTags,
|
|
36
40
|
rootProject,
|
|
37
41
|
e2eProjectName,
|
|
38
42
|
e2eProjectRoot,
|
|
39
|
-
isTsSolutionSetup
|
|
43
|
+
isTsSolutionSetup,
|
|
44
|
+
useProjectJson,
|
|
40
45
|
};
|
|
41
46
|
}
|
|
@@ -86,6 +86,10 @@
|
|
|
86
86
|
"type": "boolean",
|
|
87
87
|
"description": "Do not add dependencies to `package.json`.",
|
|
88
88
|
"default": false
|
|
89
|
+
},
|
|
90
|
+
"useProjectJson": {
|
|
91
|
+
"type": "boolean",
|
|
92
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
89
93
|
}
|
|
90
94
|
},
|
|
91
95
|
"required": ["directory"]
|
|
@@ -29,7 +29,9 @@ function addExportsToBarrel(host, options) {
|
|
|
29
29
|
const proj = workspace.get(options.projectName);
|
|
30
30
|
const isApp = (0, ts_solution_setup_1.getProjectType)(host, proj.root, proj.projectType) === 'application';
|
|
31
31
|
if (options.export && !isApp) {
|
|
32
|
-
const indexFilePath = (0, devkit_1.joinPathFragments)(options.projectSourceRoot
|
|
32
|
+
const indexFilePath = (0, devkit_1.joinPathFragments)(...(options.projectSourceRoot
|
|
33
|
+
? [options.projectSourceRoot]
|
|
34
|
+
: [options.projectRoot, 'src']), options.fileExtensionType === 'js' ? 'index.js' : 'index.ts');
|
|
33
35
|
if (!host.exists(indexFilePath)) {
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
@@ -18,7 +18,7 @@ async function expoInitGeneratorInternal(host, schema) {
|
|
|
18
18
|
schema.addPlugin ??= addPluginDefault;
|
|
19
19
|
(0, add_git_ignore_entry_1.addGitIgnoreEntry)(host);
|
|
20
20
|
if (schema.addPlugin) {
|
|
21
|
-
await (0, add_plugin_1.
|
|
21
|
+
await (0, add_plugin_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/expo/plugin', plugin_1.createNodesV2, {
|
|
22
22
|
startTargetName: ['start', 'expo:start', 'expo-start'],
|
|
23
23
|
buildTargetName: ['build', 'expo:build', 'expo-build'],
|
|
24
24
|
prebuildTargetName: ['prebuild', 'expo:prebuild', 'expo-prebuild'],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# <%=
|
|
1
|
+
# <%= projectName %>
|
|
2
2
|
|
|
3
3
|
This library was generated with [Nx](https://nx.dev).
|
|
4
4
|
|
|
5
5
|
## Running unit tests
|
|
6
6
|
|
|
7
|
-
Run `nx test <%=
|
|
7
|
+
Run `nx test <%= projectName %>` to execute the unit tests via [Jest](https://jestjs.io).
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from '../schema';
|
|
3
|
-
export interface NormalizedSchema extends Schema {
|
|
4
|
-
name: string;
|
|
3
|
+
export interface NormalizedSchema extends Omit<Schema, 'name'> {
|
|
5
4
|
fileName: string;
|
|
5
|
+
projectName: string;
|
|
6
6
|
projectRoot: string;
|
|
7
|
+
importPath: string;
|
|
7
8
|
routePath: string;
|
|
8
9
|
parsedTags: string[];
|
|
9
|
-
appMain: string;
|
|
10
10
|
isUsingTsSolutionConfig: boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
|
|
@@ -5,7 +5,7 @@ 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
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
7
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0, project_name_and_root_utils_1.
|
|
8
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'library');
|
|
9
9
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
10
10
|
name: options.name,
|
|
11
11
|
projectType: 'library',
|
|
@@ -19,17 +19,18 @@ async function normalizeOptions(host, options) {
|
|
|
19
19
|
const parsedTags = options.tags
|
|
20
20
|
? options.tags.split(',').map((s) => s.trim())
|
|
21
21
|
: [];
|
|
22
|
-
const
|
|
22
|
+
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
23
|
+
const useProjectJson = options.useProjectJson ?? !isUsingTsSolutionConfig;
|
|
23
24
|
const normalized = {
|
|
24
25
|
...options,
|
|
25
26
|
fileName: projectName,
|
|
26
27
|
routePath: `/${projectNames.projectSimpleName}`,
|
|
27
|
-
name: projectName,
|
|
28
|
+
projectName: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
|
|
28
29
|
projectRoot,
|
|
29
30
|
parsedTags,
|
|
30
31
|
importPath,
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
isUsingTsSolutionConfig,
|
|
33
|
+
useProjectJson,
|
|
33
34
|
};
|
|
34
35
|
return normalized;
|
|
35
36
|
}
|
|
@@ -7,18 +7,21 @@ const js_1 = require("@nx/js");
|
|
|
7
7
|
const init_1 = require("../init/init");
|
|
8
8
|
const add_linting_1 = require("../../utils/add-linting");
|
|
9
9
|
const add_jest_1 = require("../../utils/add-jest");
|
|
10
|
-
const versions_1 = require("../../utils/versions");
|
|
11
10
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
12
11
|
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
13
12
|
const init_root_babel_config_1 = require("../../utils/init-root-babel-config");
|
|
14
|
-
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
15
13
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
16
14
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
17
|
-
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
18
15
|
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
16
|
+
const add_rollup_build_target_1 = require("@nx/react/src/generators/library/lib/add-rollup-build-target");
|
|
17
|
+
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
18
|
+
const component_1 = require("../component/component");
|
|
19
|
+
const path_1 = require("path");
|
|
20
|
+
const versions_1 = require("../../utils/versions");
|
|
19
21
|
async function expoLibraryGenerator(host, schema) {
|
|
20
22
|
return await expoLibraryGeneratorInternal(host, {
|
|
21
23
|
addPlugin: false,
|
|
24
|
+
useProjectJson: true,
|
|
22
25
|
...schema,
|
|
23
26
|
});
|
|
24
27
|
}
|
|
@@ -33,6 +36,9 @@ async function expoLibraryGeneratorInternal(host, schema) {
|
|
|
33
36
|
if (options.publishable === true && !schema.importPath) {
|
|
34
37
|
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)`);
|
|
35
38
|
}
|
|
39
|
+
if (options.isUsingTsSolutionConfig) {
|
|
40
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
41
|
+
}
|
|
36
42
|
const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
|
|
37
43
|
tasks.push(initTask);
|
|
38
44
|
if (!options.skipPackageJson) {
|
|
@@ -46,20 +52,27 @@ async function expoLibraryGeneratorInternal(host, schema) {
|
|
|
46
52
|
}
|
|
47
53
|
const lintTask = await (0, add_linting_1.addLinting)(host, {
|
|
48
54
|
...options,
|
|
49
|
-
projectName: options.
|
|
55
|
+
projectName: options.projectName,
|
|
50
56
|
tsConfigPaths: [
|
|
51
57
|
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
|
|
52
58
|
],
|
|
53
59
|
});
|
|
54
60
|
tasks.push(lintTask);
|
|
55
|
-
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.
|
|
61
|
+
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.projectRoot, options.js, options.skipPackageJson, options.addPlugin);
|
|
56
62
|
tasks.push(jestTask);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
const relativeCwd = (0, artifact_name_and_directory_utils_1.getRelativeCwd)();
|
|
64
|
+
const path = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/lib', options.fileName);
|
|
65
|
+
const componentTask = await (0, component_1.expoComponentGenerator)(host, {
|
|
66
|
+
path: relativeCwd ? (0, path_1.relative)(relativeCwd, path) : path,
|
|
67
|
+
skipTests: options.unitTestRunner === 'none',
|
|
68
|
+
export: true,
|
|
69
|
+
skipFormat: true,
|
|
70
|
+
js: options.js,
|
|
71
|
+
});
|
|
72
|
+
tasks.push(() => componentTask);
|
|
60
73
|
if (!options.skipTsConfig && !options.isUsingTsSolutionConfig) {
|
|
61
74
|
(0, js_1.addTsConfigPath)(host, options.importPath, [
|
|
62
|
-
(0, devkit_1.joinPathFragments)(options.projectRoot,
|
|
75
|
+
(0, devkit_1.joinPathFragments)(options.projectRoot, options.js ? './src/index.js' : './src/index.ts'),
|
|
63
76
|
]);
|
|
64
77
|
}
|
|
65
78
|
(0, ts_solution_setup_1.updateTsconfigFiles)(host, options.projectRoot, 'tsconfig.lib.json', {
|
|
@@ -69,9 +82,6 @@ async function expoLibraryGeneratorInternal(host, schema) {
|
|
|
69
82
|
}, options.linter === 'eslint'
|
|
70
83
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
71
84
|
: undefined);
|
|
72
|
-
if (options.isUsingTsSolutionConfig) {
|
|
73
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
74
|
-
}
|
|
75
85
|
(0, sort_fields_1.sortPackageJsonFields)(host, options.projectRoot);
|
|
76
86
|
if (!options.skipFormat) {
|
|
77
87
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -81,7 +91,7 @@ async function expoLibraryGeneratorInternal(host, schema) {
|
|
|
81
91
|
tasks.push(() => (0, devkit_1.installPackagesTask)(host, true));
|
|
82
92
|
}
|
|
83
93
|
tasks.push(() => {
|
|
84
|
-
(0, log_show_project_command_1.logShowProjectCommand)(options.
|
|
94
|
+
(0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
|
|
85
95
|
});
|
|
86
96
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
87
97
|
}
|
|
@@ -93,61 +103,65 @@ async function addProject(host, options) {
|
|
|
93
103
|
tags: options.parsedTags,
|
|
94
104
|
targets: {},
|
|
95
105
|
};
|
|
106
|
+
let packageJson = {
|
|
107
|
+
name: options.importPath,
|
|
108
|
+
version: '0.0.1',
|
|
109
|
+
peerDependencies: {
|
|
110
|
+
react: versions_1.reactVersion,
|
|
111
|
+
'react-native': versions_1.reactNativeVersion,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
96
114
|
if (options.isUsingTsSolutionConfig) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
nx
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
112
|
-
tags: options.parsedTags?.length ? options.parsedTags : undefined,
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
+
packageJson = {
|
|
116
|
+
...packageJson,
|
|
117
|
+
...determineEntryFields(options),
|
|
118
|
+
files: options.publishable ? ['dist', '!**/*.tsbuildinfo'] : undefined,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (!options.useProjectJson) {
|
|
122
|
+
if (options.projectName !== options.importPath) {
|
|
123
|
+
packageJson.nx = { name: options.projectName };
|
|
124
|
+
}
|
|
125
|
+
if (options.parsedTags?.length) {
|
|
126
|
+
packageJson.nx ??= {};
|
|
127
|
+
packageJson.nx.tags = options.parsedTags;
|
|
128
|
+
}
|
|
115
129
|
}
|
|
116
130
|
else {
|
|
117
|
-
(0, devkit_1.addProjectConfiguration)(host, options.
|
|
131
|
+
(0, devkit_1.addProjectConfiguration)(host, options.projectName, project);
|
|
118
132
|
}
|
|
119
|
-
if (!options.
|
|
120
|
-
|
|
133
|
+
if (!options.useProjectJson ||
|
|
134
|
+
options.isUsingTsSolutionConfig ||
|
|
135
|
+
options.publishable ||
|
|
136
|
+
options.buildable) {
|
|
137
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), packageJson);
|
|
121
138
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
149
|
-
(0, devkit_1.updateProjectConfiguration)(host, options.name, project);
|
|
150
|
-
return rollupConfigTask;
|
|
139
|
+
if (options.publishable || options.buildable) {
|
|
140
|
+
const external = new Set([
|
|
141
|
+
'react/jsx-runtime',
|
|
142
|
+
'react-native',
|
|
143
|
+
'react',
|
|
144
|
+
'react-dom',
|
|
145
|
+
]);
|
|
146
|
+
const rollupTask = await (0, add_rollup_build_target_1.addRollupBuildTarget)(host, {
|
|
147
|
+
...options,
|
|
148
|
+
name: options.projectName,
|
|
149
|
+
format: ['cjs', 'esm'],
|
|
150
|
+
style: 'none',
|
|
151
|
+
js: options.js,
|
|
152
|
+
skipFormat: true,
|
|
153
|
+
}, external);
|
|
154
|
+
(0, devkit_1.updateJson)(host, `${options.projectRoot}/package.json`, (json) => {
|
|
155
|
+
json.peerDependencies = {
|
|
156
|
+
...json.peerDependencies,
|
|
157
|
+
react: versions_1.reactVersion,
|
|
158
|
+
'react-native': versions_1.reactNativeVersion,
|
|
159
|
+
};
|
|
160
|
+
return json;
|
|
161
|
+
});
|
|
162
|
+
return rollupTask;
|
|
163
|
+
}
|
|
164
|
+
return () => { };
|
|
151
165
|
}
|
|
152
166
|
function updateTsConfig(tree, options) {
|
|
153
167
|
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.json'), (json) => {
|
|
@@ -166,32 +180,35 @@ function updateTsConfig(tree, options) {
|
|
|
166
180
|
function createFiles(host, options) {
|
|
167
181
|
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/lib'), options.projectRoot, {
|
|
168
182
|
...options,
|
|
169
|
-
...(0, devkit_1.names)(options.name),
|
|
170
183
|
tmpl: '',
|
|
171
184
|
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot),
|
|
172
185
|
rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot),
|
|
173
186
|
});
|
|
174
|
-
if (!options.publishable && !options.buildable) {
|
|
175
|
-
host.delete(`${options.projectRoot}/package.json`);
|
|
176
|
-
}
|
|
177
187
|
if (options.js) {
|
|
178
188
|
(0, devkit_1.toJS)(host);
|
|
179
189
|
}
|
|
180
190
|
updateTsConfig(host, options);
|
|
181
191
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
function determineEntryFields(options) {
|
|
193
|
+
if (options.buildable ||
|
|
194
|
+
options.publishable ||
|
|
195
|
+
!options.isUsingTsSolutionConfig) {
|
|
196
|
+
// For buildable libraries, the entries are configured by the bundler (i.e. Rollup).
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
main: options.js ? './src/index.js' : './src/index.ts',
|
|
201
|
+
types: options.js ? './src/index.js' : './src/index.ts',
|
|
202
|
+
exports: {
|
|
203
|
+
'.': options.js
|
|
204
|
+
? './src/index.js'
|
|
205
|
+
: {
|
|
206
|
+
types: './src/index.ts',
|
|
207
|
+
import: './src/index.ts',
|
|
208
|
+
default: './src/index.ts',
|
|
209
|
+
},
|
|
210
|
+
'./package.json': './package.json',
|
|
211
|
+
},
|
|
212
|
+
};
|
|
196
213
|
}
|
|
197
214
|
exports.default = expoLibraryGenerator;
|
|
@@ -89,6 +89,10 @@
|
|
|
89
89
|
"type": "boolean",
|
|
90
90
|
"description": "Do not add dependencies to `package.json`.",
|
|
91
91
|
"default": false
|
|
92
|
+
},
|
|
93
|
+
"useProjectJson": {
|
|
94
|
+
"type": "boolean",
|
|
95
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
92
96
|
}
|
|
93
97
|
},
|
|
94
98
|
"required": ["directory"]
|
package/src/utils/add-linting.js
CHANGED
|
@@ -7,7 +7,7 @@ const lint_1 = require("@nx/react/src/utils/lint");
|
|
|
7
7
|
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
8
8
|
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
9
9
|
async function addLinting(host, options) {
|
|
10
|
-
if (options.linter ===
|
|
10
|
+
if (options.linter === 'none') {
|
|
11
11
|
return () => { };
|
|
12
12
|
}
|
|
13
13
|
const tasks = [];
|
|
@@ -1,25 +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 the offset from the outputDir of the export target
|
|
7
|
-
*/
|
|
8
|
-
async function update(tree) {
|
|
9
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
10
|
-
for (const [projectName, config] of projects.entries()) {
|
|
11
|
-
if (config.targets?.['export']?.executor === '@nx/expo:export') {
|
|
12
|
-
const target = config.targets['export'];
|
|
13
|
-
if (target.options?.outputDir) {
|
|
14
|
-
const offset = (0, devkit_1.offsetFromRoot)(config.root);
|
|
15
|
-
target.options.outputDir = target.options.outputDir.replace(offset, '');
|
|
16
|
-
target.outputs = ['{options.outputDir}'];
|
|
17
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, config);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
if (config.targets?.['export-web']?.executor === '@nx/expo:export') {
|
|
21
|
-
delete config.targets['export-web'];
|
|
22
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, config);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,28 +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 remove blockList in metro.config.js.
|
|
7
|
-
* It is now excluding dist folder in watchFolders in withNxMetro.
|
|
8
|
-
*/
|
|
9
|
-
async function update(tree) {
|
|
10
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
11
|
-
for (const [_, config] of projects.entries()) {
|
|
12
|
-
if (config.targets?.['start']?.executor === '@nx/expo:start') {
|
|
13
|
-
if (tree.exists((0, devkit_1.joinPathFragments)(config.root, 'metro.config.js'))) {
|
|
14
|
-
let content = tree
|
|
15
|
-
.read((0, devkit_1.joinPathFragments)(config.root, 'metro.config.js'))
|
|
16
|
-
.toString();
|
|
17
|
-
content = content.replace(/blockList: exclusionList(.+?(?=\n))/, '');
|
|
18
|
-
content = content.replace('// unstable_enableSymlinks: true,', '');
|
|
19
|
-
content = content.replace('// unstable_enablePackageExports: true,', '');
|
|
20
|
-
content = content.replace('unstable_enableSymlinks: true,', '');
|
|
21
|
-
content = content.replace('unstable_enablePackageExports: true,', '');
|
|
22
|
-
content = content.replace(`const exclusionList = require('metro-config/src/defaults/exclusionList');`, '');
|
|
23
|
-
tree.write((0, devkit_1.joinPathFragments)(config.root, 'metro.config.js'), content);
|
|
24
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
|
-
/**
|
|
3
|
-
* Remove eas-cli from dev dependencies.
|
|
4
|
-
* Use globally eas-cli.
|
|
5
|
-
*
|
|
6
|
-
* Remove metro and metro-resolver from dev dependencies.
|
|
7
|
-
* react-native has dependency of @react-native/community-cli-plugin
|
|
8
|
-
* @react-native/community-cli-plugin has dependency of metro
|
|
9
|
-
* @param tree
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export default function update(tree: Tree): Promise<void>;
|
|
@@ -1,18 +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 eas-cli from dev dependencies.
|
|
7
|
-
* Use globally eas-cli.
|
|
8
|
-
*
|
|
9
|
-
* Remove metro and metro-resolver from dev dependencies.
|
|
10
|
-
* react-native has dependency of @react-native/community-cli-plugin
|
|
11
|
-
* @react-native/community-cli-plugin has dependency of metro
|
|
12
|
-
* @param tree
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
async function update(tree) {
|
|
16
|
-
(0, devkit_1.removeDependenciesFromPackageJson)(tree, [], ['eas-cli', 'metro', 'metro-resolver']);
|
|
17
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
18
|
-
}
|
|
@@ -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
|
-
const node_fs_1 = require("node:fs");
|
|
6
|
-
/**
|
|
7
|
-
* Remove ensure-symlink target.
|
|
8
|
-
* It is going to be supported by react-native version 0.73 by default.
|
|
9
|
-
*/
|
|
10
|
-
async function update(tree) {
|
|
11
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
12
|
-
for (const [projectName, config] of projects.entries()) {
|
|
13
|
-
if (config.targets?.['ensure-symlink']?.executor === '@nx/expo:ensure-symlink') {
|
|
14
|
-
removeTargets(config.targets, 'ensure-symlink');
|
|
15
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, config);
|
|
16
|
-
(0, node_fs_1.rmSync)(`${config.root}/node_modules`, { recursive: true, force: true });
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function removeTargets(targets, targetNameToRemove) {
|
|
21
|
-
for (const targetName in targets) {
|
|
22
|
-
if (targetName === targetNameToRemove) {
|
|
23
|
-
delete targets[targetName];
|
|
24
|
-
}
|
|
25
|
-
if (targets[targetName]?.dependsOn?.length) {
|
|
26
|
-
targets[targetName].dependsOn = targets[targetName].dependsOn.filter((dependsOn) => dependsOn !== targetNameToRemove);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|