@nx/react-native 16.10.0 → 17.0.0-beta.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/migrations.json +0 -972
- package/package.json +9 -9
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.d.ts +0 -8
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.js +0 -57
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.spec.ts +0 -79
- package/src/migrations/update-12-5-0/update-jest-for-react-native.d.ts +0 -2
- package/src/migrations/update-12-5-0/update-jest-for-react-native.js +0 -58
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.d.ts +0 -2
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js +0 -18
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.spec.ts +0 -48
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.d.ts +0 -6
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.js +0 -36
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.spec.ts +0 -61
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.d.ts +0 -6
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.js +0 -28
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.spec.ts +0 -192
- package/src/migrations/update-14-0-0/update-entry-file-bundle-14-0-0.d.ts +0 -5
- package/src/migrations/update-14-0-0/update-entry-file-bundle-14-0-0.js +0 -33
- package/src/migrations/update-14-0-0/update-entry-file-bundle-14-0-0.spec.ts +0 -84
- package/src/migrations/update-14-0-2/change-main-to-class-name-14-0-2.d.ts +0 -5
- package/src/migrations/update-14-0-2/change-main-to-class-name-14-0-2.js +0 -37
- package/src/migrations/update-14-0-2/change-main-to-class-name-14-0-2.spec.ts +0 -48
- package/src/migrations/update-14-2-1/rename-blockList-metro-config.d.ts +0 -6
- package/src/migrations/update-14-2-1/rename-blockList-metro-config.js +0 -28
- package/src/migrations/update-14-2-1/rename-blockList-metro-config.spec.ts +0 -190
- package/src/migrations/update-14-5-5/add-exclude-sync-deps.d.ts +0 -5
- package/src/migrations/update-14-5-5/add-exclude-sync-deps.js +0 -21
- package/src/migrations/update-14-5-5/add-exclude-sync-deps.spec.ts +0 -39
- package/src/migrations/update-14-5-8/change-searchDir-storybook.d.ts +0 -5
- package/src/migrations/update-14-5-8/change-searchDir-storybook.js +0 -21
- package/src/migrations/update-14-5-8/change-searchDir-storybook.spec.ts +0 -39
- package/src/migrations/update-14-6-0/remove-jest-transform.d.ts +0 -5
- package/src/migrations/update-14-6-0/remove-jest-transform.js +0 -53
- package/src/migrations/update-14-6-0/remove-jest-transform.spec.ts +0 -109
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
/**
|
|
6
|
-
* This function udpate the entry file option under bundle target for react native apps
|
|
7
|
-
*/
|
|
8
|
-
async function update(tree) {
|
|
9
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
10
|
-
const updateTargetEntryFile = (target, config) => {
|
|
11
|
-
if (!config.targets?.[target]?.options?.entryFile) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (tree.exists((0, path_1.join)(config.root, 'src/main.tsx'))) {
|
|
15
|
-
config.targets[target].options.entryFile = `src/main.tsx`;
|
|
16
|
-
}
|
|
17
|
-
if (tree.exists((0, path_1.join)(config.root, 'src/main.js'))) {
|
|
18
|
-
config.targets[target].options.entryFile = `src/main.js`;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
for (const [name, config] of projects.entries()) {
|
|
22
|
-
if (config.targets?.['bundle-ios']?.executor === '@nrwl/react-native:bundle') {
|
|
23
|
-
updateTargetEntryFile('bundle-ios', config);
|
|
24
|
-
}
|
|
25
|
-
if (config.targets?.['bundle-android']?.executor ===
|
|
26
|
-
'@nrwl/react-native:bundle') {
|
|
27
|
-
updateTargetEntryFile('bundle-android', config);
|
|
28
|
-
}
|
|
29
|
-
(0, devkit_1.updateProjectConfiguration)(tree, name, config);
|
|
30
|
-
}
|
|
31
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
32
|
-
}
|
|
33
|
-
exports.default = update;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { addProjectConfiguration, Tree, getProjects } from '@nx/devkit';
|
|
2
|
-
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
3
|
-
|
|
4
|
-
import update from './update-entry-file-bundle-14-0-0';
|
|
5
|
-
|
|
6
|
-
describe('Update entryFile for bundle target for react native apps', () => {
|
|
7
|
-
let tree: Tree;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
11
|
-
addProjectConfiguration(tree, 'products', {
|
|
12
|
-
root: 'apps/products',
|
|
13
|
-
sourceRoot: 'apps/products/src',
|
|
14
|
-
targets: {
|
|
15
|
-
'bundle-ios': {
|
|
16
|
-
executor: '@nrwl/react-native:bundle',
|
|
17
|
-
options: {
|
|
18
|
-
entryFile: 'apps/mobile/src/main.tsx',
|
|
19
|
-
platform: 'ios',
|
|
20
|
-
bundleOutput: 'dist/apps/mobile/ios/main.jsbundle',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
'bundle-android': {
|
|
24
|
-
executor: '@nrwl/react-native:bundle',
|
|
25
|
-
options: {
|
|
26
|
-
entryFile: 'apps/mobile/src/main.tsx',
|
|
27
|
-
platform: 'android',
|
|
28
|
-
bundleOutput: 'dist/apps/mobile/android/main.jsbundle',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it(`should update entryFile option`, async () => {
|
|
36
|
-
tree.write('apps/products/src/main.tsx', '');
|
|
37
|
-
|
|
38
|
-
await update(tree);
|
|
39
|
-
|
|
40
|
-
getProjects(tree).forEach((project) => {
|
|
41
|
-
expect(project.targets['bundle-ios']).toEqual({
|
|
42
|
-
executor: '@nrwl/react-native:bundle',
|
|
43
|
-
options: {
|
|
44
|
-
entryFile: 'src/main.tsx',
|
|
45
|
-
platform: 'ios',
|
|
46
|
-
bundleOutput: 'dist/apps/mobile/ios/main.jsbundle',
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
expect(project.targets['bundle-android']).toEqual({
|
|
51
|
-
executor: '@nrwl/react-native:bundle',
|
|
52
|
-
options: {
|
|
53
|
-
entryFile: 'src/main.tsx',
|
|
54
|
-
platform: 'android',
|
|
55
|
-
bundleOutput: 'dist/apps/mobile/android/main.jsbundle',
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it(`should not update entryFile option if the file does not exist`, async () => {
|
|
62
|
-
await update(tree);
|
|
63
|
-
|
|
64
|
-
getProjects(tree).forEach((project) => {
|
|
65
|
-
expect(project.targets['bundle-ios']).toEqual({
|
|
66
|
-
executor: '@nrwl/react-native:bundle',
|
|
67
|
-
options: {
|
|
68
|
-
entryFile: 'apps/mobile/src/main.tsx',
|
|
69
|
-
platform: 'ios',
|
|
70
|
-
bundleOutput: 'dist/apps/mobile/ios/main.jsbundle',
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
expect(project.targets['bundle-android']).toEqual({
|
|
75
|
-
executor: '@nrwl/react-native:bundle',
|
|
76
|
-
options: {
|
|
77
|
-
entryFile: 'apps/mobile/src/main.tsx',
|
|
78
|
-
platform: 'android',
|
|
79
|
-
bundleOutput: 'dist/apps/mobile/android/main.jsbundle',
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
/**
|
|
6
|
-
* This function changes "main" tag to project's className
|
|
7
|
-
*/
|
|
8
|
-
async function update(tree) {
|
|
9
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
10
|
-
for (const [name, config] of projects.entries()) {
|
|
11
|
-
if (config.targets?.start?.executor !== '@nrwl/react-native:start')
|
|
12
|
-
continue;
|
|
13
|
-
let mailFilePath;
|
|
14
|
-
if (tree.exists((0, path_1.join)(config.root, 'src/main.tsx'))) {
|
|
15
|
-
mailFilePath = (0, path_1.join)(config.root, 'src/main.tsx');
|
|
16
|
-
}
|
|
17
|
-
if (tree.exists((0, path_1.join)(config.root, 'src/main.js'))) {
|
|
18
|
-
mailFilePath = (0, path_1.join)(config.root, 'src/main.js');
|
|
19
|
-
}
|
|
20
|
-
if (!mailFilePath) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
const { className } = (0, devkit_1.names)(name);
|
|
25
|
-
const content = tree.read(mailFilePath, 'utf-8');
|
|
26
|
-
if (!content.includes(`'main'`)) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
tree.write(mailFilePath, content.replace(`'main'`, `'${className}'`));
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
devkit_1.logger.error((0, devkit_1.stripIndents) `Unable to update ${mailFilePath} for project ${name}.`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
36
|
-
}
|
|
37
|
-
exports.default = update;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { addProjectConfiguration, Tree } from '@nx/devkit';
|
|
2
|
-
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
3
|
-
|
|
4
|
-
import update from './change-main-to-class-name-14-0-2';
|
|
5
|
-
|
|
6
|
-
describe('Change from main tag to className tag', () => {
|
|
7
|
-
let tree: Tree;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
11
|
-
addProjectConfiguration(tree, 'products', {
|
|
12
|
-
root: 'apps/products',
|
|
13
|
-
sourceRoot: 'apps/products/src',
|
|
14
|
-
targets: {
|
|
15
|
-
start: {
|
|
16
|
-
executor: '@nrwl/react-native:start',
|
|
17
|
-
options: {
|
|
18
|
-
port: 8081,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it(`should udpate main file to registerComponent className`, async () => {
|
|
26
|
-
tree.write(
|
|
27
|
-
'apps/products/src/main.tsx',
|
|
28
|
-
`AppRegistry.registerComponent('main', () => App);`
|
|
29
|
-
);
|
|
30
|
-
await update(tree);
|
|
31
|
-
|
|
32
|
-
expect(tree.read('apps/products/src/main.tsx', 'utf-8')).toEqual(
|
|
33
|
-
`AppRegistry.registerComponent('Products', () => App);\n`
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it(`should not udpate main file to registerComponent className if it does not exists`, async () => {
|
|
38
|
-
tree.write(
|
|
39
|
-
'apps/products/src/main.tsx',
|
|
40
|
-
`AppRegistry.registerComponent('otherTagName', () => App);`
|
|
41
|
-
);
|
|
42
|
-
await update(tree);
|
|
43
|
-
|
|
44
|
-
expect(tree.read('apps/products/src/main.tsx', 'utf-8')).toEqual(
|
|
45
|
-
`AppRegistry.registerComponent('otherTagName', () => App);`
|
|
46
|
-
);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
/**
|
|
5
|
-
* Rename blacklistRE to blockList in metro.config.js
|
|
6
|
-
* @param tree
|
|
7
|
-
*/
|
|
8
|
-
async function update(tree) {
|
|
9
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
10
|
-
projects.forEach((project) => {
|
|
11
|
-
const metroConfigPath = `${project.root}/metro.config.js`;
|
|
12
|
-
if (project.targets?.start?.executor !== '@nrwl/react-native:start' ||
|
|
13
|
-
!tree.exists(metroConfigPath))
|
|
14
|
-
return;
|
|
15
|
-
try {
|
|
16
|
-
const metroConfigContent = tree.read(metroConfigPath, 'utf-8');
|
|
17
|
-
if (!metroConfigContent.includes('blacklistRE:')) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
tree.write(metroConfigPath, metroConfigContent.replace('blacklistRE:', 'blockList:'));
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
devkit_1.logger.error((0, devkit_1.stripIndents) `Unable to update ${metroConfigPath} for project ${project.root}.`);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
27
|
-
}
|
|
28
|
-
exports.default = update;
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { addProjectConfiguration, Tree, getProjects } from '@nx/devkit';
|
|
2
|
-
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
3
|
-
|
|
4
|
-
import update from './rename-blockList-metro-config';
|
|
5
|
-
|
|
6
|
-
describe('Rename blacklistRE to blockList in metro.config.js for react native apps', () => {
|
|
7
|
-
let tree: Tree;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
11
|
-
addProjectConfiguration(tree, 'products', {
|
|
12
|
-
root: 'apps/products',
|
|
13
|
-
sourceRoot: 'apps/products/src',
|
|
14
|
-
targets: {
|
|
15
|
-
start: {
|
|
16
|
-
executor: '@nrwl/react-native:start',
|
|
17
|
-
options: {
|
|
18
|
-
port: 8081,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it(`should udpate metro.config.js and Rename blacklistRE to blockList`, async () => {
|
|
26
|
-
tree.write(
|
|
27
|
-
'apps/products/metro.config.js',
|
|
28
|
-
`
|
|
29
|
-
const { withNxMetro } = require('@nx/react-native');
|
|
30
|
-
const { getDefaultConfig } = require('metro-config');
|
|
31
|
-
|
|
32
|
-
module.exports = (async () => {
|
|
33
|
-
const {
|
|
34
|
-
resolver: { sourceExts, assetExts },
|
|
35
|
-
} = await getDefaultConfig();
|
|
36
|
-
// console.log(getModulesRunBeforeMainModule);
|
|
37
|
-
return withNxMetro(
|
|
38
|
-
{
|
|
39
|
-
transformer: {
|
|
40
|
-
getTransformOptions: async () => ({
|
|
41
|
-
transform: {
|
|
42
|
-
experimentalImportSupport: false,
|
|
43
|
-
inlineRequires: true,
|
|
44
|
-
},
|
|
45
|
-
}),
|
|
46
|
-
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
47
|
-
},
|
|
48
|
-
resolver: {
|
|
49
|
-
assetExts: assetExts.filter((ext) => ext !== 'svg'),
|
|
50
|
-
sourceExts: [...sourceExts, 'svg'],
|
|
51
|
-
resolverMainFields: ['sbmodern', 'browser', 'main'],
|
|
52
|
-
blacklistRE: exclusionList([/\.\/dist\/.*/]),
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
// Change this to true to see debugging info.
|
|
57
|
-
// Useful if you have issues resolving modules
|
|
58
|
-
debug: false,
|
|
59
|
-
// all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx'
|
|
60
|
-
extensions: [],
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
})();
|
|
64
|
-
`
|
|
65
|
-
);
|
|
66
|
-
await update(tree);
|
|
67
|
-
|
|
68
|
-
expect(tree.read('apps/products/metro.config.js', 'utf-8')).toEqual(`
|
|
69
|
-
const { withNxMetro } = require('@nx/react-native');
|
|
70
|
-
const { getDefaultConfig } = require('metro-config');
|
|
71
|
-
|
|
72
|
-
module.exports = (async () => {
|
|
73
|
-
const {
|
|
74
|
-
resolver: { sourceExts, assetExts },
|
|
75
|
-
} = await getDefaultConfig();
|
|
76
|
-
// console.log(getModulesRunBeforeMainModule);
|
|
77
|
-
return withNxMetro(
|
|
78
|
-
{
|
|
79
|
-
transformer: {
|
|
80
|
-
getTransformOptions: async () => ({
|
|
81
|
-
transform: {
|
|
82
|
-
experimentalImportSupport: false,
|
|
83
|
-
inlineRequires: true,
|
|
84
|
-
},
|
|
85
|
-
}),
|
|
86
|
-
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
87
|
-
},
|
|
88
|
-
resolver: {
|
|
89
|
-
assetExts: assetExts.filter((ext) => ext !== 'svg'),
|
|
90
|
-
sourceExts: [...sourceExts, 'svg'],
|
|
91
|
-
resolverMainFields: ['sbmodern', 'browser', 'main'],
|
|
92
|
-
blockList: exclusionList([/\.\/dist\/.*/]),
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
// Change this to true to see debugging info.
|
|
97
|
-
// Useful if you have issues resolving modules
|
|
98
|
-
debug: false,
|
|
99
|
-
// all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx'
|
|
100
|
-
extensions: [],
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
})();
|
|
104
|
-
`);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it(`should not udpate metro.config.js if blacklistRE does not exist`, async () => {
|
|
108
|
-
tree.write(
|
|
109
|
-
'apps/products/metro.config.js',
|
|
110
|
-
`
|
|
111
|
-
const { withNxMetro } = require('@nx/react-native');
|
|
112
|
-
const { getDefaultConfig } = require('metro-config');
|
|
113
|
-
|
|
114
|
-
module.exports = (async () => {
|
|
115
|
-
const {
|
|
116
|
-
resolver: { sourceExts, assetExts },
|
|
117
|
-
} = await getDefaultConfig();
|
|
118
|
-
// console.log(getModulesRunBeforeMainModule);
|
|
119
|
-
return withNxMetro(
|
|
120
|
-
{
|
|
121
|
-
transformer: {
|
|
122
|
-
getTransformOptions: async () => ({
|
|
123
|
-
transform: {
|
|
124
|
-
experimentalImportSupport: false,
|
|
125
|
-
inlineRequires: true,
|
|
126
|
-
},
|
|
127
|
-
}),
|
|
128
|
-
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
129
|
-
},
|
|
130
|
-
resolver: {
|
|
131
|
-
assetExts: assetExts.filter((ext) => ext !== 'svg'),
|
|
132
|
-
sourceExts: [...sourceExts, 'svg'],
|
|
133
|
-
resolverMainFields: ['sbmodern', 'browser', 'main'],
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
projectRoot: __dirname,
|
|
138
|
-
// Change this to true to see debugging info.
|
|
139
|
-
// Useful if you have issues resolving modules
|
|
140
|
-
debug: false,
|
|
141
|
-
// all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx'
|
|
142
|
-
extensions: [],
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
})();
|
|
146
|
-
`
|
|
147
|
-
);
|
|
148
|
-
await update(tree);
|
|
149
|
-
|
|
150
|
-
expect(tree.read('apps/products/metro.config.js', 'utf-8'))
|
|
151
|
-
.toMatchInlineSnapshot(`
|
|
152
|
-
"const { withNxMetro } = require('@nx/react-native');
|
|
153
|
-
const { getDefaultConfig } = require('metro-config');
|
|
154
|
-
|
|
155
|
-
module.exports = (async () => {
|
|
156
|
-
const {
|
|
157
|
-
resolver: { sourceExts, assetExts },
|
|
158
|
-
} = await getDefaultConfig();
|
|
159
|
-
// console.log(getModulesRunBeforeMainModule);
|
|
160
|
-
return withNxMetro(
|
|
161
|
-
{
|
|
162
|
-
transformer: {
|
|
163
|
-
getTransformOptions: async () => ({
|
|
164
|
-
transform: {
|
|
165
|
-
experimentalImportSupport: false,
|
|
166
|
-
inlineRequires: true,
|
|
167
|
-
},
|
|
168
|
-
}),
|
|
169
|
-
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
170
|
-
},
|
|
171
|
-
resolver: {
|
|
172
|
-
assetExts: assetExts.filter((ext) => ext !== 'svg'),
|
|
173
|
-
sourceExts: [...sourceExts, 'svg'],
|
|
174
|
-
resolverMainFields: ['sbmodern', 'browser', 'main'],
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
projectRoot: __dirname,
|
|
179
|
-
// Change this to true to see debugging info.
|
|
180
|
-
// Useful if you have issues resolving modules
|
|
181
|
-
debug: false,
|
|
182
|
-
// all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx'
|
|
183
|
-
extensions: [],
|
|
184
|
-
}
|
|
185
|
-
);
|
|
186
|
-
})();
|
|
187
|
-
"
|
|
188
|
-
`);
|
|
189
|
-
});
|
|
190
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
/**
|
|
5
|
-
* This function changes include field from string to array for sync-deps target
|
|
6
|
-
*/
|
|
7
|
-
async function update(tree) {
|
|
8
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
|
-
for (const [name, config] of projects.entries()) {
|
|
10
|
-
if (config.targets?.['sync-deps']?.executor !== '@nrwl/react-native:sync-deps')
|
|
11
|
-
continue;
|
|
12
|
-
const include = config.targets?.['sync-deps']?.options?.include;
|
|
13
|
-
if (!include || !include.length) {
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
config.targets['sync-deps'].options.include = include.split(',');
|
|
17
|
-
(0, devkit_1.updateProjectConfiguration)(tree, name, config);
|
|
18
|
-
}
|
|
19
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
20
|
-
}
|
|
21
|
-
exports.default = update;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
addProjectConfiguration,
|
|
3
|
-
readProjectConfiguration,
|
|
4
|
-
Tree,
|
|
5
|
-
} from '@nx/devkit';
|
|
6
|
-
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
7
|
-
import update from './add-exclude-sync-deps';
|
|
8
|
-
|
|
9
|
-
describe('add-exclude-sync-deps', () => {
|
|
10
|
-
let tree: Tree;
|
|
11
|
-
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
14
|
-
addProjectConfiguration(tree, 'products', {
|
|
15
|
-
root: 'apps/products',
|
|
16
|
-
sourceRoot: 'apps/products/src',
|
|
17
|
-
targets: {
|
|
18
|
-
'sync-deps': {
|
|
19
|
-
executor: '@nrwl/react-native:sync-deps',
|
|
20
|
-
options: {
|
|
21
|
-
include: 'react-native-reanmiated,react-native-screens',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it(`should change include from string to array`, async () => {
|
|
29
|
-
await update(tree);
|
|
30
|
-
|
|
31
|
-
const projectConfig = readProjectConfiguration(tree, 'products');
|
|
32
|
-
expect(projectConfig.targets['sync-deps']).toEqual({
|
|
33
|
-
executor: '@nrwl/react-native:sync-deps',
|
|
34
|
-
options: {
|
|
35
|
-
include: ['react-native-reanmiated', 'react-native-screens'],
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
/**
|
|
5
|
-
* This function changes searchDir field from string to array for storybook target
|
|
6
|
-
*/
|
|
7
|
-
async function update(tree) {
|
|
8
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
|
-
for (const [name, config] of projects.entries()) {
|
|
10
|
-
if (config.targets?.['storybook']?.executor !== '@nrwl/react-native:storybook')
|
|
11
|
-
continue;
|
|
12
|
-
const searchDir = config.targets?.['storybook']?.options?.searchDir;
|
|
13
|
-
if (!searchDir || !searchDir.length || Array.isArray(searchDir)) {
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
config.targets['storybook'].options.searchDir = searchDir.split(',');
|
|
17
|
-
(0, devkit_1.updateProjectConfiguration)(tree, name, config);
|
|
18
|
-
}
|
|
19
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
20
|
-
}
|
|
21
|
-
exports.default = update;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
addProjectConfiguration,
|
|
3
|
-
readProjectConfiguration,
|
|
4
|
-
Tree,
|
|
5
|
-
} from '@nx/devkit';
|
|
6
|
-
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
7
|
-
import update from './change-searchDir-storybook';
|
|
8
|
-
|
|
9
|
-
describe('change-searchDir-storybook', () => {
|
|
10
|
-
let tree: Tree;
|
|
11
|
-
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
14
|
-
addProjectConfiguration(tree, 'products', {
|
|
15
|
-
root: 'apps/products',
|
|
16
|
-
sourceRoot: 'apps/products/src',
|
|
17
|
-
targets: {
|
|
18
|
-
storybook: {
|
|
19
|
-
executor: '@nrwl/react-native:storybook',
|
|
20
|
-
options: {
|
|
21
|
-
searchDir: 'apps/products',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it(`should change searchDir from string to array`, async () => {
|
|
29
|
-
await update(tree);
|
|
30
|
-
|
|
31
|
-
const projectConfig = readProjectConfiguration(tree, 'products');
|
|
32
|
-
expect(projectConfig.targets['storybook']).toEqual({
|
|
33
|
-
executor: '@nrwl/react-native:storybook',
|
|
34
|
-
options: {
|
|
35
|
-
searchDir: ['apps/products'],
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
5
|
-
const jest_1 = require("@nx/jest");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
/**
|
|
8
|
-
* Remove transfrom and testRunner in jest
|
|
9
|
-
*/
|
|
10
|
-
async function update(tree) {
|
|
11
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/jest:jest', (options, projectName) => {
|
|
12
|
-
if (options.jestConfig && tree.exists(options.jestConfig)) {
|
|
13
|
-
const jestConfig = tree.read(options.jestConfig, 'utf-8');
|
|
14
|
-
if (jestConfig.includes(`preset: 'react-native'`)) {
|
|
15
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
16
|
-
removeTransform(tree, project);
|
|
17
|
-
renameBabelJson(tree, project);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
22
|
-
}
|
|
23
|
-
exports.default = update;
|
|
24
|
-
function removeTransform(host, project) {
|
|
25
|
-
const jestConfigPath = project.targets?.test?.options?.jestConfig;
|
|
26
|
-
if (!jestConfigPath || !host.exists(jestConfigPath))
|
|
27
|
-
return;
|
|
28
|
-
try {
|
|
29
|
-
(0, jest_1.removePropertyFromJestConfig)(host, jestConfigPath, 'transform');
|
|
30
|
-
(0, jest_1.removePropertyFromJestConfig)(host, jestConfigPath, 'testRunner');
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
devkit_1.logger.error((0, devkit_1.stripIndents) `Unable to update ${jestConfigPath} for project ${project.root}.`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function renameBabelJson(host, project) {
|
|
37
|
-
const babelrcPath = (0, path_1.join)(project.root, '.babelrc');
|
|
38
|
-
const babelJsonPath = (0, path_1.join)(project.root, 'babel.config.json');
|
|
39
|
-
if (!host.exists(babelrcPath)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
const buffer = host.read(babelrcPath);
|
|
44
|
-
if (!buffer) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
host.write(babelJsonPath, buffer);
|
|
48
|
-
host.delete(babelrcPath);
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
devkit_1.logger.error((0, devkit_1.stripIndents) `Unable to rename from ${babelrcPath} to ${babelJsonPath} for project ${project.root}.`);
|
|
52
|
-
}
|
|
53
|
-
}
|