@nrwl/angular 14.4.0-beta.1 → 14.4.0-beta.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/migrations.json +16 -0
  3. package/package.json +9 -9
  4. package/src/executors/file-server/file-server.impl.js +0 -3
  5. package/src/executors/file-server/file-server.impl.js.map +1 -1
  6. package/src/generators/change-storybook-targets/change-storybook-targets.d.ts +2 -1
  7. package/src/generators/change-storybook-targets/change-storybook-targets.js +5 -1
  8. package/src/generators/change-storybook-targets/change-storybook-targets.js.map +1 -1
  9. package/src/generators/change-storybook-targets/compat.d.ts +1 -1
  10. package/src/generators/change-storybook-targets/schema.d.ts +3 -0
  11. package/src/generators/change-storybook-targets/schema.json +7 -1
  12. package/src/generators/component/component.d.ts +1 -1
  13. package/src/generators/component/component.js +7 -4
  14. package/src/generators/component/component.js.map +1 -1
  15. package/src/generators/component/lib/component.d.ts +2 -2
  16. package/src/generators/component/lib/component.js +8 -15
  17. package/src/generators/component/lib/component.js.map +1 -1
  18. package/src/generators/component/lib/entry-point.d.ts +0 -1
  19. package/src/generators/component/lib/entry-point.js +3 -21
  20. package/src/generators/component/lib/entry-point.js.map +1 -1
  21. package/src/generators/component/lib/module.d.ts +2 -2
  22. package/src/generators/component/lib/module.js.map +1 -1
  23. package/src/generators/component/lib/normalize-options.d.ts +3 -0
  24. package/src/generators/component/lib/normalize-options.js +16 -0
  25. package/src/generators/component/lib/normalize-options.js.map +1 -0
  26. package/src/generators/component/schema.d.ts +6 -0
  27. package/src/generators/component-cypress-spec/component-cypress-spec.js +3 -0
  28. package/src/generators/component-cypress-spec/component-cypress-spec.js.map +1 -1
  29. package/src/generators/component-cypress-spec/schema.d.ts +1 -0
  30. package/src/generators/component-cypress-spec/schema.json +5 -0
  31. package/src/generators/component-story/component-story.js +3 -0
  32. package/src/generators/component-story/component-story.js.map +1 -1
  33. package/src/generators/component-story/schema.d.ts +1 -0
  34. package/src/generators/component-story/schema.json +5 -0
  35. package/src/generators/move/lib/update-ng-package.js +1 -1
  36. package/src/generators/move/lib/update-ng-package.js.map +1 -1
  37. package/src/generators/ngrx/files/classes-syntax/__directory__/__fileName__.facade.spec.ts__tmpl__ +3 -3
  38. package/src/generators/ngrx/files/classes-syntax/__directory__/__fileName__.reducer.spec.ts__tmpl__ +4 -4
  39. package/src/generators/ngrx/files/classes-syntax/__directory__/__fileName__.reducer.ts__tmpl__ +3 -3
  40. package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.actions.ts__tmpl__ +1 -1
  41. package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.effects.spec.ts__tmpl__ +1 -1
  42. package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.effects.ts__tmpl__ +4 -4
  43. package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.facade.spec.ts__tmpl__ +5 -5
  44. package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.facade.ts__tmpl__ +1 -1
  45. package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.reducer.spec.ts__tmpl__ +4 -4
  46. package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.reducer.ts__tmpl__ +8 -8
  47. package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.selectors.spec.ts__tmpl__ +2 -2
  48. package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.selectors.ts__tmpl__ +7 -7
  49. package/src/generators/ngrx/lib/add-imports-to-module.js +2 -1
  50. package/src/generators/ngrx/lib/add-imports-to-module.js.map +1 -1
  51. package/src/generators/scam/lib/convert-component-to-scam.d.ts +4 -0
  52. package/src/generators/scam/lib/convert-component-to-scam.js +44 -0
  53. package/src/generators/scam/lib/convert-component-to-scam.js.map +1 -0
  54. package/src/generators/scam/lib/export-scam.d.ts +4 -0
  55. package/src/generators/scam/lib/export-scam.js +37 -0
  56. package/src/generators/scam/lib/export-scam.js.map +1 -0
  57. package/src/generators/scam/lib/index.d.ts +3 -0
  58. package/src/generators/scam/lib/index.js +6 -0
  59. package/src/generators/scam/lib/index.js.map +1 -1
  60. package/src/generators/scam/lib/normalize-options.d.ts +3 -0
  61. package/src/generators/scam/lib/normalize-options.js +16 -0
  62. package/src/generators/scam/lib/normalize-options.js.map +1 -0
  63. package/src/generators/scam/scam.d.ts +1 -1
  64. package/src/generators/scam/scam.js +10 -6
  65. package/src/generators/scam/scam.js.map +1 -1
  66. package/src/generators/scam/schema.d.ts +6 -0
  67. package/src/generators/stories/schema.d.ts +1 -0
  68. package/src/generators/stories/schema.json +5 -0
  69. package/src/generators/stories/stories.js +5 -0
  70. package/src/generators/stories/stories.js.map +1 -1
  71. package/src/generators/storybook-configuration/schema.d.ts +1 -0
  72. package/src/generators/storybook-configuration/schema.json +5 -0
  73. package/src/generators/storybook-configuration/storybook-configuration.d.ts +1 -1
  74. package/src/generators/storybook-configuration/storybook-configuration.js +5 -1
  75. package/src/generators/storybook-configuration/storybook-configuration.js.map +1 -1
  76. package/src/generators/utils/component.d.ts +14 -0
  77. package/src/generators/utils/component.js +20 -0
  78. package/src/generators/utils/component.js.map +1 -0
  79. package/src/generators/utils/entry-point.d.ts +2 -0
  80. package/src/generators/utils/entry-point.js +22 -0
  81. package/src/generators/utils/entry-point.js.map +1 -0
  82. package/src/generators/utils/path.d.ts +1 -0
  83. package/src/generators/utils/path.js +7 -1
  84. package/src/generators/utils/path.js.map +1 -1
  85. package/src/utils/versions.d.ts +1 -1
  86. package/src/utils/versions.js +1 -1
  87. package/src/generators/component/lib/path.d.ts +0 -1
  88. package/src/generators/component/lib/path.js +0 -11
  89. package/src/generators/component/lib/path.js.map +0 -1
  90. package/src/generators/scam/lib/create-module.d.ts +0 -3
  91. package/src/generators/scam/lib/create-module.js +0 -90
  92. package/src/generators/scam/lib/create-module.js.map +0 -1
