@nrwl/react-native 16.0.0-beta.0 → 16.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/executors.json +40 -40
- package/generators.json +2 -107
- package/index.d.ts +1 -5
- package/index.js +2 -11
- package/index.js.map +1 -1
- package/package.json +7 -25
- package/plugins/jest/svg-mock.js.map +1 -1
- package/plugins/with-nx-metro.d.ts +1 -8
- package/plugins/with-nx-metro.js +2 -29
- package/plugins/with-nx-metro.js.map +1 -1
- package/.eslintrc.json +0 -19
- package/README.md +0 -63
- package/migrations.json +0 -1285
- package/plugins/metro-resolver.d.ts +0 -1
- package/plugins/metro-resolver.js +0 -135
- package/plugins/metro-resolver.js.map +0 -1
- package/project.json +0 -61
- package/src/executors/build-android/build-android.impl.d.ts +0 -6
- package/src/executors/build-android/build-android.impl.js +0 -76
- package/src/executors/build-android/build-android.impl.js.map +0 -1
- package/src/executors/build-android/build-android.impl.ts +0 -108
- package/src/executors/build-android/compat.d.ts +0 -2
- package/src/executors/build-android/compat.js +0 -6
- package/src/executors/build-android/compat.js.map +0 -1
- package/src/executors/build-android/schema.d.ts +0 -31
- package/src/executors/build-android/schema.json +0 -102
- package/src/executors/build-ios/build-ios.impl.d.ts +0 -6
- package/src/executors/build-ios/build-ios.impl.js +0 -77
- package/src/executors/build-ios/build-ios.impl.js.map +0 -1
- package/src/executors/build-ios/build-ios.impl.ts +0 -118
- package/src/executors/build-ios/compat.d.ts +0 -2
- package/src/executors/build-ios/compat.js +0 -6
- package/src/executors/build-ios/compat.js.map +0 -1
- package/src/executors/build-ios/schema.d.ts +0 -22
- package/src/executors/build-ios/schema.json +0 -106
- package/src/executors/bundle/bundle.impl.d.ts +0 -6
- package/src/executors/bundle/bundle.impl.js +0 -58
- package/src/executors/bundle/bundle.impl.js.map +0 -1
- package/src/executors/bundle/bundle.impl.ts +0 -76
- package/src/executors/bundle/compat.d.ts +0 -2
- package/src/executors/bundle/compat.js +0 -6
- package/src/executors/bundle/compat.js.map +0 -1
- package/src/executors/bundle/schema.d.ts +0 -16
- package/src/executors/bundle/schema.json +0 -92
- package/src/executors/ensure-symlink/compat.d.ts +0 -2
- package/src/executors/ensure-symlink/compat.js +0 -6
- package/src/executors/ensure-symlink/compat.js.map +0 -1
- package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +0 -5
- package/src/executors/ensure-symlink/ensure-symlink.impl.js +0 -13
- package/src/executors/ensure-symlink/ensure-symlink.impl.js.map +0 -1
- package/src/executors/ensure-symlink/ensure-symlink.impl.ts +0 -18
- package/src/executors/ensure-symlink/schema.json +0 -11
- package/src/executors/pod-install/compat.d.ts +0 -2
- package/src/executors/pod-install/compat.js +0 -6
- package/src/executors/pod-install/compat.js.map +0 -1
- package/src/executors/pod-install/pod-install.impl.d.ts +0 -6
- package/src/executors/pod-install/pod-install.impl.js +0 -15
- package/src/executors/pod-install/pod-install.impl.js.map +0 -1
- package/src/executors/pod-install/pod-install.impl.ts +0 -21
- package/src/executors/pod-install/schema.d.ts +0 -3
- package/src/executors/pod-install/schema.json +0 -18
- package/src/executors/run-android/compat.d.ts +0 -2
- package/src/executors/run-android/compat.js +0 -6
- package/src/executors/run-android/compat.js.map +0 -1
- package/src/executors/run-android/run-android.impl.d.ts +0 -6
- package/src/executors/run-android/run-android.impl.js +0 -72
- package/src/executors/run-android/run-android.impl.js.map +0 -1
- package/src/executors/run-android/run-android.impl.ts +0 -110
- package/src/executors/run-android/schema.d.ts +0 -24
- package/src/executors/run-android/schema.json +0 -121
- package/src/executors/run-ios/compat.d.ts +0 -2
- package/src/executors/run-ios/compat.js +0 -6
- package/src/executors/run-ios/compat.js.map +0 -1
- package/src/executors/run-ios/run-ios.impl.d.ts +0 -6
- package/src/executors/run-ios/run-ios.impl.js +0 -78
- package/src/executors/run-ios/run-ios.impl.js.map +0 -1
- package/src/executors/run-ios/run-ios.impl.ts +0 -120
- package/src/executors/run-ios/schema.d.ts +0 -12
- package/src/executors/run-ios/schema.json +0 -119
- package/src/executors/start/compat.d.ts +0 -2
- package/src/executors/start/compat.js +0 -6
- package/src/executors/start/compat.js.map +0 -1
- package/src/executors/start/lib/is-packager-running.d.ts +0 -1
- package/src/executors/start/lib/is-packager-running.js +0 -19
- package/src/executors/start/lib/is-packager-running.js.map +0 -1
- package/src/executors/start/schema.d.ts +0 -7
- package/src/executors/start/schema.json +0 -28
- package/src/executors/start/start.impl.d.ts +0 -8
- package/src/executors/start/start.impl.js +0 -99
- package/src/executors/start/start.impl.js.map +0 -1
- package/src/executors/start/start.impl.ts +0 -120
- package/src/executors/storybook/compat.d.ts +0 -2
- package/src/executors/storybook/compat.js +0 -6
- package/src/executors/storybook/compat.js.map +0 -1
- package/src/executors/storybook/schema.d.ts +0 -7
- package/src/executors/storybook/schema.json +0 -34
- package/src/executors/storybook/storybook.impl.d.ts +0 -5
- package/src/executors/storybook/storybook.impl.js +0 -76
- package/src/executors/storybook/storybook.impl.js.map +0 -1
- package/src/executors/storybook/storybook.impl.ts +0 -105
- package/src/executors/sync-deps/compat.d.ts +0 -2
- package/src/executors/sync-deps/compat.js +0 -6
- package/src/executors/sync-deps/compat.js.map +0 -1
- package/src/executors/sync-deps/schema.d.ts +0 -4
- package/src/executors/sync-deps/schema.json +0 -28
- package/src/executors/sync-deps/sync-deps.impl.d.ts +0 -8
- package/src/executors/sync-deps/sync-deps.impl.js +0 -62
- package/src/executors/sync-deps/sync-deps.impl.js.map +0 -1
- package/src/executors/sync-deps/sync-deps.impl.ts +0 -101
- package/src/generators/application/application.d.ts +0 -5
- package/src/generators/application/application.js +0 -40
- package/src/generators/application/application.js.map +0 -1
- package/src/generators/application/application.spec.ts +0 -214
- package/src/generators/application/files/app/.ruby-version +0 -1
- package/src/generators/application/files/app/Gemfile.template +0 -6
- package/src/generators/application/files/app/android/app/build.gradle.template +0 -184
- package/src/generators/application/files/app/android/app/debug.keystore +0 -0
- package/src/generators/application/files/app/android/app/proguard-rules.pro +0 -10
- package/src/generators/application/files/app/android/app/src/androidTest/java/com/__lowerCaseName__/DetoxTest.java.template +0 -30
- package/src/generators/application/files/app/android/app/src/debug/AndroidManifest.xml.template +0 -14
- package/src/generators/application/files/app/android/app/src/debug/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +0 -75
- package/src/generators/application/files/app/android/app/src/main/AndroidManifest.xml.template +0 -26
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.java.template +0 -35
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.java.template +0 -63
- package/src/generators/application/files/app/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
- 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 +0 -3
- package/src/generators/application/files/app/android/app/src/main/res/values/styles.xml +0 -9
- package/src/generators/application/files/app/android/app/src/main/res/xml/network_security_config.xml +0 -7
- package/src/generators/application/files/app/android/app/src/release/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +0 -20
- package/src/generators/application/files/app/android/build.gradle.template +0 -34
- 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 +0 -5
- package/src/generators/application/files/app/android/gradle.properties +0 -44
- package/src/generators/application/files/app/android/gradlew.bat +0 -89
- package/src/generators/application/files/app/android/gradlew.template +0 -234
- package/src/generators/application/files/app/android/settings.gradle.template +0 -7
- package/src/generators/application/files/app/app.json.template +0 -4
- package/src/generators/application/files/app/babel.config.json.template +0 -3
- package/src/generators/application/files/app/ios/.xcode.env.template +0 -12
- package/src/generators/application/files/app/ios/Podfile.template +0 -60
- package/src/generators/application/files/app/ios/__className__/AppDelegate.h +0 -6
- package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +0 -36
- package/src/generators/application/files/app/ios/__className__/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
- package/src/generators/application/files/app/ios/__className__/Images.xcassets/Contents.json +0 -6
- package/src/generators/application/files/app/ios/__className__/Info.plist.template +0 -55
- package/src/generators/application/files/app/ios/__className__/LaunchScreen.storyboard.template +0 -47
- package/src/generators/application/files/app/ios/__className__/main.m +0 -10
- package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +0 -702
- package/src/generators/application/files/app/ios/__className__.xcodeproj/xcshareddata/xcschemes/__className__.xcscheme.template +0 -88
- package/src/generators/application/files/app/ios/__className__.xcworkspace/contents.xcworkspacedata +0 -10
- package/src/generators/application/files/app/ios/__className__Tests/Info.plist +0 -24
- package/src/generators/application/files/app/ios/__className__Tests/__className__Tests.m +0 -66
- package/src/generators/application/files/app/metro.config.js.template +0 -38
- package/src/generators/application/files/app/package.json.template +0 -15
- package/src/generators/application/files/app/src/app/App.spec.tsx.template +0 -9
- package/src/generators/application/files/app/src/app/App.tsx.template +0 -694
- package/src/generators/application/files/app/src/main.tsx.template +0 -4
- package/src/generators/application/files/app/test-setup.ts.template +0 -1
- package/src/generators/application/files/app/tsconfig.app.json.template +0 -9
- package/src/generators/application/files/app/tsconfig.json.template +0 -25
- package/src/generators/application/lib/add-detox.d.ts +0 -3
- package/src/generators/application/lib/add-detox.js +0 -16
- package/src/generators/application/lib/add-detox.js.map +0 -1
- package/src/generators/application/lib/add-project.d.ts +0 -3
- package/src/generators/application/lib/add-project.js +0 -83
- package/src/generators/application/lib/add-project.js.map +0 -1
- package/src/generators/application/lib/create-application-files.d.ts +0 -3
- package/src/generators/application/lib/create-application-files.js +0 -20
- package/src/generators/application/lib/create-application-files.js.map +0 -1
- package/src/generators/application/lib/nomalize-options.spec.ts +0 -138
- package/src/generators/application/lib/normalize-options.d.ts +0 -13
- package/src/generators/application/lib/normalize-options.js +0 -36
- package/src/generators/application/lib/normalize-options.js.map +0 -1
- package/src/generators/application/schema.d.ts +0 -19
- package/src/generators/application/schema.json +0 -89
- package/src/generators/component/component.d.ts +0 -5
- package/src/generators/component/component.js +0 -53
- package/src/generators/component/component.js.map +0 -1
- package/src/generators/component/component.spec.ts +0 -135
- package/src/generators/component/files/__fileName__.spec.tsx__tmpl__ +0 -11
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +0 -32
- package/src/generators/component/lib/add-import.d.ts +0 -3
- package/src/generators/component/lib/add-import.js +0 -34
- package/src/generators/component/lib/add-import.js.map +0 -1
- package/src/generators/component/lib/normalize-options.d.ts +0 -8
- package/src/generators/component/lib/normalize-options.js +0 -58
- package/src/generators/component/lib/normalize-options.js.map +0 -1
- package/src/generators/component/schema.d.ts +0 -14
- package/src/generators/component/schema.json +0 -78
- package/src/generators/component-story/component-story.d.ts +0 -8
- package/src/generators/component-story/component-story.js +0 -113
- package/src/generators/component-story/component-story.js.map +0 -1
- package/src/generators/component-story/component-story.spec.ts +0 -433
- package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +0 -24
- package/src/generators/component-story/schema.d.ts +0 -5
- package/src/generators/component-story/schema.json +0 -34
- package/src/generators/init/init.d.ts +0 -6
- package/src/generators/init/init.js +0 -58
- package/src/generators/init/init.js.map +0 -1
- package/src/generators/init/init.spec.ts +0 -81
- package/src/generators/init/lib/add-git-ignore-entry.d.ts +0 -2
- package/src/generators/init/lib/add-git-ignore-entry.js +0 -25
- package/src/generators/init/lib/add-git-ignore-entry.js.map +0 -1
- package/src/generators/init/lib/gitignore-entries.d.ts +0 -1
- package/src/generators/init/lib/gitignore-entries.js +0 -75
- package/src/generators/init/lib/gitignore-entries.js.map +0 -1
- package/src/generators/init/schema.d.ts +0 -7
- package/src/generators/init/schema.json +0 -40
- package/src/generators/library/files/lib/README.md +0 -7
- package/src/generators/library/files/lib/babel.config.json.template +0 -17
- package/src/generators/library/files/lib/package.json__tmpl__ +0 -4
- package/src/generators/library/files/lib/src/index.ts__tmpl__ +0 -0
- package/src/generators/library/files/lib/test-setup.ts.template +0 -1
- package/src/generators/library/files/lib/tsconfig.json__tmpl__ +0 -16
- package/src/generators/library/files/lib/tsconfig.lib.json__tmpl__ +0 -9
- package/src/generators/library/lib/normalize-options.d.ts +0 -13
- package/src/generators/library/lib/normalize-options.js +0 -26
- package/src/generators/library/lib/normalize-options.js.map +0 -1
- package/src/generators/library/library.d.ts +0 -5
- package/src/generators/library/library.js +0 -101
- package/src/generators/library/library.js.map +0 -1
- package/src/generators/library/library.spec.ts +0 -397
- package/src/generators/library/schema.d.ts +0 -22
- package/src/generators/library/schema.json +0 -102
- package/src/generators/stories/schema.d.ts +0 -5
- package/src/generators/stories/schema.json +0 -42
- package/src/generators/stories/stories-app.spec.ts +0 -145
- package/src/generators/stories/stories-lib.spec.ts +0 -113
- package/src/generators/stories/stories.d.ts +0 -6
- package/src/generators/stories/stories.js +0 -63
- package/src/generators/stories/stories.js.map +0 -1
- package/src/generators/storybook-configuration/configuration.d.ts +0 -5
- package/src/generators/storybook-configuration/configuration.js +0 -60
- package/src/generators/storybook-configuration/configuration.js.map +0 -1
- package/src/generators/storybook-configuration/configuration.spec.ts +0 -146
- package/src/generators/storybook-configuration/files/app/storybook.ts.template +0 -9
- package/src/generators/storybook-configuration/files/app/toggle-storybook.tsx.template +0 -114
- package/src/generators/storybook-configuration/files/root/story-loader.js.template +0 -13
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.d.ts +0 -6
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.js +0 -26
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.js.map +0 -1
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.spec.ts +0 -161
- package/src/generators/storybook-configuration/lib/create-storybook-files.d.ts +0 -6
- package/src/generators/storybook-configuration/lib/create-storybook-files.js +0 -45
- package/src/generators/storybook-configuration/lib/create-storybook-files.js.map +0 -1
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.d.ts +0 -7
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js +0 -30
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js.map +0 -1
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.spec.ts +0 -65
- package/src/generators/storybook-configuration/schema.d.ts +0 -11
- package/src/generators/storybook-configuration/schema.json +0 -66
- package/src/generators/upgrade-native/lib/create-native-files.d.ts +0 -3
- package/src/generators/upgrade-native/lib/create-native-files.js +0 -15
- package/src/generators/upgrade-native/lib/create-native-files.js.map +0 -1
- package/src/generators/upgrade-native/lib/normalize-options.d.ts +0 -12
- package/src/generators/upgrade-native/lib/normalize-options.js +0 -28
- package/src/generators/upgrade-native/lib/normalize-options.js.map +0 -1
- package/src/generators/upgrade-native/schema.d.ts +0 -9
- package/src/generators/upgrade-native/schema.json +0 -41
- package/src/generators/upgrade-native/upgrade-native.d.ts +0 -9
- package/src/generators/upgrade-native/upgrade-native.js +0 -33
- package/src/generators/upgrade-native/upgrade-native.js.map +0 -1
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.d.ts +0 -8
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.js +0 -63
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.js.map +0 -1
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.spec.ts +0 -79
- package/src/migrations/update-12-5-0/update-jest-for-react-native.d.ts +0 -2
- package/src/migrations/update-12-5-0/update-jest-for-react-native.js +0 -62
- package/src/migrations/update-12-5-0/update-jest-for-react-native.js.map +0 -1
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.d.ts +0 -2
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js +0 -22
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js.map +0 -1
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.spec.ts +0 -48
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.d.ts +0 -6
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.js +0 -41
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.js.map +0 -1
- package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.spec.ts +0 -61
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.d.ts +0 -6
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.js +0 -33
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.js.map +0 -1
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.spec.ts +0 -192
- package/src/migrations/update-14-0-0/update-entry-file-bundle-14-0-0.d.ts +0 -5
- package/src/migrations/update-14-0-0/update-entry-file-bundle-14-0-0.js +0 -39
- package/src/migrations/update-14-0-0/update-entry-file-bundle-14-0-0.js.map +0 -1
- package/src/migrations/update-14-0-0/update-entry-file-bundle-14-0-0.spec.ts +0 -84
- package/src/migrations/update-14-0-2/change-main-to-class-name-14-0-2.d.ts +0 -5
- package/src/migrations/update-14-0-2/change-main-to-class-name-14-0-2.js +0 -42
- package/src/migrations/update-14-0-2/change-main-to-class-name-14-0-2.js.map +0 -1
- package/src/migrations/update-14-0-2/change-main-to-class-name-14-0-2.spec.ts +0 -48
- package/src/migrations/update-14-2-1/rename-blockList-metro-config.d.ts +0 -6
- package/src/migrations/update-14-2-1/rename-blockList-metro-config.js +0 -33
- package/src/migrations/update-14-2-1/rename-blockList-metro-config.js.map +0 -1
- package/src/migrations/update-14-2-1/rename-blockList-metro-config.spec.ts +0 -190
- package/src/migrations/update-14-5-5/add-exclude-sync-deps.d.ts +0 -5
- package/src/migrations/update-14-5-5/add-exclude-sync-deps.js +0 -26
- package/src/migrations/update-14-5-5/add-exclude-sync-deps.js.map +0 -1
- package/src/migrations/update-14-5-5/add-exclude-sync-deps.spec.ts +0 -39
- package/src/migrations/update-14-5-8/change-searchDir-storybook.d.ts +0 -5
- package/src/migrations/update-14-5-8/change-searchDir-storybook.js +0 -26
- package/src/migrations/update-14-5-8/change-searchDir-storybook.js.map +0 -1
- package/src/migrations/update-14-5-8/change-searchDir-storybook.spec.ts +0 -39
- package/src/migrations/update-14-6-0/remove-jest-transform.d.ts +0 -5
- package/src/migrations/update-14-6-0/remove-jest-transform.js +0 -58
- package/src/migrations/update-14-6-0/remove-jest-transform.js.map +0 -1
- package/src/migrations/update-14-6-0/remove-jest-transform.spec.ts +0 -109
- package/src/migrations/update-15-0-0/add-babel-inputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/add-babel-inputs.js +0 -13
- package/src/migrations/update-15-0-0/add-babel-inputs.js.map +0 -1
- package/src/migrations/update-15-0-0/add-babel-inputs.spec.ts +0 -73
- package/src/migrations/update-15-9-1/add-build-ios-target.d.ts +0 -5
- package/src/migrations/update-15-9-1/add-build-ios-target.js +0 -34
- package/src/migrations/update-15-9-1/add-build-ios-target.js.map +0 -1
- package/src/migrations/update-15-9-1/add-build-ios-target.spec.ts +0 -36
- package/src/utils/add-jest.d.ts +0 -2
- package/src/utils/add-jest.js +0 -38
- package/src/utils/add-jest.js.map +0 -1
- package/src/utils/add-linting.d.ts +0 -12
- package/src/utils/add-linting.js +0 -41
- package/src/utils/add-linting.js.map +0 -1
- package/src/utils/add-linting.spec.ts +0 -42
- package/src/utils/chmod-android-gradle-files.d.ts +0 -3
- package/src/utils/chmod-android-gradle-files.js +0 -24
- package/src/utils/chmod-android-gradle-files.js.map +0 -1
- package/src/utils/ensure-node-modules-symlink.d.ts +0 -9
- package/src/utils/ensure-node-modules-symlink.js +0 -29
- package/src/utils/ensure-node-modules-symlink.js.map +0 -1
- package/src/utils/ensure-node-modules-symlink.spec.ts +0 -108
- package/src/utils/find-all-npm-dependencies.d.ts +0 -2
- package/src/utils/find-all-npm-dependencies.js +0 -26
- package/src/utils/find-all-npm-dependencies.js.map +0 -1
- package/src/utils/find-all-npm-dependencies.spec.ts +0 -95
- package/src/utils/format-file.d.ts +0 -1
- package/src/utils/format-file.js +0 -17
- package/src/utils/format-file.js.map +0 -1
- package/src/utils/get-cli-options.d.ts +0 -8
- package/src/utils/get-cli-options.js +0 -31
- package/src/utils/get-cli-options.js.map +0 -1
- package/src/utils/pod-install-task.d.ts +0 -8
- package/src/utils/pod-install-task.js +0 -62
- package/src/utils/pod-install-task.js.map +0 -1
- package/src/utils/symlink-task.d.ts +0 -2
- package/src/utils/symlink-task.js +0 -19
- package/src/utils/symlink-task.js.map +0 -1
- package/src/utils/testing-generators.d.ts +0 -3
- package/src/utils/testing-generators.js +0 -36
- package/src/utils/testing-generators.js.map +0 -1
- package/src/utils/versions.d.ts +0 -20
- package/src/utils/versions.js +0 -24
- package/src/utils/versions.js.map +0 -1
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nrwl/devkit';
|
|
2
|
-
import storiesGenerator from './stories';
|
|
3
|
-
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
|
4
|
-
import applicationGenerator from '../application/application';
|
|
5
|
-
import { Linter } from '@nrwl/linter';
|
|
6
|
-
import { reactNativeComponentGenerator } from '../component/component';
|
|
7
|
-
|
|
8
|
-
describe('react:stories for applications', () => {
|
|
9
|
-
let appTree: Tree;
|
|
10
|
-
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
appTree = await createTestUIApp('test-ui-app');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should create the stories', async () => {
|
|
16
|
-
await reactNativeComponentGenerator(appTree, {
|
|
17
|
-
name: 'another-cmp',
|
|
18
|
-
project: 'test-ui-app',
|
|
19
|
-
});
|
|
20
|
-
await storiesGenerator(appTree, {
|
|
21
|
-
project: 'test-ui-app',
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
expect(appTree.exists('apps/test-ui-app/src/app/App.tsx')).toBeTruthy();
|
|
25
|
-
expect(
|
|
26
|
-
appTree.exists('apps/test-ui-app/src/app/App.stories.tsx')
|
|
27
|
-
).toBeTruthy();
|
|
28
|
-
expect(
|
|
29
|
-
appTree.exists(
|
|
30
|
-
'apps/test-ui-app/src/app/another-cmp/another-cmp.stories.tsx'
|
|
31
|
-
)
|
|
32
|
-
).toBeTruthy();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should ignore paths', async () => {
|
|
36
|
-
await reactNativeComponentGenerator(appTree, {
|
|
37
|
-
name: 'another-cmp',
|
|
38
|
-
project: 'test-ui-app',
|
|
39
|
-
});
|
|
40
|
-
await storiesGenerator(appTree, {
|
|
41
|
-
project: 'test-ui-app',
|
|
42
|
-
ignorePaths: ['apps/test-ui-app/src/app/**'],
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
expect(appTree.exists('apps/test-ui-app/src/app/App.tsx')).toBeTruthy();
|
|
46
|
-
expect(
|
|
47
|
-
appTree.exists('apps/test-ui-app/src/app/App.stories.tsx')
|
|
48
|
-
).toBeFalsy();
|
|
49
|
-
expect(
|
|
50
|
-
appTree.exists(
|
|
51
|
-
'apps/test-ui-app/src/app/another-cmp/another-cmp.stories.tsx'
|
|
52
|
-
)
|
|
53
|
-
).toBeFalsy();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should ignore paths with a direct path to a component', async () => {
|
|
57
|
-
await reactNativeComponentGenerator(appTree, {
|
|
58
|
-
name: 'another-new-cmp',
|
|
59
|
-
project: 'test-ui-app',
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
await storiesGenerator(appTree, {
|
|
63
|
-
project: 'test-ui-app',
|
|
64
|
-
ignorePaths: [
|
|
65
|
-
'apps/test-ui-app/src/app/another-new-cmp/another-new-cmp.tsx',
|
|
66
|
-
],
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
expect(appTree.exists('apps/test-ui-app/src/app/App.tsx')).toBeTruthy();
|
|
70
|
-
expect(
|
|
71
|
-
appTree.exists('apps/test-ui-app/src/app/App.stories.tsx')
|
|
72
|
-
).toBeTruthy();
|
|
73
|
-
expect(
|
|
74
|
-
appTree.exists(
|
|
75
|
-
'apps/test-ui-app/src/app/another-new-cmp/another-new-cmp.stories.tsx'
|
|
76
|
-
)
|
|
77
|
-
).toBeFalsy();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should ignore a path that has a nested component, but still generate nested component stories', async () => {
|
|
81
|
-
await reactNativeComponentGenerator(appTree, {
|
|
82
|
-
name: 'another-new-cmp',
|
|
83
|
-
project: 'test-ui-app',
|
|
84
|
-
});
|
|
85
|
-
await reactNativeComponentGenerator(appTree, {
|
|
86
|
-
name: 'comp-a',
|
|
87
|
-
directory: 'app/another-new-cmp',
|
|
88
|
-
project: 'test-ui-app',
|
|
89
|
-
});
|
|
90
|
-
await storiesGenerator(appTree, {
|
|
91
|
-
project: 'test-ui-app',
|
|
92
|
-
ignorePaths: [
|
|
93
|
-
'apps/test-ui-app/src/app/another-new-cmp/another-new-cmp.tsx',
|
|
94
|
-
],
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
expect(appTree.exists('apps/test-ui-app/src/app/App.tsx')).toBeTruthy();
|
|
98
|
-
expect(
|
|
99
|
-
appTree.exists('apps/test-ui-app/src/app/App.stories.tsx')
|
|
100
|
-
).toBeTruthy();
|
|
101
|
-
expect(
|
|
102
|
-
appTree.exists(
|
|
103
|
-
'apps/test-ui-app/src/app/another-new-cmp/comp-a/comp-a.stories.tsx'
|
|
104
|
-
)
|
|
105
|
-
).toBeTruthy();
|
|
106
|
-
expect(
|
|
107
|
-
appTree.exists(
|
|
108
|
-
'apps/test-ui-app/src/app/another-new-cmp/another-new-cmp.stories.tsx'
|
|
109
|
-
)
|
|
110
|
-
).toBeFalsy();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('should ignore files that do not contain components', async () => {
|
|
114
|
-
// create another component
|
|
115
|
-
appTree.write(
|
|
116
|
-
'apps/test-ui-app/src/app/some-utils.js',
|
|
117
|
-
`export const add = (a: number, b: number) => a + b;`
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
await storiesGenerator(appTree, {
|
|
121
|
-
project: 'test-ui-app',
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// should just create the story and not error, even though there's a js file
|
|
125
|
-
// not containing any react component
|
|
126
|
-
expect(
|
|
127
|
-
appTree.exists('apps/test-ui-app/src/app/App.stories.tsx')
|
|
128
|
-
).toBeTruthy();
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
export async function createTestUIApp(libName: string): Promise<Tree> {
|
|
133
|
-
let appTree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
134
|
-
appTree.write('.gitignore', '');
|
|
135
|
-
|
|
136
|
-
await applicationGenerator(appTree, {
|
|
137
|
-
linter: Linter.EsLint,
|
|
138
|
-
skipFormat: false,
|
|
139
|
-
style: 'css',
|
|
140
|
-
unitTestRunner: 'none',
|
|
141
|
-
name: libName,
|
|
142
|
-
install: false,
|
|
143
|
-
});
|
|
144
|
-
return appTree;
|
|
145
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nrwl/devkit';
|
|
2
|
-
import storiesGenerator from './stories';
|
|
3
|
-
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
|
4
|
-
import applicationGenerator from '../application/application';
|
|
5
|
-
import { Linter } from '@nrwl/linter';
|
|
6
|
-
import libraryGenerator from '../library/library';
|
|
7
|
-
import reactNativeComponentGenerator from '../component/component';
|
|
8
|
-
|
|
9
|
-
describe('react-native:stories for libraries', () => {
|
|
10
|
-
let appTree: Tree;
|
|
11
|
-
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
appTree = await createTestUILib('test-ui-lib');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('should create the stories', async () => {
|
|
17
|
-
await reactNativeComponentGenerator(appTree, {
|
|
18
|
-
name: 'test-ui-lib',
|
|
19
|
-
project: 'test-ui-lib',
|
|
20
|
-
});
|
|
21
|
-
await reactNativeComponentGenerator(appTree, {
|
|
22
|
-
name: 'another-cmp',
|
|
23
|
-
project: 'test-ui-lib',
|
|
24
|
-
});
|
|
25
|
-
await storiesGenerator(appTree, {
|
|
26
|
-
project: 'test-ui-lib',
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
expect(
|
|
30
|
-
appTree.exists(
|
|
31
|
-
'libs/test-ui-lib/src/lib/test-ui-lib/test-ui-lib.stories.tsx'
|
|
32
|
-
)
|
|
33
|
-
).toBeTruthy();
|
|
34
|
-
expect(
|
|
35
|
-
appTree.exists(
|
|
36
|
-
'libs/test-ui-lib/src/lib/another-cmp/another-cmp.stories.tsx'
|
|
37
|
-
)
|
|
38
|
-
).toBeTruthy();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should ignore paths', async () => {
|
|
42
|
-
await reactNativeComponentGenerator(appTree, {
|
|
43
|
-
name: 'test-ui-lib',
|
|
44
|
-
project: 'test-ui-lib',
|
|
45
|
-
});
|
|
46
|
-
await reactNativeComponentGenerator(appTree, {
|
|
47
|
-
name: 'another-cmp',
|
|
48
|
-
project: 'test-ui-lib',
|
|
49
|
-
});
|
|
50
|
-
await storiesGenerator(appTree, {
|
|
51
|
-
project: 'test-ui-lib',
|
|
52
|
-
ignorePaths: ['libs/test-ui-lib/src/lib/another-cmp/**'],
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
expect(
|
|
56
|
-
appTree.exists(
|
|
57
|
-
'libs/test-ui-lib/src/lib/test-ui-lib/test-ui-lib.stories.tsx'
|
|
58
|
-
)
|
|
59
|
-
).toBeTruthy();
|
|
60
|
-
expect(
|
|
61
|
-
appTree.exists(
|
|
62
|
-
'libs/test-ui-lib/src/lib/another-cmp/another-cmp.stories.tsx'
|
|
63
|
-
)
|
|
64
|
-
).toBeFalsy();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should ignore files that do not contain components', async () => {
|
|
68
|
-
await reactNativeComponentGenerator(appTree, {
|
|
69
|
-
name: 'test-ui-lib',
|
|
70
|
-
project: 'test-ui-lib',
|
|
71
|
-
});
|
|
72
|
-
// create another component
|
|
73
|
-
appTree.write(
|
|
74
|
-
'libs/test-ui-lib/src/lib/some-command-line-utils.ts',
|
|
75
|
-
`export const add = (a: number, b: number) => a + b;`
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
await storiesGenerator(appTree, {
|
|
79
|
-
project: 'test-ui-lib',
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// should just create the story and not error, even though there's a js file
|
|
83
|
-
// not containing any react component
|
|
84
|
-
expect(
|
|
85
|
-
appTree.exists(
|
|
86
|
-
'libs/test-ui-lib/src/lib/test-ui-lib/test-ui-lib.stories.tsx'
|
|
87
|
-
)
|
|
88
|
-
).toBeTruthy();
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
export async function createTestUILib(libName: string): Promise<Tree> {
|
|
93
|
-
let appTree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
94
|
-
appTree.write('.gitignore', '');
|
|
95
|
-
|
|
96
|
-
await libraryGenerator(appTree, {
|
|
97
|
-
linter: Linter.EsLint,
|
|
98
|
-
skipFormat: true,
|
|
99
|
-
skipTsConfig: false,
|
|
100
|
-
unitTestRunner: 'none',
|
|
101
|
-
name: libName,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
await applicationGenerator(appTree, {
|
|
105
|
-
e2eTestRunner: 'none',
|
|
106
|
-
linter: Linter.EsLint,
|
|
107
|
-
skipFormat: false,
|
|
108
|
-
unitTestRunner: 'none',
|
|
109
|
-
name: `${libName}-e2e`,
|
|
110
|
-
install: false,
|
|
111
|
-
});
|
|
112
|
-
return appTree;
|
|
113
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nrwl/devkit';
|
|
2
|
-
import { StorybookStoriesSchema } from './schema';
|
|
3
|
-
export declare function createAllStories(tree: Tree, projectName: string, ignorePaths?: string[]): Promise<void>;
|
|
4
|
-
export declare function storiesGenerator(host: Tree, schema: StorybookStoriesSchema): Promise<void>;
|
|
5
|
-
export default storiesGenerator;
|
|
6
|
-
export declare const storiesSchematic: (generatorOptions: StorybookStoriesSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storiesSchematic = exports.storiesGenerator = exports.createAllStories = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const component_story_1 = require("../component-story/component-story");
|
|
8
|
-
const stories_1 = require("@nrwl/react/src/generators/stories/stories");
|
|
9
|
-
const minimatch = require("minimatch");
|
|
10
|
-
const versions_1 = require("../../utils/versions");
|
|
11
|
-
function createAllStories(tree, projectName, ignorePaths) {
|
|
12
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
(0, devkit_1.ensurePackage)('@nrwl/storybook', versions_1.nxVersion);
|
|
14
|
-
const { isTheFileAStory } = yield Promise.resolve().then(() => require('@nrwl/storybook/src/utils/utilities'));
|
|
15
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
16
|
-
const projectConfiguration = projects.get(projectName);
|
|
17
|
-
const { sourceRoot } = projectConfiguration;
|
|
18
|
-
const projectPath = yield (0, stories_1.projectRootPath)(tree, projectConfiguration);
|
|
19
|
-
let componentPaths = [];
|
|
20
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, projectPath, (path) => {
|
|
21
|
-
if (ignorePaths === null || ignorePaths === void 0 ? void 0 : ignorePaths.some((pattern) => minimatch(path, pattern)))
|
|
22
|
-
return;
|
|
23
|
-
if ((path.endsWith('.tsx') && !path.endsWith('.spec.tsx')) ||
|
|
24
|
-
(path.endsWith('.js') && !path.endsWith('.spec.js')) ||
|
|
25
|
-
(path.endsWith('.jsx') && !path.endsWith('.spec.jsx'))) {
|
|
26
|
-
// Check if file is NOT a story (either ts/tsx or js/jsx)
|
|
27
|
-
if (!isTheFileAStory(tree, path)) {
|
|
28
|
-
// Since the file is not a story
|
|
29
|
-
// Let's see if the .stories.* file exists
|
|
30
|
-
const ext = path.slice(path.lastIndexOf('.'));
|
|
31
|
-
const storyPath = `${path.split(ext)[0]}.stories${ext}`;
|
|
32
|
-
if (!tree.exists(storyPath)) {
|
|
33
|
-
componentPaths.push(path);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
yield Promise.all(componentPaths.map((componentPath) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const relativeCmpDir = componentPath.replace((0, path_1.join)(sourceRoot, '/'), '');
|
|
40
|
-
if (!(0, stories_1.containsComponentDeclaration)(tree, componentPath)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
yield (0, component_story_1.default)(tree, {
|
|
44
|
-
componentPath: relativeCmpDir,
|
|
45
|
-
project: projectName,
|
|
46
|
-
skipFormat: true,
|
|
47
|
-
});
|
|
48
|
-
})));
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
exports.createAllStories = createAllStories;
|
|
52
|
-
function storiesGenerator(host, schema) {
|
|
53
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
yield createAllStories(host, schema.project, schema.ignorePaths);
|
|
55
|
-
if (!schema.skipFormat) {
|
|
56
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
exports.storiesGenerator = storiesGenerator;
|
|
61
|
-
exports.default = storiesGenerator;
|
|
62
|
-
exports.storiesSchematic = (0, devkit_1.convertNxGenerator)(storiesGenerator);
|
|
63
|
-
//# sourceMappingURL=stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/generators/stories/stories.ts"],"names":[],"mappings":";;;;AAAA,yCAOsB;AACtB,+BAA4B;AAC5B,wEAAyE;AAEzE,wEAGoD;AACpD,uCAAwC;AACxC,mDAAiD;AAEjD,SAAsB,gBAAgB,CACpC,IAAU,EACV,WAAmB,EACnB,WAAsB;;QAEtB,IAAA,sBAAa,EAAC,iBAAiB,EAAE,oBAAS,CAAC,CAAC;QAC5C,MAAM,EAAE,eAAe,EAAE,GAAG,2CAC1B,qCAAqC,EACtC,CAAC;QAEF,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAEvD,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,CAAC;QAC5C,MAAM,WAAW,GAAG,MAAM,IAAA,yBAAe,EAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;QAEtE,IAAI,cAAc,GAAa,EAAE,CAAC;QAClC,IAAA,6BAAoB,EAAC,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE;YAC/C,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAAE,OAAO;YAErE,IACE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;gBACtD,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;gBACpD,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,EACtD;gBACA,yDAAyD;gBACzD,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;oBAChC,gCAAgC;oBAChC,0CAA0C;oBAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC9C,MAAM,SAAS,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,EAAE,CAAC;oBAExD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;wBAC3B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBAC3B;iBACF;aACF;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CACf,cAAc,CAAC,GAAG,CAAC,CAAO,aAAa,EAAE,EAAE;YACzC,MAAM,cAAc,GAAG,aAAa,CAAC,OAAO,CAAC,IAAA,WAAI,EAAC,UAAU,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;YAExE,IAAI,CAAC,IAAA,sCAA4B,EAAC,IAAI,EAAE,aAAa,CAAC,EAAE;gBACtD,OAAO;aACR;YAED,MAAM,IAAA,yBAAuB,EAAC,IAAI,EAAE;gBAClC,aAAa,EAAE,cAAc;gBAC7B,OAAO,EAAE,WAAW;gBACpB,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;QACL,CAAC,CAAA,CAAC,CACH,CAAC;IACJ,CAAC;CAAA;AAtDD,4CAsDC;AAED,SAAsB,gBAAgB,CACpC,IAAU,EACV,MAA8B;;QAE9B,MAAM,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAEjE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACtB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AATD,4CASC;AAED,kBAAe,gBAAgB,CAAC;AACnB,QAAA,gBAAgB,GAAG,IAAA,2BAAkB,EAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { GeneratorCallback, Tree } from '@nrwl/devkit';
|
|
2
|
-
import { StorybookConfigureSchema } from './schema';
|
|
3
|
-
export declare function storybookConfigurationGenerator(host: Tree, schema: StorybookConfigureSchema): Promise<GeneratorCallback>;
|
|
4
|
-
export default storybookConfigurationGenerator;
|
|
5
|
-
export declare const storybookConfigurationSchematic: (generatorOptions: StorybookConfigureSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storybookConfigurationSchematic = exports.storybookConfigurationGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
-
const versions_1 = require("../../utils/versions");
|
|
7
|
-
const stories_1 = require("../stories/stories");
|
|
8
|
-
const add_resolver_main_fields_to_metro_config_1 = require("./lib/add-resolver-main-fields-to-metro-config");
|
|
9
|
-
const create_storybook_files_1 = require("./lib/create-storybook-files");
|
|
10
|
-
const replace_app_import_with_storybook_toggle_1 = require("./lib/replace-app-import-with-storybook-toggle");
|
|
11
|
-
function generateStories(host, schema) {
|
|
12
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
yield (0, stories_1.default)(host, {
|
|
14
|
-
project: schema.name,
|
|
15
|
-
ignorePaths: schema.ignorePaths,
|
|
16
|
-
skipFormat: true,
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function storybookConfigurationGenerator(host, schema) {
|
|
21
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nrwl/storybook', versions_1.nxVersion);
|
|
23
|
-
const installTask = yield configurationGenerator(host, {
|
|
24
|
-
name: schema.name,
|
|
25
|
-
uiFramework: '@storybook/react-native',
|
|
26
|
-
configureCypress: false,
|
|
27
|
-
js: false,
|
|
28
|
-
linter: schema.linter,
|
|
29
|
-
standaloneConfig: schema.standaloneConfig,
|
|
30
|
-
tsConfiguration: schema.tsConfiguration,
|
|
31
|
-
skipFormat: true,
|
|
32
|
-
});
|
|
33
|
-
addStorybookTask(host, schema.name);
|
|
34
|
-
(0, create_storybook_files_1.createStorybookFiles)(host, schema);
|
|
35
|
-
(0, replace_app_import_with_storybook_toggle_1.replaceAppImportWithStorybookToggle)(host, schema);
|
|
36
|
-
(0, add_resolver_main_fields_to_metro_config_1.addResolverMainFieldsToMetroConfig)(host, schema);
|
|
37
|
-
if (schema.generateStories) {
|
|
38
|
-
yield generateStories(host, schema);
|
|
39
|
-
}
|
|
40
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
41
|
-
return installTask;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
exports.storybookConfigurationGenerator = storybookConfigurationGenerator;
|
|
45
|
-
function addStorybookTask(host, projectName) {
|
|
46
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, projectName);
|
|
47
|
-
projectConfig.targets['storybook'] = {
|
|
48
|
-
executor: '@nrwl/react-native:storybook',
|
|
49
|
-
options: {
|
|
50
|
-
searchDir: [projectConfig.root],
|
|
51
|
-
outputFile: './.storybook/story-loader.js',
|
|
52
|
-
pattern: '**/*.stories.@(js|jsx|ts|tsx|md)',
|
|
53
|
-
silent: false,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
(0, devkit_1.updateProjectConfiguration)(host, projectName, projectConfig);
|
|
57
|
-
}
|
|
58
|
-
exports.default = storybookConfigurationGenerator;
|
|
59
|
-
exports.storybookConfigurationSchematic = (0, devkit_1.convertNxGenerator)(storybookConfigurationGenerator);
|
|
60
|
-
//# sourceMappingURL=configuration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/generators/storybook-configuration/configuration.ts"],"names":[],"mappings":";;;;AAAA,yCAQsB;AACtB,mDAAiD;AAEjD,gDAAkD;AAClD,6GAAoG;AACpG,yEAAoE;AACpE,6GAAqG;AAIrG,SAAe,eAAe,CAAC,IAAU,EAAE,MAAgC;;QACzE,MAAM,IAAA,iBAAgB,EAAC,IAAI,EAAE;YAC3B,OAAO,EAAE,MAAM,CAAC,IAAI;YACpB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;CAAA;AAED,SAAsB,+BAA+B,CACnD,IAAU,EACV,MAAgC;;QAEhC,MAAM,EAAE,sBAAsB,EAAE,GAAG,IAAA,sBAAa,EAE9C,iBAAiB,EAAE,oBAAS,CAAC,CAAC;QAEhC,MAAM,WAAW,GAAG,MAAM,sBAAsB,CAAC,IAAI,EAAE;YACrD,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,yBAAyB;YACtC,gBAAgB,EAAE,KAAK;YACvB,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,IAAA,6CAAoB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACnC,IAAA,8EAAmC,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAClD,IAAA,6EAAkC,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEjD,IAAI,MAAM,CAAC,eAAe,EAAE;YAC1B,MAAM,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;SACrC;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACxB,OAAO,WAAW,CAAC;IACrB,CAAC;CAAA;AA9BD,0EA8BC;AAED,SAAS,gBAAgB,CAAC,IAAU,EAAE,WAAmB;IACvD,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAClE,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG;QACnC,QAAQ,EAAE,8BAA8B;QACxC,OAAO,EAAE;YACP,SAAS,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/B,UAAU,EAAE,8BAA8B;YAC1C,OAAO,EAAE,kCAAkC;YAC3C,MAAM,EAAE,KAAK;SACd;KACF,CAAC;IAEF,IAAA,mCAA0B,EAAC,IAAI,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;AAC/D,CAAC;AAED,kBAAe,+BAA+B,CAAC;AAClC,QAAA,+BAA+B,GAAG,IAAA,2BAAkB,EAC/D,+BAA+B,CAChC,CAAC"}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nrwl/devkit';
|
|
2
|
-
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
|
|
3
|
-
import { Linter } from '@nrwl/linter';
|
|
4
|
-
import { logger } from '@nrwl/devkit';
|
|
5
|
-
|
|
6
|
-
import libraryGenerator from '../library/library';
|
|
7
|
-
import applicationGenerator from '../application/application';
|
|
8
|
-
import componentGenerator from '../component/component';
|
|
9
|
-
import storybookConfigurationGenerator from './configuration';
|
|
10
|
-
|
|
11
|
-
// nested code imports graph from the repo, which might have innacurate graph version
|
|
12
|
-
jest.mock('nx/src/project-graph/project-graph', () => ({
|
|
13
|
-
...jest.requireActual<any>('nx/src/project-graph/project-graph'),
|
|
14
|
-
createProjectGraphAsync: jest
|
|
15
|
-
.fn()
|
|
16
|
-
.mockImplementation(async () => ({ nodes: {}, dependencies: {} })),
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
describe('react-native:storybook-configuration', () => {
|
|
20
|
-
let appTree;
|
|
21
|
-
|
|
22
|
-
beforeEach(async () => {
|
|
23
|
-
// jest.spyOn(fileUtils, 'readPackageJson').mockReturnValue({
|
|
24
|
-
// devDependencies: {
|
|
25
|
-
// '@storybook/addon-essentials': '*',
|
|
26
|
-
// '@storybook/react-native': '*',
|
|
27
|
-
// '@storybook/addon-ondevice-actions': '*',
|
|
28
|
-
// '@storybook/addon-ondevice-knobs': '*',
|
|
29
|
-
// },
|
|
30
|
-
// });
|
|
31
|
-
|
|
32
|
-
jest.spyOn(logger, 'warn').mockImplementation(() => {});
|
|
33
|
-
jest.spyOn(logger, 'debug').mockImplementation(() => {});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
afterEach(() => {
|
|
37
|
-
jest.restoreAllMocks();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
describe('should generate files for an app', () => {
|
|
41
|
-
it('should configure everything at once', async () => {
|
|
42
|
-
appTree = await createTestUILib('test-ui-lib');
|
|
43
|
-
appTree.write('.gitignore', '');
|
|
44
|
-
await storybookConfigurationGenerator(appTree, {
|
|
45
|
-
name: 'test-ui-lib',
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
expect(
|
|
49
|
-
appTree.exists('libs/test-ui-lib/.storybook/main.js')
|
|
50
|
-
).toBeTruthy();
|
|
51
|
-
expect(
|
|
52
|
-
appTree.exists('libs/test-ui-lib/.storybook/tsconfig.json')
|
|
53
|
-
).toBeTruthy();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should generate stories for components', async () => {
|
|
57
|
-
appTree = await createTestUILib('test-ui-lib');
|
|
58
|
-
await componentGenerator(appTree, {
|
|
59
|
-
name: 'test-ui-lib',
|
|
60
|
-
project: 'test-ui-lib',
|
|
61
|
-
});
|
|
62
|
-
await storybookConfigurationGenerator(appTree, {
|
|
63
|
-
name: 'test-ui-lib',
|
|
64
|
-
generateStories: true,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
expect(
|
|
68
|
-
appTree.exists(
|
|
69
|
-
'libs/test-ui-lib/src/lib/test-ui-lib/test-ui-lib.stories.tsx'
|
|
70
|
-
)
|
|
71
|
-
).toBeTruthy();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
describe('should generate files for lib', () => {
|
|
76
|
-
it('should configure everything at once', async () => {
|
|
77
|
-
appTree = await createTestAppLib('test-ui-app');
|
|
78
|
-
await storybookConfigurationGenerator(appTree, {
|
|
79
|
-
name: 'test-ui-app',
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
expect(
|
|
83
|
-
appTree.exists('apps/test-ui-app/.storybook/main.js')
|
|
84
|
-
).toBeTruthy();
|
|
85
|
-
expect(
|
|
86
|
-
appTree.exists('apps/test-ui-app/.storybook/tsconfig.json')
|
|
87
|
-
).toBeTruthy();
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('should generate stories for components', async () => {
|
|
91
|
-
appTree = await createTestAppLib('test-ui-app');
|
|
92
|
-
await storybookConfigurationGenerator(appTree, {
|
|
93
|
-
name: 'test-ui-app',
|
|
94
|
-
generateStories: true,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// Currently the auto-generate stories feature only picks up components under the 'lib' directory.
|
|
98
|
-
// In our 'createTestAppLib' function, we call @nrwl/react-native:component to generate a component
|
|
99
|
-
// under the specified 'lib' directory
|
|
100
|
-
expect(
|
|
101
|
-
appTree.exists(
|
|
102
|
-
'apps/test-ui-app/src/app/my-component/my-component.stories.tsx'
|
|
103
|
-
)
|
|
104
|
-
).toBeTruthy();
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
export async function createTestUILib(libName: string): Promise<Tree> {
|
|
110
|
-
let appTree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
111
|
-
|
|
112
|
-
await libraryGenerator(appTree, {
|
|
113
|
-
linter: Linter.EsLint,
|
|
114
|
-
skipFormat: true,
|
|
115
|
-
skipTsConfig: false,
|
|
116
|
-
unitTestRunner: 'none',
|
|
117
|
-
name: libName,
|
|
118
|
-
});
|
|
119
|
-
return appTree;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export async function createTestAppLib(
|
|
123
|
-
libName: string,
|
|
124
|
-
plainJS = false
|
|
125
|
-
): Promise<Tree> {
|
|
126
|
-
let appTree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
127
|
-
|
|
128
|
-
await applicationGenerator(appTree, {
|
|
129
|
-
e2eTestRunner: 'none',
|
|
130
|
-
linter: Linter.EsLint,
|
|
131
|
-
skipFormat: false,
|
|
132
|
-
style: 'css',
|
|
133
|
-
unitTestRunner: 'none',
|
|
134
|
-
name: libName,
|
|
135
|
-
js: plainJS,
|
|
136
|
-
install: false,
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
await componentGenerator(appTree, {
|
|
140
|
-
name: 'my-component',
|
|
141
|
-
project: libName,
|
|
142
|
-
directory: 'app',
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
return appTree;
|
|
146
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { configure, getStorybookUI } from '@storybook/react-native';
|
|
2
|
-
|
|
3
|
-
import { loadStories } from '<%= offsetFromRoot %>../.storybook/story-loader';
|
|
4
|
-
|
|
5
|
-
configure(() => loadStories(), module);
|
|
6
|
-
|
|
7
|
-
const StorybookUIRoot = getStorybookUI();
|
|
8
|
-
|
|
9
|
-
export default StorybookUIRoot;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Toggle inspired from https://github.com/infinitered/ignite/blob/master/boilerplate/storybook/toggle-storybook.tsx
|
|
3
|
-
*/
|
|
4
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
5
|
-
import { DevSettings } from 'react-native';
|
|
6
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
7
|
-
|
|
8
|
-
import AppRoot from '../app/App';
|
|
9
|
-
|
|
10
|
-
export const DEFAULT_REACTOTRON_WS_URI = 'ws://localhost:9090';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Loads a string from storage.
|
|
14
|
-
*
|
|
15
|
-
* @param key The key to fetch.
|
|
16
|
-
*/
|
|
17
|
-
async function loadString(key: string): Promise<string | null> {
|
|
18
|
-
try {
|
|
19
|
-
return await AsyncStorage.getItem(key);
|
|
20
|
-
} catch {
|
|
21
|
-
// not sure why this would fail... even reading the RN docs I'm unclear
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Saves a string to storage.
|
|
28
|
-
*
|
|
29
|
-
* @param key The key to fetch.
|
|
30
|
-
* @param value The value to store.
|
|
31
|
-
*/
|
|
32
|
-
async function saveString(key: string, value: string): Promise<boolean> {
|
|
33
|
-
try {
|
|
34
|
-
await AsyncStorage.setItem(key, value);
|
|
35
|
-
return true;
|
|
36
|
-
} catch {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Toggle Storybook mode, in __DEV__ mode only.
|
|
43
|
-
*
|
|
44
|
-
* In non-__DEV__ mode, or when Storybook isn't toggled on,
|
|
45
|
-
* renders its children.
|
|
46
|
-
*
|
|
47
|
-
* The mode flag is persisted in async storage, which means it
|
|
48
|
-
* persists across reloads/restarts - this is handy when developing
|
|
49
|
-
* new components in Storybook.
|
|
50
|
-
*/
|
|
51
|
-
function ToggleStorybook(props) {
|
|
52
|
-
const [showStorybook, setShowStorybook] = useState(false);
|
|
53
|
-
const [StorybookUIRoot, setStorybookUIRoot] = useState(null);
|
|
54
|
-
const ws = useRef(new WebSocket(DEFAULT_REACTOTRON_WS_URI));
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (!__DEV__) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Load the setting from storage if it's there
|
|
62
|
-
loadString('devStorybook').then((storedSetting) => {
|
|
63
|
-
// Set the initial value
|
|
64
|
-
setShowStorybook(storedSetting === 'on');
|
|
65
|
-
|
|
66
|
-
if (DevSettings) {
|
|
67
|
-
// Add our toggle command to the menu
|
|
68
|
-
DevSettings.addMenuItem('Toggle Storybook', () => {
|
|
69
|
-
setShowStorybook((show) => {
|
|
70
|
-
// On toggle, flip the current value
|
|
71
|
-
show = !show;
|
|
72
|
-
|
|
73
|
-
// Write it back to storage
|
|
74
|
-
saveString('devStorybook', show ? 'on' : 'off');
|
|
75
|
-
|
|
76
|
-
// Return it to change the local state
|
|
77
|
-
return show;
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Load the storybook UI once
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
84
|
-
setStorybookUIRoot(() => require('./storybook.ts').default);
|
|
85
|
-
|
|
86
|
-
// Behave as Reactotron.storybookSwitcher(), not a HOC way.
|
|
87
|
-
ws.current.onmessage = (e) => {
|
|
88
|
-
const data = JSON.parse(e.data);
|
|
89
|
-
|
|
90
|
-
if (data.type === 'storybook') {
|
|
91
|
-
saveString('devStorybook', data.payload ? 'on' : 'off');
|
|
92
|
-
setShowStorybook(data.payload);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
ws.current.onerror = (e) => {
|
|
96
|
-
setShowStorybook(storedSetting === 'on');
|
|
97
|
-
};
|
|
98
|
-
});
|
|
99
|
-
}, []);
|
|
100
|
-
|
|
101
|
-
if (showStorybook) {
|
|
102
|
-
return StorybookUIRoot ? <StorybookUIRoot /> : null;
|
|
103
|
-
} else {
|
|
104
|
-
return props.children;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export default () => {
|
|
109
|
-
return (
|
|
110
|
-
<ToggleStorybook>
|
|
111
|
-
<AppRoot />
|
|
112
|
-
</ToggleStorybook>
|
|
113
|
-
);
|
|
114
|
-
};
|