@nx/react-native 20.0.0-beta.3 → 20.0.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.
- package/.eslintrc.json +12 -0
- package/package.json +7 -9
- package/plugins/with-nx-metro.js +4 -4
- package/project.json +0 -3
- package/src/executors/storybook/storybook.impl.js +2 -2
- package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +0 -7
- package/src/migrations/update-18-0-0/remove-symlink-target.js +2 -2
- package/src/utils/ensure-node-modules-symlink.js +6 -6
- package/src/utils/pod-install-task.js +4 -4
package/.eslintrc.json
CHANGED
|
@@ -43,6 +43,18 @@
|
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
49
|
+
"rules": {
|
|
50
|
+
"no-restricted-imports": [
|
|
51
|
+
"error",
|
|
52
|
+
{
|
|
53
|
+
"name": "fs-extra",
|
|
54
|
+
"message": "Please use equivalent utilities from `node:fs` instead."
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
46
58
|
}
|
|
47
59
|
]
|
|
48
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react-native",
|
|
3
|
-
"version": "20.0.0-beta.
|
|
3
|
+
"version": "20.0.0-beta.5",
|
|
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": [
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"ajv": "^8.12.0",
|
|
30
30
|
"chalk": "^4.1.0",
|
|
31
31
|
"enhanced-resolve": "^5.8.3",
|
|
32
|
-
"fs-extra": "^11.1.0",
|
|
33
32
|
"glob": "7.1.4",
|
|
34
33
|
"ignore": "^5.0.4",
|
|
35
34
|
"metro-config": "~0.80.4",
|
|
@@ -37,13 +36,12 @@
|
|
|
37
36
|
"node-fetch": "^2.6.7",
|
|
38
37
|
"tsconfig-paths": "^4.1.2",
|
|
39
38
|
"tslib": "^2.3.0",
|
|
40
|
-
"@nx/devkit": "20.0.0-beta.
|
|
41
|
-
"@nx/jest": "20.0.0-beta.
|
|
42
|
-
"@nx/js": "20.0.0-beta.
|
|
43
|
-
"@nx/eslint": "20.0.0-beta.
|
|
44
|
-
"@nx/react": "20.0.0-beta.
|
|
45
|
-
"@nx/workspace": "20.0.0-beta.
|
|
46
|
-
"@nrwl/react-native": "20.0.0-beta.3"
|
|
39
|
+
"@nx/devkit": "20.0.0-beta.5",
|
|
40
|
+
"@nx/jest": "20.0.0-beta.5",
|
|
41
|
+
"@nx/js": "20.0.0-beta.5",
|
|
42
|
+
"@nx/eslint": "20.0.0-beta.5",
|
|
43
|
+
"@nx/react": "20.0.0-beta.5",
|
|
44
|
+
"@nx/workspace": "20.0.0-beta.5"
|
|
47
45
|
},
|
|
48
46
|
"executors": "./executors.json",
|
|
49
47
|
"ng-update": {
|
package/plugins/with-nx-metro.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.withNxMetro = withNxMetro;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const metro_config_1 = require("metro-config");
|
|
6
|
-
const
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const metro_resolver_1 = require("./metro-resolver");
|
|
9
9
|
async function withNxMetro(userConfig, opts = {}) {
|
|
@@ -12,14 +12,14 @@ async function withNxMetro(userConfig, opts = {}) {
|
|
|
12
12
|
process.env.NX_REACT_NATIVE_DEBUG = 'true';
|
|
13
13
|
if (opts.extensions)
|
|
14
14
|
extensions.push(...opts.extensions);
|
|
15
|
-
let watchFolders = (0,
|
|
15
|
+
let watchFolders = (0, node_fs_1.readdirSync)(devkit_1.workspaceRoot)
|
|
16
16
|
.filter((fileName) => !['dist', 'e2e'].includes(fileName) && !fileName.startsWith('.'))
|
|
17
17
|
.map((fileName) => (0, path_1.join)(devkit_1.workspaceRoot, fileName))
|
|
18
|
-
.filter((filePath) => (0,
|
|
18
|
+
.filter((filePath) => (0, node_fs_1.statSync)(filePath).isDirectory());
|
|
19
19
|
if (opts.watchFolders?.length) {
|
|
20
20
|
watchFolders = watchFolders.concat(opts.watchFolders);
|
|
21
21
|
}
|
|
22
|
-
watchFolders = [...new Set(watchFolders)].filter((folder) => (0,
|
|
22
|
+
watchFolders = [...new Set(watchFolders)].filter((folder) => (0, node_fs_1.existsSync)(folder));
|
|
23
23
|
const nxConfig = {
|
|
24
24
|
resolver: {
|
|
25
25
|
resolveRequest: (0, metro_resolver_1.getResolveRequest)(extensions, opts.exportsConditionNames, opts.mainFields),
|
package/project.json
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = reactNativeStorybookExecutor;
|
|
4
4
|
exports.runCliStorybook = runCliStorybook;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const fileutils_1 = require("@nx/workspace/src/utilities/fileutils");
|
|
8
9
|
const chalk = require("chalk");
|
|
9
10
|
const glob_1 = require("glob");
|
|
10
11
|
const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
|
|
11
|
-
const fs_extra_1 = require("fs-extra");
|
|
12
12
|
/**
|
|
13
13
|
* TODO (@xiongemi): remove this function in v20.
|
|
14
14
|
* @deprecated Going to use the default react storybook target. Use @nx/react:storybook executor instead.
|
|
@@ -53,5 +53,5 @@ export function loadStories() {
|
|
|
53
53
|
${storiesFiles.map((story) => `require('${story}')`).join(',\n')}
|
|
54
54
|
];
|
|
55
55
|
}`;
|
|
56
|
-
(0,
|
|
56
|
+
(0, node_fs_1.writeFileSync)((0, path_1.join)(workspaceRoot, options.outputFile), newContents);
|
|
57
57
|
}
|
|
@@ -34,14 +34,12 @@ export default defineConfig({
|
|
|
34
34
|
define: {
|
|
35
35
|
global: 'window',
|
|
36
36
|
},
|
|
37
|
-
|
|
38
37
|
resolve: {
|
|
39
38
|
extensions,
|
|
40
39
|
alias: {
|
|
41
40
|
'react-native': 'react-native-web',
|
|
42
41
|
},
|
|
43
42
|
},
|
|
44
|
-
|
|
45
43
|
build: {
|
|
46
44
|
reportCompressedSize: true,
|
|
47
45
|
commonjsOptions: { transformMixedEsModules: true },
|
|
@@ -50,7 +48,6 @@ export default defineConfig({
|
|
|
50
48
|
plugins: [rollupPlugin([/react-native-vector-icons/])],
|
|
51
49
|
},
|
|
52
50
|
},
|
|
53
|
-
|
|
54
51
|
server: {
|
|
55
52
|
port: 4200,
|
|
56
53
|
host: 'localhost',
|
|
@@ -59,12 +56,10 @@ export default defineConfig({
|
|
|
59
56
|
allow: ['..'],
|
|
60
57
|
},
|
|
61
58
|
},
|
|
62
|
-
|
|
63
59
|
preview: {
|
|
64
60
|
port: 4300,
|
|
65
61
|
host: 'localhost',
|
|
66
62
|
},
|
|
67
|
-
|
|
68
63
|
optimizeDeps: {
|
|
69
64
|
esbuildOptions: {
|
|
70
65
|
resolveExtensions: extensions,
|
|
@@ -72,9 +67,7 @@ export default defineConfig({
|
|
|
72
67
|
loader: { '.js': 'jsx' },
|
|
73
68
|
},
|
|
74
69
|
},
|
|
75
|
-
|
|
76
70
|
plugins: [react(), nxViteTsPaths()],
|
|
77
|
-
|
|
78
71
|
// Uncomment this if you are using workers.
|
|
79
72
|
// worker: {
|
|
80
73
|
// plugins: [ nxViteTsPaths() ],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = update;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
6
|
/**
|
|
7
7
|
* Remove ensure-symlink target.
|
|
8
8
|
* It is going to be supported by react-native version 0.73 by default.
|
|
@@ -14,7 +14,7 @@ async function update(tree) {
|
|
|
14
14
|
'@nx/react-native:ensure-symlink') {
|
|
15
15
|
removeTargets(config.targets, 'ensure-symlink');
|
|
16
16
|
(0, devkit_1.updateProjectConfiguration)(tree, projectName, config);
|
|
17
|
-
(0,
|
|
17
|
+
(0, node_fs_1.rmSync)(`${config.root}/node_modules`, { recursive: true, force: true });
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureNodeModulesSymlink = ensureNodeModulesSymlink;
|
|
4
|
-
const
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
5
|
const os_1 = require("os");
|
|
6
|
-
const
|
|
6
|
+
const path_1 = require("path");
|
|
7
7
|
/**
|
|
8
8
|
* This function symlink workspace node_modules folder with app project's node_mdules folder.
|
|
9
9
|
* For yarn and npm, it will symlink the entire node_modules folder.
|
|
@@ -14,14 +14,14 @@ const fs_extra_1 = require("fs-extra");
|
|
|
14
14
|
*/
|
|
15
15
|
function ensureNodeModulesSymlink(workspaceRoot, projectRoot) {
|
|
16
16
|
const worksapceNodeModulesPath = (0, path_1.join)(workspaceRoot, 'node_modules');
|
|
17
|
-
if (!(0,
|
|
17
|
+
if (!(0, node_fs_1.existsSync)(worksapceNodeModulesPath)) {
|
|
18
18
|
throw new Error(`Cannot find ${worksapceNodeModulesPath}`);
|
|
19
19
|
}
|
|
20
20
|
const appNodeModulesPath = (0, path_1.join)(workspaceRoot, projectRoot, 'node_modules');
|
|
21
21
|
// `mklink /D` requires admin privilege in Windows so we need to use junction
|
|
22
22
|
const symlinkType = (0, os_1.platform)() === 'win32' ? 'junction' : 'dir';
|
|
23
|
-
if ((0,
|
|
24
|
-
(0,
|
|
23
|
+
if ((0, node_fs_1.existsSync)(appNodeModulesPath)) {
|
|
24
|
+
(0, node_fs_1.rmSync)(appNodeModulesPath, { recursive: true, force: true });
|
|
25
25
|
}
|
|
26
|
-
(0,
|
|
26
|
+
(0, node_fs_1.symlinkSync)(worksapceNodeModulesPath, appNodeModulesPath, symlinkType);
|
|
27
27
|
}
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runPodInstall = runPodInstall;
|
|
4
4
|
exports.podInstall = podInstall;
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
6
7
|
const os_1 = require("os");
|
|
8
|
+
const path_1 = require("path");
|
|
7
9
|
const chalk = require("chalk");
|
|
8
10
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const fs_extra_1 = require("fs-extra");
|
|
10
|
-
const path_1 = require("path");
|
|
11
11
|
const podInstallErrorMessage = `
|
|
12
12
|
Running ${chalk.bold('pod install')} failed, see above.
|
|
13
13
|
Do you have CocoaPods (https://cocoapods.org/) installed?
|
|
@@ -34,7 +34,7 @@ function runPodInstall(iosDirectory, install = true, options = {
|
|
|
34
34
|
devkit_1.logger.info('Skipping `pod install` on non-darwin platform');
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
if (!install || !(0,
|
|
37
|
+
if (!install || !(0, node_fs_1.existsSync)((0, path_1.join)(iosDirectory, 'Podfile'))) {
|
|
38
38
|
devkit_1.logger.info('Skipping `pod install`');
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
@@ -49,7 +49,7 @@ function podInstall(iosDirectory, options = {
|
|
|
49
49
|
useBundler: false,
|
|
50
50
|
}) {
|
|
51
51
|
try {
|
|
52
|
-
if ((0,
|
|
52
|
+
if ((0, node_fs_1.existsSync)((0, path_1.join)(iosDirectory, '.xcode.env'))) {
|
|
53
53
|
(0, child_process_1.execSync)('touch .xcode.env', {
|
|
54
54
|
cwd: iosDirectory,
|
|
55
55
|
stdio: 'inherit',
|