@nrwl/react-native 14.5.3 → 14.5.5

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/migrations.json +6 -0
  3. package/package.json +10 -9
  4. package/src/executors/storybook/storybook.impl.js +6 -1
  5. package/src/executors/storybook/storybook.impl.js.map +1 -1
  6. package/src/executors/storybook/storybook.impl.ts +6 -6
  7. package/src/executors/sync-deps/schema.d.ts +2 -1
  8. package/src/executors/sync-deps/schema.json +14 -2
  9. package/src/executors/sync-deps/sync-deps.impl.d.ts +1 -1
  10. package/src/executors/sync-deps/sync-deps.impl.js +14 -9
  11. package/src/executors/sync-deps/sync-deps.impl.js.map +1 -1
  12. package/src/executors/sync-deps/sync-deps.impl.ts +18 -8
  13. package/src/generators/application/application.spec.ts +2 -2
  14. package/src/generators/application/lib/nomalize-options.spec.ts +2 -2
  15. package/src/generators/component/component.spec.ts +2 -2
  16. package/src/generators/component-story/component-story.spec.ts +2 -2
  17. package/src/generators/init/init.spec.ts +2 -2
  18. package/src/generators/library/library.spec.ts +2 -2
  19. package/src/generators/stories/schema.d.ts +1 -0
  20. package/src/generators/stories/schema.json +15 -0
  21. package/src/generators/stories/stories-app.spec.ts +80 -2
  22. package/src/generators/stories/stories-lib.spec.ts +28 -2
  23. package/src/generators/stories/stories.d.ts +1 -1
  24. package/src/generators/stories/stories.js +6 -3
  25. package/src/generators/stories/stories.js.map +1 -1
  26. package/src/generators/storybook-configuration/configuration.js +1 -0
  27. package/src/generators/storybook-configuration/configuration.js.map +1 -1
  28. package/src/generators/storybook-configuration/configuration.spec.ts +3 -3
  29. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.spec.ts +2 -2
  30. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.spec.ts +2 -2
  31. package/src/generators/storybook-configuration/schema.d.ts +1 -0
  32. package/src/generators/storybook-configuration/schema.json +15 -0
  33. package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.spec.ts +2 -2
  34. package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.spec.ts +2 -2
  35. package/src/migrations/update-13-5-0/update-react-native-typing-svg-13-5-0.spec.ts +2 -2
  36. package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.spec.ts +2 -2
  37. package/src/migrations/update-14-0-0/update-entry-file-bundle-14-0-0.spec.ts +2 -2
  38. package/src/migrations/update-14-0-2/change-main-to-class-name-14-0-2.spec.ts +2 -2
  39. package/src/migrations/update-14-2-1/rename-blockList-metro-config.spec.ts +2 -2
  40. package/src/migrations/update-14-5-5/add-exclude-sync-deps.d.ts +5 -0
  41. package/src/migrations/update-14-5-5/add-exclude-sync-deps.js +26 -0
  42. package/src/migrations/update-14-5-5/add-exclude-sync-deps.js.map +1 -0
  43. package/src/migrations/update-14-5-5/add-exclude-sync-deps.spec.ts +36 -0
  44. package/src/utils/add-linting.spec.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [14.5.3](https://github.com/nrwl/nx/compare/14.5.2...14.5.3) (2022-08-04)
6
+ ## [14.5.5](https://github.com/nrwl/nx/compare/14.5.4...14.5.5) (2022-08-12)
7
7
 
8
8
  **Note:** Version bump only for package @nrwl/react-native
package/migrations.json CHANGED
@@ -47,6 +47,12 @@
47
47
  "cli": "nx",
48
48
  "description": "Rename blacklistRE to blockList in metro.config.js",
49
49
  "factory": "./src/migrations/update-14-2-1/rename-blockList-metro-config"
50
+ },
51
+ "add-exclude-sync-deps-14-5-5": {
52
+ "version": "14.5.5-beta.0",
53
+ "cli": "nx",
54
+ "description": "Change include field from string to array for sync-deps target",
55
+ "factory": "./src/migrations/update-14-5-5/add-exclude-sync-deps"
50
56
  }
51
57
  },
52
58
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/react-native",
3
- "version": "14.5.3",
3
+ "version": "14.5.5",
4
4
  "description": "React Native brings React's declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access to the native platform.\n\nThe Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Detox, and Storybook.\n\n- Scaffolding for creating buildable libraries that can be published to npm.\n\n- Utilities for automatic workspace refactoring.",
5
5
  "keywords": [
6
6
  "Monorepo",
@@ -24,18 +24,19 @@
24
24
  "main": "index.js",
25
25
  "types": "index.d.ts",
26
26
  "dependencies": {
27
- "@nrwl/detox": "14.5.3",
28
- "@nrwl/devkit": "14.5.3",
29
- "@nrwl/jest": "14.5.3",
30
- "@nrwl/linter": "14.5.3",
31
- "@nrwl/react": "14.5.3",
32
- "@nrwl/storybook": "14.5.3",
33
- "@nrwl/workspace": "14.5.3",
27
+ "@nrwl/detox": "14.5.5",
28
+ "@nrwl/devkit": "14.5.5",
29
+ "@nrwl/jest": "14.5.5",
30
+ "@nrwl/linter": "14.5.5",
31
+ "@nrwl/react": "14.5.5",
32
+ "@nrwl/storybook": "14.5.5",
33
+ "@nrwl/workspace": "14.5.5",
34
34
  "chalk": "^4.1.0",
35
35
  "enhanced-resolve": "^5.8.3",
36
36
  "fs-extra": "^10.1.0",
37
37
  "ignore": "^5.0.4",
38
38
  "metro-resolver": "^0.71.3",
39
+ "minimatch": "3.0.5",
39
40
  "node-fetch": "^2.6.7",
40
41
  "tsconfig-paths": "^3.9.0"
41
42
  },
@@ -49,5 +50,5 @@
49
50
  },
