@nx/react-native 19.2.0-canary.20240604-0594deb → 19.2.0-rc.0
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 -8
- package/plugins/plugin.js +1 -1
- package/project.json +1 -1
- package/src/executors/build-android/build-android.impl.ts +0 -69
- package/src/executors/build-ios/build-ios.impl.ts +0 -77
- package/src/executors/bundle/bundle.impl.ts +0 -77
- package/src/executors/ensure-symlink/ensure-symlink.impl.ts +0 -22
- package/src/executors/pod-install/pod-install.impl.ts +0 -21
- package/src/executors/run-android/run-android.impl.ts +0 -94
- package/src/executors/run-ios/run-ios.impl.ts +0 -92
- package/src/executors/start/start.impl.ts +0 -111
- package/src/executors/storybook/storybook.impl.ts +0 -93
- package/src/executors/sync-deps/sync-deps.impl.ts +0 -140
- package/src/executors/upgrade/upgrade.impl.ts +0 -64
- package/src/generators/application/application.spec.ts +0 -260
- package/src/generators/application/lib/normalize-options.spec.ts +0 -211
- package/src/generators/component/component.spec.ts +0 -129
- package/src/generators/init/init.spec.ts +0 -40
- package/src/generators/library/library.spec.ts +0 -423
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts +0 -37
- package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +0 -39
- package/src/migrations/update-18-0-0/remove-block-list.spec.ts +0 -68
- package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +0 -40
- package/src/utils/add-linting.spec.ts +0 -42
- package/src/utils/ensure-node-modules-symlink.spec.ts +0 -108
- package/src/utils/find-all-npm-dependencies.spec.ts +0 -103
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
|
-
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
3
|
-
import { Linter } from '@nx/eslint';
|
|
4
|
-
import { Schema } from '../schema';
|
|
5
|
-
import { normalizeOptions } from './normalize-options';
|
|
6
|
-
|
|
7
|
-
describe('Normalize Options', () => {
|
|
8
|
-
let appTree: Tree;
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
appTree = createTreeWithEmptyWorkspace();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('should normalize options with name in kebab case', async () => {
|
|
15
|
-
const schema: Schema = {
|
|
16
|
-
name: 'my-app',
|
|
17
|
-
linter: Linter.EsLint,
|
|
18
|
-
e2eTestRunner: 'none',
|
|
19
|
-
install: false,
|
|
20
|
-
projectNameAndRootFormat: 'as-provided',
|
|
21
|
-
unitTestRunner: 'none',
|
|
22
|
-
bundler: 'vite',
|
|
23
|
-
};
|
|
24
|
-
const options = await normalizeOptions(appTree, schema);
|
|
25
|
-
expect(options).toEqual({
|
|
26
|
-
addPlugin: true,
|
|
27
|
-
androidProjectRoot: 'my-app/android',
|
|
28
|
-
appProjectRoot: 'my-app',
|
|
29
|
-
fileName: 'my-app',
|
|
30
|
-
className: 'MyApp',
|
|
31
|
-
displayName: 'MyApp',
|
|
32
|
-
iosProjectRoot: 'my-app/ios',
|
|
33
|
-
lowerCaseName: 'myapp',
|
|
34
|
-
name: 'my-app',
|
|
35
|
-
parsedTags: [],
|
|
36
|
-
projectName: 'my-app',
|
|
37
|
-
projectNameAndRootFormat: 'as-provided',
|
|
38
|
-
linter: Linter.EsLint,
|
|
39
|
-
entryFile: 'src/main.tsx',
|
|
40
|
-
e2eTestRunner: 'none',
|
|
41
|
-
unitTestRunner: 'none',
|
|
42
|
-
install: false,
|
|
43
|
-
bundler: 'vite',
|
|
44
|
-
rootProject: false,
|
|
45
|
-
e2eProjectName: 'my-app-e2e',
|
|
46
|
-
e2eProjectRoot: 'my-app-e2e',
|
|
47
|
-
e2ePort: 4200,
|
|
48
|
-
e2eWebServerAddress: 'http://localhost:4200',
|
|
49
|
-
e2eWebServerTarget: 'serve',
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should normalize options with name in camel case', async () => {
|
|
54
|
-
const schema: Schema = {
|
|
55
|
-
name: 'myApp',
|
|
56
|
-
e2eTestRunner: 'none',
|
|
57
|
-
install: false,
|
|
58
|
-
projectNameAndRootFormat: 'as-provided',
|
|
59
|
-
linter: Linter.None,
|
|
60
|
-
unitTestRunner: 'none',
|
|
61
|
-
bundler: 'vite',
|
|
62
|
-
};
|
|
63
|
-
const options = await normalizeOptions(appTree, schema);
|
|
64
|
-
expect(options).toEqual({
|
|
65
|
-
addPlugin: true,
|
|
66
|
-
androidProjectRoot: 'myApp/android',
|
|
67
|
-
appProjectRoot: 'myApp',
|
|
68
|
-
className: 'MyApp',
|
|
69
|
-
fileName: 'my-app',
|
|
70
|
-
displayName: 'MyApp',
|
|
71
|
-
iosProjectRoot: 'myApp/ios',
|
|
72
|
-
lowerCaseName: 'myapp',
|
|
73
|
-
name: 'myApp',
|
|
74
|
-
parsedTags: [],
|
|
75
|
-
projectName: 'myApp',
|
|
76
|
-
projectNameAndRootFormat: 'as-provided',
|
|
77
|
-
entryFile: 'src/main.tsx',
|
|
78
|
-
e2eTestRunner: 'none',
|
|
79
|
-
unitTestRunner: 'none',
|
|
80
|
-
install: false,
|
|
81
|
-
bundler: 'vite',
|
|
82
|
-
linter: Linter.None,
|
|
83
|
-
rootProject: false,
|
|
84
|
-
e2eProjectName: 'my-app-e2e',
|
|
85
|
-
e2eProjectRoot: 'myApp-e2e',
|
|
86
|
-
e2ePort: 4200,
|
|
87
|
-
e2eWebServerAddress: 'http://localhost:4200',
|
|
88
|
-
e2eWebServerTarget: 'serve',
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('should normalize options with directory', async () => {
|
|
93
|
-
const schema: Schema = {
|
|
94
|
-
name: 'my-app',
|
|
95
|
-
directory: 'directory/my-app',
|
|
96
|
-
e2eTestRunner: 'none',
|
|
97
|
-
install: false,
|
|
98
|
-
projectNameAndRootFormat: 'as-provided',
|
|
99
|
-
linter: Linter.None,
|
|
100
|
-
unitTestRunner: 'none',
|
|
101
|
-
bundler: 'vite',
|
|
102
|
-
};
|
|
103
|
-
const options = await normalizeOptions(appTree, schema);
|
|
104
|
-
expect(options).toEqual({
|
|
105
|
-
addPlugin: true,
|
|
106
|
-
androidProjectRoot: 'directory/my-app/android',
|
|
107
|
-
appProjectRoot: 'directory/my-app',
|
|
108
|
-
className: 'MyApp',
|
|
109
|
-
fileName: 'my-app',
|
|
110
|
-
displayName: 'MyApp',
|
|
111
|
-
iosProjectRoot: 'directory/my-app/ios',
|
|
112
|
-
lowerCaseName: 'myapp',
|
|
113
|
-
name: 'my-app',
|
|
114
|
-
directory: 'directory/my-app',
|
|
115
|
-
parsedTags: [],
|
|
116
|
-
projectName: 'my-app',
|
|
117
|
-
projectNameAndRootFormat: 'as-provided',
|
|
118
|
-
entryFile: 'src/main.tsx',
|
|
119
|
-
e2eTestRunner: 'none',
|
|
120
|
-
unitTestRunner: 'none',
|
|
121
|
-
install: false,
|
|
122
|
-
bundler: 'vite',
|
|
123
|
-
linter: Linter.None,
|
|
124
|
-
rootProject: false,
|
|
125
|
-
e2eProjectName: 'my-app-e2e',
|
|
126
|
-
e2eProjectRoot: 'directory/my-app-e2e',
|
|
127
|
-
e2ePort: 4200,
|
|
128
|
-
e2eWebServerAddress: 'http://localhost:4200',
|
|
129
|
-
e2eWebServerTarget: 'serve',
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('should normalize options that has directory in its name', async () => {
|
|
134
|
-
const schema: Schema = {
|
|
135
|
-
name: 'directory/my-app',
|
|
136
|
-
e2eTestRunner: 'none',
|
|
137
|
-
install: false,
|
|
138
|
-
projectNameAndRootFormat: 'as-provided',
|
|
139
|
-
linter: Linter.None,
|
|
140
|
-
unitTestRunner: 'none',
|
|
141
|
-
bundler: 'vite',
|
|
142
|
-
};
|
|
143
|
-
const options = await normalizeOptions(appTree, schema);
|
|
144
|
-
expect(options).toEqual({
|
|
145
|
-
addPlugin: true,
|
|
146
|
-
androidProjectRoot: 'directory/my-app/android',
|
|
147
|
-
appProjectRoot: 'directory/my-app',
|
|
148
|
-
className: 'DirectoryMyApp',
|
|
149
|
-
fileName: 'directory/my-app',
|
|
150
|
-
displayName: 'DirectoryMyApp',
|
|
151
|
-
iosProjectRoot: 'directory/my-app/ios',
|
|
152
|
-
lowerCaseName: 'directorymyapp',
|
|
153
|
-
name: 'my-app',
|
|
154
|
-
parsedTags: [],
|
|
155
|
-
projectName: 'my-app',
|
|
156
|
-
projectNameAndRootFormat: 'as-provided',
|
|
157
|
-
entryFile: 'src/main.tsx',
|
|
158
|
-
e2eTestRunner: 'none',
|
|
159
|
-
unitTestRunner: 'none',
|
|
160
|
-
install: false,
|
|
161
|
-
bundler: 'vite',
|
|
162
|
-
linter: Linter.None,
|
|
163
|
-
rootProject: false,
|
|
164
|
-
e2eProjectName: 'directory/my-app-e2e',
|
|
165
|
-
e2eProjectRoot: 'directory/my-app-e2e',
|
|
166
|
-
e2ePort: 4200,
|
|
167
|
-
e2eWebServerAddress: 'http://localhost:4200',
|
|
168
|
-
e2eWebServerTarget: 'serve',
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it('should normalize options with display name', async () => {
|
|
173
|
-
const schema: Schema = {
|
|
174
|
-
name: 'my-app',
|
|
175
|
-
displayName: 'My App',
|
|
176
|
-
e2eTestRunner: 'none',
|
|
177
|
-
install: false,
|
|
178
|
-
projectNameAndRootFormat: 'as-provided',
|
|
179
|
-
linter: Linter.None,
|
|
180
|
-
unitTestRunner: 'none',
|
|
181
|
-
bundler: 'vite',
|
|
182
|
-
};
|
|
183
|
-
const options = await normalizeOptions(appTree, schema);
|
|
184
|
-
expect(options).toEqual({
|
|
185
|
-
addPlugin: true,
|
|
186
|
-
androidProjectRoot: 'my-app/android',
|
|
187
|
-
appProjectRoot: 'my-app',
|
|
188
|
-
className: 'MyApp',
|
|
189
|
-
fileName: 'my-app',
|
|
190
|
-
displayName: 'My App',
|
|
191
|
-
iosProjectRoot: 'my-app/ios',
|
|
192
|
-
lowerCaseName: 'myapp',
|
|
193
|
-
name: 'my-app',
|
|
194
|
-
parsedTags: [],
|
|
195
|
-
projectName: 'my-app',
|
|
196
|
-
projectNameAndRootFormat: 'as-provided',
|
|
197
|
-
entryFile: 'src/main.tsx',
|
|
198
|
-
e2eTestRunner: 'none',
|
|
199
|
-
unitTestRunner: 'none',
|
|
200
|
-
install: false,
|
|
201
|
-
bundler: 'vite',
|
|
202
|
-
linter: Linter.None,
|
|
203
|
-
rootProject: false,
|
|
204
|
-
e2eProjectName: 'my-app-e2e',
|
|
205
|
-
e2eProjectRoot: 'my-app-e2e',
|
|
206
|
-
e2ePort: 4200,
|
|
207
|
-
e2eWebServerAddress: 'http://localhost:4200',
|
|
208
|
-
e2eWebServerTarget: 'serve',
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
});
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import 'nx/src/internal-testing-utils/mock-project-graph';
|
|
2
|
-
|
|
3
|
-
import { logger, Tree } from '@nx/devkit';
|
|
4
|
-
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
5
|
-
import { createApp, createLib } from '../../utils/testing-generators';
|
|
6
|
-
import { reactNativeComponentGenerator } from './component';
|
|
7
|
-
|
|
8
|
-
describe('component', () => {
|
|
9
|
-
let appTree: Tree;
|
|
10
|
-
let projectName: string;
|
|
11
|
-
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
projectName = 'my-lib';
|
|
14
|
-
appTree = createTreeWithEmptyWorkspace();
|
|
15
|
-
appTree.write('.gitignore', '');
|
|
16
|
-
await createApp(appTree, 'my-app');
|
|
17
|
-
await createLib(appTree, projectName);
|
|
18
|
-
jest.spyOn(logger, 'warn').mockImplementation(() => {});
|
|
19
|
-
jest.spyOn(logger, 'debug').mockImplementation(() => {});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
afterEach(() => {
|
|
23
|
-
jest.restoreAllMocks();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should generate component files', async () => {
|
|
27
|
-
await reactNativeComponentGenerator(appTree, {
|
|
28
|
-
name: 'hello',
|
|
29
|
-
project: projectName,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
expect(appTree.exists('my-lib/src/lib/hello/hello.tsx')).toBeTruthy();
|
|
33
|
-
expect(appTree.exists('my-lib/src/lib/hello/hello.spec.tsx')).toBeTruthy();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should generate files for an app', async () => {
|
|
37
|
-
await reactNativeComponentGenerator(appTree, {
|
|
38
|
-
name: 'hello',
|
|
39
|
-
project: 'my-app',
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
expect(appTree.exists('my-app/src/app/hello/hello.tsx')).toBeTruthy();
|
|
43
|
-
expect(appTree.exists('my-app/src/app/hello/hello.spec.tsx')).toBeTruthy();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('--export', () => {
|
|
47
|
-
it('should add to index.ts barrel', async () => {
|
|
48
|
-
await reactNativeComponentGenerator(appTree, {
|
|
49
|
-
name: 'hello',
|
|
50
|
-
project: projectName,
|
|
51
|
-
export: true,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const indexContent = appTree.read('my-lib/src/index.ts', 'utf-8');
|
|
55
|
-
|
|
56
|
-
expect(indexContent).toMatch(/lib\/hello/);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should not export from an app', async () => {
|
|
60
|
-
await reactNativeComponentGenerator(appTree, {
|
|
61
|
-
name: 'hello',
|
|
62
|
-
project: 'my-app',
|
|
63
|
-
export: true,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const indexContent = appTree.read('my-lib/src/index.ts', 'utf-8');
|
|
67
|
-
|
|
68
|
-
expect(indexContent).not.toMatch(/lib\/hello/);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
describe('--pascalCaseFiles', () => {
|
|
73
|
-
it('should generate component files with upper case names', async () => {
|
|
74
|
-
await reactNativeComponentGenerator(appTree, {
|
|
75
|
-
name: 'hello',
|
|
76
|
-
project: projectName,
|
|
77
|
-
pascalCaseFiles: true,
|
|
78
|
-
});
|
|
79
|
-
expect(appTree.exists('my-lib/src/lib/hello/Hello.tsx')).toBeTruthy();
|
|
80
|
-
expect(
|
|
81
|
-
appTree.exists('my-lib/src/lib/hello/Hello.spec.tsx')
|
|
82
|
-
).toBeTruthy();
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
describe('--directory', () => {
|
|
87
|
-
it('should create component under the directory', async () => {
|
|
88
|
-
await reactNativeComponentGenerator(appTree, {
|
|
89
|
-
name: 'hello',
|
|
90
|
-
project: projectName,
|
|
91
|
-
directory: 'components',
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
expect(appTree.exists('my-lib/src/components/hello/hello.tsx'));
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should create with nested directories', async () => {
|
|
98
|
-
await reactNativeComponentGenerator(appTree, {
|
|
99
|
-
name: 'helloWorld',
|
|
100
|
-
project: projectName,
|
|
101
|
-
directory: 'lib/foo',
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
expect(appTree.exists('my-lib/src/lib/foo/hello-world/hello-world.tsx'));
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
describe('--flat', () => {
|
|
109
|
-
it('should create in project directory rather than in its own folder', async () => {
|
|
110
|
-
await reactNativeComponentGenerator(appTree, {
|
|
111
|
-
name: 'hello',
|
|
112
|
-
project: projectName,
|
|
113
|
-
flat: true,
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
expect(appTree.exists('my-lib/src/lib/hello.tsx'));
|
|
117
|
-
});
|
|
118
|
-
it('should work with custom directory path', async () => {
|
|
119
|
-
await reactNativeComponentGenerator(appTree, {
|
|
120
|
-
name: 'hello',
|
|
121
|
-
project: projectName,
|
|
122
|
-
flat: true,
|
|
123
|
-
directory: 'components',
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
expect(appTree.exists('my-lib/src/components/hello.tsx'));
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import 'nx/src/internal-testing-utils/mock-project-graph';
|
|
2
|
-
|
|
3
|
-
import { Tree, readJson } from '@nx/devkit';
|
|
4
|
-
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
5
|
-
import { reactNativeInitGenerator } from './init';
|
|
6
|
-
|
|
7
|
-
describe('init', () => {
|
|
8
|
-
let tree: Tree;
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
tree = createTreeWithEmptyWorkspace();
|
|
12
|
-
tree.write('.gitignore', '');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should add react native dependencies', async () => {
|
|
16
|
-
await reactNativeInitGenerator(tree, {
|
|
17
|
-
addPlugin: true,
|
|
18
|
-
});
|
|
19
|
-
const packageJson = readJson(tree, 'package.json');
|
|
20
|
-
expect(packageJson.dependencies['react']).toBeDefined();
|
|
21
|
-
expect(packageJson.dependencies['react-native']).toBeDefined();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should add .gitignore entries for React native files and directories', async () => {
|
|
25
|
-
tree.write(
|
|
26
|
-
'/.gitignore',
|
|
27
|
-
`
|
|
28
|
-
/node_modules
|
|
29
|
-
`
|
|
30
|
-
);
|
|
31
|
-
await reactNativeInitGenerator(tree, {
|
|
32
|
-
addPlugin: true,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const content = tree.read('/.gitignore').toString();
|
|
36
|
-
|
|
37
|
-
expect(content).toMatch(/# React Native/);
|
|
38
|
-
expect(content).toMatch(/# Nested node_modules/);
|
|
39
|
-
});
|
|
40
|
-
});
|