@@ -11,14 +11,14 @@ import { <%= className %>Facade } from './<%= fileName %>.facade';
11
11
  import { <%= className %>Entity } from './<%= fileName %>.models';
12
12
  import {
13
13
  <%= constantName %>_FEATURE_KEY,
14
- State,
15
- initialState,
16
- reducer
14
+ <%= className %>State,
15
+ initial<%= className %>State,
16
+ <%= propertyName %>Reducer
17
17
  } from './<%= fileName %>.reducer';
18
18
  import * as <%= className %>Selectors from './<%= fileName %>.selectors';
19
19
 
20
20
  interface TestSchema {
21
- <%= propertyName %>: State;
21
+ <%= propertyName %>: <%= className %>State;
22
22
  }
23
23
 
24
24
  describe('<%= className %>Facade', () => {
@@ -33,7 +33,7 @@ describe('<%= className %>Facade', () => {
33
33
  beforeEach(() => {
34
34
  @NgModule({
35
35
  imports: [
36
- StoreModule.forFeature(<%= constantName %>_FEATURE_KEY, reducer),
36
+ StoreModule.forFeature(<%= constantName %>_FEATURE_KEY, <%= propertyName %>Reducer),
37
37
  EffectsModule.forFeature([<%= className %>Effects])
38
38
  ],
39
39
  providers: [<%= className %>Facade]
@@ -22,6 +22,6 @@ export class <%= className %>Facade {
22
22
  * or more tasks in your Effects.
23
23
  */
24
24
  init() {
25
- this.store.dispatch(<%= className %>Actions.init());
25
+ this.store.dispatch(<%= className %>Actions.init<%= className %>());
26
26
  }
27
27
  }
@@ -2,7 +2,7 @@ import { Action } from '@ngrx/store';
2
2
 
3
3
  import * as <%= className %>Actions from './<%= fileName %>.actions';
4
4
  import { <%= className %>Entity } from './<%= fileName %>.models';
5
- import { State, initialState, reducer } from './<%= fileName %>.reducer';
5
+ import { <%= className %>State, initial<%= className %>State, <%= propertyName %>Reducer } from './<%= fileName %>.reducer';
6
6
 
7
7
  describe('<%= className %> Reducer', () => {
8
8
  const create<%= className %>Entity = (id: string, name = ''): <%= className %>Entity => ({
@@ -18,7 +18,7 @@ describe('<%= className %> Reducer', () => {
18
18
  ];
19
19
  const action = <%= className %>Actions.load<%= className %>Success({ <%= propertyName %> });
20
20
 
21
- const result: State = reducer(initialState, action);
21
+ const result: <%= className %>State = <%= propertyName %>Reducer(initial<%= className %>State, action);
22
22
 
23
23
  expect(result.loaded).toBe(true);
24
24
  expect(result.ids.length).toBe(2);
@@ -29,9 +29,9 @@ describe('<%= className %> Reducer', () => {
29
29
  it('should return the previous state', () => {
30
30
  const action = {} as Action;
31
31
 
32
- const result = reducer(initialState, action);
32
+ const result = <%= propertyName %>Reducer(initial<%= className %>State, action);
33
33
 
34
- expect(result).toBe(initialState);
34
+ expect(result).toBe(initial<%= className %>State);
35
35
  });
36
36
  });
37
37
  });
@@ -6,26 +6,26 @@ import { <%= className %>Entity } from './<%= fileName %>.models';
6
6
 
7
7
  export const <%= constantName %>_FEATURE_KEY = '<%= propertyName %>';
8
8
 
9
- export interface State extends EntityState<<%= className %>Entity> {
9
+ export interface <%= className %>State extends EntityState<<%= className %>Entity> {
10
10
  selectedId?: string | number; // which <%= className %> record has been selected
11
11
  loaded: boolean; // has the <%= className %> list been loaded
12
12
  error?: string | null; // last known error (if any)
13
13
  }
14
14
 
15
15
  export interface <%= className %>PartialState {
16
- readonly [<%= constantName %>_FEATURE_KEY]: State;
16
+ readonly [<%= constantName %>_FEATURE_KEY]: <%= className %>State;
17
17
  }
18
18
 
19
19
  export const <%= propertyName %>Adapter: EntityAdapter<<%= className %>Entity> = createEntityAdapter<<%= className %>Entity>();
20
20
 
21
- export const initialState: State = <%= propertyName %>Adapter.getInitialState({
21
+ export const initial<%= className %>State: <%= className %>State = <%= propertyName %>Adapter.getInitialState({
22
22
  // set initial required properties
23
23
  loaded: false
24
24
  });
25
25
 
26
- const <%= propertyName %>Reducer = createReducer(
27
- initialState,
28
- on(<%= className %>Actions.init,
26
+ const reducer = createReducer(
27
+ initial<%= className %>State,
28
+ on(<%= className %>Actions.init<%= className %>,
29
29
  state => ({ ...state, loaded: false, error: null })
30
30
  ),
31
31
  on(<%= className %>Actions.load<%= className %>Success,
@@ -36,6 +36,6 @@ const <%= propertyName %>Reducer = createReducer(
36
36
  ),
37
37
  );
38
38
 
39
- export function reducer(state: State | undefined, action: Action) {
40
- return <%= propertyName %>Reducer(state, action);
39
+ export function <%= propertyName %>Reducer(state: <%= className %>State | undefined, action: Action) {
40
+ return reducer(state, action);
41
41
  }
@@ -1,5 +1,5 @@
1
1
  import { <%= className %>Entity } from './<%= fileName %>.models';
2
- import { <%= propertyName %>Adapter, <%= className %>PartialState, initialState } from './<%= fileName %>.reducer';
2
+ import { <%= propertyName %>Adapter, <%= className %>PartialState, initial<%= className %>State } from './<%= fileName %>.reducer';
3
3
  import * as <%= className %>Selectors from './<%= fileName %>.selectors';
4
4
 
5
5
  describe('<%= className %> Selectors', () => {
@@ -19,7 +19,7 @@ describe('<%= className %> Selectors', () => {
19
19
  create<%= className %>Entity('PRODUCT-BBB'),
20
20
  create<%= className %>Entity('PRODUCT-CCC')
21
21
  ], {
22
- ...initialState,
22
+ ...initial<%= className %>State,
23
23
  selectedId : 'PRODUCT-BBB',
24
24
  error: ERROR_MSG,
25
25
  loaded: true
@@ -1,34 +1,34 @@
1
1
  import { createFeatureSelector, createSelector } from '@ngrx/store';
2
- import { <%= constantName %>_FEATURE_KEY, State, <%= propertyName %>Adapter } from './<%= fileName %>.reducer';
2
+ import { <%= constantName %>_FEATURE_KEY, <%= className %>State, <%= propertyName %>Adapter } from './<%= fileName %>.reducer';
3
3
 
4
4
  // Lookup the '<%= className %>' feature state managed by NgRx
5
- export const get<%= className %>State = createFeatureSelector<State>(<%= constantName %>_FEATURE_KEY);
5
+ export const get<%= className %>State = createFeatureSelector<<%= className %>State>(<%= constantName %>_FEATURE_KEY);
6
6
 
7
7
  const { selectAll, selectEntities } = <%= propertyName %>Adapter.getSelectors();
8
8
 
9
9
  export const get<%= className %>Loaded = createSelector(
10
10
  get<%= className %>State,
11
- (state: State) => state.loaded
11
+ (state: <%= className %>State) => state.loaded
12
12
  );
13
13
 
14
14
  export const get<%= className %>Error = createSelector(
15
15
  get<%= className %>State,
16
- (state: State) => state.error
16
+ (state: <%= className %>State) => state.error
17
17
  );
18
18
 
19
19
  export const getAll<%= className %> = createSelector(
20
20
  get<%= className %>State,
21
- (state: State) => selectAll(state)
21
+ (state: <%= className %>State) => selectAll(state)
22
22
  );
23
23
 
24
24
  export const get<%= className %>Entities = createSelector(
25
25
  get<%= className %>State,
26
- (state: State) => selectEntities(state)
26
+ (state: <%= className %>State) => selectEntities(state)
27
27
  );
28
28
 
29
29
  export const getSelectedId = createSelector(
30
30
  get<%= className %>State,
31
- (state: State) => state.selectedId
31
+ (state: <%= className %>State) => state.selectedId
32
32
  );
33
33
 
34
34
  export const getSelected = createSelector(
@@ -21,6 +21,7 @@ function addImportsToModule(tree, options) {
21
21
  const effectsName = `${(0, devkit_1.names)(options.name).className}Effects`;
22
22
  const facadeName = `${(0, devkit_1.names)(options.name).className}Facade`;
23
23
  const className = `${(0, devkit_1.names)(options.name).className}`;
24
+ const propertyName = `${(0, devkit_1.names)(options.name).propertyName}`;
24
25
  const reducerImports = `* as from${className}`;
25
26
  const storeMetaReducers = `metaReducers: !environment.production ? [] : []`;
26
27
  const storeForRoot = `StoreModule.forRoot({}, {
@@ -33,7 +34,7 @@ function addImportsToModule(tree, options) {
33
34
  const nxModule = 'NxModule.forRoot()';
34
35
  const effectsForRoot = `EffectsModule.forRoot([${effectsName}])`;
35
36
  const effectsForEmptyRoot = `EffectsModule.forRoot([])`;
36
- const storeForFeature = `StoreModule.forFeature(from${className}.${constantName}_FEATURE_KEY, from${className}.reducer)`;
37
+ const storeForFeature = `StoreModule.forFeature(from${className}.${constantName}_FEATURE_KEY, from${className}.${propertyName}Reducer)`;
37
38
  const effectsForFeature = `EffectsModule.forFeature([${effectsName}])`;
38
39
  const devTools = `!environment.production ? StoreDevtoolsModule.instrument() : []`;
39
40
  const storeRouterModule = 'StoreRouterConnectingModule.forRoot()';
@@ -1 +1 @@
1
- {"version":3,"file":"add-imports-to-module.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/ngrx/lib/add-imports-to-module.ts"],"names":[],"mappings":";;;AACA,yCAAqC;AACrC,uEAAuE;AAEvE,2CAA4D;AAC5D,kEAG4C;AAG5C,SA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C;YACF,UAAU,GAAG,IAAA,6BAAiB,EAC5B,IAAI,EACJ,UAAU,EACV,UAAU,EACV,cAAc,CACf,CAAC;YACF,UAAU,GAAG,IAAA,6BAAiB,EAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;YAEvE,IAAI,SAAS,EAAE;gBACb,UAAU,GAAG,SAAS,CACpB,UAAU,EACV,6BAA6B,EAC7B,oBAAoB,CACrB,CAAC;gBACF,UAAU,GAAG,IAAA,6BAAiB,EAC5B,IAAI,EACJ,UAAU,EACV,UAAU,EACV,iBAAiB,CAClB,CAAC;aACH;YAED,UAAU,GAAG,IAAA,6BAAiB,EAC5B,IAAI,EACJ,UAAU,EACV,UAAU,EACV,eAAe,CAChB,CAAC;SACH;aAAM;YACL,UAAU,GAAG,gBAAgB,EAAE,CAAC;YAEhC,UAAU,GAAG,IAAA,6BAAiB,EAC5B,IAAI,EACJ,UAAU,EACV,UAAU,EACV,eAAe,CAChB,CAAC;YACF,UAAU,GAAG,IAAA,6BAAiB,EAC5B,IAAI,EACJ,UAAU,EACV,UAAU,EACV,iBAAiB,CAClB,CAAC;SACH;KACF;AACH,CAAC;AA1LD,gDA0LC"}
1
+ {"version":3,"file":"add-imports-to-module.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/ngrx/lib/add-imports-to-module.ts"],"names":[],"mappings":";;;AACA,yCAAqC;AACrC,uEAAuE;AAEvE,2CAA4D;AAC5D,kEAG4C;AAG5C,SAAgB,kBAAkB,CAChC,IAAU,EACV,OAA6B;IAE7B,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAClC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,UAAU,GAAG,IAAA,6BAAgB,EAC/B,UAAU,EACV,UAAU,EACV,yBAAY,CAAC,MAAM,EACnB,IAAI,CACL,CAAC;IACF,MAAM,SAAS,GAAG,CAChB,MAAk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AAS,EAAE;gBACb,UAAU,GAAG,SAAS,CACpB,UAAU,EACV,6BAA6B,EAC7B,oBAAoB,CACrB,CAAC;gBACF,UAAU,GAAG,IAAA,6BAAiB,EAC5B,IAAI,EACJ,UAAU,EACV,UAAU,EACV,iBAAiB,CAClB,CAAC;aACH;YAED,UAAU,GAAG,IAAA,6BAAiB,EAC5B,IAAI,EACJ,UAAU,EACV,UAAU,EACV,eAAe,CAChB,CAAC;SACH;aAAM;YACL,UAAU,GAAG,gBAAgB,EAAE,CAAC;YAEhC,UAAU,GAAG,IAAA,6BAAiB,EAC5B,IAAI,EACJ,UAAU,EACV,UAAU,EACV,eAAe,CAChB,CAAC;YACF,UAAU,GAAG,IAAA,6BAAiB,EAC5B,IAAI,EACJ,UAAU,EACV,UAAU,EACV,iBAAiB,CAClB,CAAC;SACH;KACF;AACH,CAAC;AA3LD,gDA2LC"}
@@ -0,0 +1,4 @@
1
+ import type { Tree } from '@nrwl/devkit';
2
+ import type { Schema } from '../schema';
3
+ import type { ComponentFileInfo } from '../../utils/component';
4
+ export declare function convertComponentToScam(tree: Tree, { componentDirectory, componentFileName, componentFilePath, }: ComponentFileInfo, options: Schema): void;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertComponentToScam = void 0;
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const ast_utils_1 = require("@nrwl/workspace/src/utilities/ast-utils");
6
+ const typescript_1 = require("typescript");
7
+ function convertComponentToScam(tree, { componentDirectory, componentFileName, componentFilePath, }, options) {
8
+ var _a;
9
+ if (!tree.exists(componentFilePath)) {
10
+ throw new Error(`Couldn't find component at path ${componentFilePath} to add SCAM setup.`);
11
+ }
12
+ const componentNames = (0, devkit_1.names)(options.name);
13
+ const typeNames = (0, devkit_1.names)((_a = options.type) !== null && _a !== void 0 ? _a : 'component');
14
+ const componentClassName = `${componentNames.className}${typeNames.className}`;
15
+ if (options.inlineScam) {
16
+ const currentComponentContents = tree.read(componentFilePath, 'utf-8');
17
+ let source = (0, typescript_1.createSourceFile)(componentFilePath, currentComponentContents, typescript_1.ScriptTarget.Latest, true);
18
+ source = (0, ast_utils_1.insertImport)(tree, source, componentFilePath, 'NgModule', '@angular/core');
19
+ source = (0, ast_utils_1.insertImport)(tree, source, componentFilePath, 'CommonModule', '@angular/common');
20
+ let updatedComponentSource = source.getText();
21
+ updatedComponentSource = `${updatedComponentSource}${getNgModuleDeclaration(componentClassName)}`;
22
+ tree.write(componentFilePath, updatedComponentSource);
23
+ return;
24
+ }
25
+ const moduleFilePath = (0, devkit_1.joinPathFragments)(componentDirectory, `${componentNames.fileName}.module.ts`);
26
+ tree.write(moduleFilePath, getModuleFileContent(componentClassName, componentFileName));
27
+ }
28
+ exports.convertComponentToScam = convertComponentToScam;
29
+ function getModuleFileContent(componentClassName, componentFileName) {
30
+ return `import { NgModule } from '@angular/core';
31
+ import { CommonModule } from '@angular/common';
32
+ import { ${componentClassName} } from './${componentFileName}';
33
+ ${getNgModuleDeclaration(componentClassName)}`;
34
+ }
35
+ function getNgModuleDeclaration(componentClassName) {
36
+ return `
37
+ @NgModule({
38
+ imports: [CommonModule],
39
+ declarations: [${componentClassName}],
40
+ exports: [${componentClassName}],
41
+ })
42
+ export class ${componentClassName}Module {}`;
43
+ }
44
+ //# sourceMappingURL=convert-component-to-scam.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-component-to-scam.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/convert-component-to-scam.ts"],"names":[],"mappings":";;;AACA,yCAAwD;AACxD,uEAAuE;AACvE,2CAA4D;AAI5D,SAAgB,sBAAsB,CACpC,IAAU,EACV,EACE,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GACC,EACpB,OAAe;;IAEf,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE;QACnC,MAAM,IAAI,KAAK,CACb,mCAAmC,iBAAiB,qBAAqB,CA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AAkB,cAAc,iBAAiB;EAC1D,sBAAsB,CAAC,kBAAkB,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,sBAAsB,CAAC,kBAA0B;IACxD,OAAO;;;mBAGU,kBAAkB;cACvB,kBAAkB;;eAEjB,kBAAkB,WAAW,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Tree } from '@nrwl/devkit';
2
+ import type { ComponentFileInfo } from '../../utils/component';
3
+ import type { NormalizedSchema } from '../schema';
4
+ export declare function exportScam(tree: Tree, { componentDirectory, componentFilePath }: ComponentFileInfo, options: NormalizedSchema): void;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.exportScam = void 0;
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const entry_point_1 = require("../../utils/entry-point");
6
+ const path_1 = require("../../utils/path");
7
+ function exportScam(tree, { componentDirectory, componentFilePath }, options) {
8
+ if (!options.export) {
9
+ return;
10
+ }
11
+ const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
12
+ if (projectType === 'application') {
13
+ devkit_1.logger.warn('--export=true was ignored as the project the SCAM is being generated in is not a library.');
14
+ return;
15
+ }
16
+ const entryPointPath = (0, entry_point_1.locateLibraryEntryPointFromDirectory)(tree, componentDirectory, root, options.projectSourceRoot);
17
+ if (!entryPointPath) {
18
+ // Let's not error, simply warn the user
19
+ // It's not too much effort to manually do this
20
+ // It would be more frustrating to have to find the correct path and re-run the command
21
+ devkit_1.logger.warn(`Could not export SCAM. Unable to determine project's entry point. SCAM has still been created.`);
22
+ return;
23
+ }
24
+ const relativePathFromEntryPoint = (0, path_1.getRelativeImportToFile)(entryPointPath, componentFilePath);
25
+ const entryPointContent = tree.read(entryPointPath, 'utf-8');
26
+ let updatedEntryPointContent = (0, devkit_1.stripIndents) `${entryPointContent}
27
+ export * from "${relativePathFromEntryPoint}";`;
28
+ if (!options.inlineScam) {
29
+ const moduleFilePath = (0, devkit_1.joinPathFragments)(componentDirectory, `${(0, devkit_1.names)(options.name).fileName}.module.ts`);
30
+ const relativePathFromModule = (0, path_1.getRelativeImportToFile)(entryPointPath, moduleFilePath);
31
+ updatedEntryPointContent = (0, devkit_1.stripIndents) `${updatedEntryPointContent}
32
+ export * from "${relativePathFromModule}";`;
33
+ }
34
+ tree.write(entryPointPath, updatedEntryPointContent);
35
+ }
36
+ exports.exportScam = exportScam;
37
+ //# sourceMappingURL=export-scam.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-scam.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/export-scam.ts"],"names":[],"mappings":";;;AACA,yCAMsB;AAEtB,yDAA+E;AAC/E,2CAA2D;AAG3D,SAAgB,UAAU,CACxB,IAAU,EACV,EAAE,kBAAkB,EAAE,iBAAiB,EAAqB,EAC5D,OAAyB;IAEzB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,OAAO;KACR;IAED,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9E,IAAI,WAAW,KAAK,aAAa,EAAE;QACjC,eAAM,CAAC,IAAI,CACT,2FAA2F,CAC5F,CAAC;QAEF,OAAO;KACR;IAED,MAAM,cAAc,GAAG,IAAA,kDAAoC,EACzD,IAAI,EACJ,kBAAkB,EAClB,IAAI,EACJ,OAAO,CAAC,iBAAiB,CAC1B,CAAC;IACF,IAAI,CAAC,cAAc,EAAE;QACnB,wCAAwC;QACxC,+CAA+C;QAC/C,uFAAuF;QACvF,eAAM,CAAC,IAAI,CACT,gGAAgG,CACjG,CAAC;QAEF,OAAO;KACR;IAED,MAAM,0BAA0B,GAAG,IAAA,8BAAuB,EACxD,cAAc,EACd,iBAAiB,CAClB,CAAC;IACF,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7D,IAAI,wBAAwB,GAAG,IAAA,qBAAY,EAAA,GAAG,iBAAiB;qBAC5C,0BAA0B,IAAI,CAAC;IAElD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;QACvB,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,kBAAkB,EAClB,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,YAAY,CAC5C,CAAC;QACF,MAAM,sBAAsB,GAAG,IAAA,8BAAuB,EACpD,cAAc,EACd,cAAc,CACf,CAAC;QACF,wBAAwB,GAAG,IAAA,qBAAY,EAAA,GAAG,wBAAwB;uBAC/C,sBAAsB,IAAI,CAAC;KAC/C;IAED,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC;AACvD,CAAC;AA1DD,gCA0DC"}
@@ -0,0 +1,3 @@
1
+ export * from './convert-component-to-scam';
2
+ export * from './export-scam';
3
+ export * from './normalize-options';
@@ -1 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./convert-component-to-scam"), exports);
5
+ tslib_1.__exportStar(require("./export-scam"), exports);
6
+ tslib_1.__exportStar(require("./normalize-options"), exports);
1
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,wDAA8B;AAC9B,8DAAoC"}
@@ -0,0 +1,3 @@
1
+ import type { Tree } from '@nrwl/devkit';
2
+ import type { NormalizedSchema, Schema } from '../schema';
3
+ export declare function normalizeOptions(tree: Tree, options: Schema): NormalizedSchema;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeOptions = void 0;
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ function normalizeOptions(tree, options) {
6
+ var _a, _b;
7
+ const project = (_a = options.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readWorkspaceConfiguration)(tree).defaultProject;
8
+ const { projectType, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, project);
9
+ const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
10
+ const path = (_b = options.path) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib');
11
+ return Object.assign(Object.assign({}, options), { path,
12
+ project,
13
+ projectSourceRoot });
14
+ }
15
+ exports.normalizeOptions = normalizeOptions;
16
+ //# sourceMappingURL=normalize-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAGtB,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;;IAEf,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAA,0BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,IAAI,GACR,MAAA,OAAO,CAAC,IAAI,mCACZ,IAAA,0BAAiB,EACf,iBAAiB,EACjB,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IAEJ,uCACK,OAAO,KACV,IAAI;QACJ,OAAO;QACP,iBAAiB,IACjB;AACJ,CAAC;AAxBD,4CAwBC"}
@@ -1,4 +1,4 @@
1
1
  import type { Tree } from '@nrwl/devkit';
2
2
  import type { Schema } from './schema';
3
- export declare function scamGenerator(tree: Tree, schema: Schema): Promise<void>;
3
+ export declare function scamGenerator(tree: Tree, rawOptions: Schema): Promise<void>;
4
4
  export default scamGenerator;
@@ -2,17 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scamGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
6
5
  const devkit_1 = require("@nrwl/devkit");
7
- const create_module_1 = require("./lib/create-module");
6
+ const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
8
7
  const path_1 = require("../utils/path");
9
- function scamGenerator(tree, schema) {
8
+ const lib_1 = require("./lib");
9
+ const component_1 = require("../utils/component");
10
+ function scamGenerator(tree, rawOptions) {
10
11
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- const { inlineScam } = schema, options = tslib_1.__rest(schema, ["inlineScam"]);
12
+ const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
13
+ const { inlineScam, projectSourceRoot } = options, schematicOptions = tslib_1.__rest(options, ["inlineScam", "projectSourceRoot"]);
12
14
  checkPathUnderProjectRoot(tree, options);
13
15
  const angularComponentSchematic = (0, ngcli_adapter_1.wrapAngularDevkitSchematic)('@schematics/angular', 'component');
14
- yield angularComponentSchematic(tree, Object.assign(Object.assign({}, options), { skipImport: true, export: false }));
15
- (0, create_module_1.createScam)(tree, schema);
16
+ yield angularComponentSchematic(tree, Object.assign(Object.assign({}, schematicOptions), { skipImport: true, export: false }));
17
+ const componentFileInfo = (0, component_1.getComponentFileInfo)(tree, options);
18
+ (0, lib_1.convertComponentToScam)(tree, componentFileInfo, options);
19
+ (0, lib_1.exportScam)(tree, componentFileInfo, options);
16
20
  yield (0, devkit_1.formatFiles)(tree);
17
21
  });
18
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scam.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/scam/scam.ts"],"names":[],"mappings":";;;;AAEA,8DAAwE;AACxE,yCAKsB;AACtB,uDAAiD;AACjD,wCAA+C;AAE/C,SAAsB,aAAa,CAAC,IAAU,EAAE,MAAc;;QAC5D,MAAM,EAAE,UAAU,KAAiB,MAAM,EAAlB,OAAO,kBAAK,MAAM,EAAnC,cAA0B,CAAS,CAAC;QAE1C,yBAAyB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEzC,MAAM,yBAAyB,GAAG,IAAA,0CAA0B,EAC1D,qBAAqB,EACrB,WAAW,CACZ,CAAC;QACF,MAAM,yBAAyB,CAAC,IAAI,kCAC/B,OAAO,KACV,UAAU,EAAE,IAAI,EAChB,MAAM,EAAE,KAAK,IACb,CAAC;QAEH,IAAA,0BAAU,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEzB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAlBD,sCAkBC;AAED,SAAS,yBAAyB,CAAC,IAAU,EAAE,OAAwB;;IACrE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QACjB,OAAO;KACR;IAED,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEzD,IAAI,eAAe,GAAG,IAAA,sBAAa,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,eAAe,GAAG,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC;QAC/C,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1B,CAAC,CAAC,eAAe,CAAC;IAEpB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;IAED,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEzD,IAAI,eAAe,GAAG,IAAA,sBAAa,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,eAAe,GAAG,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC;QAC/C,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1B,CAAC,CAAC,eAAe,CAAC;IAEpB,IAAI,CAAC,IAAA,qBAAc,EAAC,eAAe,EAAE,IAAI,CAAC,EAAE;QAC1C,MAAM,IAAI,KAAK,CACb,mCAAmC,OAAO,CAAC,IAAI,4CAA4C,IAAI,IAAI,CACpG,CAAC;KACH;AACH,CAAC;AAED,kBAAe,aAAa,CAAC"}
@@ -17,3 +17,9 @@ export interface Schema {
17
17
  skipSelector?: boolean;
18
18
  export?: boolean;
19
19
  }
20
+
21
+ export interface NormalizedSchema extends Schema {
22
+ path: string;
23
+ project: string;
24
+ projectSourceRoot: string;
25
+ }
@@ -2,4 +2,5 @@ export interface StoriesGeneratorOptions {
2
2
  name: string;
3
3
  cypressProject?: string;
4
4
  generateCypressSpecs?: boolean;
5
+ skipFormat?: boolean;
5
6
  }
@@ -23,6 +23,11 @@
23
23
  "cypressProject": {
24
24
  "type": "string",
25
25
  "description": "The Cypress project to generate the stories under. This is inferred from `name` by default."
26
+ },
27
+ "skipFormat": {
28
+ "description": "Skip formatting files.",
29
+ "type": "boolean",
30
+ "default": false
26
31
  }
27
32
  },
28
33
  "additionalProperties": false,
@@ -30,6 +30,7 @@ function angularStoriesGenerator(tree, options) {
30
30
  componentName: info.name,
31
31
  componentPath: info.path,
32
32
  componentFileName: info.componentFileName,
33
+ skipFormat: false,
33
34
  });
34
35
  if (options.generateCypressSpecs && e2eProject) {
35
36
  (0, component_cypress_spec_1.default)(tree, {
@@ -39,9 +40,13 @@ function angularStoriesGenerator(tree, options) {
39
40
  componentName: info.name,
40
41
  componentPath: info.path,
41
42
  componentFileName: info.componentFileName,
43
+ skipFormat: false,
42
44
  });
43
45
  }
44
46
  });
47
+ if (!options.skipFormat) {
48
+ (0, devkit_1.formatFiles)(tree);
49
+ }
45
50
  }
46
51
  exports.angularStoriesGenerator = angularStoriesGenerator;
47
52
  exports.default = angularStoriesGenerator;
@@ -1 +1 @@
1
- {"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/stories/stories.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AACtC,6EAAgF;AAChF,6FAA6F;AAC7F,wEAAyE;AACzE,yDAG8B;AAC9B,2DAAsD;AACtD,mDAAuD;AAGvD,SAAgB,uBAAuB,CACrC,IAAU,EACV,OAAgC;;IAEhC,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,GAAG,OAAO,CAAC,IAAI,MAAM,CAAC;IACvE,MAAM,UAAU,GAAG,IAAA,+BAAa,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,IAAA,iCAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,MAAM,eAAe,GAAG,IAAA,gCAAkB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC9D,MAAM,cAAc,GAAG;QACrB,GAAG,IAAA,kCAAiB,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC;QACzD,GAAG,IAAA,4CAA2B,EAAC,IAAI,EAAE,WAAW,CAAC;KAClD,CAAC;IAEF,IAAI,OAAO,CAAC,oBAAoB,IAAI,CAAC,UAAU,EAAE;QAC/C,eAAM,CAAC,IAAI,CACT,6BAA6B,cAAc,mHAAmH,CAC/J,CAAC;KACH;IAED,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC9B,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,OAAO;SACR;QAED,IAAA,yBAAuB,EAAC,IAAI,EAAE;YAC5B,WAAW,EAAE,IAAI,CAAC,gBAAgB;YAClC,aAAa,EAAE,IAAI,CAAC,IAAI;YACxB,aAAa,EAAE,IAAI,CAAC,IAAI;YACxB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,oBAAoB,IAAI,UAAU,EAAE;YAC9C,IAAA,gCAA6B,EAAC,IAAI,EAAE;gBAClC,WAAW,EAAE,OAAO,CAAC,IAAI;gBACzB,WAAW,EAAE,IAAI,CAAC,gBAAgB;gBAClC,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,aAAa,EAAE,IAAI,CAAC,IAAI;gBACxB,aAAa,EAAE,IAAI,CAAC,IAAI;gBACxB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;aAC1C,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA1CD,0DA0CC;AAED,kBAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/stories/stories.ts"],"names":[],"mappings":";;;AACA,yCAAmD;AACnD,6EAAgF;AAChF,6FAA6F;AAC7F,wEAAyE;AACzE,yDAG8B;AAC9B,2DAAsD;AACtD,mDAAuD;AAGvD,SAAgB,uBAAuB,CACrC,IAAU,EACV,OAAgC;;IAEhC,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,GAAG,OAAO,CAAC,IAAI,MAAM,CAAC;IACvE,MAAM,UAAU,GAAG,IAAA,+BAAa,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,IAAA,iCAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,MAAM,eAAe,GAAG,IAAA,gCAAkB,E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@@ export interface StorybookConfigurationOptions {
8
8
  name: string;
9
9
  cypressDirectory?: string;
10
10
  tsConfiguration?: boolean;
11
+ skipFormat?: boolean;
11
12
  }
@@ -46,6 +46,11 @@
46
46
  "type": "boolean",
47
47
  "description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
48
48
  "default": false
49
+ },
50
+ "skipFormat": {
51
+ "description": "Skip formatting files.",
52
+ "type": "boolean",
53
+ "default": false
49
54
  }
50
55
  },
51
56
  "additionalProperties": false,
@@ -1,4 +1,4 @@
1
- import type { GeneratorCallback, Tree } from '@nrwl/devkit';
1
+ import { GeneratorCallback, Tree } from '@nrwl/devkit';
2
2
  import type { StorybookConfigurationOptions } from './schema';
3
3
  export declare function storybookConfigurationGenerator(tree: Tree, options: StorybookConfigurationOptions): Promise<GeneratorCallback>;
4
4
  export default storybookConfigurationGenerator;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.storybookConfigurationGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nrwl/devkit");
5
6
  const assert_compatible_storybook_version_1 = require("./lib/assert-compatible-storybook-version");
6
7
  const generate_stories_1 = require("./lib/generate-stories");
7
8
  const generate_storybook_configuration_1 = require("./lib/generate-storybook-configuration");
@@ -12,7 +13,10 @@ function storybookConfigurationGenerator(tree, options) {
12
13
  (0, validate_options_1.validateOptions)(options);
13
14
  const storybookGeneratorInstallTask = yield (0, generate_storybook_configuration_1.generateStorybookConfiguration)(tree, options);
14
15
  if (options.generateStories) {
15
- (0, generate_stories_1.generateStories)(tree, options);
16
+ (0, generate_stories_1.generateStories)(tree, Object.assign(Object.assign({}, options), { skipFormat: false }));
17
+ }
18
+ if (!options.skipFormat) {
19
+ yield (0, devkit_1.formatFiles)(tree);
16
20
  }
17
21
  return () => {
18
22
  storybookGeneratorInstallTask();
@@ -1 +1 @@
1
- {"version":3,"file":"storybook-configuration.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/storybook-configuration/storybook-configuration.ts"],"names":[],"mappings":";;;;AACA,mGAA6F;AAC7F,6DAAyD;AACzD,6FAAwF;AACxF,6DAAyD;AAGzD,SAAsB,+BAA+B,CACnD,IAAU,EACV,OAAsC;;QAEtC,IAAA,sEAAgC,GAAE,CAAC;QACnC,IAAA,kCAAe,EAAC,OAAO,CAAC,CAAC;QAEzB,MAAM,6BAA6B,GAAG,MAAM,IAAA,iEAA8B,EACxE,IAAI,EACJ,OAAO,CACR,CAAC;QAEF,IAAI,OAAO,CAAC,eAAe,EAAE;YAC3B,IAAA,kCAAe,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAChC;QAED,OAAO,GAAG,EAAE;YACV,6BAA6B,EAAE,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC;CAAA;AAnBD,0EAmBC;AAED,kBAAe,+BAA+B,CAAC"}
1
+ {"version":3,"file":"storybook-configuration.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/storybook-configuration/storybook-configuration.ts"],"names":[],"mappings":";;;;AAAA,yCAAoE;AACpE,mGAA6F;AAC7F,6DAAyD;AACzD,6FAAwF;AACxF,6DAAyD;AAGzD,SAAsB,+BAA+B,CACnD,IAAU,EACV,OAAsC;;QAEtC,IAAA,sEAAgC,GAAE,CAAC;QACnC,IAAA,kCAAe,EAAC,OAAO,CAAC,CAAC;QAEzB,MAAM,6BAA6B,GAAG,MAAM,IAAA,iEAA8B,EACxE,IAAI,EACJ,OAAO,CACR,CAAC;QAEF,IAAI,OAAO,CAAC,eAAe,EAAE;YAC3B,IAAA,kCAAe,EAAC,IAAI,kCAAO,OAAO,KAAE,UAAU,EAAE,KAAK,IAAG,CAAC;SAC1D;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,GAAG,EAAE;YACV,6BAA6B,EAAE,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC;CAAA;AAvBD,0EAuBC;AAED,kBAAe,+BAA+B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export declare type ComponentGenerationOptions = {
3
+ name: string;
4
+ flat?: boolean;
5
+ path?: string;
6
+ project?: string;
7
+ type?: string;
8
+ };
9
+ export declare type ComponentFileInfo = {
10
+ componentDirectory: string;
11
+ componentFileName: string;
12
+ componentFilePath: string;
13
+ };
14
+ export declare function getComponentFileInfo(tree: Tree, options: ComponentGenerationOptions): ComponentFileInfo;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getComponentFileInfo = void 0;
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ function getComponentFileInfo(tree, options) {
6
+ var _a, _b;
7
+ const project = (_a = options.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readWorkspaceConfiguration)(tree).defaultProject;
8
+ const { root, sourceRoot, projectType } = (0, devkit_1.readProjectConfiguration)(tree, project);
9
+ const { fileName: normalizedName } = (0, devkit_1.names)(options.name);
10
+ const componentFileName = `${normalizedName}.${options.type ? (0, devkit_1.names)(options.type).fileName : 'component'}`;
11
+ const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
12
+ const path = (_b = options.path) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib');
13
+ const componentDirectory = options.flat
14
+ ? (0, devkit_1.normalizePath)(path)
15
+ : (0, devkit_1.joinPathFragments)(path, normalizedName);
16
+ const componentFilePath = (0, devkit_1.joinPathFragments)(componentDirectory, `${componentFileName}.ts`);
17
+ return { componentDirectory, componentFileName, componentFilePath };
18
+ }
19
+ exports.getComponentFileInfo = getComponentFileInfo;
20
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../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-0,0 +1,2 @@
1
+ import type { Tree } from '@nrwl/devkit';
2
+ export declare function locateLibraryEntryPointFromDirectory(tree: Tree, directory: string, projectRoot: string, projectSourceRoot: string): string | null;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.locateLibraryEntryPointFromDirectory = void 0;
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const path_1 = require("path");
6
+ function locateLibraryEntryPointFromDirectory(tree, directory, projectRoot, projectSourceRoot) {
7
+ var _a, _b;
8
+ const ngPackageJsonPath = (0, devkit_1.joinPathFragments)(directory, 'ng-package.json');
9
+ let entryPointFile = tree.exists(ngPackageJsonPath)
10
+ ? (_b = (_a = (0, devkit_1.readJson)(tree, ngPackageJsonPath).lib) === null || _a === void 0 ? void 0 : _a.entryFile) !== null && _b !== void 0 ? _b : 'src/public_api.ts'
11
+ : null;
12
+ if (entryPointFile) {
13
+ return (0, devkit_1.joinPathFragments)(directory, entryPointFile);
14
+ }
15
+ if (directory === projectRoot) {
16
+ const indexFile = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'index.ts');
17
+ return tree.exists(indexFile) ? indexFile : null;
18
+ }
19
+ return locateLibraryEntryPointFromDirectory(tree, (0, path_1.dirname)(directory), projectRoot, projectSourceRoot);
20
+ }
21
+ exports.locateLibraryEntryPointFromDirectory = locateLibraryEntryPointFromDirectory;
22
+ //# sourceMappingURL=entry-point.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/entry-point.ts"],"names":[],"mappings":";;;AACA,yCAA2D;AAC3D,+BAA+B;AAE/B,SAAgB,oCAAoC,CAClD,IAAU,EACV,SAAiB,EACjB,WAAmB,EACnB,iBAAyB;;IAEzB,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC1E,IAAI,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;QACjD,CAAC,CAAC,MAAA,MAAA,IAAA,iBAAQ,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,GAAG,0CAAE,SAAS,mCAAI,mBAAmB;QACzE,CAAC,CAAC,IAAI,CAAC;IAET,IAAI,cAAc,EAAE;QAClB,OAAO,IAAA,0BAAiB,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC;KACrD;IAED,IAAI,SAAS,KAAK,WAAW,EAAE;QAC7B,MAAM,SAAS,GAAG,IAAA,0BAAiB,EAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QAEnE,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;KAClD;IAED,OAAO,oCAAoC,CACzC,IAAI,EACJ,IAAA,cAAO,EAAC,SAAS,CAAC,EAClB,WAAW,EACX,iBAAiB,CAClB,CAAC;AACJ,CAAC;AA3BD,oFA2BC"}
@@ -1 +1,2 @@
1
1
  export declare function pathStartsWith(path1: string, path2: string): boolean;
2
+ export declare function getRelativeImportToFile(sourceFilePath: string, targetFilePath: string): string;