@o3r/localization 10.0.0-prerelease.103 → 10.0.0-prerelease.104
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": "10.0.0-prerelease.
|
|
3
|
+
"version": "10.0.0-prerelease.104",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -43,13 +43,14 @@
|
|
|
43
43
|
"@formatjs/intl-numberformat": "^8.0.2",
|
|
44
44
|
"@ngrx/store": "~17.1.0",
|
|
45
45
|
"@ngx-translate/core": "~15.0.0",
|
|
46
|
-
"@o3r/core": "^10.0.0-prerelease.
|
|
47
|
-
"@o3r/dynamic-content": "^10.0.0-prerelease.
|
|
48
|
-
"@o3r/extractors": "^10.0.0-prerelease.
|
|
49
|
-
"@o3r/logger": "^10.0.0-prerelease.
|
|
50
|
-
"@o3r/schematics": "^10.0.0-prerelease.
|
|
46
|
+
"@o3r/core": "^10.0.0-prerelease.104",
|
|
47
|
+
"@o3r/dynamic-content": "^10.0.0-prerelease.104",
|
|
48
|
+
"@o3r/extractors": "^10.0.0-prerelease.104",
|
|
49
|
+
"@o3r/logger": "^10.0.0-prerelease.104",
|
|
50
|
+
"@o3r/schematics": "^10.0.0-prerelease.104",
|
|
51
51
|
"@schematics/angular": "~17.2.0",
|
|
52
52
|
"chokidar": "^3.5.2",
|
|
53
|
+
"globby": "^11.1.0",
|
|
53
54
|
"intl-messageformat": "~10.5.0",
|
|
54
55
|
"rxjs": "^7.8.1",
|
|
55
56
|
"typescript": "~5.2.2"
|
|
@@ -76,6 +77,9 @@
|
|
|
76
77
|
"chokidar": {
|
|
77
78
|
"optional": true
|
|
78
79
|
},
|
|
80
|
+
"globby": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
79
83
|
"typescript": {
|
|
80
84
|
"optional": true
|
|
81
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,IAAI,EAAyC,MAAM,4BAA4B,CAAC;AAgC7I;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,IAAI,EAAyC,MAAM,4BAA4B,CAAC;AAgC7I;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAob/G;AAiDD,eAAO,MAAM,UAAU;kBA1CuB,MAAM,GAAG,SAAS;UA0Ca,CAAC"}
|
|
@@ -7,12 +7,10 @@ const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
|
7
7
|
const utility_1 = require("@schematics/angular/utility");
|
|
8
8
|
const change_1 = require("@schematics/angular/utility/change");
|
|
9
9
|
const path = require("node:path");
|
|
10
|
+
const fs = require("node:fs");
|
|
10
11
|
const ts = require("typescript");
|
|
11
12
|
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
12
|
-
const
|
|
13
|
-
const intlMessageFormatDep = 'intl-messageformat';
|
|
14
|
-
const formatjsIntlNumberformatDep = '@formatjs/intl-numberformat';
|
|
15
|
-
const angularCdkDep = '@angular/cdk';
|
|
13
|
+
const ownPackageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
|
|
16
14
|
/**
|
|
17
15
|
* Add Otter localization support
|
|
18
16
|
* @param options @see RuleFactory.options
|
|
@@ -330,21 +328,24 @@ function updateLocalization(options, rootPath) {
|
|
|
330
328
|
/**
|
|
331
329
|
* Add location required dependencies
|
|
332
330
|
* @param tree
|
|
333
|
-
* @param _context
|
|
334
|
-
* @param context
|
|
335
331
|
*/
|
|
336
|
-
const addDependencies = (tree
|
|
332
|
+
const addDependencies = (tree) => {
|
|
337
333
|
const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
|
338
|
-
const
|
|
339
|
-
const
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
334
|
+
const types = (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject);
|
|
335
|
+
const generatorDependencies = ['@ngx-translate/core', 'intl-messageformat', '@formatjs/intl-numberformat', '@angular/cdk'];
|
|
336
|
+
const dependencies = generatorDependencies.reduce((acc, dep) => {
|
|
337
|
+
acc[dep] = {
|
|
338
|
+
inManifest: [{
|
|
339
|
+
range: ownPackageJson.peerDependencies[dep],
|
|
340
|
+
types
|
|
341
|
+
}]
|
|
342
|
+
};
|
|
343
|
+
return acc;
|
|
344
|
+
}, {});
|
|
345
|
+
return (0, schematics_2.setupDependencies)({
|
|
346
|
+
projectName: options.projectName || undefined,
|
|
347
|
+
dependencies
|
|
348
|
+
});
|
|
348
349
|
};
|
|
349
350
|
// Ignore generated CMS metadata
|
|
350
351
|
const ignoreDevResourcesFiles = (tree, _context) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAKvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAKvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAgFtD;;;GAGG;AACH,eAAO,MAAM,KAAK,0CAAiD,CAAC"}
|
|
@@ -7,6 +7,10 @@ const path = require("node:path");
|
|
|
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
|
+
const dependenciesToInstall = [
|
|
11
|
+
'chokidar',
|
|
12
|
+
'globby'
|
|
13
|
+
];
|
|
10
14
|
/**
|
|
11
15
|
* Add Otter localization to an Angular Project
|
|
12
16
|
* @param options for the dependencies installations
|
|
@@ -14,7 +18,7 @@ const devtools_registration_1 = require("./helpers/devtools-registration");
|
|
|
14
18
|
function ngAddFn(options) {
|
|
15
19
|
return async (tree, context) => {
|
|
16
20
|
try {
|
|
17
|
-
const { applyEsLintFix,
|
|
21
|
+
const { applyEsLintFix, getPackageInstallConfig, getProjectNewDependenciesTypes, getWorkspaceConfig, setupDependencies, getO3rPeerDeps, getExternalDependenciesVersionRange } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
18
22
|
const { updateI18n, updateLocalization } = await Promise.resolve().then(() => require('../localization-base'));
|
|
19
23
|
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
20
24
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
|
|
@@ -24,34 +28,39 @@ function ngAddFn(options) {
|
|
|
24
28
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
25
29
|
const { NodeDependencyType } = await Promise.resolve().then(() => require('@schematics/angular/utility/dependencies'));
|
|
26
30
|
const workspaceProject = options.projectName ? getWorkspaceConfig(tree)?.projects[options.projectName] : undefined;
|
|
27
|
-
const
|
|
28
|
-
|
|
31
|
+
const dependencies = depsInfo.o3rPeerDeps.reduce((acc, dep) => {
|
|
32
|
+
acc[dep] = {
|
|
33
|
+
inManifest: [{
|
|
34
|
+
range: `~${depsInfo.packageVersion}`,
|
|
35
|
+
types: getProjectNewDependenciesTypes(workspaceProject)
|
|
36
|
+
}]
|
|
37
|
+
};
|
|
38
|
+
return acc;
|
|
39
|
+
}, getPackageInstallConfig(packageJsonPath, tree, options.projectName));
|
|
40
|
+
Object.entries(getExternalDependenciesVersionRange(dependenciesToInstall, packageJsonPath)).forEach(([dep, range]) => {
|
|
41
|
+
dependencies[dep] = {
|
|
42
|
+
inManifest: [{
|
|
43
|
+
range,
|
|
44
|
+
types: [NodeDependencyType.Dev]
|
|
45
|
+
}]
|
|
46
|
+
};
|
|
47
|
+
});
|
|
29
48
|
const registerDevtoolRule = await (0, devtools_registration_1.registerDevtools)(options);
|
|
30
49
|
return () => (0, schematics_1.chain)([
|
|
31
50
|
updateLocalization(options, __dirname),
|
|
32
51
|
updateI18n(options),
|
|
33
52
|
options.skipLinter ? (0, schematics_1.noop)() : applyEsLintFix(),
|
|
34
|
-
|
|
35
|
-
options.skipInstall ? schematics_1.noop : install,
|
|
36
|
-
(t, c) => ngAddPackages(depsInfo.o3rPeerDeps, {
|
|
37
|
-
skipConfirmation: true,
|
|
38
|
-
version: depsInfo.packageVersion,
|
|
39
|
-
parentPackageInfo: `${depsInfo.packageName} - setup`,
|
|
53
|
+
setupDependencies({
|
|
40
54
|
projectName: options.projectName,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
ngAddPeerDependencyPackages(['chokidar'], packageJsonPath, NodeDependencyType.Dev, { ...options, workingDirectory, skipNgAddSchematicRun: true }, '@o3r/localization - install builder dependency'),
|
|
55
|
+
dependencies,
|
|
56
|
+
ngAddToRun: depsInfo.o3rPeerDeps
|
|
57
|
+
}),
|
|
45
58
|
(0, cms_adapter_1.updateCmsAdapter)(options),
|
|
46
59
|
(0, schematics_2.registerPackageCollectionSchematics)(packageJson),
|
|
47
60
|
(0, schematics_2.setupSchematicsDefaultParams)({
|
|
48
61
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
49
|
-
'@o3r/core:component': {
|
|
50
|
-
useLocalization:
|
|
51
|
-
},
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
53
|
-
'@o3r/core:component-presenter': {
|
|
54
|
-
useLocalization: undefined
|
|
62
|
+
'@o3r/core:component*': {
|
|
63
|
+
useLocalization: true
|
|
55
64
|
}
|
|
56
65
|
}),
|
|
57
66
|
registerDevtoolRule
|