@nx/react-native 0.0.0-pr-22179-271588f
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 +48 -0
- package/LICENSE +22 -0
- package/README.md +68 -0
- package/executors.json +59 -0
- package/generators.json +58 -0
- package/index.d.ts +5 -0
- package/index.js +13 -0
- package/migrations.json +632 -0
- package/package.json +57 -0
- package/plugin.d.ts +1 -0
- package/plugin.js +6 -0
- package/plugins/jest/svg-mock.d.ts +0 -0
- package/plugins/jest/svg-mock.js +3 -0
- package/plugins/metro-resolver.d.ts +1 -0
- package/plugins/metro-resolver.js +136 -0
- package/plugins/plugin.d.ts +14 -0
- package/plugins/plugin.js +162 -0
- package/plugins/with-nx-metro.d.ts +8 -0
- package/plugins/with-nx-metro.js +31 -0
- package/project.json +54 -0
- package/src/executors/build-android/build-android.impl.d.ts +6 -0
- package/src/executors/build-android/build-android.impl.js +48 -0
- package/src/executors/build-android/build-android.impl.ts +69 -0
- package/src/executors/build-android/schema.d.ts +14 -0
- package/src/executors/build-android/schema.json +81 -0
- package/src/executors/build-ios/build-ios.impl.d.ts +6 -0
- package/src/executors/build-ios/build-ios.impl.js +55 -0
- package/src/executors/build-ios/build-ios.impl.ts +77 -0
- package/src/executors/build-ios/schema.d.ts +17 -0
- package/src/executors/build-ios/schema.json +91 -0
- package/src/executors/bundle/bundle.impl.d.ts +6 -0
- package/src/executors/bundle/bundle.impl.js +56 -0
- package/src/executors/bundle/bundle.impl.ts +77 -0
- package/src/executors/bundle/schema.d.ts +16 -0
- package/src/executors/bundle/schema.json +92 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +9 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.js +13 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.ts +22 -0
- package/src/executors/ensure-symlink/schema.json +11 -0
- package/src/executors/pod-install/pod-install.impl.d.ts +6 -0
- package/src/executors/pod-install/pod-install.impl.js +11 -0
- package/src/executors/pod-install/pod-install.impl.ts +21 -0
- package/src/executors/pod-install/schema.d.ts +6 -0
- package/src/executors/pod-install/schema.json +33 -0
- package/src/executors/run-android/run-android.impl.d.ts +6 -0
- package/src/executors/run-android/run-android.impl.js +66 -0
- package/src/executors/run-android/run-android.impl.ts +94 -0
- package/src/executors/run-android/schema.d.ts +13 -0
- package/src/executors/run-android/schema.json +100 -0
- package/src/executors/run-ios/run-ios.impl.d.ts +6 -0
- package/src/executors/run-ios/run-ios.impl.js +65 -0
- package/src/executors/run-ios/run-ios.impl.ts +92 -0
- package/src/executors/run-ios/schema.d.ts +7 -0
- package/src/executors/run-ios/schema.json +96 -0
- package/src/executors/start/lib/is-packager-running.d.ts +1 -0
- package/src/executors/start/lib/is-packager-running.js +15 -0
- package/src/executors/start/schema.d.ts +7 -0
- package/src/executors/start/schema.json +28 -0
- package/src/executors/start/start.impl.d.ts +10 -0
- package/src/executors/start/start.impl.js +87 -0
- package/src/executors/start/start.impl.ts +111 -0
- package/src/executors/storybook/schema.d.ts +5 -0
- package/src/executors/storybook/schema.json +29 -0
- package/src/executors/storybook/storybook.impl.d.ts +10 -0
- package/src/executors/storybook/storybook.impl.js +51 -0
- package/src/executors/storybook/storybook.impl.ts +85 -0
- package/src/executors/sync-deps/schema.d.ts +5 -0
- package/src/executors/sync-deps/schema.json +33 -0
- package/src/executors/sync-deps/sync-deps.impl.d.ts +9 -0
- package/src/executors/sync-deps/sync-deps.impl.js +78 -0
- package/src/executors/sync-deps/sync-deps.impl.ts +140 -0
- package/src/executors/upgrade/schema.d.ts +1 -0
- package/src/executors/upgrade/schema.json +11 -0
- package/src/executors/upgrade/upgrade.impl.d.ts +13 -0
- package/src/executors/upgrade/upgrade.impl.js +47 -0
- package/src/executors/upgrade/upgrade.impl.ts +64 -0
- package/src/generators/application/application.d.ts +5 -0
- package/src/generators/application/application.js +87 -0
- package/src/generators/application/application.spec.ts +258 -0
- package/src/generators/application/files/app/.babelrc.js.template +23 -0
- package/src/generators/application/files/app/Gemfile.template +7 -0
- package/src/generators/application/files/app/android/app/build.gradle.template +119 -0
- package/src/generators/application/files/app/android/app/debug.keystore +0 -0
- package/src/generators/application/files/app/android/app/proguard-rules.pro +10 -0
- package/src/generators/application/files/app/android/app/src/androidTest/java/com/__lowerCaseName__/DetoxTest.java.template +30 -0
- package/src/generators/application/files/app/android/app/src/debug/AndroidManifest.xml.template +10 -0
- package/src/generators/application/files/app/android/app/src/main/AndroidManifest.xml.template +26 -0
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.kt.template +22 -0
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +45 -0
- package/src/generators/application/files/app/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/values/strings.xml.template +3 -0
- package/src/generators/application/files/app/android/app/src/main/res/values/styles.xml +9 -0
- package/src/generators/application/files/app/android/app/src/main/res/xml/network_security_config.xml +7 -0
- package/src/generators/application/files/app/android/build.gradle.template +21 -0
- package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/src/generators/application/files/app/android/gradle.properties +41 -0
- package/src/generators/application/files/app/android/gradlew.bat +92 -0
- package/src/generators/application/files/app/android/gradlew.template +249 -0
- package/src/generators/application/files/app/android/settings.gradle.template +4 -0
- package/src/generators/application/files/app/app.json.template +4 -0
- package/src/generators/application/files/app/ios/.xcode.env.template +12 -0
- package/src/generators/application/files/app/ios/Podfile.template +55 -0
- package/src/generators/application/files/app/ios/__className__/AppDelegate.h +6 -0
- package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +31 -0
- package/src/generators/application/files/app/ios/__className__/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/src/generators/application/files/app/ios/__className__/Images.xcassets/Contents.json +6 -0
- package/src/generators/application/files/app/ios/__className__/Info.plist.template +52 -0
- package/src/generators/application/files/app/ios/__className__/LaunchScreen.storyboard.template +47 -0
- package/src/generators/application/files/app/ios/__className__/main.m +10 -0
- package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +684 -0
- package/src/generators/application/files/app/ios/__className__.xcodeproj/xcshareddata/xcschemes/__className__.xcscheme.template +88 -0
- package/src/generators/application/files/app/ios/__className__.xcworkspace/contents.xcworkspacedata +10 -0
- package/src/generators/application/files/app/ios/__className__Tests/Info.plist +24 -0
- package/src/generators/application/files/app/ios/__className__Tests/__className__Tests.m +66 -0
- package/src/generators/application/files/app/metro.config.js.template +31 -0
- package/src/generators/application/files/app/package.json.template +14 -0
- package/src/generators/application/files/app/src/app/App.spec.tsx.template +9 -0
- package/src/generators/application/files/app/src/app/App.tsx.template +731 -0
- package/src/generators/application/files/app/src/main.tsx.template +4 -0
- package/src/generators/application/files/app/test-setup.ts.template +1 -0
- package/src/generators/application/files/app/tsconfig.app.json.template +10 -0
- package/src/generators/application/files/app/tsconfig.json.template +19 -0
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +46 -0
- package/src/generators/application/lib/add-project.d.ts +3 -0
- package/src/generators/application/lib/add-project.js +91 -0
- package/src/generators/application/lib/create-application-files.d.ts +3 -0
- package/src/generators/application/lib/create-application-files.js +24 -0
- package/src/generators/application/lib/normalize-options.d.ts +17 -0
- package/src/generators/application/lib/normalize-options.js +47 -0
- package/src/generators/application/lib/normalize-options.spec.ts +196 -0
- package/src/generators/application/schema.d.ts +23 -0
- package/src/generators/application/schema.json +103 -0
- package/src/generators/component/component.d.ts +5 -0
- package/src/generators/component/component.js +64 -0
- package/src/generators/component/component.spec.ts +127 -0
- package/src/generators/component/files/__fileName__.spec.tsx__tmpl__ +11 -0
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +32 -0
- package/src/generators/component/lib/add-import.d.ts +3 -0
- package/src/generators/component/lib/add-import.js +33 -0
- package/src/generators/component/lib/normalize-options.d.ts +10 -0
- package/src/generators/component/lib/normalize-options.js +50 -0
- package/src/generators/component/schema.d.ts +24 -0
- package/src/generators/component/schema.json +85 -0
- package/src/generators/component-story/component-story.d.ts +8 -0
- package/src/generators/component-story/component-story.js +15 -0
- package/src/generators/component-story/schema.d.ts +6 -0
- package/src/generators/component-story/schema.json +42 -0
- package/src/generators/init/init.d.ts +6 -0
- package/src/generators/init/init.js +78 -0
- package/src/generators/init/init.spec.ts +38 -0
- package/src/generators/init/lib/add-git-ignore-entry.d.ts +2 -0
- package/src/generators/init/lib/add-git-ignore-entry.js +24 -0
- package/src/generators/init/lib/gitignore-entries.d.ts +1 -0
- package/src/generators/init/lib/gitignore-entries.js +74 -0
- package/src/generators/init/schema.d.ts +7 -0
- package/src/generators/init/schema.json +35 -0
- package/src/generators/library/files/lib/.babelrc.js.template +21 -0
- package/src/generators/library/files/lib/README.md +7 -0
- package/src/generators/library/files/lib/package.json.template +4 -0
- package/src/generators/library/files/lib/src/index.ts.template +0 -0
- package/src/generators/library/files/lib/test-setup.ts.template +1 -0
- package/src/generators/library/files/lib/tsconfig.json.template +16 -0
- package/src/generators/library/files/lib/tsconfig.lib.json.template +9 -0
- package/src/generators/library/lib/normalize-options.d.ts +12 -0
- package/src/generators/library/lib/normalize-options.js +33 -0
- package/src/generators/library/library.d.ts +5 -0
- package/src/generators/library/library.js +154 -0
- package/src/generators/library/library.spec.ts +420 -0
- package/src/generators/library/schema.d.ts +25 -0
- package/src/generators/library/schema.json +107 -0
- package/src/generators/stories/schema.d.ts +7 -0
- package/src/generators/stories/schema.json +58 -0
- package/src/generators/stories/stories.d.ts +8 -0
- package/src/generators/stories/stories.js +13 -0
- package/src/generators/storybook-configuration/configuration.d.ts +9 -0
- package/src/generators/storybook-configuration/configuration.js +26 -0
- package/src/generators/storybook-configuration/schema.d.ts +13 -0
- package/src/generators/storybook-configuration/schema.json +79 -0
- package/src/generators/upgrade-native/lib/create-native-files.d.ts +3 -0
- package/src/generators/upgrade-native/lib/create-native-files.js +14 -0
- package/src/generators/upgrade-native/lib/normalize-options.d.ts +12 -0
- package/src/generators/upgrade-native/lib/normalize-options.js +27 -0
- package/src/generators/upgrade-native/schema.d.ts +9 -0
- package/src/generators/upgrade-native/schema.json +41 -0
- package/src/generators/upgrade-native/upgrade-native.d.ts +10 -0
- package/src/generators/upgrade-native/upgrade-native.js +31 -0
- package/src/generators/web-configuration/files/base-vite/.babelrc.js.template +23 -0
- package/src/generators/web-configuration/files/base-vite/index.html__tmpl__ +15 -0
- package/src/generators/web-configuration/files/base-vite/public/favicon.ico +0 -0
- package/src/generators/web-configuration/files/base-vite/src/assets/.gitkeep +0 -0
- package/src/generators/web-configuration/files/base-vite/src/main-web.tsx__tmpl__ +9 -0
- package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +82 -0
- package/src/generators/web-configuration/files/base-webpack/.babelrc.js.template +23 -0
- package/src/generators/web-configuration/files/base-webpack/src/assets/.gitkeep +0 -0
- package/src/generators/web-configuration/files/base-webpack/src/favicon.ico +0 -0
- package/src/generators/web-configuration/files/base-webpack/src/index.html__tmpl__ +14 -0
- package/src/generators/web-configuration/files/base-webpack/src/main-web.tsx__tmpl__ +9 -0
- package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +77 -0
- package/src/generators/web-configuration/lib/normalize-schema.d.ts +17 -0
- package/src/generators/web-configuration/lib/normalize-schema.js +16 -0
- package/src/generators/web-configuration/lib/webpack-targets.d.ts +7 -0
- package/src/generators/web-configuration/lib/webpack-targets.js +75 -0
- package/src/generators/web-configuration/schema.d.ts +6 -0
- package/src/generators/web-configuration/schema.json +42 -0
- package/src/generators/web-configuration/web-configuration.d.ts +12 -0
- package/src/generators/web-configuration/web-configuration.js +87 -0
- package/src/migrations/update-15-0-0/add-babel-inputs.d.ts +2 -0
- package/src/migrations/update-15-0-0/add-babel-inputs.js +9 -0
- package/src/migrations/update-15-0-0/add-babel-inputs.spec.ts +73 -0
- package/src/migrations/update-15-9-1/add-build-ios-target.d.ts +5 -0
- package/src/migrations/update-15-9-1/add-build-ios-target.js +29 -0
- package/src/migrations/update-15-9-1/add-build-ios-target.spec.ts +36 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts +37 -0
- package/src/migrations/update-16-1-0/upgrade-storybook-6-5.d.ts +6 -0
- package/src/migrations/update-16-1-0/upgrade-storybook-6-5.js +21 -0
- package/src/migrations/update-16-6-0/add-depends-on.d.ts +6 -0
- package/src/migrations/update-16-6-0/add-depends-on.js +63 -0
- package/src/migrations/update-16-6-0/update-metro-config.d.ts +6 -0
- package/src/migrations/update-16-6-0/update-metro-config.js +63 -0
- package/src/migrations/update-16-9-0/remove-types-react-native.d.ts +7 -0
- package/src/migrations/update-16-9-0/remove-types-react-native.js +13 -0
- package/src/migrations/update-18-0-0/add-upgrade-target.d.ts +6 -0
- package/src/migrations/update-18-0-0/add-upgrade-target.js +33 -0
- package/src/migrations/update-18-0-0/add-web-configuration.d.ts +8 -0
- package/src/migrations/update-18-0-0/add-web-configuration.js +33 -0
- package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +39 -0
- package/src/migrations/update-18-0-0/change-storybook-targets.d.ts +5 -0
- package/src/migrations/update-18-0-0/change-storybook-targets.js +57 -0
- package/src/migrations/update-18-0-0/remove-block-list.d.ts +6 -0
- package/src/migrations/update-18-0-0/remove-block-list.js +28 -0
- package/src/migrations/update-18-0-0/remove-block-list.spec.ts +68 -0
- package/src/migrations/update-18-0-0/remove-metro.d.ts +14 -0
- package/src/migrations/update-18-0-0/remove-metro.js +29 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +6 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.js +30 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +40 -0
- package/src/utils/add-jest.d.ts +2 -0
- package/src/utils/add-jest.js +48 -0
- package/src/utils/add-linting.d.ts +13 -0
- package/src/utils/add-linting.js +36 -0
- package/src/utils/add-linting.spec.ts +40 -0
- package/src/utils/chmod-android-gradle-files.d.ts +3 -0
- package/src/utils/chmod-android-gradle-files.js +27 -0
- package/src/utils/ensure-dependencies.d.ts +2 -0
- package/src/utils/ensure-dependencies.js +30 -0
- package/src/utils/ensure-node-modules-symlink.d.ts +9 -0
- package/src/utils/ensure-node-modules-symlink.js +28 -0
- package/src/utils/ensure-node-modules-symlink.spec.ts +108 -0
- package/src/utils/find-all-npm-dependencies.d.ts +2 -0
- package/src/utils/find-all-npm-dependencies.js +27 -0
- package/src/utils/find-all-npm-dependencies.spec.ts +103 -0
- package/src/utils/format-file.d.ts +1 -0
- package/src/utils/format-file.js +16 -0
- package/src/utils/get-cli-options.d.ts +8 -0
- package/src/utils/get-cli-options.js +33 -0
- package/src/utils/pod-install-task.d.ts +18 -0
- package/src/utils/pod-install-task.js +73 -0
- package/src/utils/testing-generators.d.ts +3 -0
- package/src/utils/testing-generators.js +32 -0
- package/src/utils/versions.d.ts +17 -0
- package/src/utils/versions.js +20 -0
- package/typings/svg.d.ts +7 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { tmpdir } from 'os';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import * as fs from 'fs-extra';
|
|
4
|
+
import { ensureNodeModulesSymlink } from './ensure-node-modules-symlink';
|
|
5
|
+
|
|
6
|
+
const workspaceDir = join(tmpdir(), 'nx-react-native-test');
|
|
7
|
+
const appDir = 'apps/myapp';
|
|
8
|
+
const appDirAbsolutePath = join(workspaceDir, appDir);
|
|
9
|
+
|
|
10
|
+
describe('ensureNodeModulesSymlink', () => {
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
if (fs.existsSync(workspaceDir)) fs.removeSync(workspaceDir);
|
|
13
|
+
fs.mkdirSync(workspaceDir);
|
|
14
|
+
fs.mkdirSync(appDirAbsolutePath, { recursive: true });
|
|
15
|
+
fs.mkdirSync(appDirAbsolutePath, { recursive: true });
|
|
16
|
+
fs.writeFileSync(
|
|
17
|
+
join(appDirAbsolutePath, 'package.json'),
|
|
18
|
+
JSON.stringify({
|
|
19
|
+
name: 'myapp',
|
|
20
|
+
dependencies: { 'react-native': '*' },
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
fs.writeFileSync(
|
|
24
|
+
join(workspaceDir, 'package.json'),
|
|
25
|
+
JSON.stringify({
|
|
26
|
+
name: 'workspace',
|
|
27
|
+
dependencies: {
|
|
28
|
+
'@nx/react-native': '9999.9.9',
|
|
29
|
+
'@react-native-community/cli-platform-ios': '7777.7.7',
|
|
30
|
+
'@react-native-community/cli-platform-android': '7777.7.7',
|
|
31
|
+
'react-native': '0.9999.0',
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
afterEach(() => {
|
|
38
|
+
if (fs.existsSync(workspaceDir)) fs.removeSync(workspaceDir);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should create symlinks', () => {
|
|
42
|
+
createNpmDirectory('@nx/react-native', '9999.9.9');
|
|
43
|
+
createNpmDirectory(
|
|
44
|
+
'@react-native-community/cli-platform-android',
|
|
45
|
+
'7777.7.7'
|
|
46
|
+
);
|
|
47
|
+
createNpmDirectory('@react-native-community/cli-platform-ios', '7777.7.7');
|
|
48
|
+
createNpmDirectory('hermes-engine', '3333.3.3');
|
|
49
|
+
createNpmDirectory('react-native', '0.9999.0');
|
|
50
|
+
createNpmDirectory('jsc-android', '888888.0.0');
|
|
51
|
+
createNpmDirectory('@babel/runtime', '5555.0.0');
|
|
52
|
+
|
|
53
|
+
ensureNodeModulesSymlink(workspaceDir, appDir);
|
|
54
|
+
|
|
55
|
+
expectSymlinkToExist('@nx/react-native');
|
|
56
|
+
expectSymlinkToExist('react-native');
|
|
57
|
+
expectSymlinkToExist('jsc-android');
|
|
58
|
+
expectSymlinkToExist('hermes-engine');
|
|
59
|
+
expectSymlinkToExist('@react-native-community/cli-platform-ios');
|
|
60
|
+
expectSymlinkToExist('@react-native-community/cli-platform-android');
|
|
61
|
+
expectSymlinkToExist('@babel/runtime');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should add packages listed in workspace package.json', () => {
|
|
65
|
+
fs.writeFileSync(
|
|
66
|
+
join(workspaceDir, 'package.json'),
|
|
67
|
+
JSON.stringify({
|
|
68
|
+
name: 'workspace',
|
|
69
|
+
dependencies: {
|
|
70
|
+
random: '9999.9.9',
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
createNpmDirectory('@nx/react-native', '9999.9.9');
|
|
75
|
+
createNpmDirectory(
|
|
76
|
+
'@react-native-community/cli-platform-android',
|
|
77
|
+
'7777.7.7'
|
|
78
|
+
);
|
|
79
|
+
createNpmDirectory('@react-native-community/cli-platform-ios', '7777.7.7');
|
|
80
|
+
createNpmDirectory('hermes-engine', '3333.3.3');
|
|
81
|
+
createNpmDirectory('react-native', '0.9999.0');
|
|
82
|
+
createNpmDirectory('jsc-android', '888888.0.0');
|
|
83
|
+
createNpmDirectory('@babel/runtime', '5555.0.0');
|
|
84
|
+
createNpmDirectory('random', '9999.9.9');
|
|
85
|
+
|
|
86
|
+
ensureNodeModulesSymlink(workspaceDir, appDir);
|
|
87
|
+
|
|
88
|
+
expectSymlinkToExist('random');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
function createNpmDirectory(packageName, version) {
|
|
92
|
+
const dir = join(workspaceDir, `node_modules/${packageName}`);
|
|
93
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
94
|
+
fs.writeFileSync(
|
|
95
|
+
join(dir, 'package.json'),
|
|
96
|
+
JSON.stringify({ name: packageName, version: version })
|
|
97
|
+
);
|
|
98
|
+
return dir;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function expectSymlinkToExist(packageName) {
|
|
102
|
+
expect(
|
|
103
|
+
fs.existsSync(
|
|
104
|
+
join(appDirAbsolutePath, `node_modules/${packageName}/package.json`)
|
|
105
|
+
)
|
|
106
|
+
).toBe(true);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findAllNpmDependencies = void 0;
|
|
4
|
+
function findAllNpmDependencies(graph, projectName, list = [], seen = new Set()) {
|
|
5
|
+
// In case of bad circular dependencies
|
|
6
|
+
if (seen.has(projectName)) {
|
|
7
|
+
return list;
|
|
8
|
+
}
|
|
9
|
+
seen.add(projectName);
|
|
10
|
+
const node = graph.externalNodes[projectName];
|
|
11
|
+
// Don't want to include '@nx/react-native' and '@nx/expo' because React Native
|
|
12
|
+
// autolink will warn that the package has no podspec file for iOS.
|
|
13
|
+
if (node) {
|
|
14
|
+
if (node.name !== `npm:@nx/react-native` &&
|
|
15
|
+
node.name !== `npm:@nrwl/react-native` &&
|
|
16
|
+
node.name !== `npm:@nx/expo` &&
|
|
17
|
+
node.name !== `npm:@nrwl/expo`) {
|
|
18
|
+
list.push(node.data.packageName);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
// it's workspace project, search for it's dependencies
|
|
23
|
+
graph.dependencies[projectName]?.forEach((dep) => findAllNpmDependencies(graph, dep.target, list, seen));
|
|
24
|
+
}
|
|
25
|
+
return list;
|
|
26
|
+
}
|
|
27
|
+
exports.findAllNpmDependencies = findAllNpmDependencies;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { findAllNpmDependencies } from './find-all-npm-dependencies';
|
|
2
|
+
import { DependencyType, ProjectGraph } from '@nx/devkit';
|
|
3
|
+
|
|
4
|
+
test('findAllNpmDependencies', () => {
|
|
5
|
+
const graph: ProjectGraph = {
|
|
6
|
+
nodes: {
|
|
7
|
+
myapp: {
|
|
8
|
+
type: 'app',
|
|
9
|
+
name: 'myapp',
|
|
10
|
+
data: { files: [] },
|
|
11
|
+
},
|
|
12
|
+
lib1: {
|
|
13
|
+
type: 'lib',
|
|
14
|
+
name: 'lib1',
|
|
15
|
+
data: { files: [] },
|
|
16
|
+
},
|
|
17
|
+
lib2: {
|
|
18
|
+
type: 'lib',
|
|
19
|
+
name: 'lib2',
|
|
20
|
+
data: { files: [] },
|
|
21
|
+
},
|
|
22
|
+
lib3: {
|
|
23
|
+
type: 'lib',
|
|
24
|
+
name: 'lib3',
|
|
25
|
+
data: { files: [] },
|
|
26
|
+
},
|
|
27
|
+
} as any,
|
|
28
|
+
externalNodes: {
|
|
29
|
+
'npm:react-native-image-picker': {
|
|
30
|
+
type: 'npm',
|
|
31
|
+
name: 'npm:react-native-image-picker',
|
|
32
|
+
data: {
|
|
33
|
+
version: '1',
|
|
34
|
+
packageName: 'react-native-image-picker',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
'npm:react-native-dialog': {
|
|
38
|
+
type: 'npm',
|
|
39
|
+
name: 'npm:react-native-dialog',
|
|
40
|
+
data: {
|
|
41
|
+
version: '1',
|
|
42
|
+
packageName: 'react-native-dialog',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
'npm:react-native-snackbar': {
|
|
46
|
+
type: 'npm',
|
|
47
|
+
name: 'npm:react-native-snackbar',
|
|
48
|
+
data: {
|
|
49
|
+
version: '1',
|
|
50
|
+
packageName: 'react-native-snackbar',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
'npm:@nx/react-native': {
|
|
54
|
+
type: 'npm',
|
|
55
|
+
name: 'npm:@nx/react-native',
|
|
56
|
+
data: {
|
|
57
|
+
version: '1',
|
|
58
|
+
packageName: '@nx/react-native',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
dependencies: {
|
|
63
|
+
myapp: [
|
|
64
|
+
{ type: DependencyType.static, source: 'myapp', target: 'lib1' },
|
|
65
|
+
{ type: DependencyType.static, source: 'myapp', target: 'lib2' },
|
|
66
|
+
{
|
|
67
|
+
type: DependencyType.static,
|
|
68
|
+
source: 'myapp',
|
|
69
|
+
target: 'npm:react-native-image-picker',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: DependencyType.static,
|
|
73
|
+
source: 'myapp',
|
|
74
|
+
target: 'npm:@nx/react-native',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
lib1: [
|
|
78
|
+
{ type: DependencyType.static, source: 'lib1', target: 'lib2' },
|
|
79
|
+
{
|
|
80
|
+
type: DependencyType.static,
|
|
81
|
+
source: 'lib3',
|
|
82
|
+
target: 'npm:react-native-snackbar',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
lib2: [{ type: DependencyType.static, source: 'lib2', target: 'lib3' }],
|
|
86
|
+
lib3: [
|
|
87
|
+
{
|
|
88
|
+
type: DependencyType.static,
|
|
89
|
+
source: 'lib3',
|
|
90
|
+
target: 'npm:react-native-dialog',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const result = findAllNpmDependencies(graph, 'myapp');
|
|
97
|
+
|
|
98
|
+
expect(result).toEqual([
|
|
99
|
+
'react-native-dialog',
|
|
100
|
+
'react-native-snackbar',
|
|
101
|
+
'react-native-image-picker',
|
|
102
|
+
]);
|
|
103
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatFile(content: any, ...values: any[]): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatFile = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const prettier_1 = require("prettier");
|
|
6
|
+
function formatFile(content, ...values) {
|
|
7
|
+
return (0, prettier_1.format)((0, devkit_1.stripIndents)(content, values)
|
|
8
|
+
.split('\n')
|
|
9
|
+
.map((line) => line.trim())
|
|
10
|
+
.join('')
|
|
11
|
+
.trim(), {
|
|
12
|
+
singleQuote: true,
|
|
13
|
+
parser: 'typescript',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.formatFile = formatFile;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function normalizes the options passed in to the Nx and returns an array of strings that can be passed to the React Native CLI.
|
|
3
|
+
* @param options Nx options
|
|
4
|
+
* @param optionKeysToIgnore Keys to ignore
|
|
5
|
+
* @param optionKeysInCamelName Keys that are in camel case. Most react native cli options are in kebab case, but some are in camel case.
|
|
6
|
+
* @returns options that can be passed to the React Native CLI
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCliOptions<T>(options: T, optionKeysToIgnore?: string[], optionKeysInCamelName?: string[]): string[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCliOptions = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
/**
|
|
6
|
+
* This function normalizes the options passed in to the Nx and returns an array of strings that can be passed to the React Native CLI.
|
|
7
|
+
* @param options Nx options
|
|
8
|
+
* @param optionKeysToIgnore Keys to ignore
|
|
9
|
+
* @param optionKeysInCamelName Keys that are in camel case. Most react native cli options are in kebab case, but some are in camel case.
|
|
10
|
+
* @returns options that can be passed to the React Native CLI
|
|
11
|
+
*/
|
|
12
|
+
function getCliOptions(options, optionKeysToIgnore = [], optionKeysInCamelName = []) {
|
|
13
|
+
return Object.keys(options).reduce((acc, optionKey) => {
|
|
14
|
+
const optionValue = options[optionKey];
|
|
15
|
+
if (!optionKeysToIgnore.includes(optionKey)) {
|
|
16
|
+
const cliKey = optionKeysInCamelName.includes(optionKey)
|
|
17
|
+
? (0, devkit_1.names)(optionKey).propertyName
|
|
18
|
+
: (0, devkit_1.names)(optionKey).fileName; // cli uses kebab case as default
|
|
19
|
+
if (Array.isArray(optionValue)) {
|
|
20
|
+
acc.push(`--${cliKey}`, optionValue.join(','));
|
|
21
|
+
}
|
|
22
|
+
else if (typeof optionValue === 'boolean' && optionValue) {
|
|
23
|
+
// no need to pass in the value when it is true, just the flag name
|
|
24
|
+
acc.push(`--${cliKey}`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
acc.push(`--${cliKey}`, optionValue);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return acc;
|
|
31
|
+
}, []);
|
|
32
|
+
}
|
|
33
|
+
exports.getCliOptions = getCliOptions;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GeneratorCallback } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* Run pod install on ios directory
|
|
4
|
+
* @param iosDirectory ios directory that contains Podfile
|
|
5
|
+
* @returns resolve with 0 if not error, reject with error otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function runPodInstall(iosDirectory: string, install?: boolean, options?: {
|
|
8
|
+
buildFolder?: string;
|
|
9
|
+
repoUpdate?: boolean;
|
|
10
|
+
deployment?: boolean;
|
|
11
|
+
useBundler?: boolean;
|
|
12
|
+
}): GeneratorCallback;
|
|
13
|
+
export declare function podInstall(iosDirectory: string, options?: {
|
|
14
|
+
buildFolder?: string;
|
|
15
|
+
repoUpdate?: boolean;
|
|
16
|
+
deployment?: boolean;
|
|
17
|
+
useBundler?: boolean;
|
|
18
|
+
}): void;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.podInstall = exports.runPodInstall = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const os_1 = require("os");
|
|
6
|
+
const chalk = require("chalk");
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const fs_extra_1 = require("fs-extra");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const podInstallErrorMessage = `
|
|
11
|
+
Running ${chalk.bold('pod install')} failed, see above.
|
|
12
|
+
Do you have CocoaPods (https://cocoapods.org/) installed?
|
|
13
|
+
|
|
14
|
+
Check that your XCode path is correct:
|
|
15
|
+
${chalk.bold('sudo xcode-select --print-path')}
|
|
16
|
+
|
|
17
|
+
If the path is wrong, switch the path: (your path may be different)
|
|
18
|
+
${chalk.bold('sudo xcode-select --switch /Applications/Xcode.app')}
|
|
19
|
+
`;
|
|
20
|
+
/**
|
|
21
|
+
* Run pod install on ios directory
|
|
22
|
+
* @param iosDirectory ios directory that contains Podfile
|
|
23
|
+
* @returns resolve with 0 if not error, reject with error otherwise
|
|
24
|
+
*/
|
|
25
|
+
function runPodInstall(iosDirectory, install = true, options = {
|
|
26
|
+
buildFolder: './build',
|
|
27
|
+
repoUpdate: false,
|
|
28
|
+
deployment: false,
|
|
29
|
+
useBundler: false,
|
|
30
|
+
}) {
|
|
31
|
+
return () => {
|
|
32
|
+
if ((0, os_1.platform)() !== 'darwin') {
|
|
33
|
+
devkit_1.logger.info('Skipping `pod install` on non-darwin platform');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (!install || !(0, fs_extra_1.existsSync)((0, path_1.join)(iosDirectory, 'Podfile'))) {
|
|
37
|
+
devkit_1.logger.info('Skipping `pod install`');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
devkit_1.logger.info(`Running \`pod install\` from "${iosDirectory}"`);
|
|
41
|
+
return podInstall(iosDirectory, options);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
exports.runPodInstall = runPodInstall;
|
|
45
|
+
function podInstall(iosDirectory, options = {
|
|
46
|
+
buildFolder: './build',
|
|
47
|
+
repoUpdate: false,
|
|
48
|
+
deployment: false,
|
|
49
|
+
useBundler: false,
|
|
50
|
+
}) {
|
|
51
|
+
try {
|
|
52
|
+
if ((0, fs_extra_1.existsSync)((0, path_1.join)(iosDirectory, '.xcode.env'))) {
|
|
53
|
+
(0, child_process_1.execSync)('touch .xcode.env', {
|
|
54
|
+
cwd: iosDirectory,
|
|
55
|
+
stdio: 'inherit',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const podCommand = [
|
|
59
|
+
options.useBundler ? 'bundle exec pod install' : 'pod install',
|
|
60
|
+
options.repoUpdate ? '--repo-update' : '',
|
|
61
|
+
options.deployment ? '--deployment' : '',
|
|
62
|
+
].join(' ');
|
|
63
|
+
(0, child_process_1.execSync)(podCommand, {
|
|
64
|
+
cwd: iosDirectory,
|
|
65
|
+
stdio: 'inherit',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
devkit_1.logger.error(podInstallErrorMessage);
|
|
70
|
+
throw e;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.podInstall = podInstall;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLib = exports.createApp = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const application_1 = require("../generators/application/application");
|
|
6
|
+
const eslint_1 = require("@nx/eslint");
|
|
7
|
+
async function createApp(tree, appName) {
|
|
8
|
+
await (0, application_1.default)(tree, {
|
|
9
|
+
linter: eslint_1.Linter.EsLint,
|
|
10
|
+
skipFormat: true,
|
|
11
|
+
style: 'css',
|
|
12
|
+
unitTestRunner: 'none',
|
|
13
|
+
name: appName,
|
|
14
|
+
e2eTestRunner: 'none',
|
|
15
|
+
install: false,
|
|
16
|
+
projectNameAndRootFormat: 'as-provided',
|
|
17
|
+
bundler: 'webpack',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.createApp = createApp;
|
|
21
|
+
async function createLib(tree, libName) {
|
|
22
|
+
const { fileName } = (0, devkit_1.names)(libName);
|
|
23
|
+
tree.write(`${fileName}/src/index.ts`, `import React from 'react';\n`);
|
|
24
|
+
(0, devkit_1.addProjectConfiguration)(tree, fileName, {
|
|
25
|
+
tags: [],
|
|
26
|
+
root: `${fileName}`,
|
|
27
|
+
projectType: 'library',
|
|
28
|
+
sourceRoot: `${fileName}/src`,
|
|
29
|
+
targets: {},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.createLib = createLib;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const nxVersion: any;
|
|
2
|
+
export declare const reactNativeVersion = "0.73.2";
|
|
3
|
+
export declare const typesNodeVersion = "18.16.9";
|
|
4
|
+
export declare const reactNativeCommunityCliPlatformAndroidVersion = "12.3.0";
|
|
5
|
+
export declare const reactNativeBabelPresetVersion = "^0.73.18";
|
|
6
|
+
export declare const reactNativeMetroConfigVersion = "^0.73.2";
|
|
7
|
+
export declare const reactNativeWebVersion = "^0.19.9";
|
|
8
|
+
export declare const reactVersion = "18.2.0";
|
|
9
|
+
export declare const reactDomVersion = "18.2.0";
|
|
10
|
+
export declare const reactTestRendererVersion = "18.2.0";
|
|
11
|
+
export declare const typesReactVersion = "~18.2.45";
|
|
12
|
+
export declare const testingLibraryReactNativeVersion = "~12.4.2";
|
|
13
|
+
export declare const testingLibraryJestNativeVersion = "~5.4.3";
|
|
14
|
+
export declare const jestReactNativeVersion = "18.0.0";
|
|
15
|
+
export declare const reactNativeSvgTransformerVersion = "1.2.0";
|
|
16
|
+
export declare const reactNativeSvgVersion = "14.1.0";
|
|
17
|
+
export declare const babelRuntimeVersion = "7.22.6";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.babelRuntimeVersion = exports.reactNativeSvgVersion = exports.reactNativeSvgTransformerVersion = exports.jestReactNativeVersion = exports.testingLibraryJestNativeVersion = exports.testingLibraryReactNativeVersion = exports.typesReactVersion = exports.reactTestRendererVersion = exports.reactDomVersion = exports.reactVersion = exports.reactNativeWebVersion = exports.reactNativeMetroConfigVersion = exports.reactNativeBabelPresetVersion = exports.reactNativeCommunityCliPlatformAndroidVersion = exports.typesNodeVersion = exports.reactNativeVersion = exports.nxVersion = void 0;
|
|
4
|
+
exports.nxVersion = require('../../package.json').version;
|
|
5
|
+
exports.reactNativeVersion = '0.73.2';
|
|
6
|
+
exports.typesNodeVersion = '18.16.9';
|
|
7
|
+
exports.reactNativeCommunityCliPlatformAndroidVersion = '12.3.0'; // anddroid refers files from this package
|
|
8
|
+
exports.reactNativeBabelPresetVersion = '^0.73.18';
|
|
9
|
+
exports.reactNativeMetroConfigVersion = '^0.73.2';
|
|
10
|
+
exports.reactNativeWebVersion = '^0.19.9';
|
|
11
|
+
exports.reactVersion = '18.2.0';
|
|
12
|
+
exports.reactDomVersion = '18.2.0';
|
|
13
|
+
exports.reactTestRendererVersion = '18.2.0';
|
|
14
|
+
exports.typesReactVersion = '~18.2.45';
|
|
15
|
+
exports.testingLibraryReactNativeVersion = '~12.4.2';
|
|
16
|
+
exports.testingLibraryJestNativeVersion = '~5.4.3';
|
|
17
|
+
exports.jestReactNativeVersion = '18.0.0';
|
|
18
|
+
exports.reactNativeSvgTransformerVersion = '1.2.0';
|
|
19
|
+
exports.reactNativeSvgVersion = '14.1.0';
|
|
20
|
+
exports.babelRuntimeVersion = '7.22.6';
|
package/typings/svg.d.ts
ADDED