@o3r/localization 12.5.0-prerelease.19 → 12.5.0-prerelease.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/localization",
|
|
3
|
-
"version": "12.5.0-prerelease.
|
|
3
|
+
"version": "12.5.0-prerelease.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@formatjs/intl-numberformat": "^8.0.2",
|
|
45
45
|
"@ngrx/store": "^19.0.0",
|
|
46
46
|
"@ngx-translate/core": "~16.0.4",
|
|
47
|
-
"@o3r/core": "^12.5.0-prerelease.
|
|
48
|
-
"@o3r/dynamic-content": "^12.5.0-prerelease.
|
|
49
|
-
"@o3r/extractors": "^12.5.0-prerelease.
|
|
50
|
-
"@o3r/logger": "^12.5.0-prerelease.
|
|
51
|
-
"@o3r/schematics": "^12.5.0-prerelease.
|
|
47
|
+
"@o3r/core": "^12.5.0-prerelease.2",
|
|
48
|
+
"@o3r/dynamic-content": "^12.5.0-prerelease.2",
|
|
49
|
+
"@o3r/extractors": "^12.5.0-prerelease.2",
|
|
50
|
+
"@o3r/logger": "^12.5.0-prerelease.2",
|
|
51
|
+
"@o3r/schematics": "^12.5.0-prerelease.2",
|
|
52
52
|
"@schematics/angular": "^19.0.0",
|
|
53
53
|
"@yarnpkg/cli": "^4.3.1",
|
|
54
54
|
"@yarnpkg/core": "^4.1.1",
|
|
@@ -115,9 +115,12 @@
|
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@o3r/schematics": "^12.5.0-prerelease.
|
|
118
|
+
"@o3r/schematics": "^12.5.0-prerelease.2",
|
|
119
119
|
"tslib": "^2.6.2"
|
|
120
120
|
},
|
|
121
|
+
"generatorDependencies": {
|
|
122
|
+
"@angular/cdk": "~19.2.0"
|
|
123
|
+
},
|
|
121
124
|
"engines": {
|
|
122
125
|
"node": "^20.11.1 || >=22.0.0"
|
|
123
126
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-base/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-base/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAQL,IAAI,EAKL,MAAM,4BAA4B,CAAC;AAqCpC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CA6Z/G;AA4CD,eAAO,MAAM,UAAU,wBAAqC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateI18n = void 0;
|
|
4
4
|
exports.updateLocalization = updateLocalization;
|
|
5
|
+
const fs = require("node:fs");
|
|
5
6
|
const path = require("node:path");
|
|
6
7
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
8
|
const schematics_2 = require("@o3r/schematics");
|
|
@@ -9,6 +10,8 @@ const utility_1 = require("@schematics/angular/utility");
|
|
|
9
10
|
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
10
11
|
const change_1 = require("@schematics/angular/utility/change");
|
|
11
12
|
const ts = require("typescript");
|
|
13
|
+
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
14
|
+
const ownPackageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' }));
|
|
12
15
|
/**
|
|
13
16
|
* Add Otter localization support
|
|
14
17
|
* @param options @see RuleFactory.options
|
|
@@ -298,6 +301,28 @@ function updateLocalization(options, rootPath) {
|
|
|
298
301
|
tree.commitUpdate(recorder);
|
|
299
302
|
return tree;
|
|
300
303
|
};
|
|
304
|
+
/**
|
|
305
|
+
* Add location required dependencies
|
|
306
|
+
* @param tree
|
|
307
|
+
*/
|
|
308
|
+
const addDependencies = (tree) => {
|
|
309
|
+
const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
|
310
|
+
const types = (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject);
|
|
311
|
+
const generatorDependencies = ['@ngx-translate/core', 'intl-messageformat', '@formatjs/intl-numberformat', '@angular/cdk'];
|
|
312
|
+
const dependencies = generatorDependencies.reduce((acc, dep) => {
|
|
313
|
+
acc[dep] = {
|
|
314
|
+
inManifest: [{
|
|
315
|
+
range: ownPackageJson.peerDependencies[dep],
|
|
316
|
+
types
|
|
317
|
+
}]
|
|
318
|
+
};
|
|
319
|
+
return acc;
|
|
320
|
+
}, {});
|
|
321
|
+
return (0, schematics_2.setupDependencies)({
|
|
322
|
+
projectName: options.projectName || undefined,
|
|
323
|
+
dependencies
|
|
324
|
+
});
|
|
325
|
+
};
|
|
301
326
|
// Ignore generated CMS metadata
|
|
302
327
|
const ignoreDevResourcesFiles = (tree, _context) => {
|
|
303
328
|
const workingDirectory = (options.projectName && (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName]?.root) || '.';
|
|
@@ -313,6 +338,7 @@ function updateLocalization(options, rootPath) {
|
|
|
313
338
|
generateLocalesFolder,
|
|
314
339
|
updateAngularJson,
|
|
315
340
|
updatePackageJson,
|
|
341
|
+
addDependencies,
|
|
316
342
|
setDefaultLanguage,
|
|
317
343
|
addMockTranslationModule,
|
|
318
344
|
ignoreDevResourcesFiles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,IAAI,EACL,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,IAAI,EACL,MAAM,4BAA4B,CAAC;AAmBpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AA0DlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
|
|
@@ -7,25 +7,7 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
7
7
|
const schematics_2 = require("@o3r/schematics");
|
|
8
8
|
const cms_adapter_1 = require("../cms-adapter");
|
|
9
9
|
const devtools_registration_1 = require("./helpers/devtools-registration");
|
|
10
|
-
/**
|
|
11
|
-
* List of external dependencies to be added to the project as peer dependencies
|
|
12
|
-
*/
|
|
13
10
|
const dependenciesToInstall = [
|
|
14
|
-
'@angular/cdk',
|
|
15
|
-
'@angular/common',
|
|
16
|
-
'@angular/core',
|
|
17
|
-
'@angular/platform-browser-dynamic',
|
|
18
|
-
'@formatjs/intl-numberformat',
|
|
19
|
-
'@ngrx/store',
|
|
20
|
-
'@ngx-translate/core',
|
|
21
|
-
'intl-messageformat',
|
|
22
|
-
'rxjs'
|
|
23
|
-
];
|
|
24
|
-
/**
|
|
25
|
-
* List of external dependencies to be added to the project as dev dependencies
|
|
26
|
-
*/
|
|
27
|
-
const devDependenciesToInstall = [
|
|
28
|
-
'@angular-devkit/core',
|
|
29
11
|
'chokidar',
|
|
30
12
|
'globby'
|
|
31
13
|
];
|
|
@@ -38,12 +20,11 @@ function ngAddFn(options) {
|
|
|
38
20
|
const { updateI18n, updateLocalization } = await Promise.resolve().then(() => require('../localization-base'));
|
|
39
21
|
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
40
22
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' }));
|
|
41
|
-
const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
|
42
|
-
const projectDirectory = workspaceProject?.root || '.';
|
|
43
|
-
const projectPackageJson = tree.readJson(path.posix.join(projectDirectory, 'package.json'));
|
|
44
23
|
const depsInfo = (0, schematics_2.getO3rPeerDeps)(packageJsonPath);
|
|
45
24
|
context.logger.info(`The package ${depsInfo.packageName} comes with a debug mechanism`);
|
|
46
25
|
context.logger.info('Get information on https://github.com/AmadeusITGroup/otter/tree/main/docs/localization/LOCALIZATION.md#Debugging');
|
|
26
|
+
const { NodeDependencyType } = await Promise.resolve().then(() => require('@schematics/angular/utility/dependencies'));
|
|
27
|
+
const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
|
47
28
|
const dependencies = depsInfo.o3rPeerDeps.reduce((acc, dep) => {
|
|
48
29
|
acc[dep] = {
|
|
49
30
|
inManifest: [{
|
|
@@ -54,13 +35,14 @@ function ngAddFn(options) {
|
|
|
54
35
|
};
|
|
55
36
|
return acc;
|
|
56
37
|
}, (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion));
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
Object.entries((0, schematics_2.getExternalDependenciesVersionRange)(dependenciesToInstall, packageJsonPath, context.logger)).forEach(([dep, range]) => {
|
|
39
|
+
dependencies[dep] = {
|
|
40
|
+
inManifest: [{
|
|
41
|
+
range,
|
|
42
|
+
types: [NodeDependencyType.Dev]
|
|
43
|
+
}]
|
|
44
|
+
};
|
|
45
|
+
});
|
|
64
46
|
const registerDevtoolRule = (0, devtools_registration_1.registerDevtools)(options);
|
|
65
47
|
return (0, schematics_1.chain)([
|
|
66
48
|
updateLocalization(options, __dirname),
|
|
@@ -68,10 +50,7 @@ function ngAddFn(options) {
|
|
|
68
50
|
options.skipLinter ? (0, schematics_1.noop)() : (0, schematics_2.applyEsLintFix)(),
|
|
69
51
|
(0, schematics_2.setupDependencies)({
|
|
70
52
|
projectName: options.projectName,
|
|
71
|
-
dependencies
|
|
72
|
-
...dependencies,
|
|
73
|
-
...externalDependenciesInfo
|
|
74
|
-
},
|
|
53
|
+
dependencies,
|
|
75
54
|
ngAddToRun: depsInfo.o3rPeerDeps
|
|
76
55
|
}),
|
|
77
56
|
(0, cms_adapter_1.updateCmsAdapter)(options),
|