@nx/react-native 17.0.4 → 17.0.6
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 +1 -7
- package/LICENSE +1 -1
- package/README.md +4 -9
- package/executors.json +0 -5
- package/generators.json +11 -12
- package/migrations.json +0 -126
- package/package.json +15 -11
- package/plugins/metro-resolver.js +1 -4
- package/plugins/with-nx-metro.js +2 -6
- package/src/executors/build-android/build-android.impl.js +6 -2
- package/src/executors/build-android/build-android.impl.ts +6 -2
- package/src/executors/build-android/schema.json +1 -1
- package/src/executors/build-ios/schema.json +1 -1
- package/src/executors/bundle/schema.d.ts +1 -1
- package/src/executors/bundle/schema.json +1 -1
- package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +0 -4
- package/src/executors/ensure-symlink/ensure-symlink.impl.js +0 -4
- package/src/executors/ensure-symlink/ensure-symlink.impl.ts +0 -4
- package/src/executors/ensure-symlink/schema.json +1 -1
- package/src/executors/pod-install/schema.json +1 -1
- package/src/executors/run-android/run-android.impl.js +17 -5
- package/src/executors/run-android/run-android.impl.ts +18 -9
- package/src/executors/run-android/schema.json +1 -1
- package/src/executors/run-ios/run-ios.impl.js +16 -4
- package/src/executors/run-ios/run-ios.impl.ts +18 -9
- package/src/executors/run-ios/schema.json +1 -1
- package/src/executors/start/schema.d.ts +1 -1
- package/src/executors/start/schema.json +1 -1
- package/src/executors/start/start.impl.js +26 -11
- package/src/executors/start/start.impl.ts +28 -14
- package/src/executors/storybook/storybook.impl.d.ts +0 -4
- package/src/executors/storybook/storybook.impl.js +2 -15
- package/src/executors/storybook/storybook.impl.ts +7 -26
- package/src/executors/sync-deps/schema.d.ts +0 -1
- package/src/executors/sync-deps/schema.json +1 -6
- package/src/executors/sync-deps/sync-deps.impl.d.ts +1 -2
- package/src/executors/sync-deps/sync-deps.impl.js +11 -33
- package/src/executors/sync-deps/sync-deps.impl.ts +18 -57
- package/src/generators/application/application.js +8 -52
- package/src/generators/application/application.spec.ts +2 -29
- package/src/generators/application/files/app/Gemfile.template +1 -2
- package/src/generators/application/files/app/android/app/build.gradle.template +28 -12
- package/src/generators/application/files/app/android/app/src/debug/AndroidManifest.xml.template +6 -2
- package/src/generators/application/files/app/android/app/src/debug/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +75 -0
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.java.template +32 -0
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.java.template +62 -0
- package/src/generators/application/files/app/android/app/src/release/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +20 -0
- package/src/generators/application/files/app/android/build.gradle.template +20 -7
- package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +1 -2
- package/src/generators/application/files/app/android/gradle.properties +3 -0
- package/src/generators/application/files/app/android/gradlew.template +7 -12
- package/src/generators/application/files/app/android/settings.gradle.template +2 -2
- package/src/generators/application/files/app/babel.config.json.template +3 -0
- package/src/generators/application/files/app/ios/Podfile.template +7 -0
- package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +0 -5
- package/src/generators/application/files/app/ios/__className__/Info.plist.template +8 -5
- package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +33 -11
- package/src/generators/application/files/app/metro.config.js.template +5 -1
- package/src/generators/application/files/app/src/app/App.tsx.template +13 -50
- package/src/generators/application/lib/add-detox.d.ts +3 -0
- package/src/generators/application/lib/add-detox.js +23 -0
- package/src/generators/application/lib/add-project.js +18 -18
- package/src/generators/application/lib/normalize-options.d.ts +0 -7
- package/src/generators/application/lib/normalize-options.js +3 -35
- package/src/generators/application/lib/normalize-options.spec.ts +7 -70
- package/src/generators/application/schema.d.ts +3 -5
- package/src/generators/application/schema.json +6 -14
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +1 -1
- package/src/generators/component/schema.d.ts +3 -3
- package/src/generators/component/schema.json +4 -4
- package/src/generators/component-story/component-story.d.ts +8 -5
- package/src/generators/component-story/component-story.js +69 -8
- package/src/generators/component-story/component-story.spec.ts +428 -0
- package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +32 -0
- package/src/generators/component-story/schema.d.ts +0 -1
- package/src/generators/component-story/schema.json +3 -11
- package/src/generators/init/init.d.ts +1 -2
- package/src/generators/init/init.js +56 -55
- package/src/generators/init/init.spec.ts +6 -7
- package/src/generators/init/schema.d.ts +3 -3
- package/src/generators/init/schema.json +18 -13
- package/src/generators/library/files/lib/babel.config.json.template +17 -0
- package/src/generators/library/lib/normalize-options.js +0 -5
- package/src/generators/library/library.js +38 -48
- package/src/generators/library/library.spec.ts +60 -12
- package/src/generators/library/schema.d.ts +0 -1
- package/src/generators/library/schema.json +2 -2
- package/src/generators/stories/schema.d.ts +0 -2
- package/src/generators/stories/schema.json +2 -15
- package/src/generators/stories/stories-app.spec.ts +128 -0
- package/src/generators/stories/stories-lib.spec.ts +105 -0
- package/src/generators/stories/stories.d.ts +2 -5
- package/src/generators/stories/stories.js +50 -7
- package/src/generators/storybook-configuration/configuration.d.ts +2 -7
- package/src/generators/storybook-configuration/configuration.js +48 -18
- package/src/generators/storybook-configuration/configuration.spec.ts +135 -0
- package/src/generators/storybook-configuration/files/app/storybook.ts.template +9 -0
- package/src/generators/storybook-configuration/files/app/toggle-storybook.tsx.template +74 -0
- package/src/generators/storybook-configuration/files/root/story-loader.ts.template +5 -0
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.d.ts +6 -0
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.js +25 -0
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.spec.ts +161 -0
- package/src/generators/storybook-configuration/lib/create-storybook-files.d.ts +6 -0
- package/src/generators/storybook-configuration/lib/create-storybook-files.js +42 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.d.ts +7 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js +29 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.spec.ts +65 -0
- package/src/generators/storybook-configuration/schema.d.ts +2 -4
- package/src/generators/storybook-configuration/schema.json +12 -22
- package/src/generators/upgrade-native/lib/normalize-options.d.ts +1 -1
- package/src/generators/upgrade-native/schema.d.ts +1 -1
- package/src/generators/upgrade-native/schema.json +3 -3
- package/src/generators/upgrade-native/upgrade-native.d.ts +0 -2
- package/src/generators/upgrade-native/upgrade-native.js +0 -3
- package/src/migrations/update-16-6-0/update-metro-config.js +5 -1
- package/src/migrations/update-16-9-0/remove-types-react-native.js +9 -2
- package/src/utils/add-jest.d.ts +1 -1
- package/src/utils/add-jest.js +1 -13
- package/src/utils/add-linting.d.ts +0 -1
- package/src/utils/add-linting.js +1 -1
- package/src/utils/add-linting.spec.ts +6 -4
- package/src/utils/chmod-android-gradle-files.js +2 -6
- package/src/utils/find-all-npm-dependencies.js +3 -5
- package/src/utils/find-all-npm-dependencies.spec.ts +9 -17
- package/src/utils/symlink-task.d.ts +2 -0
- package/src/utils/symlink-task.js +18 -0
- package/src/utils/testing-generators.js +0 -1
- package/src/utils/versions.d.ts +13 -10
- package/src/utils/versions.js +14 -11
- package/plugin.d.ts +0 -1
- package/plugin.js +0 -6
- package/plugins/plugin.d.ts +0 -14
- package/plugins/plugin.js +0 -162
- package/src/executors/upgrade/schema.d.ts +0 -1
- package/src/executors/upgrade/schema.json +0 -11
- package/src/executors/upgrade/upgrade.impl.d.ts +0 -13
- package/src/executors/upgrade/upgrade.impl.js +0 -47
- package/src/executors/upgrade/upgrade.impl.ts +0 -64
- package/src/generators/application/files/app/.babelrc.js.template +0 -23
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.kt.template +0 -22
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +0 -45
- package/src/generators/application/lib/add-e2e.d.ts +0 -3
- package/src/generators/application/lib/add-e2e.js +0 -46
- package/src/generators/library/files/lib/.babelrc.js.template +0 -21
- package/src/generators/web-configuration/files/base-vite/.babelrc.js.template +0 -23
- package/src/generators/web-configuration/files/base-vite/index.html__tmpl__ +0 -15
- 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__ +0 -9
- package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +0 -82
- package/src/generators/web-configuration/files/base-webpack/.babelrc.js.template +0 -23
- 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__ +0 -14
- package/src/generators/web-configuration/files/base-webpack/src/main-web.tsx__tmpl__ +0 -9
- package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +0 -77
- package/src/generators/web-configuration/lib/normalize-schema.d.ts +0 -17
- package/src/generators/web-configuration/lib/normalize-schema.js +0 -16
- package/src/generators/web-configuration/lib/webpack-targets.d.ts +0 -7
- package/src/generators/web-configuration/lib/webpack-targets.js +0 -75
- package/src/generators/web-configuration/schema.d.ts +0 -6
- package/src/generators/web-configuration/schema.json +0 -42
- package/src/generators/web-configuration/web-configuration.d.ts +0 -12
- package/src/generators/web-configuration/web-configuration.js +0 -87
- package/src/migrations/update-18-0-0/add-upgrade-target.d.ts +0 -6
- package/src/migrations/update-18-0-0/add-upgrade-target.js +0 -33
- package/src/migrations/update-18-0-0/add-web-configuration.d.ts +0 -8
- package/src/migrations/update-18-0-0/add-web-configuration.js +0 -33
- package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +0 -39
- package/src/migrations/update-18-0-0/change-storybook-targets.d.ts +0 -5
- package/src/migrations/update-18-0-0/change-storybook-targets.js +0 -57
- package/src/migrations/update-18-0-0/remove-block-list.d.ts +0 -6
- package/src/migrations/update-18-0-0/remove-block-list.js +0 -28
- package/src/migrations/update-18-0-0/remove-block-list.spec.ts +0 -68
- package/src/migrations/update-18-0-0/remove-metro.d.ts +0 -14
- package/src/migrations/update-18-0-0/remove-metro.js +0 -29
- package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +0 -6
- package/src/migrations/update-18-0-0/remove-symlink-target.js +0 -30
- package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +0 -40
- package/src/utils/ensure-dependencies.d.ts +0 -2
- package/src/utils/ensure-dependencies.js +0 -30
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
/**
|
|
5
|
-
* Remove metro-* package since it is no longer explicity required in package.json.
|
|
6
|
-
* react-native has dependency of @react-native/community-cli-plugin
|
|
7
|
-
* @react-native/community-cli-plugin has dependency of metro
|
|
8
|
-
*
|
|
9
|
-
* Also remove @react-native-community/cli-* since it is a dependency of react-native.
|
|
10
|
-
* (excpet reactNativeCommunityCliPlatformAndroidVersion because android files refer it by path)
|
|
11
|
-
*
|
|
12
|
-
* https://react-native-community.github.io/upgrade-helper/?from=0.72.6&to=0.73.1#RnDiffApp-package.json
|
|
13
|
-
* @param tree
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
async function update(tree) {
|
|
17
|
-
(0, devkit_1.removeDependenciesFromPackageJson)(tree, [], [
|
|
18
|
-
'metro',
|
|
19
|
-
'metro-resolver',
|
|
20
|
-
'metro-config',
|
|
21
|
-
'metro-react-native-babel-preset',
|
|
22
|
-
'metro-babel-register',
|
|
23
|
-
'metro-react-native-babel-transformer',
|
|
24
|
-
'@react-native-community/cli',
|
|
25
|
-
'@react-native-community/cli-platform-ios',
|
|
26
|
-
]);
|
|
27
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
28
|
-
}
|
|
29
|
-
exports.default = update;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
const fs_extra_1 = require("fs-extra");
|
|
5
|
-
/**
|
|
6
|
-
* Remove ensure-symlink target.
|
|
7
|
-
* It is going to be supported by react-native version 0.73 by default.
|
|
8
|
-
*/
|
|
9
|
-
async function update(tree) {
|
|
10
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
|
11
|
-
for (const [projectName, config] of projects.entries()) {
|
|
12
|
-
if (config.targets?.['ensure-symlink']?.executor ===
|
|
13
|
-
'@nx/react-native:ensure-symlink') {
|
|
14
|
-
removeTargets(config.targets, 'ensure-symlink');
|
|
15
|
-
(0, devkit_1.updateProjectConfiguration)(tree, projectName, config);
|
|
16
|
-
(0, fs_extra_1.removeSync)(`${config.root}/node_modules`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.default = update;
|
|
21
|
-
function removeTargets(targets, targetNameToRemove) {
|
|
22
|
-
for (const targetName in targets) {
|
|
23
|
-
if (targetName === targetNameToRemove) {
|
|
24
|
-
delete targets[targetName];
|
|
25
|
-
}
|
|
26
|
-
if (targets[targetName]?.dependsOn?.length) {
|
|
27
|
-
targets[targetName].dependsOn = targets[targetName].dependsOn.filter((dependsOn) => dependsOn !== targetNameToRemove);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { addProjectConfiguration, getProjects, Tree } from '@nx/devkit';
|
|
2
|
-
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
3
|
-
import update from './remove-symlink-target';
|
|
4
|
-
|
|
5
|
-
describe('remove-symlink-target', () => {
|
|
6
|
-
let tree: Tree;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
10
|
-
addProjectConfiguration(tree, 'product', {
|
|
11
|
-
root: 'apps/product',
|
|
12
|
-
sourceRoot: 'apps/product/src',
|
|
13
|
-
targets: {
|
|
14
|
-
'ensure-symlink': {
|
|
15
|
-
executor: '@nx/react-native:ensure-symlink',
|
|
16
|
-
options: {},
|
|
17
|
-
},
|
|
18
|
-
'bundle-android': {
|
|
19
|
-
executor: '@nx/react-native:bundle',
|
|
20
|
-
dependsOn: ['ensure-symlink'],
|
|
21
|
-
outputs: ['{options.bundleOutput}'],
|
|
22
|
-
options: {
|
|
23
|
-
entryFile: 'src/main.tsx',
|
|
24
|
-
platform: 'android',
|
|
25
|
-
bundleOutput: 'dist/apps/techy-jokes/android/main.jsbundle',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it(`should remove ensure-symlink target from project.json`, async () => {
|
|
33
|
-
await update(tree);
|
|
34
|
-
|
|
35
|
-
getProjects(tree).forEach((project) => {
|
|
36
|
-
expect(project.targets['ensure-symlink']).toBeUndefined();
|
|
37
|
-
expect(project.targets['bundle-android'].dependsOn).toEqual([]);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureDependencies = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const versions_1 = require("@nx/react/src/utils/versions");
|
|
6
|
-
const versions_2 = require("./versions");
|
|
7
|
-
function ensureDependencies(tree) {
|
|
8
|
-
const isPnpm = (0, devkit_1.detectPackageManager)(tree.root) === 'pnpm';
|
|
9
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
10
|
-
'@types/node': versions_2.typesNodeVersion,
|
|
11
|
-
'@types/react': versions_2.typesReactVersion,
|
|
12
|
-
'@react-native/babel-preset': versions_2.reactNativeBabelPresetVersion,
|
|
13
|
-
'@react-native/metro-config': versions_2.reactNativeMetroConfigVersion,
|
|
14
|
-
'@testing-library/react-native': versions_2.testingLibraryReactNativeVersion,
|
|
15
|
-
'@testing-library/jest-native': versions_2.testingLibraryJestNativeVersion,
|
|
16
|
-
'@react-native-community/cli-platform-android': versions_2.reactNativeCommunityCliPlatformAndroidVersion,
|
|
17
|
-
'jest-react-native': versions_2.jestReactNativeVersion,
|
|
18
|
-
'react-test-renderer': versions_2.reactTestRendererVersion,
|
|
19
|
-
'react-native-svg-transformer': versions_2.reactNativeSvgTransformerVersion,
|
|
20
|
-
'react-native-svg': versions_2.reactNativeSvgVersion,
|
|
21
|
-
'@babel/preset-react': versions_1.babelPresetReactVersion,
|
|
22
|
-
'@babel/core': versions_1.babelCoreVersion,
|
|
23
|
-
...(isPnpm
|
|
24
|
-
? {
|
|
25
|
-
'@babel/runtime': versions_2.babelRuntimeVersion, // @babel/runtime is used by react-native-svg
|
|
26
|
-
}
|
|
27
|
-
: {}),
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
exports.ensureDependencies = ensureDependencies;
|