@nx/expo 20.4.0 → 20.4.2
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 +8 -9
- package/src/executors/serve/lib/is-packager-running.js +1 -2
- package/src/generators/library/files/lib/package.json.template +1 -1
- package/src/generators/library/lib/normalize-options.d.ts +1 -0
- package/src/generators/library/lib/normalize-options.js +6 -1
- package/src/generators/library/library.js +29 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/expo",
|
|
3
|
-
"version": "20.4.
|
|
3
|
+
"version": "20.4.2",
|
|
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,17 +28,16 @@
|
|
|
28
28
|
"main": "./index",
|
|
29
29
|
"types": "index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nx/devkit": "20.4.
|
|
32
|
-
"@nx/eslint": "20.4.
|
|
33
|
-
"@nx/jest": "20.4.
|
|
34
|
-
"@nx/js": "20.4.
|
|
35
|
-
"@nx/react": "20.4.
|
|
36
|
-
"@nx/web": "20.4.
|
|
37
|
-
"@nx/webpack": "20.4.
|
|
31
|
+
"@nx/devkit": "20.4.2",
|
|
32
|
+
"@nx/eslint": "20.4.2",
|
|
33
|
+
"@nx/jest": "20.4.2",
|
|
34
|
+
"@nx/js": "20.4.2",
|
|
35
|
+
"@nx/react": "20.4.2",
|
|
36
|
+
"@nx/web": "20.4.2",
|
|
37
|
+
"@nx/webpack": "20.4.2",
|
|
38
38
|
"enhanced-resolve": "^5.8.3",
|
|
39
39
|
"metro-config": "~0.80.4",
|
|
40
40
|
"metro-resolver": "~0.80.4",
|
|
41
|
-
"node-fetch": "^2.6.7",
|
|
42
41
|
"picocolors": "^1.1.0",
|
|
43
42
|
"tsconfig-paths": "^4.1.2",
|
|
44
43
|
"tslib": "^2.3.0"
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPackagerRunning = isPackagerRunning;
|
|
4
|
-
const node_fetch_1 = require("node-fetch");
|
|
5
4
|
async function isPackagerRunning(packagerPort) {
|
|
6
5
|
try {
|
|
7
|
-
const resp = await (
|
|
6
|
+
const resp = await fetch(`http://localhost:${packagerPort}/status`);
|
|
8
7
|
const data = await resp.text();
|
|
9
8
|
return data === 'packager-status:running' ? 'running' : 'unrecognized';
|
|
10
9
|
}
|
|
@@ -4,6 +4,7 @@ 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
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
7
8
|
async function normalizeOptions(host, options) {
|
|
8
9
|
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
|
|
9
10
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
@@ -20,16 +21,20 @@ async function normalizeOptions(host, options) {
|
|
|
20
21
|
? options.tags.split(',').map((s) => s.trim())
|
|
21
22
|
: [];
|
|
22
23
|
const appMain = options.js ? 'src/index.js' : 'src/index.ts';
|
|
24
|
+
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
23
25
|
const normalized = {
|
|
24
26
|
...options,
|
|
25
27
|
fileName: projectName,
|
|
26
28
|
routePath: `/${projectNames.projectSimpleName}`,
|
|
27
29
|
name: projectName,
|
|
30
|
+
projectName: isUsingTsSolutionConfig
|
|
31
|
+
? (0, get_import_path_1.getImportPath)(host, projectName)
|
|
32
|
+
: projectName,
|
|
28
33
|
projectRoot,
|
|
29
34
|
parsedTags,
|
|
30
35
|
importPath,
|
|
31
36
|
appMain,
|
|
32
|
-
isUsingTsSolutionConfig
|
|
37
|
+
isUsingTsSolutionConfig,
|
|
33
38
|
};
|
|
34
39
|
return normalized;
|
|
35
40
|
}
|
|
@@ -14,7 +14,6 @@ const init_root_babel_config_1 = require("../../utils/init-root-babel-config");
|
|
|
14
14
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
15
15
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
16
16
|
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
17
|
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
19
18
|
async function expoLibraryGenerator(host, schema) {
|
|
20
19
|
return await expoLibraryGeneratorInternal(host, {
|
|
@@ -33,6 +32,9 @@ async function expoLibraryGeneratorInternal(host, schema) {
|
|
|
33
32
|
if (options.publishable === true && !schema.importPath) {
|
|
34
33
|
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
34
|
}
|
|
35
|
+
if (options.isUsingTsSolutionConfig) {
|
|
36
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
37
|
+
}
|
|
36
38
|
const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
|
|
37
39
|
tasks.push(initTask);
|
|
38
40
|
if (!options.skipPackageJson) {
|
|
@@ -46,13 +48,13 @@ async function expoLibraryGeneratorInternal(host, schema) {
|
|
|
46
48
|
}
|
|
47
49
|
const lintTask = await (0, add_linting_1.addLinting)(host, {
|
|
48
50
|
...options,
|
|
49
|
-
projectName: options.
|
|
51
|
+
projectName: options.projectName,
|
|
50
52
|
tsConfigPaths: [
|
|
51
53
|
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
|
|
52
54
|
],
|
|
53
55
|
});
|
|
54
56
|
tasks.push(lintTask);
|
|
55
|
-
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.
|
|
57
|
+
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.projectRoot, options.js, options.skipPackageJson, options.addPlugin);
|
|
56
58
|
tasks.push(jestTask);
|
|
57
59
|
if (options.publishable || options.buildable) {
|
|
58
60
|
updateLibPackageNpmScope(host, options);
|
|
@@ -69,9 +71,6 @@ async function expoLibraryGeneratorInternal(host, schema) {
|
|
|
69
71
|
}, options.linter === 'eslint'
|
|
70
72
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
71
73
|
: undefined);
|
|
72
|
-
if (options.isUsingTsSolutionConfig) {
|
|
73
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
74
|
-
}
|
|
75
74
|
(0, sort_fields_1.sortPackageJsonFields)(host, options.projectRoot);
|
|
76
75
|
if (!options.skipFormat) {
|
|
77
76
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -94,23 +93,34 @@ async function addProject(host, options) {
|
|
|
94
93
|
targets: {},
|
|
95
94
|
};
|
|
96
95
|
if (options.isUsingTsSolutionConfig) {
|
|
97
|
-
const packageName = (0, get_import_path_1.getImportPath)(host, options.name);
|
|
98
96
|
const sourceEntry = !options.buildable
|
|
99
97
|
? options.js
|
|
100
98
|
? './src/index.js'
|
|
101
99
|
: './src/index.ts'
|
|
102
100
|
: undefined;
|
|
103
101
|
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
|
|
104
|
-
name:
|
|
102
|
+
name: options.projectName,
|
|
105
103
|
version: '0.0.1',
|
|
106
104
|
main: sourceEntry,
|
|
107
105
|
types: sourceEntry,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
// For buildable libraries, the entries are configured by the bundler (i.e. Rollup).
|
|
107
|
+
exports: options.buildable
|
|
108
|
+
? undefined
|
|
109
|
+
: {
|
|
110
|
+
'./package.json': './package.json',
|
|
111
|
+
'.': options.js
|
|
112
|
+
? './src/index.js'
|
|
113
|
+
: {
|
|
114
|
+
types: './src/index.ts',
|
|
115
|
+
import: './src/index.ts',
|
|
116
|
+
default: './src/index.ts',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
nx: options.parsedTags?.length
|
|
120
|
+
? {
|
|
121
|
+
tags: options.parsedTags,
|
|
122
|
+
}
|
|
123
|
+
: undefined,
|
|
114
124
|
});
|
|
115
125
|
}
|
|
116
126
|
else {
|
|
@@ -122,7 +132,7 @@ async function addProject(host, options) {
|
|
|
122
132
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/rollup', versions_1.nxVersion);
|
|
123
133
|
const rollupConfigTask = await configurationGenerator(host, {
|
|
124
134
|
...options,
|
|
125
|
-
project: options.
|
|
135
|
+
project: options.projectName,
|
|
126
136
|
skipFormat: true,
|
|
127
137
|
});
|
|
128
138
|
const external = ['react/jsx-runtime', 'react-native', 'react', 'react-dom'];
|
|
@@ -146,7 +156,7 @@ async function addProject(host, options) {
|
|
|
146
156
|
],
|
|
147
157
|
},
|
|
148
158
|
};
|
|
149
|
-
(0, devkit_1.updateProjectConfiguration)(host, options.
|
|
159
|
+
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
|
|
150
160
|
return rollupConfigTask;
|
|
151
161
|
}
|
|
152
162
|
function updateTsConfig(tree, options) {
|
|
@@ -171,7 +181,9 @@ function createFiles(host, options) {
|
|
|
171
181
|
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot),
|
|
172
182
|
rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot),
|
|
173
183
|
});
|
|
174
|
-
if (!options.publishable &&
|
|
184
|
+
if (!options.publishable &&
|
|
185
|
+
!options.buildable &&
|
|
186
|
+
!options.isUsingTsSolutionConfig) {
|
|
175
187
|
host.delete(`${options.projectRoot}/package.json`);
|
|
176
188
|
}
|
|
177
189
|
if (options.js) {
|