@nx/react-native 17.3.0-beta.5 → 17.3.0-beta.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react-native",
3
- "version": "17.3.0-beta.5",
3
+ "version": "17.3.0-beta.8",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: \n\n-Integration with libraries such as Jest, Detox, and Storybook.\n-Scaffolding for creating buildable libraries that can be published to npm.\n-Utilities for automatic workspace refactoring.",
6
6
  "keywords": [
@@ -32,18 +32,18 @@
32
32
  "ignore": "^5.0.4",
33
33
  "metro-config": "~0.76.8",
34
34
  "metro-resolver": "~0.76.8",
35
- "minimatch": "3.0.5",
35
+ "minimatch": "9.0.3",
36
36
  "node-fetch": "^2.6.7",
37
37
  "tsconfig-paths": "^4.1.2",
38
38
  "tslib": "^2.3.0",
39
- "@nx/detox": "17.3.0-beta.5",
40
- "@nx/devkit": "17.3.0-beta.5",
41
- "@nx/jest": "17.3.0-beta.5",
42
- "@nx/js": "17.3.0-beta.5",
43
- "@nx/eslint": "17.3.0-beta.5",
44
- "@nx/react": "17.3.0-beta.5",
45
- "@nx/workspace": "17.3.0-beta.5",
46
- "@nrwl/react-native": "17.3.0-beta.5"
39
+ "@nx/detox": "17.3.0-beta.8",
40
+ "@nx/devkit": "17.3.0-beta.8",
41
+ "@nx/jest": "17.3.0-beta.8",
42
+ "@nx/js": "17.3.0-beta.8",
43
+ "@nx/eslint": "17.3.0-beta.8",
44
+ "@nx/react": "17.3.0-beta.8",
45
+ "@nx/workspace": "17.3.0-beta.8",
46
+ "@nrwl/react-native": "17.3.0-beta.8"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react-native": ">= 0.72.0 < 0.73.0"
@@ -26,7 +26,7 @@ export function <%= className %>(props: <%= className %>Props) {
26
26
  <Text>Welcome to <%= name %>!</Text>
27
27
  </View>
28
28
  );
29
- };
29
+ }
30
30
  <% } %>
31
31
 
32
32
  export default <%= className %>;
@@ -1,5 +1,5 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
3
  export declare function reactNativeInitGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
4
- export declare function updateDependencies(host: Tree): GeneratorCallback;
4
+ export declare function updateDependencies(host: Tree, schema: Schema): GeneratorCallback;
5
5
  export default reactNativeInitGenerator;
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateDependencies = exports.reactNativeInitGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
6
+ const plugin_1 = require("../../../plugins/plugin");
5
7
  const versions_1 = require("../../utils/versions");
6
8
  const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
7
9
  async function reactNativeInitGenerator(host, schema) {
@@ -12,7 +14,10 @@ async function reactNativeInitGenerator(host, schema) {
12
14
  const tasks = [];
13
15
  if (!schema.skipPackageJson) {
14
16
  tasks.push(moveDependency(host));
15
- tasks.push(updateDependencies(host));
17
+ tasks.push(updateDependencies(host, schema));
18
+ }
19
+ if (schema.updatePackageScripts) {
20
+ await (0, update_package_scripts_1.updatePackageScripts)(host, plugin_1.createNodes);
16
21
  }
17
22
  if (!schema.skipFormat) {
18
23
  await (0, devkit_1.formatFiles)(host);
@@ -20,7 +25,7 @@ async function reactNativeInitGenerator(host, schema) {
20
25
  return (0, devkit_1.runTasksInSerial)(...tasks);
21
26
  }
22
27
  exports.reactNativeInitGenerator = reactNativeInitGenerator;
23
- function updateDependencies(host) {
28
+ function updateDependencies(host, schema) {
24
29
  return (0, devkit_1.addDependenciesToPackageJson)(host, {
25
30
  react: versions_1.reactVersion,
26
31
  'react-dom': versions_1.reactDomVersion,
@@ -30,7 +35,7 @@ function updateDependencies(host) {
30
35
  '@react-native-community/cli': versions_1.reactNativeCommunityCli,
31
36
  '@react-native-community/cli-platform-android': versions_1.reactNativeCommunityCliAndroid,
32
37
  '@react-native-community/cli-platform-ios': versions_1.reactNativeCommunityCliIos,
33
- });
38
+ }, undefined, schema.keepExistingVersions);
34
39
  }
35
40
  exports.updateDependencies = updateDependencies;
36
41
  function moveDependency(host) {
@@ -1,4 +1,6 @@
1
1
  export interface Schema {
2
2
  skipFormat?: boolean;
3
3
  skipPackageJson?: boolean; //default is false
4
+ keepExistingVersions?: boolean; //default is false
5
+ updatePackageScripts?: boolean;
4
6
  }
@@ -17,6 +17,18 @@
17
17
  "type": "boolean",
18
18
  "default": false,
19
19
  "x-priority": "internal"
20
+ },
21
+ "keepExistingVersions": {
22
+ "type": "boolean",
23
+ "x-priority": "internal",
24
+ "description": "Keep existing dependencies versions",
25
+ "default": false
26
+ },
27
+ "updatePackageScripts": {
28
+ "type": "boolean",
29
+ "x-priority": "internal",
30
+ "description": "Update `package.json` scripts with inferred targets",
31
+ "default": false
20
32
  }
21
33
  },
22
34
  "required": []
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
5
5
  const path_1 = require("path");
6
6
  const component_story_1 = require("../component-story/component-story");
7
7
  const stories_1 = require("@nx/react/src/generators/stories/stories");
8
- const minimatch = require("minimatch");
8
+ const minimatch_1 = require("minimatch");
9
9
  const versions_1 = require("../../utils/versions");
10
10
  async function createAllStories(tree, projectName, ignorePaths) {
11
11
  (0, devkit_1.ensurePackage)('@nx/storybook', versions_1.nxVersion);
@@ -16,7 +16,7 @@ async function createAllStories(tree, projectName, ignorePaths) {
16
16
  const projectPath = await (0, stories_1.projectRootPath)(tree, projectConfiguration);
17
17
  let componentPaths = [];
18
18
  (0, devkit_1.visitNotIgnoredFiles)(tree, projectPath, (path) => {
19
- if (ignorePaths?.some((pattern) => minimatch(path, pattern)))
19
+ if (ignorePaths?.some((pattern) => (0, minimatch_1.minimatch)(path, pattern)))
20
20
  return;
21
21
  if ((path.endsWith('.tsx') && !path.endsWith('.spec.tsx')) ||
22
22
  (path.endsWith('.js') && !path.endsWith('.spec.js')) ||
@@ -15,8 +15,8 @@ describe('Add Linting', () => {
15
15
  });
16
16
  });
17
17
 
18
- it('should add update configuration when eslint is passed', () => {
19
- addLinting(tree, {
18
+ it('should add update configuration when eslint is passed', async () => {
19
+ await addLinting(tree, {
20
20
  projectName: 'my-lib',
21
21
  linter: Linter.EsLint,
22
22
  tsConfigPaths: ['libs/my-lib/tsconfig.lib.json'],
@@ -29,7 +29,7 @@ describe('Add Linting', () => {
29
29
  });
30
30
 
31
31
  it('should not add lint target when "none" is passed', async () => {
32
- addLinting(tree, {
32
+ await addLinting(tree, {
33
33
  projectName: 'my-lib',
34
34
  linter: Linter.None,
35
35
  tsConfigPaths: ['libs/my-lib/tsconfig.lib.json'],