@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,13 @@
|
|
|
1
|
+
import { Linter } from '@nx/eslint';
|
|
2
|
+
|
|
3
|
+
export interface StorybookConfigureSchema {
|
|
4
|
+
project: string;
|
|
5
|
+
interactionTests?: boolean;
|
|
6
|
+
generateStories?: boolean;
|
|
7
|
+
js?: boolean;
|
|
8
|
+
tsConfiguration?: boolean;
|
|
9
|
+
linter?: Linter;
|
|
10
|
+
ignorePaths?: string[];
|
|
11
|
+
configureStaticServe?: boolean;
|
|
12
|
+
addPlugin?: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "NxReactNativeStorybookConfigure",
|
|
5
|
+
"title": "React native Storybook configuration",
|
|
6
|
+
"description": "Set up Storybook for a React-Native app or library.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"project": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"aliases": ["name", "projectName"],
|
|
12
|
+
"description": "Project for which to generate Storybook configuration.",
|
|
13
|
+
"$default": {
|
|
14
|
+
"$source": "argv",
|
|
15
|
+
"index": 0
|
|
16
|
+
},
|
|
17
|
+
"x-prompt": "For which project do you want to generate Storybook configuration?",
|
|
18
|
+
"x-dropdown": "projects",
|
|
19
|
+
"x-priority": "important"
|
|
20
|
+
},
|
|
21
|
+
"interactionTests": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Set up Storybook interaction tests.",
|
|
24
|
+
"x-prompt": "Do you want to set up Storybook interaction tests?",
|
|
25
|
+
"x-priority": "important",
|
|
26
|
+
"alias": ["configureTestRunner"],
|
|
27
|
+
"default": true
|
|
28
|
+
},
|
|
29
|
+
"generateStories": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"description": "Automatically generate `*.stories.ts` files for components declared in this project?",
|
|
32
|
+
"x-prompt": "Automatically generate *.stories.ts files for components declared in this project?",
|
|
33
|
+
"default": true,
|
|
34
|
+
"x-priority": "important"
|
|
35
|
+
},
|
|
36
|
+
"configureStaticServe": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"description": "Specifies whether to configure a static file server target for serving storybook. Helpful for speeding up CI build/test times.",
|
|
39
|
+
"x-prompt": "Configure a static file server for the storybook instance?",
|
|
40
|
+
"default": true,
|
|
41
|
+
"x-priority": "important"
|
|
42
|
+
},
|
|
43
|
+
"js": {
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"description": "Generate JavaScript story files rather than TypeScript story files.",
|
|
46
|
+
"default": false
|
|
47
|
+
},
|
|
48
|
+
"tsConfiguration": {
|
|
49
|
+
"type": "boolean",
|
|
50
|
+
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
|
|
51
|
+
"default": true
|
|
52
|
+
},
|
|
53
|
+
"linter": {
|
|
54
|
+
"description": "The tool to use for running lint checks.",
|
|
55
|
+
"type": "string",
|
|
56
|
+
"enum": ["eslint"],
|
|
57
|
+
"default": "eslint"
|
|
58
|
+
},
|
|
59
|
+
"ignorePaths": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"description": "Paths to ignore when looking for components.",
|
|
62
|
+
"items": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Path to ignore."
|
|
65
|
+
},
|
|
66
|
+
"default": [
|
|
67
|
+
"*.stories.ts,*.stories.tsx,*.stories.js,*.stories.jsx,*.stories.mdx"
|
|
68
|
+
],
|
|
69
|
+
"examples": [
|
|
70
|
+
"apps/my-app/src/not-stories/**",
|
|
71
|
+
"**/**/src/**/not-stories/**",
|
|
72
|
+
"libs/my-lib/**/*.something.ts",
|
|
73
|
+
"**/**/src/**/*.other.*",
|
|
74
|
+
"libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"required": ["project"]
|
|
79
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNativeFiles = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const normalize_options_1 = require("./normalize-options");
|
|
7
|
+
function createNativeFiles(host, schema, appProjectRoot) {
|
|
8
|
+
const options = (0, normalize_options_1.normalizeOptions)(schema, appProjectRoot);
|
|
9
|
+
const iosProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'ios');
|
|
10
|
+
const androidProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'android');
|
|
11
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../../application/files/app/ios'), iosProjectRoot, options);
|
|
12
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../../application/files/app/android'), androidProjectRoot, options);
|
|
13
|
+
}
|
|
14
|
+
exports.createNativeFiles = createNativeFiles;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UpgradeNativeConfigureSchema } from '../schema';
|
|
2
|
+
export interface NormalizedSchema {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
className: string;
|
|
6
|
+
lowerCaseName: string;
|
|
7
|
+
entryFile: string;
|
|
8
|
+
entryFileIos: string;
|
|
9
|
+
e2eTestRunner: 'cypress' | 'playwright' | 'detox' | 'none';
|
|
10
|
+
offsetFromRoot: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function normalizeOptions(options: UpgradeNativeConfigureSchema, appProjectRoot: string): NormalizedSchema;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function normalizeOptions(options, appProjectRoot // app root
|
|
6
|
+
) {
|
|
7
|
+
const { fileName, className } = (0, devkit_1.names)(options.name);
|
|
8
|
+
const entryFileIos = 'src/main';
|
|
9
|
+
const entryFile = options.js ? 'src/main.js' : 'src/main.tsx';
|
|
10
|
+
/**
|
|
11
|
+
* if options.name is "my-app"
|
|
12
|
+
* name: "my-app", className: 'MyApp', lowerCaseName: 'myapp', displayName: 'MyApp'
|
|
13
|
+
* if options.name is "myApp"
|
|
14
|
+
* name: "my-app", className: 'MyApp', lowerCaseName: 'myapp', displayName: 'MyApp'
|
|
15
|
+
*/
|
|
16
|
+
return {
|
|
17
|
+
name: fileName,
|
|
18
|
+
className,
|
|
19
|
+
lowerCaseName: className.toLowerCase(),
|
|
20
|
+
displayName: options.displayName || className,
|
|
21
|
+
entryFile,
|
|
22
|
+
entryFileIos,
|
|
23
|
+
e2eTestRunner: options.e2eTestRunner,
|
|
24
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(appProjectRoot),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
exports.normalizeOptions = normalizeOptions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Linter } from '@nx/eslint';
|
|
2
|
+
|
|
3
|
+
export interface UpgradeNativeConfigureSchema {
|
|
4
|
+
name: string;
|
|
5
|
+
displayName?: string;
|
|
6
|
+
js: boolean; // default is false
|
|
7
|
+
e2eTestRunner: 'cypress' | 'playwright' | 'detox' | 'none'; // default is cypress
|
|
8
|
+
install: boolean; // default is true
|
|
9
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "NxReactNativeUpgradeNativeConfigure",
|
|
5
|
+
"title": "React native upgrade native configuration",
|
|
6
|
+
"description": "Upgrade native iOS and Android code to latest.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"name": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Application project name to upgrade native files.",
|
|
12
|
+
"$default": {
|
|
13
|
+
"$source": "argv",
|
|
14
|
+
"index": 0
|
|
15
|
+
},
|
|
16
|
+
"x-dropdown": "project"
|
|
17
|
+
},
|
|
18
|
+
"displayName": {
|
|
19
|
+
"description": "The display name to show in the application. Defaults to name.",
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"js": {
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"description": "Generate JavaScript files rather than TypeScript files",
|
|
25
|
+
"default": false
|
|
26
|
+
},
|
|
27
|
+
"e2eTestRunner": {
|
|
28
|
+
"description": "Adds the specified e2e test runner.",
|
|
29
|
+
"type": "string",
|
|
30
|
+
"enum": ["cypress", "playwright", "detox", "none"],
|
|
31
|
+
"default": "cypress"
|
|
32
|
+
},
|
|
33
|
+
"install": {
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"description": "Runs `pod install` for native modules before building iOS app.",
|
|
36
|
+
"default": true,
|
|
37
|
+
"x-priority": "internal"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"required": ["name"]
|
|
41
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated use `nx run @nx/react-native:upgrade` instead.
|
|
3
|
+
* TODO (@xiongemi): remove this generator for nx v19
|
|
4
|
+
* This function is a destructive command that replace React Native iOS and Android code with latest.
|
|
5
|
+
* It would replace the Android and iOS folder entirely.
|
|
6
|
+
*/
|
|
7
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
8
|
+
import { UpgradeNativeConfigureSchema } from './schema';
|
|
9
|
+
export declare function reactNativeUpgradeNativeGenerator(host: Tree, schema: UpgradeNativeConfigureSchema): Promise<GeneratorCallback>;
|
|
10
|
+
export default reactNativeUpgradeNativeGenerator;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated use `nx run @nx/react-native:upgrade` instead.
|
|
4
|
+
* TODO (@xiongemi): remove this generator for nx v19
|
|
5
|
+
* This function is a destructive command that replace React Native iOS and Android code with latest.
|
|
6
|
+
* It would replace the Android and iOS folder entirely.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.reactNativeUpgradeNativeGenerator = void 0;
|
|
10
|
+
const devkit_1 = require("@nx/devkit");
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const pod_install_task_1 = require("../../utils/pod-install-task");
|
|
13
|
+
const chmod_android_gradle_files_1 = require("../../utils/chmod-android-gradle-files");
|
|
14
|
+
const create_native_files_1 = require("./lib/create-native-files");
|
|
15
|
+
async function reactNativeUpgradeNativeGenerator(host, schema) {
|
|
16
|
+
devkit_1.logger.warn(`Please run 'nx run @nx/react-native:upgrade ${schema.name}' instead.`);
|
|
17
|
+
const { projectType, root: appProjectRoot } = (0, devkit_1.readProjectConfiguration)(host, schema.name);
|
|
18
|
+
const iosProjectRoot = (0, devkit_1.joinPathFragments)(host.root, appProjectRoot, 'ios');
|
|
19
|
+
const androidProjectRoot = (0, devkit_1.joinPathFragments)(host.root, appProjectRoot, 'android');
|
|
20
|
+
if (projectType !== 'application' ||
|
|
21
|
+
!(0, fs_1.existsSync)(iosProjectRoot) ||
|
|
22
|
+
!(0, fs_1.existsSync)(androidProjectRoot)) {
|
|
23
|
+
throw new Error(`Could not upgrade React Native code for ${schema.name}`);
|
|
24
|
+
}
|
|
25
|
+
(0, create_native_files_1.createNativeFiles)(host, schema, appProjectRoot);
|
|
26
|
+
const podInstallTask = (0, pod_install_task_1.runPodInstall)(iosProjectRoot, schema.install);
|
|
27
|
+
const chmodTaskGradlew = (0, chmod_android_gradle_files_1.chmodAndroidGradlewFilesTask)(androidProjectRoot);
|
|
28
|
+
return (0, devkit_1.runTasksInSerial)(podInstallTask, chmodTaskGradlew);
|
|
29
|
+
}
|
|
30
|
+
exports.reactNativeUpgradeNativeGenerator = reactNativeUpgradeNativeGenerator;
|
|
31
|
+
exports.default = reactNativeUpgradeNativeGenerator;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = function (api) {
|
|
2
|
+
api.cache(true);
|
|
3
|
+
|
|
4
|
+
if (
|
|
5
|
+
process.env.NX_TASK_TARGET_TARGET === 'build' ||
|
|
6
|
+
process.env.NX_TASK_TARGET_TARGET.includes('storybook')
|
|
7
|
+
) {
|
|
8
|
+
return {
|
|
9
|
+
presets: [
|
|
10
|
+
[
|
|
11
|
+
'@nx/react/babel',
|
|
12
|
+
{
|
|
13
|
+
runtime: 'automatic',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
presets: [['module:@react-native/babel-preset', { "useTransformReactJSX": true }]],
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" style="height: 100%">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title><%= className %></title>
|
|
6
|
+
<base href="/" />
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
10
|
+
</head>
|
|
11
|
+
<body style="height:100%">
|
|
12
|
+
<div id="root" style="display: flex; height: 100%"></div>
|
|
13
|
+
<script type="module" src="/src/main-web.tsx"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
4
|
+
import * as esbuild from 'esbuild';
|
|
5
|
+
import { readFileSync } from 'fs';
|
|
6
|
+
|
|
7
|
+
const extensions = [
|
|
8
|
+
'.mjs',
|
|
9
|
+
'.web.tsx',
|
|
10
|
+
'.tsx',
|
|
11
|
+
'.web.ts',
|
|
12
|
+
'.ts',
|
|
13
|
+
'.web.jsx',
|
|
14
|
+
'.jsx',
|
|
15
|
+
'.web.js',
|
|
16
|
+
'.js',
|
|
17
|
+
'.css',
|
|
18
|
+
'.json',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const rollupPlugin = (matchers: RegExp[]) => ({
|
|
22
|
+
name: 'js-in-jsx',
|
|
23
|
+
load(id: string) {
|
|
24
|
+
if (matchers.some((matcher) => matcher.test(id)) && id.endsWith('.js')) {
|
|
25
|
+
const file = readFileSync(id, { encoding: 'utf-8' });
|
|
26
|
+
return esbuild.transformSync(file, { loader: 'jsx', jsx: 'automatic' });
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
root: __dirname,
|
|
33
|
+
cacheDir: '../../node_modules/.vite/<%= fileName %>',
|
|
34
|
+
define: {
|
|
35
|
+
global: 'window',
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
resolve: {
|
|
39
|
+
extensions,
|
|
40
|
+
alias: {
|
|
41
|
+
'react-native': 'react-native-web',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
build: {
|
|
46
|
+
reportCompressedSize: true,
|
|
47
|
+
commonjsOptions: { transformMixedEsModules: true },
|
|
48
|
+
outDir: '../../dist/apps/<%= fileName %>/web',
|
|
49
|
+
rollupOptions: {
|
|
50
|
+
plugins: [rollupPlugin([/react-native-vector-icons/])],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
server: {
|
|
55
|
+
port: 4200,
|
|
56
|
+
host: 'localhost',
|
|
57
|
+
fs: {
|
|
58
|
+
// Allow serving files from one level up to the project root
|
|
59
|
+
allow: ['..'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
preview: {
|
|
64
|
+
port: 4300,
|
|
65
|
+
host: 'localhost',
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
optimizeDeps: {
|
|
69
|
+
esbuildOptions: {
|
|
70
|
+
resolveExtensions: extensions,
|
|
71
|
+
jsx: 'automatic',
|
|
72
|
+
loader: { '.js': 'jsx' },
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
plugins: [react(), nxViteTsPaths()],
|
|
77
|
+
|
|
78
|
+
// Uncomment this if you are using workers.
|
|
79
|
+
// worker: {
|
|
80
|
+
// plugins: [ nxViteTsPaths() ],
|
|
81
|
+
// },
|
|
82
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = function (api) {
|
|
2
|
+
api.cache(true);
|
|
3
|
+
|
|
4
|
+
if (
|
|
5
|
+
process.env.NX_TASK_TARGET_TARGET === 'build' ||
|
|
6
|
+
process.env.NX_TASK_TARGET_TARGET.includes('storybook')
|
|
7
|
+
) {
|
|
8
|
+
return {
|
|
9
|
+
presets: [
|
|
10
|
+
[
|
|
11
|
+
'@nx/react/babel',
|
|
12
|
+
{
|
|
13
|
+
runtime: 'automatic',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
presets: [['module:@react-native/babel-preset', { "useTransformReactJSX": true }]],
|
|
22
|
+
};
|
|
23
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" style="height: 100%">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title><%= className %></title>
|
|
6
|
+
<base href="/" />
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
10
|
+
</head>
|
|
11
|
+
<body style="height:100%">
|
|
12
|
+
<div id="root" style="display: flex; height: 100%"></div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<% if (webpackPluginOptions) { %>
|
|
2
|
+
const { NxWebpackPlugin } = require('@nx/webpack');
|
|
3
|
+
const { NxReactWebpackPlugin } = require('@nx/react');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
resolve: {
|
|
7
|
+
alias: {
|
|
8
|
+
'react-native$': 'react-native-web',
|
|
9
|
+
},
|
|
10
|
+
extensions: ['.web.tsx', '.web.ts', '.web.jsx', '.web.js']
|
|
11
|
+
},
|
|
12
|
+
devServer: {
|
|
13
|
+
port: 4200
|
|
14
|
+
},
|
|
15
|
+
plugins: [
|
|
16
|
+
new NxWebpackPlugin({
|
|
17
|
+
tsConfig: '<%= webpackPluginOptions.tsConfig %>',
|
|
18
|
+
compiler: '<%= webpackPluginOptions.compiler %>',
|
|
19
|
+
main: '<%= webpackPluginOptions.main %>',
|
|
20
|
+
index: '<%= webpackPluginOptions.index %>',
|
|
21
|
+
outputPath: '<%= webpackPluginOptions.outputPath %>',
|
|
22
|
+
baseHref: '<%= webpackPluginOptions.baseHref %>',
|
|
23
|
+
assets: <%- JSON.stringify(webpackPluginOptions.assets) %>,
|
|
24
|
+
styles: <%- JSON.stringify(webpackPluginOptions.styles) %>,
|
|
25
|
+
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
26
|
+
optimization: process.env['NODE_ENV'] === 'production',
|
|
27
|
+
}),
|
|
28
|
+
new NxReactWebpackPlugin({
|
|
29
|
+
// Uncomment this line if you don't want to use SVGR
|
|
30
|
+
// See: https://react-svgr.com/
|
|
31
|
+
// svgr: false
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
<% } else { %>
|
|
36
|
+
const { composePlugins, withNx } = require('@nx/webpack');
|
|
37
|
+
const { withReact } = require('@nx/react');
|
|
38
|
+
|
|
39
|
+
// Nx plugins for webpack.
|
|
40
|
+
module.exports = composePlugins(
|
|
41
|
+
withNx(),
|
|
42
|
+
withReact({
|
|
43
|
+
// Uncomment this line if you don't want to use SVGR
|
|
44
|
+
// See: https://react-svgr.com/
|
|
45
|
+
// svgr: false
|
|
46
|
+
}),
|
|
47
|
+
(config) => {
|
|
48
|
+
// Update the webpack config as needed here.
|
|
49
|
+
// e.g. `config.plugins.push(new MyPlugin())`
|
|
50
|
+
|
|
51
|
+
config.resolve.alias = {
|
|
52
|
+
...config.resolve.alias ?? {},
|
|
53
|
+
'react-native$': 'react-native-web',
|
|
54
|
+
};
|
|
55
|
+
config.resolve.extensions = [
|
|
56
|
+
'.web.tsx',
|
|
57
|
+
'.web.ts',
|
|
58
|
+
'.web.jsx',
|
|
59
|
+
'.web.js',
|
|
60
|
+
...config.resolve.extensions,
|
|
61
|
+
];
|
|
62
|
+
config.module.rules.push({
|
|
63
|
+
test: /\.(js|jsx)$/,
|
|
64
|
+
include: /react-native-vector-icons/,
|
|
65
|
+
loader: 'babel-loader',
|
|
66
|
+
options: {
|
|
67
|
+
presets: [
|
|
68
|
+
'@babel/preset-env',
|
|
69
|
+
['@babel/preset-react', { runtime: 'automatic' }],
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
<% } %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { WebConfigurationGeneratorSchema } from '../schema';
|
|
3
|
+
export interface NormalizedSchema extends WebConfigurationGeneratorSchema {
|
|
4
|
+
projectRoot: string;
|
|
5
|
+
fileName: string;
|
|
6
|
+
className: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function normalizeSchema(tree: Tree, schema: WebConfigurationGeneratorSchema): {
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
offsetFromRoot: string;
|
|
11
|
+
fileName: string;
|
|
12
|
+
className: string;
|
|
13
|
+
project: string;
|
|
14
|
+
bundler: "vite" | "webpack";
|
|
15
|
+
skipFormat?: boolean;
|
|
16
|
+
skipPackageJson?: boolean;
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeSchema = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function normalizeSchema(tree, schema) {
|
|
6
|
+
const project = (0, devkit_1.getProjects)(tree).get(schema.project);
|
|
7
|
+
const { fileName, className } = (0, devkit_1.names)(schema.project);
|
|
8
|
+
return {
|
|
9
|
+
...schema,
|
|
10
|
+
projectRoot: project.root,
|
|
11
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(project.root),
|
|
12
|
+
fileName,
|
|
13
|
+
className,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.normalizeSchema = normalizeSchema;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TargetConfiguration } from '@nx/devkit';
|
|
2
|
+
import type { WithReactOptions } from '@nx/react';
|
|
3
|
+
import type { WithNxOptions } from '@nx/webpack';
|
|
4
|
+
import { NormalizedSchema } from './normalize-schema';
|
|
5
|
+
export declare function createBuildTarget(options: NormalizedSchema): TargetConfiguration;
|
|
6
|
+
export declare function createServeTarget(options: NormalizedSchema): TargetConfiguration;
|
|
7
|
+
export declare function createNxWebpackPluginOptions(options: NormalizedSchema): WithNxOptions & WithReactOptions;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNxWebpackPluginOptions = exports.createServeTarget = exports.createBuildTarget = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function createBuildTarget(options) {
|
|
6
|
+
return {
|
|
7
|
+
executor: '@nx/webpack:webpack',
|
|
8
|
+
outputs: ['{options.outputPath}'],
|
|
9
|
+
defaultConfiguration: 'production',
|
|
10
|
+
options: {
|
|
11
|
+
compiler: 'babel',
|
|
12
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', options.projectRoot != '.' ? options.projectRoot : options.project, 'web'),
|
|
13
|
+
index: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/index.html'),
|
|
14
|
+
baseHref: '/',
|
|
15
|
+
main: (0, devkit_1.joinPathFragments)(options.projectRoot, `src/main-web.tsx`),
|
|
16
|
+
tsConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.app.json'),
|
|
17
|
+
assets: [
|
|
18
|
+
(0, devkit_1.joinPathFragments)(options.projectRoot, 'src/favicon.ico'),
|
|
19
|
+
(0, devkit_1.joinPathFragments)(options.projectRoot, 'src/assets'),
|
|
20
|
+
],
|
|
21
|
+
webpackConfig: (0, devkit_1.joinPathFragments)(options.projectRoot, 'webpack.config.js'),
|
|
22
|
+
},
|
|
23
|
+
configurations: {
|
|
24
|
+
development: {
|
|
25
|
+
extractLicenses: false,
|
|
26
|
+
optimization: false,
|
|
27
|
+
sourceMap: true,
|
|
28
|
+
vendorChunk: true,
|
|
29
|
+
},
|
|
30
|
+
production: {
|
|
31
|
+
optimization: true,
|
|
32
|
+
outputHashing: 'all',
|
|
33
|
+
sourceMap: false,
|
|
34
|
+
namedChunks: false,
|
|
35
|
+
extractLicenses: true,
|
|
36
|
+
vendorChunk: false,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.createBuildTarget = createBuildTarget;
|
|
42
|
+
function createServeTarget(options) {
|
|
43
|
+
return {
|
|
44
|
+
executor: '@nx/webpack:dev-server',
|
|
45
|
+
defaultConfiguration: 'development',
|
|
46
|
+
options: {
|
|
47
|
+
buildTarget: `${options.project}:build`,
|
|
48
|
+
hmr: true,
|
|
49
|
+
},
|
|
50
|
+
configurations: {
|
|
51
|
+
development: {
|
|
52
|
+
buildTarget: `${options.project}:build:development`,
|
|
53
|
+
},
|
|
54
|
+
production: {
|
|
55
|
+
buildTarget: `${options.project}:build:production`,
|
|
56
|
+
hmr: false,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.createServeTarget = createServeTarget;
|
|
62
|
+
function createNxWebpackPluginOptions(options) {
|
|
63
|
+
return {
|
|
64
|
+
target: 'web',
|
|
65
|
+
compiler: 'babel',
|
|
66
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist', options.projectRoot != '.' ? options.projectRoot : options.project),
|
|
67
|
+
index: './src/index.html',
|
|
68
|
+
baseHref: '/',
|
|
69
|
+
main: `./src/main-web.tsx`,
|
|
70
|
+
tsConfig: './tsconfig.app.json',
|
|
71
|
+
assets: ['./src/favicon.ico', './src/assets'],
|
|
72
|
+
styles: [],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
exports.createNxWebpackPluginOptions = createNxWebpackPluginOptions;
|