@o3r/core 13.4.0-prerelease.9 → 13.5.0-prerelease.1
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/README.md +1 -1
- package/fesm2022/o3r-core.mjs.map +1 -1
- package/index.d.ts.map +1 -1
- package/migration.json +5 -0
- package/package.json +14 -11
- package/schematics/component/container/index.d.ts.map +1 -1
- package/schematics/component/container/index.js +22 -35
- package/schematics/component/container/schema.d.ts +2 -0
- package/schematics/component/container/schema.d.ts.map +1 -1
- package/schematics/component/container/schema.json +4 -0
- package/schematics/component/container/templates/index.ts.template +2 -2
- package/schematics/component/presenter/index.d.ts.map +1 -1
- package/schematics/component/presenter/index.js +10 -39
- package/schematics/component/presenter/schema.d.ts +2 -0
- package/schematics/component/presenter/schema.d.ts.map +1 -1
- package/schematics/component/presenter/schema.json +4 -0
- package/schematics/component/presenter/templates/index.ts.template +2 -2
- package/schematics/component/schema.d.ts +2 -0
- package/schematics/component/schema.d.ts.map +1 -1
- package/schematics/component/schema.json +4 -0
- package/schematics/component/templates/fixtures.ts.template +2 -2
- package/schematics/context-to-component/index.d.ts.map +1 -1
- package/schematics/context-to-component/index.js +8 -6
- package/schematics/ng-add/component-decorator/index.js +1 -1
- package/schematics/ng-update/index.d.ts +4 -0
- package/schematics/ng-update/index.d.ts.map +1 -1
- package/schematics/ng-update/index.js +5 -1
- package/schematics/page/index.d.ts.map +1 -1
- package/schematics/page/index.js +11 -34
- package/schematics/page/schema.d.ts +2 -0
- package/schematics/page/schema.d.ts.map +1 -1
- package/schematics/page/schema.json +4 -0
- package/schematics/page/templates/index.ts.template +1 -1
- package/schematics/service/index.d.ts.map +1 -1
- package/schematics/service/index.js +14 -2
- package/schematics/service/schema.d.ts +4 -0
- package/schematics/service/schema.d.ts.map +1 -1
- package/schematics/service/schema.json +9 -0
- package/schematics/service/templates/base/__name__/__featureName__/{__name__.__featureName__.service.spec.ts.template → __name__-__featureName__.spec.ts.template} +1 -1
- package/schematics/service/templates/base/__name__/__featureName__/{__name__.__featureName__.service.ts.template → __name__-__featureName__.ts.template} +1 -1
- package/schematics/service/templates/base/__name__/__featureName__/index.ts.template +2 -2
- package/schematics/service/templates/jasmine-core/__name__/fixture/jasmine/index.ts.template +2 -2
- package/schematics/service/templates/jest/__name__/fixture/jest/index.ts.template +2 -2
- package/schematics/shared/presets/{all.preset.d.ts → all-preset.d.ts} +2 -2
- package/schematics/shared/presets/all-preset.d.ts.map +1 -0
- package/schematics/shared/presets/{all.preset.js → all-preset.js} +1 -1
- package/schematics/shared/presets/{basic.preset.d.ts → basic-preset.d.ts} +1 -1
- package/schematics/shared/presets/basic-preset.d.ts.map +1 -0
- package/schematics/shared/presets/{basic.preset.js → basic-preset.js} +1 -1
- package/schematics/shared/presets/{cms.preset.d.ts → cms-preset.d.ts} +2 -2
- package/schematics/shared/presets/cms-preset.d.ts.map +1 -0
- package/schematics/shared/presets/{cms.preset.js → cms-preset.js} +1 -1
- package/schematics/shared/presets/{external.preset.d.ts → external-preset.d.ts} +2 -2
- package/schematics/shared/presets/{external.preset.d.ts.map → external-preset.d.ts.map} +1 -1
- package/schematics/shared/presets/{external.preset.js → external-preset.js} +1 -1
- package/schematics/shared/presets/helpers.d.ts +1 -1
- package/schematics/shared/presets/index.d.ts +3 -3
- package/schematics/shared/presets/index.js +6 -6
- package/schematics/shared/presets/{preset.interface.d.ts → preset-interface.d.ts} +1 -1
- package/schematics/shared/presets/{preset.interface.d.ts.map → preset-interface.d.ts.map} +1 -1
- package/schematics/shared/presets/{preset.interface.js → preset-interface.js} +1 -1
- package/schematics/shared/presets/{recommended.preset.d.ts → recommended-preset.d.ts} +2 -2
- package/schematics/shared/presets/recommended-preset.d.ts.map +1 -0
- package/schematics/shared/presets/{recommended.preset.js → recommended-preset.js} +1 -1
- package/schematics/store/common/templates/index.ts.template +1 -1
- package/schematics/shared/presets/all.preset.d.ts.map +0 -1
- package/schematics/shared/presets/basic.preset.d.ts.map +0 -1
- package/schematics/shared/presets/cms.preset.d.ts.map +0 -1
- package/schematics/shared/presets/recommended.preset.d.ts.map +0 -1
- /package/schematics/context-to-component/templates/{__name__.context.ts.template → __name__-context.ts.template} +0 -0
- /package/schematics/service/templates/base/__name__/__featureName__/{__name__.__featureName__.module.ts.template → __name__-__featureName__-module.ts.template} +0 -0
- /package/schematics/service/templates/jasmine-core/__name__/fixture/jasmine/{__name__.__featureName__.fixture.jasmine.ts.template → __name__-__featureName__-fixture-jasmine.ts.template} +0 -0
- /package/schematics/service/templates/jest/__name__/fixture/jest/{__name__.__featureName__.fixture.jest.ts.template → __name__-__featureName__-fixture-jest.ts.template} +0 -0
- /package/schematics/store/common/templates/{__storeName@dasherize__.module.ts.template → __storeName@dasherize__-module.ts.template} +0 -0
|
@@ -25,11 +25,11 @@ const getTemplateProperties = (options, componentStructureDef, prefix) => {
|
|
|
25
25
|
const structure = componentStructureDef === structures_types_1.ComponentStructureDef.Simple ? '' : componentStructureDef;
|
|
26
26
|
return {
|
|
27
27
|
...options,
|
|
28
|
-
componentName: (0, schematics_2.
|
|
28
|
+
componentName: (0, schematics_2.getComponentBaseName)(inputComponentName, structure),
|
|
29
29
|
componentSelector: (0, schematics_2.getComponentSelectorWithoutSuffix)(options.componentName, prefix || null),
|
|
30
30
|
projectName: options.projectName || (0, schematics_2.getLibraryNameFromPath)(options.path),
|
|
31
31
|
folderName,
|
|
32
|
-
name: (0, schematics_2.getComponentFileName)(options.componentName, structure),
|
|
32
|
+
name: (0, schematics_2.getComponentFileName)(options.componentName, structure, options.type),
|
|
33
33
|
suffix: structure.toLowerCase(),
|
|
34
34
|
description: options.description || ''
|
|
35
35
|
};
|
|
@@ -44,15 +44,10 @@ function ngGenerateComponentPresenterFn(options) {
|
|
|
44
44
|
const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
|
45
45
|
const properties = getTemplateProperties(options, options.componentStructure === 'simple' ? structures_types_1.ComponentStructureDef.Simple : structures_types_1.ComponentStructureDef.Pres, options.prefix || workspaceProject?.prefix);
|
|
46
46
|
const destination = (0, schematics_2.getDestinationPath)('@o3r/core:component', options.path, tree, options.projectName);
|
|
47
|
-
const componentDestination = path.posix.join(destination, fullStructureRequested ? path.posix.join(properties.folderName, exports.PRESENTER_FOLDER) : properties.folderName);
|
|
48
|
-
const componentPath = path.posix.join(componentDestination, `${properties.name}.
|
|
49
|
-
const
|
|
50
|
-
const o3rSpecPath = path.posix.join(componentDestination, `${properties.name}.spec.ts`);
|
|
51
|
-
const ngStylePath = path.posix.join(componentDestination, `${properties.name}.component.scss`);
|
|
52
|
-
const o3rStylePath = path.posix.join(componentDestination, `${properties.name}.style.scss`);
|
|
47
|
+
const componentDestination = path.posix.join(destination, fullStructureRequested ? path.posix.join(properties.folderName, exports.PRESENTER_FOLDER) : `${properties.folderName}${properties.suffix ? ('-' + properties.suffix) : ''}`);
|
|
48
|
+
const componentPath = path.posix.join(componentDestination, `${properties.name}.ts`);
|
|
49
|
+
const stylePath = path.posix.join(componentDestination, `${properties.name}.scss`);
|
|
53
50
|
const o3rDesignTokenPath = path.posix.join(componentDestination, `${properties.name}.theme.json`);
|
|
54
|
-
const ngTemplatePath = path.posix.join(componentDestination, `${properties.name}.component.html`);
|
|
55
|
-
const o3rTemplatePath = path.posix.join(componentDestination, `${properties.name}.template.html`);
|
|
56
51
|
const componentSelector = `${properties.componentSelector}${properties.suffix ? ('-' + properties.suffix) : ''}`;
|
|
57
52
|
const rules = [];
|
|
58
53
|
if (!options.standalone) {
|
|
@@ -60,8 +55,7 @@ function ngGenerateComponentPresenterFn(options) {
|
|
|
60
55
|
project: properties.projectName,
|
|
61
56
|
path: componentDestination,
|
|
62
57
|
flat: true,
|
|
63
|
-
name: properties.componentName
|
|
64
|
-
typeSeparator: '.'
|
|
58
|
+
name: properties.componentName
|
|
65
59
|
}));
|
|
66
60
|
}
|
|
67
61
|
rules.push((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
|
|
@@ -78,7 +72,7 @@ function ngGenerateComponentPresenterFn(options) {
|
|
|
78
72
|
viewEncapsulation: 'None',
|
|
79
73
|
changeDetection: 'OnPush',
|
|
80
74
|
style: 'scss',
|
|
81
|
-
type:
|
|
75
|
+
type: options.type,
|
|
82
76
|
skipSelector: false,
|
|
83
77
|
standalone: options.standalone,
|
|
84
78
|
...(options.standalone
|
|
@@ -86,37 +80,14 @@ function ngGenerateComponentPresenterFn(options) {
|
|
|
86
80
|
skipImport: true
|
|
87
81
|
}
|
|
88
82
|
: {
|
|
89
|
-
module: `${properties.name}
|
|
83
|
+
module: `${properties.name}-module.ts`,
|
|
90
84
|
export: true
|
|
91
85
|
}),
|
|
92
86
|
flat: true
|
|
93
|
-
}),
|
|
94
|
-
// Angular schematics generate spec file with this pattern: component-name.component.spec.ts
|
|
95
|
-
(0, schematics_1.move)(ngSpecPath, o3rSpecPath),
|
|
96
|
-
// Angular schematics generate style file with this pattern: component-name.component.scss
|
|
97
|
-
(0, schematics_1.chain)([
|
|
98
|
-
(0, schematics_1.move)(ngStylePath, o3rStylePath),
|
|
99
|
-
(t) => {
|
|
100
|
-
// Styling file is empty by default, as we create component with `viewEncapsulation` set to 'None', we should wrap the styling into the selector of the component
|
|
101
|
-
t.overwrite(o3rStylePath, `${componentSelector} {\n\t// Your component custom SCSS\n}\n`);
|
|
102
|
-
return t;
|
|
103
|
-
},
|
|
104
|
-
(t) => {
|
|
105
|
-
t.overwrite(componentPath, t.readText(componentPath).replace(path.basename(ngStylePath), path.basename(o3rStylePath)));
|
|
106
|
-
return t;
|
|
107
|
-
}
|
|
108
|
-
]),
|
|
109
|
-
// Angular schematics generate template file with this pattern: component-name.component.html
|
|
110
|
-
(0, schematics_1.chain)([
|
|
111
|
-
(0, schematics_1.move)(ngTemplatePath, o3rTemplatePath),
|
|
112
|
-
(t) => {
|
|
113
|
-
t.overwrite(componentPath, t.readText(componentPath).replace(path.basename(ngTemplatePath), path.basename(o3rTemplatePath)));
|
|
114
|
-
return t;
|
|
115
|
-
}
|
|
116
|
-
]), (0, schematics_1.schematic)('convert-component', {
|
|
87
|
+
}), (0, schematics_1.schematic)('convert-component', {
|
|
117
88
|
path: componentPath,
|
|
118
89
|
skipLinter: options.skipLinter
|
|
119
|
-
}), (0, configuration_1.getAddConfigurationRules)(componentPath, options), (0, theming_1.getAddThemingRules)(
|
|
90
|
+
}), (0, configuration_1.getAddConfigurationRules)(componentPath, options), (0, theming_1.getAddThemingRules)(stylePath, options), (0, design_token_1.getAddDesignTokenRules)(stylePath, o3rDesignTokenPath, options), (0, localization_1.getAddLocalizationRules)(componentPath, options), (0, fixture_1.getAddFixtureRules)(componentPath, options), (0, analytics_1.getAddAnalyticsRules)(componentPath, options), (0, context_1.getAddContextRules)(componentPath, options));
|
|
120
91
|
return (0, schematics_1.chain)(rules);
|
|
121
92
|
};
|
|
122
93
|
return (0, schematics_1.chain)([
|
|
@@ -31,5 +31,7 @@ export interface NgGenerateComponentPresenterSchematicsSchema extends SchematicO
|
|
|
31
31
|
skipLinter: boolean;
|
|
32
32
|
/** Whether the generated component is standalone */
|
|
33
33
|
standalone: boolean;
|
|
34
|
+
/** Custom type to append to the component's file name */
|
|
35
|
+
type?: string;
|
|
34
36
|
}
|
|
35
37
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../schematics/component/presenter/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,4CAA6C,SAAQ,qBAAqB;IACzF,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IAEtB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B,0BAA0B;IAC1B,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE3C,uEAAuE;IACvE,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEtC,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAErC,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAExC,yDAAyD;IACzD,eAAe,EAAE,OAAO,CAAC;IAEzB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC,oDAAoD;IACpD,aAAa,EAAE,OAAO,CAAC;IAEvB,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IAEpB,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../schematics/component/presenter/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,4CAA6C,SAAQ,qBAAqB;IACzF,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IAEtB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B,0BAA0B;IAC1B,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE3C,uEAAuE;IACvE,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEtC,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAErC,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAExC,yDAAyD;IACzD,eAAe,EAAE,OAAO,CAAC;IAEzB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC,oDAAoD;IACpD,aAAa,EAAE,OAAO,CAAC;IAEvB,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IAEpB,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;IAEpB,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -86,6 +86,10 @@
|
|
|
86
86
|
"type": "boolean",
|
|
87
87
|
"description": "Whether the generated component is standalone.",
|
|
88
88
|
"default": true
|
|
89
|
+
},
|
|
90
|
+
"type": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Custom type to append to the component's file name"
|
|
89
93
|
}
|
|
90
94
|
},
|
|
91
95
|
"additionalProperties": true,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './<%= name
|
|
2
|
-
<% if (!standalone) { %>export * from './<%= name
|
|
1
|
+
export * from './<%= name %>';
|
|
2
|
+
<% if (!standalone) { %>export * from './<%= name %>-module';
|
|
3
3
|
<% } %>
|
|
@@ -35,5 +35,7 @@ export interface NgGenerateComponentSchematicsSchema extends SchematicOptionObje
|
|
|
35
35
|
skipLinter: boolean;
|
|
36
36
|
/** Whether the generated component is standalone */
|
|
37
37
|
standalone: boolean;
|
|
38
|
+
/** Custom type to append to the component's file name */
|
|
39
|
+
type?: string;
|
|
38
40
|
}
|
|
39
41
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,mCAAoC,SAAQ,qBAAqB;IAChF,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IAEtB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B,0BAA0B;IAC1B,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE3C,uEAAuE;IACvE,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEtC,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE1C,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAErC,yDAAyD;IACzD,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAErC,yDAAyD;IACzD,eAAe,EAAE,OAAO,CAAC;IAEzB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC,oDAAoD;IACpD,aAAa,EAAE,OAAO,CAAC;IAEvB,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAExC,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IAEpB,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,mCAAoC,SAAQ,qBAAqB;IAChF,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IAEtB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B,0BAA0B;IAC1B,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE3C,uEAAuE;IACvE,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEtC,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE1C,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAErC,yDAAyD;IACzD,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAErC,yDAAyD;IACzD,eAAe,EAAE,OAAO,CAAC;IAEzB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC,oDAAoD;IACpD,aAAa,EAAE,OAAO,CAAC;IAEvB,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAExC,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IAEpB,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;IAEpB,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -91,6 +91,10 @@
|
|
|
91
91
|
"type": "boolean",
|
|
92
92
|
"description": "Whether the generated component is standalone.",
|
|
93
93
|
"default": true
|
|
94
|
+
},
|
|
95
|
+
"type": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "Custom type to append to the component's file name"
|
|
94
98
|
}
|
|
95
99
|
},
|
|
96
100
|
"additionalProperties": true,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<% if (generateComponentIndex) { %><% if (!useComponentFixtures) { %>// <% } %>export * from './container/<%=folderName%>-cont
|
|
2
|
-
<% if (!useComponentFixtures) { %>// <% } %>export * from './presenter/<%=folderName%>-pres
|
|
1
|
+
<% if (generateComponentIndex) { %><% if (!useComponentFixtures) { %>// <% } %>export * from './container/<%=folderName%>-cont-fixture';
|
|
2
|
+
<% if (!useComponentFixtures) { %>// <% } %>export * from './presenter/<%=folderName%>-pres-fixture';
|
|
3
3
|
<% } else { %><% if (!useComponentFixtures) { %>// <% } %>export * from './<%=folderName%>/fixtures';<% } %>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/context-to-component/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/context-to-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAQL,IAAI,EAML,MAAM,4BAA4B,CAAC;AAepC,OAAO,KAAK,EACV,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAWlB;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAwEzE;AAED,eAAO,MAAM,YAAY,wBAAuC,CAAC"}
|
|
@@ -6,9 +6,9 @@ const node_path_1 = require("node:path");
|
|
|
6
6
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
7
|
const schematics_2 = require("@o3r/schematics");
|
|
8
8
|
const ts = require("typescript");
|
|
9
|
-
const checkContext = (componentPath, tree) => {
|
|
9
|
+
const checkContext = (componentPath, tree, baseFileName) => {
|
|
10
10
|
const files = [
|
|
11
|
-
node_path_1.posix.join((0, node_path_1.dirname)(componentPath), `${
|
|
11
|
+
node_path_1.posix.join((0, node_path_1.dirname)(componentPath), `${baseFileName}-context.ts`)
|
|
12
12
|
];
|
|
13
13
|
if (files.some((file) => tree.exists(file))) {
|
|
14
14
|
throw new schematics_2.O3rCliError(`Unable to add context to this component because it already has at least one of these files: ${files.join(', ')}.`);
|
|
@@ -22,11 +22,13 @@ function ngAddContextFn(options) {
|
|
|
22
22
|
return async (tree, context) => {
|
|
23
23
|
const componentPath = options.path;
|
|
24
24
|
try {
|
|
25
|
+
const baseFileName = (0, schematics_2.getComponentBaseFileName)(componentPath);
|
|
25
26
|
const { name } = (0, schematics_2.getO3rComponentInfoOrThrowIfNotFound)(tree, componentPath);
|
|
26
|
-
checkContext(componentPath, tree);
|
|
27
|
+
checkContext(componentPath, tree, baseFileName);
|
|
27
28
|
const properties = {
|
|
28
|
-
componentContext:
|
|
29
|
-
|
|
29
|
+
componentContext: (0, schematics_2.getComponentContextName)(baseFileName),
|
|
30
|
+
componentName: name,
|
|
31
|
+
name: baseFileName
|
|
30
32
|
};
|
|
31
33
|
const createConfigFilesRule = (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
|
|
32
34
|
(0, schematics_1.template)(properties),
|
|
@@ -36,7 +38,7 @@ function ngAddContextFn(options) {
|
|
|
36
38
|
const updateComponentRule = (0, schematics_1.chain)([
|
|
37
39
|
(0, schematics_2.addImportsRule)(componentPath, [
|
|
38
40
|
{
|
|
39
|
-
from: `./${properties.name}
|
|
41
|
+
from: `./${properties.name}-context`,
|
|
40
42
|
importNames: [
|
|
41
43
|
properties.componentContext
|
|
42
44
|
]
|
|
@@ -19,7 +19,7 @@ const removeImport = (source, symbolName, fileName) => {
|
|
|
19
19
|
* @param tree Tree
|
|
20
20
|
*/
|
|
21
21
|
const updateComponentDecorators = (tree) => {
|
|
22
|
-
const componentFiles = new Set((0, schematics_1.
|
|
22
|
+
const componentFiles = new Set((0, schematics_1.getComponentFilesInFolderFromWorkspaceProjectsInTree)(tree, ''));
|
|
23
23
|
componentFiles.forEach((filePath) => {
|
|
24
24
|
const source = ts.createSourceFile(filePath, tree.readText(filePath), ts.ScriptTarget.ES2015, true);
|
|
25
25
|
const recorder = tree.beginUpdate(filePath);
|
|
@@ -15,4 +15,8 @@ export declare const updateV12_0: (options: any) => Rule;
|
|
|
15
15
|
* Update of Otter library V12.1
|
|
16
16
|
*/
|
|
17
17
|
export declare const updateV12_1: (options: any) => Rule;
|
|
18
|
+
/**
|
|
19
|
+
* Update of All versions
|
|
20
|
+
*/
|
|
21
|
+
export declare const updateAll: (options: any) => Rule;
|
|
18
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-update/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,IAAI,EAGL,MAAM,4BAA4B,CAAC;AA6BpC;;GAEG;AAEH,eAAO,MAAM,UAAU,wBAAqC,CAAC;AAkB7D;;GAEG;AAEH,eAAO,MAAM,WAAW,wBAAsC,CAAC;AAE/D;;GAEG;AAEH,eAAO,MAAM,WAAW,wBAEvB,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,WAAW,wBAEvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-update/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,IAAI,EAGL,MAAM,4BAA4B,CAAC;AA6BpC;;GAEG;AAEH,eAAO,MAAM,UAAU,wBAAqC,CAAC;AAkB7D;;GAEG;AAEH,eAAO,MAAM,WAAW,wBAAsC,CAAC;AAE/D;;GAEG;AAEH,eAAO,MAAM,WAAW,wBAEvB,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,WAAW,wBAEvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,wBAErB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateV12_1 = exports.updateV12_0 = exports.updateV10_0 = exports.updateV8_2 = void 0;
|
|
3
|
+
exports.updateAll = exports.updateV12_1 = exports.updateV12_0 = exports.updateV10_0 = exports.updateV8_2 = void 0;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
5
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
6
|
const schematics_2 = require("@o3r/schematics");
|
|
@@ -53,4 +53,8 @@ exports.updateV12_0 = (0, schematics_2.createOtterSchematic)(() => (0, schematic
|
|
|
53
53
|
*/
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/naming-convention -- version is in the function name
|
|
55
55
|
exports.updateV12_1 = (0, schematics_2.createOtterSchematic)(() => (0, schematics_2.updatePackageGroup)(o3rPackageJsonPath));
|
|
56
|
+
/**
|
|
57
|
+
* Update of All versions
|
|
58
|
+
*/
|
|
59
|
+
exports.updateAll = (0, schematics_2.createOtterSchematic)(() => (0, schematics_2.updatePackageGroup)(o3rPackageJsonPath));
|
|
56
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/page/index.ts"],"names":[],"mappings":"AAIA,OAAO,EASL,IAAI,EAML,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/page/index.ts"],"names":[],"mappings":"AAIA,OAAO,EASL,IAAI,EAML,MAAM,4BAA4B,CAAC;AAgOpC;;;GAGG;AACH,eAAO,MAAM,cAAc,wBAAyC,CAAC"}
|
package/schematics/page/index.js
CHANGED
|
@@ -34,18 +34,14 @@ function ngGeneratePageFn(options) {
|
|
|
34
34
|
context.logger.warn('No application detected in this project, the page cannot be generated');
|
|
35
35
|
return schematics_1.noop;
|
|
36
36
|
}
|
|
37
|
+
options.type ??= '';
|
|
37
38
|
const destination = (0, schematics_2.getDestinationPath)('@o3r/core:page', options.path, tree, options.projectName);
|
|
38
39
|
const pagePath = path.posix.join(destination, core_1.strings.dasherize(options.scope), core_1.strings.dasherize(options.name));
|
|
39
40
|
const dasherizedPageName = core_1.strings.dasherize(options.name);
|
|
40
41
|
const projectName = options.projectName;
|
|
41
|
-
const componentPath = path.posix.join(pagePath, `${dasherizedPageName}.
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const ngStylePath = path.posix.join(pagePath, `${dasherizedPageName}.component.scss`);
|
|
45
|
-
const o3rStylePath = path.posix.join(pagePath, `${dasherizedPageName}.style.scss`);
|
|
46
|
-
const ngTemplatePath = path.posix.join(pagePath, `${dasherizedPageName}.component.html`);
|
|
47
|
-
const o3rTemplatePath = path.posix.join(pagePath, `${dasherizedPageName}.template.html`);
|
|
48
|
-
const moduleFileName = `${dasherizedPageName}.module.ts`;
|
|
42
|
+
const componentPath = path.posix.join(pagePath, `${dasherizedPageName}${options.type ? '.' + options.type : ''}.ts`);
|
|
43
|
+
const stylePath = path.posix.join(pagePath, `${dasherizedPageName}${options.type ? '.' + options.type : ''}.scss`);
|
|
44
|
+
const moduleFileName = `${dasherizedPageName}-module.ts`;
|
|
49
45
|
const moduleFilePath = path.posix.join(pagePath, moduleFileName);
|
|
50
46
|
const rules = [];
|
|
51
47
|
if (!options.standalone) {
|
|
@@ -53,14 +49,13 @@ function ngGeneratePageFn(options) {
|
|
|
53
49
|
project: projectName,
|
|
54
50
|
path: pagePath,
|
|
55
51
|
flat: true,
|
|
56
|
-
name: pageName
|
|
57
|
-
typeSeparator: '.'
|
|
52
|
+
name: pageName
|
|
58
53
|
}), () => {
|
|
59
54
|
const sourceFileContent = tree.readText(moduleFilePath);
|
|
60
55
|
const sourceFile = ts.createSourceFile(moduleFilePath, sourceFileContent, ts.ScriptTarget.ES2015, true);
|
|
61
56
|
const recorder = tree.beginUpdate(moduleFilePath);
|
|
62
57
|
const { moduleIndex } = (0, schematics_2.getModuleIndex)(sourceFile, sourceFileContent);
|
|
63
|
-
(0, schematics_2.addImportToModuleFile)('RouterModule', '@angular/router', sourceFile, sourceFileContent, context, recorder, moduleFilePath, moduleIndex, `.forChild([{path: '', component: ${core_1.strings.classify(pageName)}
|
|
58
|
+
(0, schematics_2.addImportToModuleFile)('RouterModule', '@angular/router', sourceFile, sourceFileContent, context, recorder, moduleFilePath, moduleIndex, `.forChild([{path: '', component: ${core_1.strings.classify(pageName)}}])`, true);
|
|
64
59
|
tree.commitUpdate(recorder);
|
|
65
60
|
return tree;
|
|
66
61
|
});
|
|
@@ -75,7 +70,7 @@ function ngGeneratePageFn(options) {
|
|
|
75
70
|
viewEncapsulation: 'None',
|
|
76
71
|
changeDetection: 'OnPush',
|
|
77
72
|
style: 'scss',
|
|
78
|
-
type:
|
|
73
|
+
type: options.type,
|
|
79
74
|
skipSelector: false,
|
|
80
75
|
standalone: options.standalone,
|
|
81
76
|
...(options.standalone
|
|
@@ -83,29 +78,11 @@ function ngGeneratePageFn(options) {
|
|
|
83
78
|
skipImport: true
|
|
84
79
|
}
|
|
85
80
|
: {
|
|
86
|
-
module: `${dasherizedPageName}
|
|
81
|
+
module: `${dasherizedPageName}-module.ts`,
|
|
87
82
|
export: true
|
|
88
83
|
}),
|
|
89
84
|
flat: true
|
|
90
|
-
}),
|
|
91
|
-
// Angular schematics generate spec file with this pattern: component-name.component.spec.ts
|
|
92
|
-
(0, schematics_1.move)(ngSpecPath, o3rSpecPath),
|
|
93
|
-
// Angular schematics generate style file with this pattern: component-name.component.scss
|
|
94
|
-
(0, schematics_1.chain)([
|
|
95
|
-
(0, schematics_1.move)(ngStylePath, o3rStylePath),
|
|
96
|
-
(t) => {
|
|
97
|
-
t.overwrite(componentPath, t.readText(componentPath).replace(path.basename(ngStylePath), path.basename(o3rStylePath)));
|
|
98
|
-
return t;
|
|
99
|
-
}
|
|
100
|
-
]),
|
|
101
|
-
// Angular schematics generate template file with this pattern: component-name.component.html
|
|
102
|
-
(0, schematics_1.chain)([
|
|
103
|
-
(0, schematics_1.move)(ngTemplatePath, o3rTemplatePath),
|
|
104
|
-
(t) => {
|
|
105
|
-
t.overwrite(componentPath, t.readText(componentPath).replace(path.basename(ngTemplatePath), path.basename(o3rTemplatePath)));
|
|
106
|
-
return t;
|
|
107
|
-
}
|
|
108
|
-
]), (0, schematics_1.schematic)('convert-component', {
|
|
85
|
+
}), (0, schematics_1.schematic)('convert-component', {
|
|
109
86
|
path: componentPath,
|
|
110
87
|
skipLinter: options.skipLinter,
|
|
111
88
|
componentType: 'Page'
|
|
@@ -117,7 +94,7 @@ function ngGeneratePageFn(options) {
|
|
|
117
94
|
}),
|
|
118
95
|
(0, schematics_1.renameTemplateFiles)(),
|
|
119
96
|
(0, schematics_1.move)(pagePath)
|
|
120
|
-
]), schematics_1.MergeStrategy.Overwrite), (0, configuration_1.getAddConfigurationRules)(componentPath, options), (0, theming_1.getAddThemingRules)(
|
|
97
|
+
]), schematics_1.MergeStrategy.Overwrite), (0, configuration_1.getAddConfigurationRules)(componentPath, options), (0, theming_1.getAddThemingRules)(stylePath, options), (0, localization_1.getAddLocalizationRules)(componentPath, options), (0, fixture_1.getAddFixtureRules)(componentPath, {
|
|
121
98
|
skipLinter: options.skipLinter,
|
|
122
99
|
useComponentFixtures: options.usePageFixtures
|
|
123
100
|
}, true));
|
|
@@ -133,7 +110,7 @@ function ngGeneratePageFn(options) {
|
|
|
133
110
|
const route = {
|
|
134
111
|
path: core_1.strings.dasherize(options.name),
|
|
135
112
|
import: `./${indexFilePath.replace(/[/\\]/g, '/')}`,
|
|
136
|
-
module: `${pageName}${options.standalone ? '
|
|
113
|
+
module: `${pageName}${options.standalone ? (options.type ? core_1.strings.classify(options.type) : '') : 'Module'}`
|
|
137
114
|
};
|
|
138
115
|
if (options.appRoutingModulePath) {
|
|
139
116
|
return (0, schematics_2.insertRoute)(tree, context, options.appRoutingModulePath, route, options.standalone);
|
|
@@ -26,5 +26,7 @@ export interface NgGeneratePageSchematicsSchema extends SchematicOptionObject {
|
|
|
26
26
|
usePageFixtures: boolean;
|
|
27
27
|
/** Generate dummy values */
|
|
28
28
|
activateDummy: boolean;
|
|
29
|
+
/** Custom type to append to the page's file name */
|
|
30
|
+
type?: string;
|
|
29
31
|
}
|
|
30
32
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/page/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,8BAA+B,SAAQ,qBAAqB;IAC3E,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1C,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IAEpB,kEAAkE;IAClE,eAAe,EAAE,OAAO,CAAC;IAEzB,2DAA2D;IAC3D,cAAc,EAAE,OAAO,CAAC;IAExB,oDAAoD;IACpD,eAAe,EAAE,OAAO,CAAC;IAEzB,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;IAEpB,uCAAuC;IACvC,eAAe,EAAE,OAAO,CAAC;IAEzB,4BAA4B;IAC5B,aAAa,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/page/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,8BAA+B,SAAQ,qBAAqB;IAC3E,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1C,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IAEpB,kEAAkE;IAClE,eAAe,EAAE,OAAO,CAAC;IAEzB,2DAA2D;IAC3D,cAAc,EAAE,OAAO,CAAC;IAExB,oDAAoD;IACpD,eAAe,EAAE,OAAO,CAAC;IAEzB,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;IAEpB,uCAAuC;IACvC,eAAe,EAAE,OAAO,CAAC;IAEzB,4BAA4B;IAC5B,aAAa,EAAE,OAAO,CAAC;IAEvB,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './<%= dasherize(name)
|
|
1
|
+
export * from './<%= dasherize(name) %><%= standalone ? (type ? '.' + type : '') : '-module' %>';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/service/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAQL,IAAI,EAKL,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/service/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAQL,IAAI,EAKL,MAAM,4BAA4B,CAAC;AA6HpC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,wBAA4C,CAAC"}
|
|
@@ -14,6 +14,7 @@ function ngGenerateServiceFn(options) {
|
|
|
14
14
|
const destination = (0, schematics_2.getDestinationPath)('@o3r/core:service', options.path, tree, options.projectName);
|
|
15
15
|
const featureName = core_1.strings.dasherize(options.featureName);
|
|
16
16
|
const name = core_1.strings.dasherize(options.name);
|
|
17
|
+
const type = options.type ? core_1.strings.dasherize(options.type) : '';
|
|
17
18
|
let currentServiceIndex = '';
|
|
18
19
|
const barrelPath = path.join(destination, 'index.ts');
|
|
19
20
|
if (tree.exists(barrelPath) && !(0, schematics_2.moduleHasSubEntryPoints)(tree, destination)) {
|
|
@@ -51,6 +52,10 @@ function ngGenerateServiceFn(options) {
|
|
|
51
52
|
}
|
|
52
53
|
packageName = JSON.parse(tree.read(path.join(currentDirectory, 'package.json')).toString()).name?.split('/')[0] || destination;
|
|
53
54
|
}
|
|
55
|
+
const servicePath = path.posix.join(destination, name, featureName, `${core_1.strings.dasherize(name)}-${core_1.strings.dasherize(featureName)}.ts`);
|
|
56
|
+
const serviceSpecPath = path.posix.join(destination, name, featureName, `${core_1.strings.dasherize(name)}-${core_1.strings.dasherize(featureName)}.spec.ts`);
|
|
57
|
+
const servicePathWithType = path.posix.join(destination, name, featureName, `${core_1.strings.dasherize(name)}-${core_1.strings.dasherize(featureName)}.${core_1.strings.dasherize(type)}.ts`);
|
|
58
|
+
const serviceSpecPathWithType = path.posix.join(destination, name, featureName, `${core_1.strings.dasherize(name)}-${core_1.strings.dasherize(featureName)}.${core_1.strings.dasherize(type)}.spec.ts`);
|
|
54
59
|
const templateData = {
|
|
55
60
|
...core_1.strings,
|
|
56
61
|
...options,
|
|
@@ -58,13 +63,20 @@ function ngGenerateServiceFn(options) {
|
|
|
58
63
|
currentServiceIndex,
|
|
59
64
|
currentFixtureJasmineIndex,
|
|
60
65
|
currentFixtureJestIndex,
|
|
61
|
-
serviceName: core_1.strings.capitalize(core_1.strings.camelize(options.name + ' ' + options.featureName)),
|
|
66
|
+
serviceName: core_1.strings.capitalize(core_1.strings.camelize(options.name + ' ' + options.featureName + (options.addTypeToClassName && type ? ' ' + type : ''))),
|
|
67
|
+
type,
|
|
62
68
|
packageName
|
|
63
69
|
};
|
|
64
70
|
const baseTemplateSource = (0, schematics_1.apply)((0, schematics_1.url)('./templates/base'), [
|
|
65
71
|
(0, schematics_1.template)(templateData),
|
|
66
72
|
(0, schematics_1.renameTemplateFiles)(),
|
|
67
|
-
(0, schematics_1.move)(destination)
|
|
73
|
+
(0, schematics_1.move)(destination),
|
|
74
|
+
...(type
|
|
75
|
+
? [
|
|
76
|
+
(0, schematics_1.move)(servicePath, servicePathWithType),
|
|
77
|
+
(0, schematics_1.move)(serviceSpecPath, serviceSpecPathWithType)
|
|
78
|
+
]
|
|
79
|
+
: [])
|
|
68
80
|
]);
|
|
69
81
|
const rules = [(0, schematics_1.mergeWith)(baseTemplateSource, schematics_1.MergeStrategy.Overwrite)];
|
|
70
82
|
const testFramework = (0, schematics_2.getTestFramework)(workspaceConfig, context);
|
|
@@ -10,5 +10,9 @@ export interface NgGenerateServiceSchematicsSchema extends SchematicOptionObject
|
|
|
10
10
|
path?: string | undefined;
|
|
11
11
|
/** Skip the linter process which includes the run of EsLint and EditorConfig rules */
|
|
12
12
|
skipLinter: boolean;
|
|
13
|
+
/** Custom type to append to the service's file name */
|
|
14
|
+
type?: string;
|
|
15
|
+
/** Append the 'type' option to the generated class name */
|
|
16
|
+
addTypeToClassName: boolean;
|
|
13
17
|
}
|
|
14
18
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/service/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,iCAAkC,SAAQ,qBAAqB;IAC9E,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IAEb,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IAEpB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/service/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,iCAAkC,SAAQ,qBAAqB;IAC9E,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IAEb,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IAEpB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IAEpB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,2DAA2D;IAC3D,kBAAkB,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -36,6 +36,15 @@
|
|
|
36
36
|
"type": "boolean",
|
|
37
37
|
"description": "Skip the linter process which includes EsLint and EditorConfig rules applying",
|
|
38
38
|
"default": false
|
|
39
|
+
},
|
|
40
|
+
"type": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Custom type to append to the service's file name"
|
|
43
|
+
},
|
|
44
|
+
"addTypeToClassName": {
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"description": "Append the 'type' option to the generated class name",
|
|
47
|
+
"default": true
|
|
39
48
|
}
|
|
40
49
|
},
|
|
41
50
|
"additionalProperties": true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {getTestBed, TestBed} from '@angular/core/testing';
|
|
2
2
|
import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
|
|
3
|
-
import {<%= serviceName %>} from './<%= name
|
|
3
|
+
import {<%= serviceName %>} from './<%= name %>-<%= featureName %><% if (type) { %>.<%= type %><% } %>';
|
|
4
4
|
|
|
5
5
|
let service: <%= serviceName %>;
|
|
6
6
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './<%= name
|
|
2
|
-
export * from './<%= name
|
|
1
|
+
export * from './<%= name %>-<%= featureName %><% if (type) { %>.<%= type %><% } %>';
|
|
2
|
+
export * from './<%= name %>-<%= featureName %>-module';
|
package/schematics/service/templates/jasmine-core/__name__/fixture/jasmine/index.ts.template
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './<%= name
|
|
2
|
-
<%= currentFixtureJasmineIndex %>
|
|
1
|
+
export * from './<%= name %>-<%= featureName %>-fixture-jasmine';
|
|
2
|
+
<%= currentFixtureJasmineIndex %>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './<%= name
|
|
2
|
-
<%= currentFixtureJestIndex %>
|
|
1
|
+
export * from './<%= name %>-<%= featureName %>-fixture-jest';
|
|
2
|
+
<%= currentFixtureJestIndex %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PresetOptions } from './preset
|
|
1
|
+
import type { PresetOptions } from './preset-interface';
|
|
2
2
|
/**
|
|
3
3
|
* Preset Installing all the Otter modules
|
|
4
4
|
* @param options
|
|
@@ -7,4 +7,4 @@ export declare function allPreset(options: PresetOptions): {
|
|
|
7
7
|
modules: string[];
|
|
8
8
|
rule: import("@angular-devkit/schematics").Rule;
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=all
|
|
10
|
+
//# sourceMappingURL=all-preset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-preset.d.ts","sourceRoot":"","sources":["../../../../schematics/shared/presets/all-preset.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,aAAa;;;EA6B/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic-preset.d.ts","sourceRoot":"","sources":["../../../../schematics/shared/presets/basic-preset.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,wBAAgB,WAAW;;EAO1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PresetOptions } from './preset
|
|
1
|
+
import type { PresetOptions } from './preset-interface';
|
|
2
2
|
/**
|
|
3
3
|
* Preset Installing the minimum modules to fully administrated the application via CMS
|
|
4
4
|
* @param options
|
|
@@ -7,4 +7,4 @@ export declare function cmsPreset(options: PresetOptions): {
|
|
|
7
7
|
modules: string[];
|
|
8
8
|
rule: import("@angular-devkit/schematics").Rule;
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=cms
|
|
10
|
+
//# sourceMappingURL=cms-preset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-preset.d.ts","sourceRoot":"","sources":["../../../../schematics/shared/presets/cms-preset.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,aAAa;;;EAmB/C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
-
import type { PresetFactory } from './preset
|
|
2
|
+
import type { PresetFactory } from './preset-interface';
|
|
3
3
|
/**
|
|
4
4
|
* Generate the Preset runner for external presets
|
|
5
5
|
* @param externalPresetLabel
|
|
@@ -7,4 +7,4 @@ import type { PresetFactory } from './preset.interface';
|
|
|
7
7
|
* @param context
|
|
8
8
|
*/
|
|
9
9
|
export declare function getExternalPreset(externalPresetLabel: string, tree: Tree, context: SchematicContext): PresetFactory;
|
|
10
|
-
//# sourceMappingURL=external
|
|
10
|
+
//# sourceMappingURL=external-preset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external
|
|
1
|
+
{"version":3,"file":"external-preset.d.ts","sourceRoot":"","sources":["../../../../schematics/shared/presets/external-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,IAAI,EACL,MAAM,4BAA4B,CAAC;AAUpC,OAAO,KAAK,EACV,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,mBAAmB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAanH"}
|