@o3r/transloco 0.0.0 → 14.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/LICENSE +26 -0
- package/README.md +64 -0
- package/builders/helpers/localization-generator.d.ts +126 -0
- package/builders/helpers/localization-generator.d.ts.map +1 -0
- package/builders/helpers/localization-generator.js +303 -0
- package/builders/helpers/localization-generator.js.map +1 -0
- package/builders/i18n/index.d.ts +7 -0
- package/builders/i18n/index.d.ts.map +1 -0
- package/builders/i18n/index.js +39 -0
- package/builders/i18n/index.js.map +1 -0
- package/builders/i18n/schema.d.ts +30 -0
- package/builders/i18n/schema.d.ts.map +1 -0
- package/builders/i18n/schema.js +3 -0
- package/builders/i18n/schema.js.map +1 -0
- package/builders/i18n/schema.json +35 -0
- package/builders/localization/index.d.ts +23 -0
- package/builders/localization/index.d.ts.map +1 -0
- package/builders/localization/index.js +416 -0
- package/builders/localization/index.js.map +1 -0
- package/builders/localization/schema.d.ts +29 -0
- package/builders/localization/schema.d.ts.map +1 -0
- package/builders/localization/schema.js +3 -0
- package/builders/localization/schema.js.map +1 -0
- package/builders/localization/schema.json +78 -0
- package/builders/localization-extractor/index.d.ts +8 -0
- package/builders/localization-extractor/index.d.ts.map +1 -0
- package/builders/localization-extractor/index.js +181 -0
- package/builders/localization-extractor/index.js.map +1 -0
- package/builders/localization-extractor/schema.d.ts +25 -0
- package/builders/localization-extractor/schema.d.ts.map +1 -0
- package/builders/localization-extractor/schema.js +3 -0
- package/builders/localization-extractor/schema.js.map +1 -0
- package/builders/localization-extractor/schema.json +62 -0
- package/builders/localization-extractor/validations.d.ts +17 -0
- package/builders/localization-extractor/validations.d.ts.map +1 -0
- package/builders/localization-extractor/validations.js +54 -0
- package/builders/localization-extractor/validations.js.map +1 -0
- package/builders/metadata-check/helpers/index.d.ts +2 -0
- package/builders/metadata-check/helpers/index.d.ts.map +1 -0
- package/builders/metadata-check/helpers/index.js +5 -0
- package/builders/metadata-check/helpers/index.js.map +1 -0
- package/builders/metadata-check/helpers/localization-metadata-comparison-helper.d.ts +14 -0
- package/builders/metadata-check/helpers/localization-metadata-comparison-helper.d.ts.map +1 -0
- package/builders/metadata-check/helpers/localization-metadata-comparison-helper.js +34 -0
- package/builders/metadata-check/helpers/localization-metadata-comparison-helper.js.map +1 -0
- package/builders/metadata-check/index.d.ts +7 -0
- package/builders/metadata-check/index.d.ts.map +1 -0
- package/builders/metadata-check/index.js +12 -0
- package/builders/metadata-check/index.js.map +1 -0
- package/builders/metadata-check/schema.d.ts +5 -0
- package/builders/metadata-check/schema.d.ts.map +1 -0
- package/builders/metadata-check/schema.js +3 -0
- package/builders/metadata-check/schema.js.map +1 -0
- package/builders/metadata-check/schema.json +46 -0
- package/builders/package.json +3 -0
- package/builders.json +25 -0
- package/collection.json +29 -0
- package/fesm2022/o3r-transloco-rules-engine.mjs +57 -0
- package/fesm2022/o3r-transloco-rules-engine.mjs.map +1 -0
- package/fesm2022/o3r-transloco.mjs +1177 -0
- package/fesm2022/o3r-transloco.mjs.map +1 -0
- package/package.json +190 -2
- package/rules-engine/package.json +4 -0
- package/schemas/localization.metadata.schema.json +84 -0
- package/schemas/localization.schema.json +116 -0
- package/schemas/rules-engine.localization-action.schema.json +26 -0
- package/schematics/add-localization-key/index.d.ts +13 -0
- package/schematics/add-localization-key/index.d.ts.map +1 -0
- package/schematics/add-localization-key/index.js +227 -0
- package/schematics/add-localization-key/index.js.map +1 -0
- package/schematics/add-localization-key/schema.d.ts +20 -0
- package/schematics/add-localization-key/schema.d.ts.map +1 -0
- package/schematics/add-localization-key/schema.js +3 -0
- package/schematics/add-localization-key/schema.js.map +1 -0
- package/schematics/add-localization-key/schema.json +49 -0
- package/schematics/cms-adapter/index.d.ts +8 -0
- package/schematics/cms-adapter/index.d.ts.map +1 -0
- package/schematics/cms-adapter/index.js +81 -0
- package/schematics/cms-adapter/index.js.map +1 -0
- package/schematics/localization-base/index.d.ts +14 -0
- package/schematics/localization-base/index.d.ts.map +1 -0
- package/schematics/localization-base/index.js +359 -0
- package/schematics/localization-base/index.js.map +1 -0
- package/schematics/localization-base/templates/src/assets/locales/__empty__.gitkeep +0 -0
- package/schematics/localization-to-component/index.d.ts +13 -0
- package/schematics/localization-to-component/index.d.ts.map +1 -0
- package/schematics/localization-to-component/index.js +264 -0
- package/schematics/localization-to-component/index.js.map +1 -0
- package/schematics/localization-to-component/schema.d.ts +12 -0
- package/schematics/localization-to-component/schema.d.ts.map +1 -0
- package/schematics/localization-to-component/schema.js +3 -0
- package/schematics/localization-to-component/schema.js.map +1 -0
- package/schematics/localization-to-component/schema.json +31 -0
- package/schematics/localization-to-component/templates/__name__-localization.json +3 -0
- package/schematics/localization-to-component/templates/__name__-translation.ts.template +5 -0
- package/schematics/migration-localization-to-transloco/index.d.ts +8 -0
- package/schematics/migration-localization-to-transloco/index.d.ts.map +1 -0
- package/schematics/migration-localization-to-transloco/index.js +194 -0
- package/schematics/migration-localization-to-transloco/index.js.map +1 -0
- package/schematics/migration-localization-to-transloco/schema.d.ts +15 -0
- package/schematics/migration-localization-to-transloco/schema.d.ts.map +1 -0
- package/schematics/migration-localization-to-transloco/schema.js +3 -0
- package/schematics/migration-localization-to-transloco/schema.js.map +1 -0
- package/schematics/migration-localization-to-transloco/schema.json +30 -0
- package/schematics/ng-add/helpers/devtools-registration.d.ts +8 -0
- package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -0
- package/schematics/ng-add/helpers/devtools-registration.js +37 -0
- package/schematics/ng-add/helpers/devtools-registration.js.map +1 -0
- package/schematics/ng-add/index.d.ts +8 -0
- package/schematics/ng-add/index.d.ts.map +1 -0
- package/schematics/ng-add/index.js +62 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.d.ts +11 -0
- package/schematics/ng-add/schema.d.ts.map +1 -0
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/schema.json +38 -0
- package/schematics/package.json +3 -0
- package/types/o3r-transloco-rules-engine.d.ts +40 -0
- package/types/o3r-transloco-rules-engine.d.ts.map +1 -0
- package/types/o3r-transloco.d.ts +804 -0
- package/types/o3r-transloco.d.ts.map +1 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngAddLocalization = void 0;
|
|
4
|
+
exports.ngAddLocalizationFn = ngAddLocalizationFn;
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
|
+
const schematics_2 = require("@o3r/schematics");
|
|
8
|
+
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
9
|
+
const change_1 = require("@schematics/angular/utility/change");
|
|
10
|
+
const ts = require("typescript");
|
|
11
|
+
/**
|
|
12
|
+
* List of properties that will be added to the component for localization
|
|
13
|
+
*/
|
|
14
|
+
const localizationProperties = [
|
|
15
|
+
'translations'
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Checks if localization files already exist for a component
|
|
19
|
+
* @param componentPath Path to the component file
|
|
20
|
+
* @param tree Schematic tree
|
|
21
|
+
* @param baseFileName Base file name of the component
|
|
22
|
+
*/
|
|
23
|
+
const checkLocalization = (componentPath, tree, baseFileName) => {
|
|
24
|
+
const files = [
|
|
25
|
+
node_path_1.posix.join((0, node_path_1.dirname)(componentPath), `${baseFileName}-localization.json`),
|
|
26
|
+
node_path_1.posix.join((0, node_path_1.dirname)(componentPath), `${baseFileName}-translation.ts`)
|
|
27
|
+
];
|
|
28
|
+
if (files.some((file) => tree.exists(file))) {
|
|
29
|
+
throw new schematics_2.O3rCliError(`Unable to add localization to this component because it already has at least one of these files: ${files.join(', ')}.`);
|
|
30
|
+
}
|
|
31
|
+
const componentSourceFile = ts.createSourceFile(componentPath, tree.readText(componentPath), ts.ScriptTarget.ES2020, true);
|
|
32
|
+
const o3rClassDeclaration = componentSourceFile.statements.find((statement) => ts.isClassDeclaration(statement)
|
|
33
|
+
&& (0, schematics_2.isO3rClassComponent)(statement));
|
|
34
|
+
if (o3rClassDeclaration.members.some((classElement) => ts.isPropertyDeclaration(classElement)
|
|
35
|
+
&& ts.isIdentifier(classElement.name)
|
|
36
|
+
&& localizationProperties.includes(classElement.name.escapedText.toString()))) {
|
|
37
|
+
throw new schematics_2.O3rCliError(`Unable to add localization to this component because it already has at least one of these properties: ${localizationProperties.join(', ')}.`);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Add localization architecture to an existing component
|
|
42
|
+
* @param options
|
|
43
|
+
*/
|
|
44
|
+
function ngAddLocalizationFn(options) {
|
|
45
|
+
return async (tree, context) => {
|
|
46
|
+
try {
|
|
47
|
+
const baseFileName = (0, schematics_2.getComponentBaseFileName)(options.path);
|
|
48
|
+
const { selector, standalone, templateRelativePath } = (0, schematics_2.getO3rComponentInfoOrThrowIfNotFound)(tree, options.path);
|
|
49
|
+
checkLocalization(options.path, tree, baseFileName);
|
|
50
|
+
const properties = {
|
|
51
|
+
...options,
|
|
52
|
+
componentTranslation: (0, schematics_2.getComponentTranslationName)(baseFileName),
|
|
53
|
+
componentSelector: selector,
|
|
54
|
+
name: baseFileName
|
|
55
|
+
};
|
|
56
|
+
const createLocalizationFilesRule = (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
|
|
57
|
+
(0, schematics_1.template)(properties),
|
|
58
|
+
(0, schematics_1.renameTemplateFiles)(),
|
|
59
|
+
(0, schematics_1.move)((0, node_path_1.dirname)(options.path))
|
|
60
|
+
]), schematics_1.MergeStrategy.Overwrite);
|
|
61
|
+
const updateComponentRule = (0, schematics_1.chain)([
|
|
62
|
+
(0, schematics_2.addImportsRule)(options.path, [
|
|
63
|
+
{
|
|
64
|
+
from: '@angular/core',
|
|
65
|
+
importNames: [
|
|
66
|
+
'Input'
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
from: '@o3r/transloco',
|
|
71
|
+
importNames: [
|
|
72
|
+
'Localization',
|
|
73
|
+
'Translatable',
|
|
74
|
+
...(standalone ? ['O3rLocalizationTranslatePipe'] : [])
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
from: `./${properties.name}-translation`,
|
|
79
|
+
importNames: [
|
|
80
|
+
'translations',
|
|
81
|
+
properties.componentTranslation
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
]),
|
|
85
|
+
() => {
|
|
86
|
+
const componentSourceFile = ts.createSourceFile(options.path, tree.readText(options.path), ts.ScriptTarget.ES2020, true);
|
|
87
|
+
const result = ts.transform(componentSourceFile, [
|
|
88
|
+
(0, schematics_2.addInterfaceToClassTransformerFactory)(`Translatable<${properties.componentTranslation}>`, schematics_2.isO3rClassComponent),
|
|
89
|
+
...(standalone
|
|
90
|
+
? [(0, schematics_2.addImportsIntoComponentDecoratorTransformerFactory)(['O3rLocalizationTranslatePipe'])]
|
|
91
|
+
: []),
|
|
92
|
+
(ctx) => (rootNode) => {
|
|
93
|
+
const { factory } = ctx;
|
|
94
|
+
const visit = (node) => {
|
|
95
|
+
if (ts.isClassDeclaration(node) && (0, schematics_2.isO3rClassComponent)(node)) {
|
|
96
|
+
const propertiesToAdd = (0, schematics_2.generateClassElementsFromString)(`
|
|
97
|
+
@Input()
|
|
98
|
+
public translations: ${properties.componentTranslation};
|
|
99
|
+
`);
|
|
100
|
+
const constructorDeclaration = node.members.find((classElement) => ts.isConstructorDeclaration(classElement));
|
|
101
|
+
const localizationConstructorBlockStatements = (0, schematics_2.generateBlockStatementsFromString)('this.translations = translations;');
|
|
102
|
+
const newContructorDeclaration = constructorDeclaration
|
|
103
|
+
? factory.updateConstructorDeclaration(constructorDeclaration, ts.getModifiers(constructorDeclaration) || [], constructorDeclaration.parameters, constructorDeclaration.body
|
|
104
|
+
? factory.updateBlock(constructorDeclaration.body, constructorDeclaration.body.statements.concat(localizationConstructorBlockStatements))
|
|
105
|
+
: factory.createBlock(localizationConstructorBlockStatements, true))
|
|
106
|
+
: factory.createConstructorDeclaration([], [], factory.createBlock(localizationConstructorBlockStatements, true));
|
|
107
|
+
const newModifiers = []
|
|
108
|
+
.concat(ts.getDecorators(node) || [])
|
|
109
|
+
.concat(ts.getModifiers(node) || []);
|
|
110
|
+
const newMembers = node.members
|
|
111
|
+
.filter((classElement) => !ts.isConstructorDeclaration(classElement))
|
|
112
|
+
.concat(propertiesToAdd, newContructorDeclaration)
|
|
113
|
+
.toSorted(schematics_2.sortClassElement);
|
|
114
|
+
(0, schematics_2.addCommentsOnClassProperties)(newMembers, {
|
|
115
|
+
translations: 'Localization of the component'
|
|
116
|
+
});
|
|
117
|
+
return factory.updateClassDeclaration(node, newModifiers, node.name, node.typeParameters, node.heritageClauses, newMembers);
|
|
118
|
+
}
|
|
119
|
+
return ts.visitEachChild(node, visit, ctx);
|
|
120
|
+
};
|
|
121
|
+
return ts.visitNode(rootNode, visit);
|
|
122
|
+
}
|
|
123
|
+
]);
|
|
124
|
+
const printer = ts.createPrinter({
|
|
125
|
+
removeComments: false,
|
|
126
|
+
newLine: ts.NewLineKind.LineFeed
|
|
127
|
+
});
|
|
128
|
+
tree.overwrite(options.path, printer.printFile(result.transformed[0]));
|
|
129
|
+
const sf = ts.createSourceFile(options.path, tree.readText(options.path), ts.ScriptTarget.ES2020, true);
|
|
130
|
+
// Has to be done at the end because ts.Printer as some issues with Decorators with arguments
|
|
131
|
+
const translationsPropDeclaration = sf.statements
|
|
132
|
+
.find((statement) => ts.isClassDeclaration(statement) && (0, schematics_2.isO3rClassComponent)(statement))
|
|
133
|
+
.members.find((member) => ts.isPropertyDeclaration(member) && member.name.getText() === 'translations');
|
|
134
|
+
const translationsPropLastDecorator = ts.getDecorators(translationsPropDeclaration)?.at(-1);
|
|
135
|
+
if (translationsPropLastDecorator) {
|
|
136
|
+
tree.commitUpdate(tree
|
|
137
|
+
.beginUpdate(options.path)
|
|
138
|
+
.insertRight(translationsPropLastDecorator.getEnd(), `\n @Localization('./${baseFileName}-localization.json')`));
|
|
139
|
+
}
|
|
140
|
+
return tree;
|
|
141
|
+
}
|
|
142
|
+
]);
|
|
143
|
+
const updateTemplateRule = () => {
|
|
144
|
+
const templatePath = templateRelativePath && node_path_1.posix.join((0, node_path_1.dirname)(options.path), templateRelativePath);
|
|
145
|
+
if (templatePath && tree.exists(templatePath)) {
|
|
146
|
+
tree.commitUpdate(tree
|
|
147
|
+
.beginUpdate(templatePath)
|
|
148
|
+
.insertLeft(0, '<div>Localization: {{ translations.dummyLoc1 | o3rTranslate }}</div>\n'));
|
|
149
|
+
}
|
|
150
|
+
return tree;
|
|
151
|
+
};
|
|
152
|
+
const specFilePath = options.specFilePath || node_path_1.posix.join((0, node_path_1.dirname)(options.path), `${baseFileName}.spec.ts`);
|
|
153
|
+
const updateSpecRule = (0, schematics_1.chain)([
|
|
154
|
+
(0, schematics_2.addImportsRule)(specFilePath, [
|
|
155
|
+
{
|
|
156
|
+
from: '@angular/core',
|
|
157
|
+
importNames: ['Provider']
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
from: '@o3r/transloco',
|
|
161
|
+
importNames: ['LocalizationService']
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
from: '@o3r/testing/transloco',
|
|
165
|
+
importNames: ['provideLocalizationMock']
|
|
166
|
+
}
|
|
167
|
+
]),
|
|
168
|
+
() => {
|
|
169
|
+
if (!tree.exists(specFilePath)) {
|
|
170
|
+
context.logger.warn(`No update applied on spec file because ${specFilePath} does not exist.`);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
let specSourceFile = ts.createSourceFile(specFilePath, tree.readText(specFilePath), ts.ScriptTarget.ES2020, true);
|
|
174
|
+
const recorder = tree.beginUpdate(specFilePath);
|
|
175
|
+
const lastImport = [...specSourceFile.statements].reverse().find((statement) => ts.isImportDeclaration(statement));
|
|
176
|
+
const changes = [new change_1.InsertChange(specFilePath, lastImport?.getEnd() || 0, `
|
|
177
|
+
const localizationConfiguration = {language: 'en'};
|
|
178
|
+
const mockTranslations = {
|
|
179
|
+
en: {${options.activateDummy
|
|
180
|
+
? `
|
|
181
|
+
'${properties.componentSelector}.dummyLoc1': 'Dummy 1'
|
|
182
|
+
`
|
|
183
|
+
: ''}}
|
|
184
|
+
};
|
|
185
|
+
`)];
|
|
186
|
+
(0, change_1.applyToUpdateRecorder)(recorder, changes);
|
|
187
|
+
tree.commitUpdate(recorder);
|
|
188
|
+
specSourceFile = ts.createSourceFile(specFilePath, tree.readText(specFilePath), ts.ScriptTarget.ES2020, true);
|
|
189
|
+
const result = ts.transform(specSourceFile, [
|
|
190
|
+
(ctx) => (0, schematics_2.addImportsAndCodeBlockStatementAtSpecInitializationTransformerFactory)([
|
|
191
|
+
ctx.factory.createSpreadElement(ctx.factory.createCallExpression(ctx.factory.createIdentifier('provideLocalizationMock'), undefined, [
|
|
192
|
+
ctx.factory.createIdentifier('localizationConfiguration'),
|
|
193
|
+
ctx.factory.createIdentifier('mockTranslations')
|
|
194
|
+
]))
|
|
195
|
+
], `const localizationService = TestBed.inject(LocalizationService);\nlocalizationService.configure();\n`)(ctx)
|
|
196
|
+
]);
|
|
197
|
+
const printer = ts.createPrinter({
|
|
198
|
+
removeComments: false,
|
|
199
|
+
newLine: ts.NewLineKind.LineFeed
|
|
200
|
+
});
|
|
201
|
+
const newContent = printer.printFile(result.transformed[0]);
|
|
202
|
+
tree.overwrite(specFilePath, newContent);
|
|
203
|
+
return tree;
|
|
204
|
+
}
|
|
205
|
+
]);
|
|
206
|
+
const updateModuleRule = () => {
|
|
207
|
+
const moduleFilePath = options.path.replace(/\.ts$/, '-module.ts');
|
|
208
|
+
// Check if module file exists
|
|
209
|
+
if (!tree.exists(moduleFilePath)) {
|
|
210
|
+
return tree;
|
|
211
|
+
}
|
|
212
|
+
const moduleSourceFile = ts.createSourceFile(moduleFilePath, tree.readText(moduleFilePath), ts.ScriptTarget.ES2020, true);
|
|
213
|
+
// Check if provideLocalization is already in the module
|
|
214
|
+
const moduleContent = tree.readText(moduleFilePath);
|
|
215
|
+
if (moduleContent.includes('provideLocalization')) {
|
|
216
|
+
return tree;
|
|
217
|
+
}
|
|
218
|
+
const recorder = tree.beginUpdate(moduleFilePath);
|
|
219
|
+
const importChanges = (0, ast_utils_1.insertImport)(moduleSourceFile, moduleFilePath, 'provideLocalization', '@o3r/transloco');
|
|
220
|
+
if (importChanges instanceof change_1.InsertChange) {
|
|
221
|
+
recorder.insertLeft(importChanges.pos, importChanges.toAdd);
|
|
222
|
+
}
|
|
223
|
+
const providerChanges = (0, ast_utils_1.addProviderToModule)(moduleSourceFile, moduleFilePath, 'provideLocalization()', '@o3r/transloco');
|
|
224
|
+
(0, change_1.applyToUpdateRecorder)(recorder, providerChanges);
|
|
225
|
+
tree.commitUpdate(recorder);
|
|
226
|
+
};
|
|
227
|
+
const addDummyKeyRule = (0, schematics_1.schematic)('add-localization-key', {
|
|
228
|
+
path: options.path,
|
|
229
|
+
skipLinter: options.skipLinter,
|
|
230
|
+
key: 'dummyLoc1',
|
|
231
|
+
description: 'Dummy 1 description',
|
|
232
|
+
value: 'Dummy 1'
|
|
233
|
+
});
|
|
234
|
+
return (0, schematics_1.chain)([
|
|
235
|
+
createLocalizationFilesRule,
|
|
236
|
+
updateComponentRule,
|
|
237
|
+
updateSpecRule,
|
|
238
|
+
standalone ? (0, schematics_1.noop)() : updateModuleRule,
|
|
239
|
+
...(options.activateDummy ? [addDummyKeyRule, updateTemplateRule] : []),
|
|
240
|
+
options.skipLinter ? (0, schematics_1.noop)() : (0, schematics_2.applyEsLintFix)()
|
|
241
|
+
]);
|
|
242
|
+
}
|
|
243
|
+
catch (e) {
|
|
244
|
+
if (e instanceof schematics_2.NoOtterComponent && context.interactive) {
|
|
245
|
+
const shouldConvertComponent = await (0, schematics_2.askConfirmationToConvertComponent)();
|
|
246
|
+
if (shouldConvertComponent) {
|
|
247
|
+
return (0, schematics_1.chain)([
|
|
248
|
+
(0, schematics_1.externalSchematic)('@o3r/core', 'convert-component', {
|
|
249
|
+
path: options.path
|
|
250
|
+
}),
|
|
251
|
+
ngAddLocalizationFn(options)
|
|
252
|
+
]);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
throw e;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Add localization architecture to an existing component
|
|
261
|
+
* @param options
|
|
262
|
+
*/
|
|
263
|
+
exports.ngAddLocalization = (0, schematics_2.createOtterSchematic)(ngAddLocalizationFn);
|
|
264
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/localization-to-component/index.ts"],"names":[],"mappings":";;;AAiGA,kDAyTC;AA1ZD,yCAGmB;AACnB,2DAeoC;AACpC,gDAkByB;AACzB,qEAG+C;AAC/C,+DAG4C;AAC5C,iCAAiC;AAKjC;;GAEG;AACH,MAAM,sBAAsB,GAAG;IAC7B,cAAc;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,aAAqB,EAAE,IAAU,EAAE,YAAoB,EAAE,EAAE;IACpF,MAAM,KAAK,GAAG;QACZ,iBAAK,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,aAAa,CAAC,EAAE,GAAG,YAAY,oBAAoB,CAAC;QACvE,iBAAK,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,aAAa,CAAC,EAAE,GAAG,YAAY,iBAAiB,CAAC;KACrE,CAAC;IACF,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,wBAAW,CAAC,oGAAoG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjJ,CAAC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ematicOptionObject {
|
|
3
|
+
/** Path to the component */
|
|
4
|
+
path: string;
|
|
5
|
+
/** Path to spec file of the component */
|
|
6
|
+
specFilePath?: string | undefined;
|
|
7
|
+
/** Skip the linter process which includes the run of EsLint and EditorConfig rules */
|
|
8
|
+
skipLinter: boolean;
|
|
9
|
+
/** Determine if the dummy localization should be generated */
|
|
10
|
+
activateDummy: boolean;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/localization-to-component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,iCAAkC,SAAQ,qBAAqB;IAC9E,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IAEb,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAElC,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;IAEpB,8DAA8D;IAC9D,aAAa,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../schematics/localization-to-component/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "NgAddLocalizationSchematicsSchema",
|
|
4
|
+
"title": "Add Otter Localization to an existing component",
|
|
5
|
+
"description": "Add Otter Localization to an existing component",
|
|
6
|
+
"properties": {
|
|
7
|
+
"path": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Path to the component",
|
|
10
|
+
"default": ""
|
|
11
|
+
},
|
|
12
|
+
"specFilePath": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Path to spec file of the component"
|
|
15
|
+
},
|
|
16
|
+
"skipLinter": {
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"description": "Skip the linter process which includes EsLint and EditorConfig rules applying",
|
|
19
|
+
"default": false
|
|
20
|
+
},
|
|
21
|
+
"activateDummy": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Generate dummy values",
|
|
24
|
+
"default": false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"additionalProperties": true,
|
|
28
|
+
"required": [
|
|
29
|
+
"path"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import type { MigrationLocalizationToTranslocoSchema } from './schema';
|
|
3
|
+
/**
|
|
4
|
+
* Migrate from \@o3r/localization to \@o3r/transloco
|
|
5
|
+
* @param options Migration options
|
|
6
|
+
*/
|
|
7
|
+
export declare const migrationLocalizationToTransloco: (options: MigrationLocalizationToTranslocoSchema) => Rule;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/migration-localization-to-transloco/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EAGL,MAAM,4BAA4B,CAAC;AAQpC,OAAO,KAAK,EACV,sCAAsC,EACvC,MAAM,UAAU,CAAC;AAyNlB;;;GAGG;AACH,eAAO,MAAM,gCAAgC,GAAI,SAAS,sCAAsC,SAC7B,CAAC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrationLocalizationToTransloco = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const schematics_2 = require("@o3r/schematics");
|
|
6
|
+
/**
|
|
7
|
+
* Pre-flight checks before migration
|
|
8
|
+
*/
|
|
9
|
+
function runPreflightChecks() {
|
|
10
|
+
return (tree, context) => {
|
|
11
|
+
if (!tree.exists('/package.json')) {
|
|
12
|
+
throw new Error('package.json not found');
|
|
13
|
+
}
|
|
14
|
+
// Check if @o3r/localization is installed
|
|
15
|
+
const packageJson = tree.readJson('/package.json');
|
|
16
|
+
const hasLocalization = packageJson.dependencies?.['@o3r/localization']
|
|
17
|
+
|| packageJson.devDependencies?.['@o3r/localization']
|
|
18
|
+
|| packageJson.peerDependencies?.['@o3r/localization'];
|
|
19
|
+
if (!hasLocalization) {
|
|
20
|
+
throw new Error('@o3r/localization is not installed. Nothing to migrate.');
|
|
21
|
+
}
|
|
22
|
+
context.logger.info('Pre-flight checks passed');
|
|
23
|
+
return tree;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Remove \@o3r/localization dependency from package.json
|
|
28
|
+
* @param options Migration options
|
|
29
|
+
*/
|
|
30
|
+
function removeO3rLocalizationDependency(options) {
|
|
31
|
+
return (tree, context) => {
|
|
32
|
+
if (options.verbose) {
|
|
33
|
+
context.logger.info('Removing @o3r/localization from package.json...');
|
|
34
|
+
}
|
|
35
|
+
const packageJsonPath = '/package.json';
|
|
36
|
+
if (!tree.exists(packageJsonPath)) {
|
|
37
|
+
throw new Error('package.json not found');
|
|
38
|
+
}
|
|
39
|
+
const packageJson = tree.readJson(packageJsonPath);
|
|
40
|
+
// Remove @o3r/localization from all dependency sections
|
|
41
|
+
const depToRemove = '@o3r/localization';
|
|
42
|
+
if (packageJson.dependencies?.[depToRemove]) {
|
|
43
|
+
delete packageJson.dependencies[depToRemove];
|
|
44
|
+
}
|
|
45
|
+
if (packageJson.devDependencies?.[depToRemove]) {
|
|
46
|
+
delete packageJson.devDependencies[depToRemove];
|
|
47
|
+
}
|
|
48
|
+
if (packageJson.peerDependencies?.[depToRemove]) {
|
|
49
|
+
delete packageJson.peerDependencies[depToRemove];
|
|
50
|
+
}
|
|
51
|
+
tree.overwrite(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
|
|
52
|
+
context.logger.info('✓ Removed @o3r/localization');
|
|
53
|
+
return tree;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Clean up old message format imports and configuration
|
|
58
|
+
* @param options Migration options
|
|
59
|
+
*/
|
|
60
|
+
function cleanupMessageFormatReferences(options) {
|
|
61
|
+
return (tree, context) => {
|
|
62
|
+
if (options.verbose) {
|
|
63
|
+
context.logger.info('Cleaning up old message format references...');
|
|
64
|
+
}
|
|
65
|
+
tree.visit((filePath) => {
|
|
66
|
+
if (!filePath.endsWith('.ts')) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const content = tree.readText(filePath);
|
|
70
|
+
// Check if this file has old message format setup
|
|
71
|
+
const hasMessageFormatCompiler = content.includes('TranslateMessageFormatLazyCompiler');
|
|
72
|
+
const hasMessageFormatConfig = content.includes('MESSAGE_FORMAT_CONFIG');
|
|
73
|
+
if (!hasMessageFormatCompiler && !hasMessageFormatConfig) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
let newContent = content;
|
|
77
|
+
// Remove MESSAGE_FORMAT_CONFIG imports and usage
|
|
78
|
+
newContent = newContent.replace(/,?\s*MESSAGE_FORMAT_CONFIG\s*,?/g, '');
|
|
79
|
+
newContent = newContent.replace(/\{\s*provide:\s*MESSAGE_FORMAT_CONFIG\s*,\s*useValue:\s*\{\s*\}\s*\}\s*,?\s*/g, '');
|
|
80
|
+
// Remove TranslateMessageFormatLazyCompiler imports and usage
|
|
81
|
+
newContent = newContent.replace(/,?\s*TranslateMessageFormatLazyCompiler\s*,?/g, '');
|
|
82
|
+
newContent = newContent.replace(/,?\s*TranslateCompiler\s*,?/g, '');
|
|
83
|
+
if (newContent !== content) {
|
|
84
|
+
tree.overwrite(filePath, newContent);
|
|
85
|
+
if (options.verbose) {
|
|
86
|
+
context.logger.info(` ✓ Cleaned up message format references in ${filePath}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return tree;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Detect if message format is used in the project
|
|
95
|
+
* @param tree
|
|
96
|
+
*/
|
|
97
|
+
function detectMessageFormatUsage(tree) {
|
|
98
|
+
let hasMessageFormat = false;
|
|
99
|
+
tree.visit((filePath) => {
|
|
100
|
+
if (!filePath.endsWith('.ts') || hasMessageFormat) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const content = tree.readText(filePath);
|
|
104
|
+
if (content.includes('TranslateMessageFormatLazyCompiler') || content.includes('MESSAGE_FORMAT_CONFIG')) {
|
|
105
|
+
hasMessageFormat = true;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return hasMessageFormat;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Transform \@o3r/localization imports and executors to \@o3r/transloco in all TypeScript and config files
|
|
112
|
+
* @param options Migration options
|
|
113
|
+
*/
|
|
114
|
+
function transformFilesRule(options) {
|
|
115
|
+
return (tree, context) => {
|
|
116
|
+
if (options.verbose) {
|
|
117
|
+
context.logger.info('Transforming @o3r/localization references to @o3r/transloco...');
|
|
118
|
+
}
|
|
119
|
+
tree.visit((filePath) => {
|
|
120
|
+
let regex;
|
|
121
|
+
let replacement;
|
|
122
|
+
// Determine file type and transformation
|
|
123
|
+
if (filePath.endsWith('.ts')) {
|
|
124
|
+
regex = /@o3r\/localization(\/[^'"\s]*)?/g;
|
|
125
|
+
replacement = '@o3r/transloco$1';
|
|
126
|
+
}
|
|
127
|
+
else if (filePath === '/angular.json' || filePath === '/workspace.json' || filePath.endsWith('/project.json')) {
|
|
128
|
+
regex = /@o3r\/localization:/g;
|
|
129
|
+
replacement = '@o3r/transloco:';
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const content = tree.readText(filePath);
|
|
135
|
+
let newContent = content.replace(regex, replacement);
|
|
136
|
+
// Remove LocalizationModule references (doesn't exist in @o3r/transloco)
|
|
137
|
+
if (filePath.endsWith('.ts')) {
|
|
138
|
+
newContent = newContent.replace(/,?\s*LocalizationModule\s*,?/g, '');
|
|
139
|
+
newContent = newContent.replace(/LocalizationModule\.forRoot\([^)]*\)\s*,?\s*/g, '');
|
|
140
|
+
}
|
|
141
|
+
if (newContent !== content) {
|
|
142
|
+
tree.overwrite(filePath, newContent);
|
|
143
|
+
if (options.verbose) {
|
|
144
|
+
context.logger.info(` ✓ Transformed ${filePath}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
context.logger.info(`✓ Transformed @o3r/localization imports and executors`);
|
|
149
|
+
return tree;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Migration schematic entry point
|
|
154
|
+
* @param options Migration options
|
|
155
|
+
*/
|
|
156
|
+
function migrationLocalizationToTranslocoFn(options) {
|
|
157
|
+
let hasMessageFormat = false;
|
|
158
|
+
return (0, schematics_1.chain)([
|
|
159
|
+
(tree, context) => {
|
|
160
|
+
context.logger.info('Starting migration from @o3r/localization to @o3r/transloco...');
|
|
161
|
+
// Detect message format usage
|
|
162
|
+
hasMessageFormat = detectMessageFormatUsage(tree);
|
|
163
|
+
if (hasMessageFormat) {
|
|
164
|
+
context.logger.info('✓ Detected message format usage - ng-add will install provideTranslocoMessageformat()');
|
|
165
|
+
}
|
|
166
|
+
return tree;
|
|
167
|
+
},
|
|
168
|
+
runPreflightChecks(),
|
|
169
|
+
removeO3rLocalizationDependency(options),
|
|
170
|
+
cleanupMessageFormatReferences(options),
|
|
171
|
+
(0, schematics_1.externalSchematic)('@o3r/transloco', 'ng-add', {
|
|
172
|
+
skipInstall: options.skipInstall,
|
|
173
|
+
skipLinter: options.skipLinter,
|
|
174
|
+
enableMessageFormat: hasMessageFormat
|
|
175
|
+
}),
|
|
176
|
+
transformFilesRule(options),
|
|
177
|
+
(tree, context) => {
|
|
178
|
+
context.logger.info('✓ Migration completed successfully');
|
|
179
|
+
context.logger.info('');
|
|
180
|
+
context.logger.info('Next steps:');
|
|
181
|
+
context.logger.info(' 1. Install dependencies: npm install (or yarn install)');
|
|
182
|
+
context.logger.info(' 2. Migrate ngx-translate API calls to Transloco:');
|
|
183
|
+
context.logger.info(' ng g @jsverse/transloco-schematics:ngx-migrate');
|
|
184
|
+
return tree;
|
|
185
|
+
}
|
|
186
|
+
]);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Migrate from \@o3r/localization to \@o3r/transloco
|
|
190
|
+
* @param options Migration options
|
|
191
|
+
*/
|
|
192
|
+
const migrationLocalizationToTransloco = (options) => (0, schematics_2.createOtterSchematic)(migrationLocalizationToTranslocoFn)(options);
|
|
193
|
+
exports.migrationLocalizationToTransloco = migrationLocalizationToTransloco;
|
|
194
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/migration-localization-to-transloco/index.ts"],"names":[],"mappings":";;;AAKA,2DAGoC;AACpC,gDAEyB;AAKzB;;GAEG;AACH,SAAS,kBAAkB;IACzB,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;QAED,0CAA0C;QAC1C,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAQ,CAAC;QAC1D,MAAM,eAAe,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC,mBAAmB,CAAC;eAClE,WAAW,CAAC,eAAe,EAAE,CAAC,mBAAmB,CAAC;eAClD,WAAW,CAAC,gBAAgB,EAAE,CAAC,mBAAmB,CAAC,CAAC;QAEzD,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,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BAAgB,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;YAClD,IAAI,gBAAgB,EAAE,CAAC;gBACrB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAC;YAC/G,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QACD,kBAAkB,EAAE;QACpB,+BAA+B,CAAC,OAAO,CAAC;QACxC,8BAA8B,CAAC,OAAO,CAAC;QACvC,IAAA,8BAAiB,EAAC,gBAAgB,EAAE,QAAQ,EAAE;YAC5C,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,mBAAmB,EAAE,gBAAgB;SACtC,CAAC;QACF,kBAAkB,CAAC,OAAO,CAAC;QAC3B,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;YACxC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;YAC1D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACxB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACnC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;YAChF,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;YAC1E,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;YAC3E,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACI,MAAM,gCAAgC,GAAG,CAAC,OAA+C,EAAE,EAAE,CAClG,IAAA,iCAAoB,EAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC,CAAC;AADvD,QAAA,gCAAgC,oCACuB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SchematicOptionObject } from '@o3r/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* Migration options for transforming from \@o3r/localization to \@o3r/transloco
|
|
4
|
+
*/
|
|
5
|
+
export interface MigrationLocalizationToTranslocoSchema extends SchematicOptionObject {
|
|
6
|
+
/** Skip npm/yarn install after migration */
|
|
7
|
+
skipInstall?: boolean;
|
|
8
|
+
/** Skip running lint --fix after migration */
|
|
9
|
+
skipLinter?: boolean;
|
|
10
|
+
/** Preview changes without applying them */
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
/** Show detailed transformation logs */
|
|
13
|
+
verbose?: boolean;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/migration-localization-to-transloco/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,WAAW,sCAAuC,SAAQ,qBAAqB;IACnF,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../schematics/migration-localization-to-transloco/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "MigrationLocalizationToTranslocoSchema",
|
|
4
|
+
"title": "Transloco Migration Options",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"skipInstall": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"default": false,
|
|
10
|
+
"description": "Skip npm/yarn install after migration"
|
|
11
|
+
},
|
|
12
|
+
"skipLinter": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"default": false,
|
|
15
|
+
"description": "Skip running lint --fix after migration"
|
|
16
|
+
},
|
|
17
|
+
"dryRun": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"default": false,
|
|
20
|
+
"description": "Preview changes without applying them"
|
|
21
|
+
},
|
|
22
|
+
"verbose": {
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"default": false,
|
|
25
|
+
"description": "Show detailed transformation logs"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": [],
|
|
29
|
+
"additionalProperties": true
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import type { NgAddSchematicsSchema } from '../schema';
|
|
3
|
+
/**
|
|
4
|
+
* Register Devtools to the application
|
|
5
|
+
* @param options
|
|
6
|
+
*/
|
|
7
|
+
export declare const registerDevtools: (options: NgAddSchematicsSchema) => Rule;
|
|
8
|
+
//# sourceMappingURL=devtools-registration.d.ts.map
|