@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,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addGitIgnoreEntry = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const ignore_1 = require("ignore");
|
|
6
|
+
const gitignore_entries_1 = require("./gitignore-entries");
|
|
7
|
+
function addGitIgnoreEntry(host) {
|
|
8
|
+
if (!host.exists('.gitignore')) {
|
|
9
|
+
devkit_1.logger.warn(`Couldn't find .gitignore file to update`);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let content = host.read('.gitignore', 'utf-8').trimEnd();
|
|
13
|
+
const ig = (0, ignore_1.default)();
|
|
14
|
+
ig.add(host.read('.gitignore', 'utf-8'));
|
|
15
|
+
if (!ig.ignores('apps/example/ios/Pods/Folly')) {
|
|
16
|
+
content = `${content}\n${gitignore_entries_1.gitIgnoreEntriesForReactNative}\n`;
|
|
17
|
+
}
|
|
18
|
+
// also ignore nested node_modules folders due to symlink for React Native
|
|
19
|
+
if (!ig.ignores('apps/example/node_modules')) {
|
|
20
|
+
content = `${content}\n## Nested node_modules\n\nnode_modules/\n`;
|
|
21
|
+
}
|
|
22
|
+
host.write('.gitignore', content);
|
|
23
|
+
}
|
|
24
|
+
exports.addGitIgnoreEntry = addGitIgnoreEntry;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const gitIgnoreEntriesForReactNative = "\n# React Native\n\n# OSX\n#\n.DS_Store\n\n# Xcode\n#\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\nxcuserdata\n*.xccheckout\n*.moved-aside\nDerivedData\n*.hmap\n*.ipa\n*.xcuserstate\nios/.xcode.env.local\n\n# Android/IntelliJ\n#\nbuild/\n.idea\n.gradle\nlocal.properties\n*.iml\n*.hprof\n.cxx/\n*.keystore\n!debug.keystore\n\n# node.js\n#\nnode_modules/\nnpm-debug.log\nyarn-error.log\n\n# fastlane\n#\n# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the\n# screenshots whenever they are needed.\n# For more information about the recommended setup visit:\n# https://docs.fastlane.tools/best-practices/source-control/\n\n**/fastlane/report.xml\n**/fastlane/Preview.html\n**/fastlane/screenshots\n**/fastlane/test_output\n\n# Bundle artifact\n*.jsbundle\n\n# Ruby / CocoaPods\n**/ios/Pods/\n**/vendor/bundle/\n\n# Temporary files created by Metro to check the health of the file watcher\n.metro-health-check*\n\n# testing\n/coverage\n";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gitIgnoreEntriesForReactNative = void 0;
|
|
4
|
+
// template from https://github.com/facebook/react-native/blob/main/template/_gitignore
|
|
5
|
+
exports.gitIgnoreEntriesForReactNative = `
|
|
6
|
+
# React Native
|
|
7
|
+
|
|
8
|
+
# OSX
|
|
9
|
+
#
|
|
10
|
+
.DS_Store
|
|
11
|
+
|
|
12
|
+
# Xcode
|
|
13
|
+
#
|
|
14
|
+
build/
|
|
15
|
+
*.pbxuser
|
|
16
|
+
!default.pbxuser
|
|
17
|
+
*.mode1v3
|
|
18
|
+
!default.mode1v3
|
|
19
|
+
*.mode2v3
|
|
20
|
+
!default.mode2v3
|
|
21
|
+
*.perspectivev3
|
|
22
|
+
!default.perspectivev3
|
|
23
|
+
xcuserdata
|
|
24
|
+
*.xccheckout
|
|
25
|
+
*.moved-aside
|
|
26
|
+
DerivedData
|
|
27
|
+
*.hmap
|
|
28
|
+
*.ipa
|
|
29
|
+
*.xcuserstate
|
|
30
|
+
ios/.xcode.env.local
|
|
31
|
+
|
|
32
|
+
# Android/IntelliJ
|
|
33
|
+
#
|
|
34
|
+
build/
|
|
35
|
+
.idea
|
|
36
|
+
.gradle
|
|
37
|
+
local.properties
|
|
38
|
+
*.iml
|
|
39
|
+
*.hprof
|
|
40
|
+
.cxx/
|
|
41
|
+
*.keystore
|
|
42
|
+
!debug.keystore
|
|
43
|
+
|
|
44
|
+
# node.js
|
|
45
|
+
#
|
|
46
|
+
node_modules/
|
|
47
|
+
npm-debug.log
|
|
48
|
+
yarn-error.log
|
|
49
|
+
|
|
50
|
+
# fastlane
|
|
51
|
+
#
|
|
52
|
+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
|
53
|
+
# screenshots whenever they are needed.
|
|
54
|
+
# For more information about the recommended setup visit:
|
|
55
|
+
# https://docs.fastlane.tools/best-practices/source-control/
|
|
56
|
+
|
|
57
|
+
**/fastlane/report.xml
|
|
58
|
+
**/fastlane/Preview.html
|
|
59
|
+
**/fastlane/screenshots
|
|
60
|
+
**/fastlane/test_output
|
|
61
|
+
|
|
62
|
+
# Bundle artifact
|
|
63
|
+
*.jsbundle
|
|
64
|
+
|
|
65
|
+
# Ruby / CocoaPods
|
|
66
|
+
**/ios/Pods/
|
|
67
|
+
**/vendor/bundle/
|
|
68
|
+
|
|
69
|
+
# Temporary files created by Metro to check the health of the file watcher
|
|
70
|
+
.metro-health-check*
|
|
71
|
+
|
|
72
|
+
# testing
|
|
73
|
+
/coverage
|
|
74
|
+
`;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cli": "nx",
|
|
3
|
+
"$id": "NxReactNativeInit",
|
|
4
|
+
"$schema": "https://json-schema.org/schema",
|
|
5
|
+
"title": "Add Nx React Native Schematics",
|
|
6
|
+
"description": "Add Nx React native schematics.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"skipFormat": {
|
|
10
|
+
"description": "Skip formatting files.",
|
|
11
|
+
"type": "boolean",
|
|
12
|
+
"default": false,
|
|
13
|
+
"x-priority": "internal"
|
|
14
|
+
},
|
|
15
|
+
"skipPackageJson": {
|
|
16
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"default": false,
|
|
19
|
+
"x-priority": "internal"
|
|
20
|
+
},
|
|
21
|
+
"keepExistingVersions": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"x-priority": "internal",
|
|
24
|
+
"description": "Keep existing dependencies versions",
|
|
25
|
+
"default": false
|
|
26
|
+
},
|
|
27
|
+
"updatePackageScripts": {
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"x-priority": "internal",
|
|
30
|
+
"description": "Update `package.json` scripts with inferred targets",
|
|
31
|
+
"default": false
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": []
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = function (api) {
|
|
2
|
+
api.cache(true);
|
|
3
|
+
|
|
4
|
+
return {
|
|
5
|
+
presets: [
|
|
6
|
+
[
|
|
7
|
+
'@nx/react/babel',
|
|
8
|
+
{
|
|
9
|
+
runtime: 'automatic',
|
|
10
|
+
useBuiltIns: 'usage',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
],
|
|
14
|
+
plugins: [],
|
|
15
|
+
env: {
|
|
16
|
+
test: {
|
|
17
|
+
presets: [['module:@react-native/babel-preset', { "useTransformReactJSX": true }]],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-native/extend-expect';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "<%= rootTsConfigPath %>",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"allowSyntheticDefaultImports": true
|
|
8
|
+
},
|
|
9
|
+
"files": [],
|
|
10
|
+
"include": [],
|
|
11
|
+
"references": [
|
|
12
|
+
{
|
|
13
|
+
"path": "./tsconfig.lib.json"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
|
+
"types": ["node"]
|
|
6
|
+
},
|
|
7
|
+
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.spec.tsx", "test-setup.ts"],
|
|
8
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { Schema } from '../schema';
|
|
3
|
+
export interface NormalizedSchema extends Schema {
|
|
4
|
+
name: string;
|
|
5
|
+
fileName: string;
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
routePath: string;
|
|
8
|
+
parsedTags: string[];
|
|
9
|
+
appMain?: string;
|
|
10
|
+
appSourceRoot?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
|
+
async function normalizeOptions(host, options) {
|
|
7
|
+
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
8
|
+
name: options.name,
|
|
9
|
+
projectType: 'library',
|
|
10
|
+
directory: options.directory,
|
|
11
|
+
importPath: options.importPath,
|
|
12
|
+
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
13
|
+
callingGenerator: '@nx/react-native:library',
|
|
14
|
+
});
|
|
15
|
+
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
16
|
+
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
17
|
+
nxJson.useInferencePlugins !== false;
|
|
18
|
+
options.addPlugin ??= addPluginDefault;
|
|
19
|
+
const parsedTags = options.tags
|
|
20
|
+
? options.tags.split(',').map((s) => s.trim())
|
|
21
|
+
: [];
|
|
22
|
+
const normalized = {
|
|
23
|
+
...options,
|
|
24
|
+
fileName: projectName,
|
|
25
|
+
routePath: `/${projectNames.projectSimpleName}`,
|
|
26
|
+
name: projectName,
|
|
27
|
+
projectRoot,
|
|
28
|
+
parsedTags,
|
|
29
|
+
importPath,
|
|
30
|
+
};
|
|
31
|
+
return normalized;
|
|
32
|
+
}
|
|
33
|
+
exports.normalizeOptions = normalizeOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import { Schema } from './schema';
|
|
3
|
+
export declare function reactNativeLibraryGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
|
+
export declare function reactNativeLibraryGeneratorInternal(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
5
|
+
export default reactNativeLibraryGenerator;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reactNativeLibraryGeneratorInternal = exports.reactNativeLibraryGenerator = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const js_1 = require("@nx/js");
|
|
6
|
+
const init_1 = require("../init/init");
|
|
7
|
+
const add_linting_1 = require("../../utils/add-linting");
|
|
8
|
+
const add_jest_1 = require("../../utils/add-jest");
|
|
9
|
+
const versions_1 = require("../../utils/versions");
|
|
10
|
+
const normalize_options_1 = require("./lib/normalize-options");
|
|
11
|
+
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
12
|
+
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
13
|
+
async function reactNativeLibraryGenerator(host, schema) {
|
|
14
|
+
return await reactNativeLibraryGeneratorInternal(host, {
|
|
15
|
+
addPlugin: false,
|
|
16
|
+
projectNameAndRootFormat: 'derived',
|
|
17
|
+
...schema,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.reactNativeLibraryGenerator = reactNativeLibraryGenerator;
|
|
21
|
+
async function reactNativeLibraryGeneratorInternal(host, schema) {
|
|
22
|
+
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
23
|
+
if (options.publishable === true && !schema.importPath) {
|
|
24
|
+
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)`);
|
|
25
|
+
}
|
|
26
|
+
const tasks = [];
|
|
27
|
+
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
28
|
+
...schema,
|
|
29
|
+
skipFormat: true,
|
|
30
|
+
});
|
|
31
|
+
tasks.push(jsInitTask);
|
|
32
|
+
const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
|
|
33
|
+
tasks.push(initTask);
|
|
34
|
+
if (!options.skipPackageJson) {
|
|
35
|
+
tasks.push((0, ensure_dependencies_1.ensureDependencies)(host));
|
|
36
|
+
}
|
|
37
|
+
const addProjectTask = await addProject(host, options);
|
|
38
|
+
if (addProjectTask) {
|
|
39
|
+
tasks.push(addProjectTask);
|
|
40
|
+
}
|
|
41
|
+
createFiles(host, options);
|
|
42
|
+
const lintTask = await (0, add_linting_1.addLinting)(host, {
|
|
43
|
+
...options,
|
|
44
|
+
projectName: options.name,
|
|
45
|
+
tsConfigPaths: [
|
|
46
|
+
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
tasks.push(lintTask);
|
|
50
|
+
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.name, options.projectRoot, options.js, options.skipPackageJson, options.addPlugin);
|
|
51
|
+
tasks.push(jestTask);
|
|
52
|
+
if (options.publishable || options.buildable) {
|
|
53
|
+
updateLibPackageNpmScope(host, options);
|
|
54
|
+
}
|
|
55
|
+
if (!options.skipTsConfig) {
|
|
56
|
+
(0, js_1.addTsConfigPath)(host, options.importPath, [
|
|
57
|
+
(0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
if (!options.skipFormat) {
|
|
61
|
+
await (0, devkit_1.formatFiles)(host);
|
|
62
|
+
}
|
|
63
|
+
tasks.push(() => {
|
|
64
|
+
(0, log_show_project_command_1.logShowProjectCommand)(options.name);
|
|
65
|
+
});
|
|
66
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
67
|
+
}
|
|
68
|
+
exports.reactNativeLibraryGeneratorInternal = reactNativeLibraryGeneratorInternal;
|
|
69
|
+
async function addProject(host, options) {
|
|
70
|
+
const project = {
|
|
71
|
+
root: options.projectRoot,
|
|
72
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
73
|
+
projectType: 'library',
|
|
74
|
+
tags: options.parsedTags,
|
|
75
|
+
targets: {},
|
|
76
|
+
};
|
|
77
|
+
(0, devkit_1.addProjectConfiguration)(host, options.name, project);
|
|
78
|
+
if (!options.publishable && !options.buildable) {
|
|
79
|
+
return () => { };
|
|
80
|
+
}
|
|
81
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/rollup', versions_1.nxVersion);
|
|
82
|
+
const rollupConfigTask = await configurationGenerator(host, {
|
|
83
|
+
...options,
|
|
84
|
+
project: options.name,
|
|
85
|
+
skipFormat: true,
|
|
86
|
+
});
|
|
87
|
+
const external = ['react/jsx-runtime', 'react-native', 'react', 'react-dom'];
|
|
88
|
+
project.targets.build = {
|
|
89
|
+
executor: '@nx/rollup:rollup',
|
|
90
|
+
outputs: ['{options.outputPath}'],
|
|
91
|
+
options: {
|
|
92
|
+
outputPath: `dist/${options.projectRoot}`,
|
|
93
|
+
tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
|
|
94
|
+
project: `${options.projectRoot}/package.json`,
|
|
95
|
+
entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`),
|
|
96
|
+
external,
|
|
97
|
+
rollupConfig: `@nx/react/plugins/bundle-rollup`,
|
|
98
|
+
assets: [
|
|
99
|
+
{
|
|
100
|
+
glob: `${options.projectRoot}/README.md`,
|
|
101
|
+
input: '.',
|
|
102
|
+
output: '.',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
(0, devkit_1.updateProjectConfiguration)(host, options.name, project);
|
|
108
|
+
return rollupConfigTask;
|
|
109
|
+
}
|
|
110
|
+
function updateTsConfig(tree, options) {
|
|
111
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.json'), (json) => {
|
|
112
|
+
if (options.strict) {
|
|
113
|
+
json.compilerOptions = {
|
|
114
|
+
...json.compilerOptions,
|
|
115
|
+
forceConsistentCasingInFileNames: true,
|
|
116
|
+
strict: true,
|
|
117
|
+
noImplicitReturns: true,
|
|
118
|
+
noFallthroughCasesInSwitch: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return json;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function createFiles(host, options) {
|
|
125
|
+
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/lib'), options.projectRoot, {
|
|
126
|
+
...options,
|
|
127
|
+
...(0, devkit_1.names)(options.name),
|
|
128
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot),
|
|
129
|
+
rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot),
|
|
130
|
+
});
|
|
131
|
+
if (!options.publishable && !options.buildable) {
|
|
132
|
+
host.delete(`${options.projectRoot}/package.json`);
|
|
133
|
+
}
|
|
134
|
+
if (options.js) {
|
|
135
|
+
(0, devkit_1.toJS)(host);
|
|
136
|
+
}
|
|
137
|
+
updateTsConfig(host, options);
|
|
138
|
+
}
|
|
139
|
+
function updateLibPackageNpmScope(host, options) {
|
|
140
|
+
return (0, devkit_1.updateJson)(host, `${options.projectRoot}/package.json`, (json) => {
|
|
141
|
+
json.name = options.importPath;
|
|
142
|
+
json.peerDependencies = {
|
|
143
|
+
react: versions_1.reactVersion,
|
|
144
|
+
'react-native': versions_1.reactNativeVersion,
|
|
145
|
+
};
|
|
146
|
+
return json;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function maybeJs(options, path) {
|
|
150
|
+
return options.js && (path.endsWith('.ts') || path.endsWith('.tsx'))
|
|
151
|
+
? path.replace(/\.tsx?$/, '.js')
|
|
152
|
+
: path;
|
|
153
|
+
}
|
|
154
|
+
exports.default = reactNativeLibraryGenerator;
|