50
51
  "schematics": "./generators.json",
51
52
  "typings": "./index.d.ts",
52
- "gitHead": "72106d0d81ff66f92d4cbb0459dd70cbe1c7aefa"
53
+ "gitHead": "d9ebe0870de2bd309af1d790d57a2f66583c5839"
53
54
  }
@@ -15,7 +15,12 @@ function reactNatievStorybookExecutor(options, context) {
15
15
  // add storybook addons to app's package.json
16
16
  const packageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
17
17
  if ((0, fileutils_1.fileExists)(packageJsonPath))
18
- (0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, yield tslib_1.__await((0, sync_deps_impl_1.syncDeps)(context.projectName, projectRoot, context.root, '@storybook/addon-ondevice-actions,@storybook/addon-ondevice-backgrounds,@storybook/addon-ondevice-controls,@storybook/addon-ondevice-notes')));
18
+ (0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, yield tslib_1.__await((0, sync_deps_impl_1.syncDeps)(context.projectName, projectRoot, context.root, [
19
+ '@storybook/addon-ondevice-actions',
20
+ '@storybook/addon-ondevice-backgrounds',
21
+ '@storybook/addon-ondevice-controls',
22
+ '@storybook/addon-ondevice-notes',
23
+ ])));
19
24
  try {
20
25
  yield tslib_1.__await(runCliStorybook(context.root, projectRoot, options));
21
26
  yield yield tslib_1.__await({ success: true });
@@ -1 +1 @@
1
- {"version":3,"file":"storybook.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/storybook/storybook.impl.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,yCAAuD;AACvD,uEAAqE;AACrE,+BAA+B;AAG/B,iDAAmD;AACnD,gEAGqC;AAErC,IAAI,YAA0B,CAAC;AAE/B,SAA+B,4BAA4B,CACzD,OAAoC,EACpC,OAAwB;;QAExB,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;QACzE,eAAM,CAAC,IAAI,CACT,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAChB,MAAM,CACP,8IAA8I,CAChJ,CAAC;QAEF,6CAA6C;QAC7C,MAAM,eAAe,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QACxE,IAAI,IAAA,sBAAU,EAAC,eAAe,CAAC;YAC7B,IAAA,6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;aACd;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,OAAO;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QAC5C,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,OAAO,CAAC,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,KAAK,IAAI,EAAE;gBACd,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aACpB;SACF;aAAM;YACL,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;SAChC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
1
+ {"version":3,"file":"storybook.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/storybook/storybook.impl.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,yCAAuD;AACvD,uEAAqE;AACrE,+BAA+B;AAG/B,iDAAmD;AACnD,gEAGqC;AAErC,IAAI,YAA0B,CAAC;AAE/B,SAA+B,4BAA4B,CACzD,OAAoC,EACpC,OAAwB;;QAExB,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;QACzE,eAAM,CAAC,IAAI,CACT,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAChB,MAAM,CACP,8IAA8I,CAChJ,CAAC;QAEF,6CAA6C;QAC7C,MAAM,eAAe,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QACxE,IAAI,IAAA,sBAAU,EAAC,eAAe,CAAC;YAC7B,IAAA,6CAA4B,EAC1B,OAA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;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,CAAC;aACd;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,OAAO;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QAC5C,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACrB,IAAI,OAAO,CAAC,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,KAAK,IAAI,EAAE;gBACd,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aACpB;SACF;aAAM;YACL,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;SAChC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
@@ -28,12 +28,12 @@ export default async function* reactNatievStorybookExecutor(
28
28
  if (fileExists(packageJsonPath))
29
29
  displayNewlyAddedDepsMessage(
30
30
  context.projectName,
31
- await syncDeps(
32
- context.projectName,
33
- projectRoot,
34
- context.root,
35
- '@storybook/addon-ondevice-actions,@storybook/addon-ondevice-backgrounds,@storybook/addon-ondevice-controls,@storybook/addon-ondevice-notes'
36
- )
31
+ await syncDeps(context.projectName, projectRoot, context.root, [
32
+ '@storybook/addon-ondevice-actions',
33
+ '@storybook/addon-ondevice-backgrounds',
34
+ '@storybook/addon-ondevice-controls',
35
+ '@storybook/addon-ondevice-notes',
36
+ ])
37
37
  );
38
38
 
39
39
  try {
@@ -1,3 +1,4 @@
1
1
  export interface ReactNativeSyncDepsOptions {
2
- include: string;
2
+ include: string[] | string; // default is an empty array []
3
+ exclude: string[] | string; // default is an empty array []
3
4
  }
@@ -7,8 +7,20 @@
7
7
  "type": "object",
8
8
  "properties": {
9
9
  "include": {
10
- "type": "string",
11
- "description": "A comma-separated list of additional npm packages to include. e.g. `nx sync-deps --include=react-native-gesture-handler,react-native-safe-area-context`"
10
+ "type": "array",
11
+ "items": {
12
+ "type": "string"
13
+ },
14
+ "default": [],
15
+ "description": "An array of additional npm packages to include."
16
+ },
17
+ "exclude": {
18
+ "type": "array",
19
+ "items": {
20
+ "type": "string"
21
+ },
22
+ "default": [],
23
+ "description": "An array of npm packages to exclude."
12
24
  }
13
25
  }
14
26
  }
@@ -4,5 +4,5 @@ export interface ReactNativeSyncDepsOutput {
4
4
  success: boolean;
5
5
  }
6
6
  export default function syncDepsExecutor(options: ReactNativeSyncDepsOptions, context: ExecutorContext): AsyncGenerator<ReactNativeSyncDepsOutput>;
7
- export declare function syncDeps(projectName: string, projectRoot: string, workspaceRoot: string, include?: string): Promise<string[]>;
7
+ export declare function syncDeps(projectName: string, projectRoot: string, workspaceRoot: string, include?: string[], exclude?: string[]): Promise<string[]>;
8
8
  export declare function displayNewlyAddedDepsMessage(projectName: string, deps: string[]): void;
@@ -3,33 +3,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.displayNewlyAddedDepsMessage = exports.syncDeps = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path_1 = require("path");
6
- const find_all_npm_dependencies_1 = require("../../utils/find-all-npm-dependencies");
7
6
  const chalk = require("chalk");
8
7
  const devkit_1 = require("@nrwl/devkit");
9
- const devkit_2 = require("@nrwl/devkit");
8
+ const find_all_npm_dependencies_1 = require("../../utils/find-all-npm-dependencies");
10
9
  function syncDepsExecutor(options, context) {
11
10
  return tslib_1.__asyncGenerator(this, arguments, function* syncDepsExecutor_1() {
12
11
  const projectRoot = context.workspace.projects[context.projectName].root;
13
- displayNewlyAddedDepsMessage(context.projectName, yield tslib_1.__await(syncDeps(context.projectName, projectRoot, context.root, options.include)));
12
+ displayNewlyAddedDepsMessage(context.projectName, yield tslib_1.__await(syncDeps(context.projectName, projectRoot, context.root, typeof options.include === 'string'
13
+ ? options.include.split(',')
14
+ : options.include, typeof options.exclude === 'string'
15
+ ? options.exclude.split(',')
16
+ : options.exclude)));
14
17
  yield yield tslib_1.__await({ success: true });
15
18
  });
16
19
  }
17
20
  exports.default = syncDepsExecutor;
18
- function syncDeps(projectName, projectRoot, workspaceRoot, include) {
21
+ function syncDeps(projectName, projectRoot, workspaceRoot, include = [], exclude = []) {
19
22
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
- const graph = yield (0, devkit_2.createProjectGraphAsync)();
21
- const npmDeps = (0, find_all_npm_dependencies_1.findAllNpmDependencies)(graph, projectName);
23
+ const graph = yield (0, devkit_1.createProjectGraphAsync)();
24
+ let npmDeps = (0, find_all_npm_dependencies_1.findAllNpmDependencies)(graph, projectName);
22
25
  const packageJsonPath = (0, path_1.join)(workspaceRoot, projectRoot, 'package.json');
23
26
  const packageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
24
27
  const newDeps = [];
25
- const includeDeps = include === null || include === void 0 ? void 0 : include.split(',');
26
28
  let updated = false;
27
29
  if (!packageJson.dependencies) {
28
30
  packageJson.dependencies = {};
29
31
  updated = true;
30
32
  }
31
- if (includeDeps) {
32
- npmDeps.push(...includeDeps);
33
+ if (include && include.length) {
34
+ npmDeps.push(...include);
35
+ }
36
+ if (exclude && exclude.length) {
37
+ npmDeps = npmDeps.filter((dep) => !exclude.includes(dep));
33
38
  }
34
39
  npmDeps.forEach((dep) => {
35
40
  if (!packageJson.dependencies[dep]) {
@@ -1 +1 @@
1
- {"version":3,"file":"sync-deps.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/sync-deps/sync-deps.impl.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,qFAA+E;AAC/E,+BAA+B;AAC/B,yCAKsB;AAEtB,yCAAuD;AAMvD,SAA+B,gBAAgB,CAC7C,OAAmC,EACnC,OAAwB;;QAExB,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW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BAClB,OAAO,GAAG,IAAI,CAAC;aAChB;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,EAAE;YACX,IAAA,sBAAa,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;SAC7C;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AApCD,4BAoCC;AAED,SAAgB,4BAA4B,CAC1C,WAAmB,EACnB,IAAc;IAEd,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QACnB,eAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAC5B,MAAM,CACP,yCAAyC,WAAW;IACrD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;KACjE;SAAM;QACL,eAAM,CAAC,IAAI,CACT,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAChB,MAAM,CACP,sBAAsB,WAAW,oCAAoC,CACvE,CAAC;KACH;AACH,CAAC;AAhBD,oEAgBC"}
1
+ {"version":3,"file":"sync-deps.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/sync-deps/sync-deps.impl.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,+BAA+B;AAC/B,yCAMsB;AAEtB,qFAA+E;AAQ/E,SAA+B,gBAAgB,CAC7C,OAAmC,EACnC,OAAwB;;QAExB,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;QACzE,4BAA4B,CAC1B,OAAO,CAAC,WAAW,EACnB,sBAAM,QAAQ,CACZ,OAAO,CAAC,WAAW,EACnB,WAAW,EACX,OAAO,CAAC,IAAI,EACZ,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ;YACjC,CAAC,CA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OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACtB,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;gBAClC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;gBACpC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAClB,OAAO,GAAG,IAAI,CAAC;aAChB;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,EAAE;YACX,IAAA,sBAAa,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;SAC7C;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CAAA;AAvCD,4BAuCC;AAED,SAAgB,4BAA4B,CAC1C,WAAmB,EACnB,IAAc;IAEd,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QACnB,eAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAC5B,MAAM,CACP,yCAAyC,WAAW;IACrD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;KACjE;SAAM;QACL,eAAM,CAAC,IAAI,CACT,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAChB,MAAM,CACP,sBAAsB,WAAW,oCAAoC,CACvE,CAAC;KACH;AACH,CAAC;AAhBD,oEAgBC"}
@@ -1,14 +1,16 @@
1
1
  import { join } from 'path';
2
- import { findAllNpmDependencies } from '../../utils/find-all-npm-dependencies';
3
2
  import * as chalk from 'chalk';
4
3
  import {
5
4
  ExecutorContext,
6
5
  logger,
7
6
  readJsonFile,
8
7
  writeJsonFile,
8
+ createProjectGraphAsync,
9
9
  } from '@nrwl/devkit';
10
+
11
+ import { findAllNpmDependencies } from '../../utils/find-all-npm-dependencies';
12
+
10
13
  import { ReactNativeSyncDepsOptions } from './schema';
11
- import { createProjectGraphAsync } from '@nrwl/devkit';
12
14
 
13
15
  export interface ReactNativeSyncDepsOutput {
14
16
  success: boolean;
@@ -25,7 +27,12 @@ export default async function* syncDepsExecutor(
25
27
  context.projectName,
26
28
  projectRoot,
27
29
  context.root,
28
- options.include
30
+ typeof options.include === 'string'
31
+ ? options.include.split(',')
32
+ : options.include,
33
+ typeof options.exclude === 'string'
34
+ ? options.exclude.split(',')
35
+ : options.exclude
29
36
  )
30
37
  );
31
38
 
@@ -36,14 +43,14 @@ export async function syncDeps(
36
43
  projectName: string,
37
44
  projectRoot: string,
38
45
  workspaceRoot: string,
39
- include?: string
46
+ include: string[] = [],
47
+ exclude: string[] = []
40
48
  ): Promise<string[]> {
41
49
  const graph = await createProjectGraphAsync();
42
- const npmDeps = findAllNpmDependencies(graph, projectName);
50
+ let npmDeps = findAllNpmDependencies(graph, projectName);
43
51
  const packageJsonPath = join(workspaceRoot, projectRoot, 'package.json');
44
52
  const packageJson = readJsonFile(packageJsonPath);
45
53
  const newDeps = [];
46
- const includeDeps = include?.split(',');
47
54
  let updated = false;
48
55
 
49
56
  if (!packageJson.dependencies) {
@@ -51,8 +58,11 @@ export async function syncDeps(
51
58
  updated = true;
52
59
  }
53
60
 
54
- if (includeDeps) {
55
- npmDeps.push(...includeDeps);
61
+ if (include && include.length) {
62
+ npmDeps.push(...include);
63
+ }
64
+ if (exclude && exclude.length) {
65
+ npmDeps = npmDeps.filter((dep) => !exclude.includes(dep));
56
66
  }
57
67
 
58
68
  npmDeps.forEach((dep) => {
@@ -4,7 +4,7 @@ import {
4
4
  getProjects,
5
5
  readJson,
6
6
  } from '@nrwl/devkit';
7
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
7
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
8
8
  import { Linter } from '@nrwl/linter';
9
9
  import { reactNativeApplicationGenerator } from './application';
10
10
 
@@ -12,7 +12,7 @@ describe('app', () => {
12
12
  let appTree: Tree;
13
13
 
14
14
  beforeEach(() => {
15
- appTree = createTreeWithEmptyWorkspace();
15
+ appTree = createTreeWithEmptyV1Workspace();
16
16
  appTree.write('.gitignore', '');
17
17
  });
18
18
 
@@ -1,5 +1,5 @@
1
1
  import { Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
  import { Linter } from '@nrwl/linter';
4
4
  import { Schema } from '../schema';
5
5
  import { normalizeOptions } from './normalize-options';
@@ -8,7 +8,7 @@ describe('Normalize Options', () => {
8
8
  let appTree: Tree;
9
9
 
10
10
  beforeEach(() => {
11
- appTree = createTreeWithEmptyWorkspace();
11
+ appTree = createTreeWithEmptyV1Workspace();
12
12
  });
13
13
 
14
14
  it('should normalize options with name in kebab case', () => {
@@ -1,5 +1,5 @@
1
1
  import { logger, Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
  import { createApp, createLib } from '../../utils/testing-generators';
4
4
  import { reactNativeComponentGenerator } from './component';
5
5
 
@@ -9,7 +9,7 @@ describe('component', () => {
9
9
 
10
10
  beforeEach(async () => {
11
11
  projectName = 'my-lib';
12
- appTree = createTreeWithEmptyWorkspace();
12
+ appTree = createTreeWithEmptyV1Workspace();
13
13
  appTree.write('.gitignore', '');
14
14
  await createApp(appTree, 'my-app');
15
15
  await createLib(appTree, projectName);
@@ -1,5 +1,5 @@
1
1
  import { getProjects, Tree, updateProjectConfiguration } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
  import componentStoryGenerator from './component-story';
4
4
  import { Linter } from '@nrwl/linter';
5
5
 
@@ -408,7 +408,7 @@ export async function createTestUILib(
408
408
  libName: string,
409
409
  useEsLint = false
410
410
  ): Promise<Tree> {
411
- let appTree = createTreeWithEmptyWorkspace();
411
+ let appTree = createTreeWithEmptyV1Workspace();
412
412
  appTree.write('.gitignore', '');
413
413
 
414
414
  await libraryGenerator(appTree, {
@@ -1,13 +1,13 @@
1
1
  import { logger } from '@nrwl/devkit';
2
2
  import { Tree, readJson, updateJson } from '@nrwl/devkit';
3
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
3
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
4
4
  import { reactNativeInitGenerator } from './init';
5
5
 
6
6
  describe('init', () => {
7
7
  let tree: Tree;
8
8
 
9
9
  beforeEach(() => {
10
- tree = createTreeWithEmptyWorkspace();
10
+ tree = createTreeWithEmptyV1Workspace();
11
11
  tree.write('.gitignore', '');
12
12
  });
13
13
 
@@ -1,5 +1,5 @@
1
1
  import { getProjects, readJson, Tree, updateJson } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
  import libraryGenerator from './library';
4
4
  import { Linter } from '@nrwl/linter';
5
5
  import { Schema } from './schema';
@@ -17,7 +17,7 @@ describe('lib', () => {
17
17
  };
18
18
 
19
19
  beforeEach(() => {
20
- appTree = createTreeWithEmptyWorkspace();
20
+ appTree = createTreeWithEmptyV1Workspace();
21
21
  appTree.write('.gitignore', '');
22
22
  });
23
23
 
@@ -1,3 +1,4 @@
1
1
  export interface StorybookStoriesSchema {
2
2
  project: string;
3
+ ignorePaths?: string[];
3
4
  }
@@ -15,6 +15,21 @@
15
15
  "index": 0
16
16
  },
17
17
  "x-prompt": "For which project do you want to generate stories?"
18
+ },
19
+ "ignorePaths": {
20
+ "type": "array",
21
+ "description": "Paths to ignore when looking for components.",
22
+ "items": {
23
+ "type": "string",
24
+ "description": "Path to ignore."
25
+ },
26
+ "examples": [
27
+ "apps/my-app/src/not-stories/**",
28
+ "**/**/src/**/not-stories/**",
29
+ "libs/my-lib/**/*.something.ts",
30
+ "**/**/src/**/*.other.*",
31
+ "libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
32
+ ]
18
33
  }
19
34
  },
20
35
  "required": ["project"]
@@ -1,6 +1,6 @@
1
1
  import { Tree } from '@nrwl/devkit';
2
2
  import storiesGenerator from './stories';
3
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
3
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
4
4
  import applicationGenerator from '../application/application';
5
5
  import { Linter } from '@nrwl/linter';
6
6
  import { reactNativeComponentGenerator } from '../component/component';
@@ -32,6 +32,84 @@ describe('react:stories for applications', () => {
32
32
  ).toBeTruthy();
33
33
  });
34
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
+
35
113
  it('should ignore files that do not contain components', async () => {
36
114
  // create another component
37
115
  appTree.write(
@@ -52,7 +130,7 @@ describe('react:stories for applications', () => {
52
130
  });
53
131
 
54
132
  export async function createTestUIApp(libName: string): Promise<Tree> {
55
- let appTree = createTreeWithEmptyWorkspace();
133
+ let appTree = createTreeWithEmptyV1Workspace();
56
134
  appTree.write('.gitignore', '');
57
135
 
58
136
  await applicationGenerator(appTree, {
@@ -1,6 +1,6 @@
1
1
  import { Tree } from '@nrwl/devkit';
2
2
  import storiesGenerator from './stories';
3
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
3
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
4
4
  import applicationGenerator from '../application/application';
5
5
  import { Linter } from '@nrwl/linter';
6
6
  import libraryGenerator from '../library/library';
@@ -38,6 +38,32 @@ describe('react-native:stories for libraries', () => {
38
38
  ).toBeTruthy();
39
39
  });
40
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
+
41
67
  it('should ignore files that do not contain components', async () => {
42
68
  await reactNativeComponentGenerator(appTree, {
43
69
  name: 'test-ui-lib',
@@ -64,7 +90,7 @@ describe('react-native:stories for libraries', () => {
64
90
  });
65
91
 
66
92
  export async function createTestUILib(libName: string): Promise<Tree> {
67
- let appTree = createTreeWithEmptyWorkspace();
93
+ let appTree = createTreeWithEmptyV1Workspace();
68
94
  appTree.write('.gitignore', '');
69
95
 
70
96
  await libraryGenerator(appTree, {
@@ -1,6 +1,6 @@
1
1
  import { Tree } from '@nrwl/devkit';
2
2
  import { StorybookStoriesSchema } from './schema';
3
- export declare function createAllStories(tree: Tree, projectName: string): Promise<void>;
3
+ export declare function createAllStories(tree: Tree, projectName: string, ignorePaths?: string[]): Promise<void>;
4
4
  export declare function storiesGenerator(host: Tree, schema: StorybookStoriesSchema): Promise<void>;
5
5
  export default storiesGenerator;
6
6
  export declare const storiesSchematic: (generatorOptions: StorybookStoriesSchema) => (tree: any, context: any) => Promise<any>;
@@ -7,14 +7,17 @@ const path_1 = require("path");
7
7
  const component_story_1 = require("../component-story/component-story");
8
8
  const stories_1 = require("@nrwl/react/src/generators/stories/stories");
9
9
  const utilities_1 = require("@nrwl/storybook/src/utils/utilities");
10
- function createAllStories(tree, projectName) {
10
+ const minimatch = require("minimatch");
11
+ function createAllStories(tree, projectName, ignorePaths) {
11
12
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
13
  const projects = (0, devkit_1.getProjects)(tree);
13
14
  const projectConfiguration = projects.get(projectName);
14
- const { sourceRoot } = projectConfiguration;
15
+ const { sourceRoot, root } = projectConfiguration;
15
16
  const projectPath = (0, stories_1.projectRootPath)(projectConfiguration);
16
17
  let componentPaths = [];
17
18
  (0, devkit_1.visitNotIgnoredFiles)(tree, projectPath, (path) => {
19
+ if (ignorePaths === null || ignorePaths === void 0 ? void 0 : ignorePaths.some((pattern) => minimatch(path, pattern)))
20
+ return;
18
21
  if ((path.endsWith('.tsx') && !path.endsWith('.spec.tsx')) ||
19
22
  (path.endsWith('.js') && !path.endsWith('.spec.js')) ||
20
23
  (path.endsWith('.jsx') && !path.endsWith('.spec.jsx'))) {
@@ -45,7 +48,7 @@ function createAllStories(tree, projectName) {
45
48
  exports.createAllStories = createAllStories;
46
49
  function storiesGenerator(host, schema) {
47
50
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
- yield createAllStories(host, schema.project);
51
+ yield createAllStories(host, schema.project, schema.ignorePaths);
49
52
  });
50
53
  }
51
54
  exports.storiesGenerator = storiesGenerator;
@@ -1 +1 @@
1
- {"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/generators/stories/stories.ts"],"names":[],"mappings":";;;;AAAA,yCAKsB;AACtB,+BAA4B;AAE5B,wEAAyE;AAEzE,wEAGoD;AACpD,mEAAsE;AAEtE,SAAsB,gBAAgB,CAAC,IAAU,EAAE,WAAmB;;QAC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Aa,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;aACrB,CAAC,CAAC;QACL,CAAC,CAAA,CAAC,CACH,CAAC;IACJ,CAAC;CAAA;AA1CD,4CA0CC;AAED,SAAsB,gBAAgB,CACpC,IAAU,EACV,MAA8B;;QAE9B,MAAM,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;CAAA;AALD,4CAKC;AAED,kBAAe,gBAAgB,CAAC;AACnB,QAAA,gBAAgB,GAAG,IAAA,2BAAkB,EAAC,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/generators/stories/stories.ts"],"names":[],"mappings":";;;;AAAA,yCAKsB;AACtB,+BAA4B;AAC5B,wEAAyE;AAEzE,wEAGoD;AACpD,mEAAsE;AACtE,uCAAwC;AAExC,SAAsB,gBAAgB,CACpC,IAAU,EACV,WAAmB,EACnB,WAAsB;;QAEtB,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,IAAI,EAAE,GAAG,oBAAoB,CAAC;QAClD,MAAM,WAAW,GAAG,IAAA,yBAAe,EAAC,oBAAoB,CAAC,CAAC;QAE1D,IAAI,cAAc,GAAa,EAAE,CAAC;QAClC,IAAA,6BAAoB,EAAC,IAAI,EAAE,WAAW,EAAE,CAAC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EAAE;gBACtD,OAAO;aACR;YAED,MAAM,IAAA,yBAAuB,EAAC,IAAI,EAAE;gBAClC,aAAa,EAAE,cAAc;gBAC7B,OAAO,EAAE,WAAW;aACrB,CAAC,CAAC;QACL,CAAC,CAAA,CAAC,CACH,CAAC;IACJ,CAAC;CAAA;AAhDD,4CAgDC;AAED,SAAsB,gBAAgB,CACpC,IAAU,EACV,MAA8B;;QAE9B,MAAM,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACnE,CAAC;CAAA;AALD,4CAKC;AAED,kBAAe,gBAAgB,CAAC;AACnB,QAAA,gBAAgB,GAAG,IAAA,2BAAkB,EAAC,gBAAgB,CAAC,CAAC"}
@@ -12,6 +12,7 @@ function generateStories(host, schema) {
12
12
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
13
  yield (0, stories_1.default)(host, {
14
14
  project: schema.name,
15
+ ignorePaths: schema.ignorePaths,
15
16
  });
16
17
  });
17
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/generators/storybook-configuration/configuration.ts"],"names":[],"mappings":";;;;AAAA,yCAOsB;AACtB,+CAAyD;AAEzD,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;SACrB,CAAC,CAAC;IACL,CAAC;CAAA;AAED,SAAsB,+BAA+B,CACnD,IAAU,EACV,MAAgC;;QAEhC,MAAM,WAAW,GAAG,MAAM,IAAA,kCAAsB,EAAC,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;SACxC,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;AAzBD,0EAyBC;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,aAAa,CAAC,IAAI;YAC7B,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
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/generators/storybook-configuration/configuration.ts"],"names":[],"mappings":";;;;AAAA,yCAOsB;AACtB,+CAAyD;AAEzD,gDAAkD;AAClD,6GA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E;YACP,SAAS,EAAE,aAAa,CAAC,IAAI;YAC7B,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,5 +1,5 @@
1
1
  import { Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
  import { Linter } from '@nrwl/linter';
4
4
  import { logger } from '@nrwl/devkit';
5
5
 
@@ -103,7 +103,7 @@ describe('react-native:storybook-configuration', () => {
103
103
  });
104
104
 
105
105
  export async function createTestUILib(libName: string): Promise<Tree> {
106
- let appTree = createTreeWithEmptyWorkspace();
106
+ let appTree = createTreeWithEmptyV1Workspace();
107
107
 
108
108
  await libraryGenerator(appTree, {
109
109
  linter: Linter.EsLint,
@@ -119,7 +119,7 @@ export async function createTestAppLib(
119
119
  libName: string,
120
120
  plainJS = false
121
121
  ): Promise<Tree> {
122
- let appTree = createTreeWithEmptyWorkspace();
122
+ let appTree = createTreeWithEmptyV1Workspace();
123
123
 
124
124
  await applicationGenerator(appTree, {
125
125
  e2eTestRunner: 'none',
@@ -1,5 +1,5 @@
1
1
  import { addProjectConfiguration, Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
 
4
4
  import { formatFile } from '../../../utils/format-file';
5
5
 
@@ -9,7 +9,7 @@ describe('addResolverMainFieldsToMetroConfig', () => {
9
9
  let tree: Tree;
10
10
 
11
11
  beforeEach(() => {
12
- tree = createTreeWithEmptyWorkspace();
12
+ tree = createTreeWithEmptyV1Workspace();
13
13
 
14
14
  addProjectConfiguration(tree, 'products', {
15
15
  root: 'apps/products',
@@ -1,5 +1,5 @@
1
1
  import { addProjectConfiguration, Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
 
4
4
  import { formatFile } from '../../../utils/format-file';
5
5
 
@@ -9,7 +9,7 @@ describe('replaceAppImportWithStorybookToggle', () => {
9
9
  let tree: Tree;
10
10
 
11
11
  beforeEach(() => {
12
- tree = createTreeWithEmptyWorkspace();
12
+ tree = createTreeWithEmptyV1Workspace();
13
13
 
14
14
  addProjectConfiguration(tree, 'products', {
15
15
  root: 'apps/products',
@@ -7,4 +7,5 @@ export interface StorybookConfigureSchema {
7
7
  tsConfiguration?: boolean;
8
8
  linter?: Linter;
9
9
  standaloneConfig?: boolean;
10
+ ignorePaths?: string[];
10
11
  }
@@ -42,6 +42,21 @@
42
42
  "standaloneConfig": {
43
43
  "description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
44
44
  "type": "boolean"
45
+ },
46
+ "ignorePaths": {
47
+ "type": "array",
48
+ "description": "Paths to ignore when looking for components.",
49
+ "items": {
50
+ "type": "string",
51
+ "description": "Path to ignore."
52
+ },
53
+ "examples": [
54
+ "apps/my-app/src/not-stories/**",
55
+ "**/**/src/**/not-stories/**",
56
+ "libs/my-lib/**/*.something.ts",
57
+ "**/**/src/**/*.other.*",
58
+ "libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
59
+ ]
45
60
  }
46
61
  },
47
62
  "required": ["name"]
@@ -1,5 +1,5 @@
1
1
  import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
  import {
4
4
  reactNativeSvgTransformerVersion,
5
5
  reactNativeSvgVersion,
@@ -10,7 +10,7 @@ describe('Add react-native-svg to dev dependencies', () => {
10
10
  let tree: Tree;
11
11
 
12
12
  beforeEach(async () => {
13
- tree = createTreeWithEmptyWorkspace();
13
+ tree = createTreeWithEmptyV1Workspace();
14
14
  addProjectConfiguration(tree, 'products', {
15
15
  root: 'apps/products',
16
16
  sourceRoot: 'apps/products/src',
@@ -1,12 +1,12 @@
1
1
  import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
  import update from './add-babel-config-root-13-5-0';
4
4
 
5
5
  describe('Add react-native-svg to dev dependencies', () => {
6
6
  let tree: Tree;
7
7
 
8
8
  beforeEach(async () => {
9
- tree = createTreeWithEmptyWorkspace();
9
+ tree = createTreeWithEmptyV1Workspace();
10
10
  addProjectConfiguration(tree, 'products', {
11
11
  root: 'apps/products',
12
12
  sourceRoot: 'apps/products/src',
@@ -1,12 +1,12 @@
1
1
  import { addProjectConfiguration, readJson, Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
  import update from './update-react-native-typing-svg-13-5-0';
4
4
 
5
5
  describe('Update svg typings in tsconfig for react native app', () => {
6
6
  let tree: Tree;
7
7
 
8
8
  beforeEach(async () => {
9
- tree = createTreeWithEmptyWorkspace();
9
+ tree = createTreeWithEmptyV1Workspace();
10
10
  addProjectConfiguration(tree, 'products', {
11
11
  root: 'apps/products',
12
12
  sourceRoot: 'apps/products/src',
@@ -1,5 +1,5 @@
1
1
  import { addProjectConfiguration, Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
 
4
4
  import update from './add-project-root-metro-config-14-0-0';
5
5
 
@@ -7,7 +7,7 @@ describe('Add projectRoot option in metro.config.js', () => {
7
7
  let tree: Tree;
8
8
 
9
9
  beforeEach(async () => {
10
- tree = createTreeWithEmptyWorkspace();
10
+ tree = createTreeWithEmptyV1Workspace();
11
11
  addProjectConfiguration(tree, 'products', {
12
12
  root: 'apps/products',
13
13
  sourceRoot: 'apps/products/src',
@@ -1,5 +1,5 @@
1
1
  import { addProjectConfiguration, Tree, getProjects } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
 
4
4
  import update from './update-entry-file-bundle-14-0-0';
5
5
 
@@ -7,7 +7,7 @@ describe('Update entryFile for bundle target for react native apps', () => {
7
7
  let tree: Tree;
8
8
 
9
9
  beforeEach(async () => {
10
- tree = createTreeWithEmptyWorkspace();
10
+ tree = createTreeWithEmptyV1Workspace();
11
11
  addProjectConfiguration(tree, 'products', {
12
12
  root: 'apps/products',
13
13
  sourceRoot: 'apps/products/src',
@@ -1,5 +1,5 @@
1
1
  import { addProjectConfiguration, Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
 
4
4
  import update from './change-main-to-class-name-14-0-2';
5
5
 
@@ -7,7 +7,7 @@ describe('Change from main tag to className tag', () => {
7
7
  let tree: Tree;
8
8
 
9
9
  beforeEach(async () => {
10
- tree = createTreeWithEmptyWorkspace();
10
+ tree = createTreeWithEmptyV1Workspace();
11
11
  addProjectConfiguration(tree, 'products', {
12
12
  root: 'apps/products',
13
13
  sourceRoot: 'apps/products/src',
@@ -1,5 +1,5 @@
1
1
  import { addProjectConfiguration, Tree, getProjects } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
 
4
4
  import update from './rename-blockList-metro-config';
5
5
 
@@ -7,7 +7,7 @@ describe('Rename blacklistRE to blockList in metro.config.js for react native ap
7
7
  let tree: Tree;
8
8
 
9
9
  beforeEach(async () => {
10
- tree = createTreeWithEmptyWorkspace();
10
+ tree = createTreeWithEmptyV1Workspace();
11
11
  addProjectConfiguration(tree, 'products', {
12
12
  root: 'apps/products',
13
13
  sourceRoot: 'apps/products/src',
@@ -0,0 +1,5 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ /**
3
+ * This function changes include field from string to array for sync-deps target
4
+ */
5
+ export default function update(tree: Tree): Promise<void>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ /**
6
+ * This function changes include field from string to array for sync-deps target
7
+ */
8
+ function update(tree) {
9
+ var _a, _b, _c, _d, _e;
10
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
+ const projects = (0, devkit_1.getProjects)(tree);
12
+ for (const [name, config] of projects.entries()) {
13
+ if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a['sync-deps']) === null || _b === void 0 ? void 0 : _b.executor) !== '@nrwl/react-native:sync-deps')
14
+ continue;
15
+ const include = (_e = (_d = (_c = config.targets) === null || _c === void 0 ? void 0 : _c['sync-deps']) === null || _d === void 0 ? void 0 : _d.options) === null || _e === void 0 ? void 0 : _e.include;
16
+ if (!include || !include.length) {
17
+ continue;
18
+ }
19
+ config.targets['sync-deps'].options.include = include.split(',');
20
+ (0, devkit_1.updateProjectConfiguration)(tree, name, config);
21
+ }
22
+ yield (0, devkit_1.formatFiles)(tree);
23
+ });
24
+ }
25
+ exports.default = update;
26
+ //# sourceMappingURL=add-exclude-sync-deps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-exclude-sync-deps.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/migrations/update-14-5-5/add-exclude-sync-deps.ts"],"names":[],"mappings":";;;AAAA,yCAKsB;AAEtB;;GAEG;AACH,SAA8B,MAAM,CAAC,IAAU;;;QAC7C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;YAC/C,IACE,CAAA,MAAA,MAAA,MAAM,CAAC,OAAO,0CAAG,WAAW,CAAC,0CAAE,QAAQ,MAAK,8BAA8B;gBAE1E,SAAS;YACX,MAAM,OAAO,GAAG,MAAA,MAAA,MAAA,MAAM,CAAC,OAAO,0CAAG,WAAW,CAAC,0CAAE,OAAO,0CAAE,OAAO,CAAC;YAChE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;gBAC/B,SAAS;aACV;YACD,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACjE,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;SAChD;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;;CACzB;AAjBD,yBAiBC"}
@@ -0,0 +1,36 @@
1
+ import { addProjectConfiguration, getProjects, Tree } from '@nrwl/devkit';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
+ import update from './add-exclude-sync-deps';
4
+
5
+ describe('add-exclude-sync-deps', () => {
6
+ let tree: Tree;
7
+
8
+ beforeEach(async () => {
9
+ tree = createTreeWithEmptyV1Workspace();
10
+ addProjectConfiguration(tree, 'products', {
11
+ root: 'apps/products',
12
+ sourceRoot: 'apps/products/src',
13
+ targets: {
14
+ 'sync-deps': {
15
+ executor: '@nrwl/react-native:sync-deps',
16
+ options: {
17
+ include: 'react-native-reanmiated,react-native-screens',
18
+ },
19
+ },
20
+ },
21
+ });
22
+ });
23
+
24
+ it(`should change include from string to array`, async () => {
25
+ await update(tree);
26
+
27
+ getProjects(tree).forEach((project) => {
28
+ expect(project.targets['sync-deps']).toEqual({
29
+ executor: '@nrwl/react-native:sync-deps',
30
+ options: {
31
+ include: ['react-native-reanmiated', 'react-native-screens'],
32
+ },
33
+ });
34
+ });
35
+ });
36
+ });
@@ -1,5 +1,5 @@
1
1
  import { readProjectConfiguration, Tree } from '@nrwl/devkit';
2
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
+ import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
3
3
  import { Linter } from '@nrwl/linter';
4
4
  import { libraryGenerator } from '@nrwl/workspace/src/generators/library/library';
5
5
  import { addLinting } from './add-linting';
@@ -8,7 +8,7 @@ describe('Add Linting', () => {
8
8
  let tree: Tree;
9
9
 
10
10
  beforeEach(async () => {
11
- tree = createTreeWithEmptyWorkspace();
11
+ tree = createTreeWithEmptyV1Workspace();
12
12
  await libraryGenerator(tree, {
13
13
  name: 'my-lib',
14
14
  linter: Linter.None,