@nx/react-native 0.0.0-pr-28808-0f14212 → 0.0.0-pr-28808-6acf6c6
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 +7 -7
- package/src/generators/application/application.js +5 -3
- package/src/generators/application/schema.d.ts +2 -0
- package/src/generators/application/schema.json +6 -3
- package/src/generators/library/library.js +24 -6
- package/src/generators/library/schema.json +5 -2
- package/src/generators/web-configuration/web-configuration.js +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react-native",
|
|
3
|
-
"version": "0.0.0-pr-28808-
|
|
3
|
+
"version": "0.0.0-pr-28808-6acf6c6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: \n\n-Integration with libraries such as Jest, Detox, and Storybook.\n-Scaffolding for creating buildable libraries that can be published to npm.\n-Utilities for automatic workspace refactoring.",
|
|
6
6
|
"keywords": [
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"node-fetch": "^2.6.7",
|
|
37
37
|
"tsconfig-paths": "^4.1.2",
|
|
38
38
|
"tslib": "^2.3.0",
|
|
39
|
-
"@nx/devkit": "0.0.0-pr-28808-
|
|
40
|
-
"@nx/jest": "0.0.0-pr-28808-
|
|
41
|
-
"@nx/js": "0.0.0-pr-28808-
|
|
42
|
-
"@nx/eslint": "0.0.0-pr-28808-
|
|
43
|
-
"@nx/react": "0.0.0-pr-28808-
|
|
44
|
-
"@nx/workspace": "0.0.0-pr-28808-
|
|
39
|
+
"@nx/devkit": "0.0.0-pr-28808-6acf6c6",
|
|
40
|
+
"@nx/jest": "0.0.0-pr-28808-6acf6c6",
|
|
41
|
+
"@nx/js": "0.0.0-pr-28808-6acf6c6",
|
|
42
|
+
"@nx/eslint": "0.0.0-pr-28808-6acf6c6",
|
|
43
|
+
"@nx/react": "0.0.0-pr-28808-6acf6c6",
|
|
44
|
+
"@nx/workspace": "0.0.0-pr-28808-6acf6c6"
|
|
45
45
|
},
|
|
46
46
|
"executors": "./executors.json",
|
|
47
47
|
"ng-update": {
|
|
@@ -29,8 +29,7 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
|
29
29
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
30
30
|
...schema,
|
|
31
31
|
skipFormat: true,
|
|
32
|
-
addTsPlugin:
|
|
33
|
-
process.env.NX_ADD_TS_PLUGIN !== 'false',
|
|
32
|
+
addTsPlugin: schema.useTsSolution,
|
|
34
33
|
});
|
|
35
34
|
tasks.push(jsInitTask);
|
|
36
35
|
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
@@ -82,7 +81,10 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
|
|
|
82
81
|
module: 'esnext',
|
|
83
82
|
moduleResolution: 'bundler',
|
|
84
83
|
noUnusedLocals: false,
|
|
85
|
-
|
|
84
|
+
lib: ['dom'],
|
|
85
|
+
}, options.linter === 'eslint'
|
|
86
|
+
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
87
|
+
: undefined);
|
|
86
88
|
if (!options.skipFormat) {
|
|
87
89
|
await (0, devkit_1.formatFiles)(host);
|
|
88
90
|
}
|
|
@@ -16,6 +16,8 @@ export interface Schema {
|
|
|
16
16
|
bundler: 'webpack' | 'vite'; // default is webpack
|
|
17
17
|
install: boolean; // default is true
|
|
18
18
|
skipPackageJson?: boolean; //default is false
|
|
19
|
+
// Internal options
|
|
19
20
|
addPlugin?: boolean;
|
|
20
21
|
nxCloudToken?: string;
|
|
22
|
+
useTsSolution?: boolean;
|
|
21
23
|
}
|
|
@@ -44,13 +44,15 @@
|
|
|
44
44
|
"description": "The tool to use for running lint checks.",
|
|
45
45
|
"type": "string",
|
|
46
46
|
"enum": ["eslint", "none"],
|
|
47
|
-
"default": "
|
|
47
|
+
"default": "none",
|
|
48
|
+
"x-priority": "important"
|
|
48
49
|
},
|
|
49
50
|
"unitTestRunner": {
|
|
50
51
|
"type": "string",
|
|
51
52
|
"enum": ["jest", "none"],
|
|
52
53
|
"description": "Test runner to use for unit tests",
|
|
53
|
-
"default": "
|
|
54
|
+
"default": "none",
|
|
55
|
+
"x-priority": "important"
|
|
54
56
|
},
|
|
55
57
|
"tags": {
|
|
56
58
|
"type": "string",
|
|
@@ -71,7 +73,8 @@
|
|
|
71
73
|
"description": "Adds the specified e2e test runner.",
|
|
72
74
|
"type": "string",
|
|
73
75
|
"enum": ["playwright", "cypress", "detox", "none"],
|
|
74
|
-
"default": "
|
|
76
|
+
"default": "none",
|
|
77
|
+
"x-priority": "important"
|
|
75
78
|
},
|
|
76
79
|
"install": {
|
|
77
80
|
"type": "boolean",
|
|
@@ -12,6 +12,7 @@ const normalize_options_1 = require("./lib/normalize-options");
|
|
|
12
12
|
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
13
13
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
14
14
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
15
|
+
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
15
16
|
async function reactNativeLibraryGenerator(host, schema) {
|
|
16
17
|
return await reactNativeLibraryGeneratorInternal(host, {
|
|
17
18
|
addPlugin: false,
|
|
@@ -19,17 +20,16 @@ async function reactNativeLibraryGenerator(host, schema) {
|
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
async function reactNativeLibraryGeneratorInternal(host, schema) {
|
|
22
|
-
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'react-native', 'library');
|
|
23
|
-
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
24
|
-
if (options.publishable === true && !schema.importPath) {
|
|
25
|
-
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)`);
|
|
26
|
-
}
|
|
27
23
|
const tasks = [];
|
|
28
24
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
29
25
|
...schema,
|
|
30
26
|
skipFormat: true,
|
|
31
27
|
});
|
|
32
28
|
tasks.push(jsInitTask);
|
|
29
|
+
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
30
|
+
if (options.publishable === true && !schema.importPath) {
|
|
31
|
+
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)`);
|
|
32
|
+
}
|
|
33
33
|
const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
|
|
34
34
|
tasks.push(initTask);
|
|
35
35
|
if (!options.skipPackageJson) {
|
|
@@ -58,6 +58,13 @@ async function reactNativeLibraryGeneratorInternal(host, schema) {
|
|
|
58
58
|
(0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
|
|
59
59
|
]);
|
|
60
60
|
}
|
|
61
|
+
(0, ts_solution_setup_1.updateTsconfigFiles)(host, options.projectRoot, 'tsconfig.lib.json', {
|
|
62
|
+
jsx: 'react-jsx',
|
|
63
|
+
module: 'esnext',
|
|
64
|
+
moduleResolution: 'bundler',
|
|
65
|
+
}, options.linter === 'eslint'
|
|
66
|
+
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
67
|
+
: undefined);
|
|
61
68
|
if (!options.skipFormat) {
|
|
62
69
|
await (0, devkit_1.formatFiles)(host);
|
|
63
70
|
}
|
|
@@ -74,7 +81,18 @@ async function addProject(host, options) {
|
|
|
74
81
|
tags: options.parsedTags,
|
|
75
82
|
targets: {},
|
|
76
83
|
};
|
|
77
|
-
(0,
|
|
84
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
85
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
|
|
86
|
+
name: (0, get_import_path_1.getImportPath)(host, options.name),
|
|
87
|
+
version: '0.0.1',
|
|
88
|
+
nx: {
|
|
89
|
+
name: options.name,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
(0, devkit_1.addProjectConfiguration)(host, options.name, project);
|
|
95
|
+
}
|
|
78
96
|
if (!options.publishable && !options.buildable) {
|
|
79
97
|
return () => { };
|
|
80
98
|
}
|
|
@@ -32,13 +32,16 @@
|
|
|
32
32
|
"description": "The tool to use for running lint checks.",
|
|
33
33
|
"type": "string",
|
|
34
34
|
"enum": ["eslint", "none"],
|
|
35
|
-
"default": "
|
|
35
|
+
"default": "none",
|
|
36
|
+
"x-prompt": "Which linter would you like to use?",
|
|
37
|
+
"x-priority": "important"
|
|
36
38
|
},
|
|
37
39
|
"unitTestRunner": {
|
|
38
40
|
"type": "string",
|
|
39
41
|
"enum": ["jest", "none"],
|
|
40
42
|
"description": "Test runner to use for unit tests.",
|
|
41
|
-
"default": "
|
|
43
|
+
"default": "none",
|
|
44
|
+
"x-priority": "important"
|
|
42
45
|
},
|
|
43
46
|
"tags": {
|
|
44
47
|
"type": "string",
|
|
@@ -40,6 +40,11 @@ async function webConfigurationGenerator(tree, options) {
|
|
|
40
40
|
: null,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
if (!options.skipPackageJson) {
|
|
44
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
45
|
+
'@types/react-dom': versions_1.typesReactVersion,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
43
48
|
if (!options.skipFormat) {
|
|
44
49
|
await (0, devkit_1.formatFiles)(tree);
|
|
45
50
|
}
|