@o3r/localization 12.3.0-prerelease.48 → 12.3.0-prerelease.49
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 +7 -6
- package/schematics/ng-add/helpers/devtools-registration.d.ts +1 -1
- package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -1
- package/schematics/ng-add/helpers/devtools-registration.js +4 -4
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +12 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/localization",
|
|
3
|
-
"version": "12.3.0-prerelease.
|
|
3
|
+
"version": "12.3.0-prerelease.49",
|
|
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.3.0-prerelease.
|
|
48
|
-
"@o3r/dynamic-content": "^12.3.0-prerelease.
|
|
49
|
-
"@o3r/extractors": "^12.3.0-prerelease.
|
|
50
|
-
"@o3r/logger": "^12.3.0-prerelease.
|
|
51
|
-
"@o3r/schematics": "^12.3.0-prerelease.
|
|
47
|
+
"@o3r/core": "^12.3.0-prerelease.49",
|
|
48
|
+
"@o3r/dynamic-content": "^12.3.0-prerelease.49",
|
|
49
|
+
"@o3r/extractors": "^12.3.0-prerelease.49",
|
|
50
|
+
"@o3r/logger": "^12.3.0-prerelease.49",
|
|
51
|
+
"@o3r/schematics": "^12.3.0-prerelease.49",
|
|
52
52
|
"@schematics/angular": "^19.0.0",
|
|
53
53
|
"@yarnpkg/cli": "^4.3.1",
|
|
54
54
|
"@yarnpkg/core": "^4.1.1",
|
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
+
"@o3r/schematics": "^12.3.0-prerelease.49",
|
|
118
119
|
"tslib": "^2.6.2"
|
|
119
120
|
},
|
|
120
121
|
"engines": {
|
|
@@ -4,5 +4,5 @@ import type { NgAddSchematicsSchema } from '../schema';
|
|
|
4
4
|
* Register Devtools to the application
|
|
5
5
|
* @param options
|
|
6
6
|
*/
|
|
7
|
-
export declare const registerDevtools: (options: NgAddSchematicsSchema) =>
|
|
7
|
+
export declare const registerDevtools: (options: NgAddSchematicsSchema) => Rule;
|
|
8
8
|
//# sourceMappingURL=devtools-registration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-registration.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/devtools-registration.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,IAAI,EACL,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"devtools-registration.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/devtools-registration.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,IAAI,EACL,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,WAAW,CAAC;AAOnB;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,qBAAqB,KAAG,IAejE,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.registerDevtools = void 0;
|
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
const path = require("node:path");
|
|
6
6
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
|
+
const schematics_2 = require("@o3r/schematics");
|
|
7
8
|
const DEVTOOL_MODULE_NAME = 'LocalizationDevtoolsModule';
|
|
8
9
|
const MESSAGE_DEVTOOL_SERVICE_NAME = 'LocalizationDevtoolsMessageService';
|
|
9
10
|
const CONSOLE_DEVTOOL_SERVICE_NAME = 'LocalizationDevtoolsConsoleService';
|
|
@@ -12,16 +13,15 @@ const PACKAGE_NAME = JSON.parse((0, node_fs_1.readFileSync)(path.resolve(__dirna
|
|
|
12
13
|
* Register Devtools to the application
|
|
13
14
|
* @param options
|
|
14
15
|
*/
|
|
15
|
-
const registerDevtools =
|
|
16
|
-
const { registerDevtoolsToApplication } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
16
|
+
const registerDevtools = (options) => {
|
|
17
17
|
return (0, schematics_1.chain)([
|
|
18
|
-
registerDevtoolsToApplication({
|
|
18
|
+
(0, schematics_2.registerDevtoolsToApplication)({
|
|
19
19
|
moduleName: DEVTOOL_MODULE_NAME,
|
|
20
20
|
packageName: PACKAGE_NAME,
|
|
21
21
|
serviceName: MESSAGE_DEVTOOL_SERVICE_NAME,
|
|
22
22
|
projectName: options.projectName
|
|
23
23
|
}),
|
|
24
|
-
registerDevtoolsToApplication({
|
|
24
|
+
(0, schematics_2.registerDevtoolsToApplication)({
|
|
25
25
|
moduleName: DEVTOOL_MODULE_NAME,
|
|
26
26
|
packageName: PACKAGE_NAME,
|
|
27
27
|
serviceName: CONSOLE_DEVTOOL_SERVICE_NAME,
|
|
@@ -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"}
|
|
@@ -4,44 +4,38 @@ exports.ngAdd = void 0;
|
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const path = require("node:path");
|
|
6
6
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
|
+
const schematics_2 = require("@o3r/schematics");
|
|
7
8
|
const cms_adapter_1 = require("../cms-adapter");
|
|
8
9
|
const devtools_registration_1 = require("./helpers/devtools-registration");
|
|
9
10
|
const dependenciesToInstall = [
|
|
10
11
|
'chokidar',
|
|
11
12
|
'globby'
|
|
12
13
|
];
|
|
13
|
-
const reportMissingSchematicsDep = (logger) => (reason) => {
|
|
14
|
-
logger.error(`[ERROR]: Adding @o3r/localization has failed.
|
|
15
|
-
If the error is related to missing @o3r dependencies you need to install '@o3r/core' to be able to use the localization package. Please run 'ng add @o3r/core' .
|
|
16
|
-
Otherwise, use the error message as guidance.`);
|
|
17
|
-
throw reason;
|
|
18
|
-
};
|
|
19
14
|
/**
|
|
20
15
|
* Add Otter localization to an Angular Project
|
|
21
16
|
* @param options for the dependencies installations
|
|
22
17
|
*/
|
|
23
18
|
function ngAddFn(options) {
|
|
24
19
|
return async (tree, context) => {
|
|
25
|
-
const { applyEsLintFix, getPackageInstallConfig, getProjectNewDependenciesTypes, getWorkspaceConfig, setupDependencies, getO3rPeerDeps, getExternalDependenciesVersionRange, registerPackageCollectionSchematics, setupSchematicsParamsForProject } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
26
20
|
const { updateI18n, updateLocalization } = await Promise.resolve().then(() => require('../localization-base'));
|
|
27
21
|
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
28
22
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' }));
|
|
29
|
-
const depsInfo = getO3rPeerDeps(packageJsonPath);
|
|
23
|
+
const depsInfo = (0, schematics_2.getO3rPeerDeps)(packageJsonPath);
|
|
30
24
|
context.logger.info(`The package ${depsInfo.packageName} comes with a debug mechanism`);
|
|
31
25
|
context.logger.info('Get information on https://github.com/AmadeusITGroup/otter/tree/main/docs/localization/LOCALIZATION.md#Debugging');
|
|
32
26
|
const { NodeDependencyType } = await Promise.resolve().then(() => require('@schematics/angular/utility/dependencies'));
|
|
33
|
-
const workspaceProject = options.projectName ? getWorkspaceConfig(tree)?.projects[options.projectName] : undefined;
|
|
27
|
+
const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
|
|
34
28
|
const dependencies = depsInfo.o3rPeerDeps.reduce((acc, dep) => {
|
|
35
29
|
acc[dep] = {
|
|
36
30
|
inManifest: [{
|
|
37
31
|
range: `${options.exactO3rVersion ? '' : '~'}${depsInfo.packageVersion}`,
|
|
38
|
-
types: getProjectNewDependenciesTypes(workspaceProject)
|
|
32
|
+
types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
|
|
39
33
|
}],
|
|
40
34
|
ngAddOptions: { exactO3rVersion: options.exactO3rVersion }
|
|
41
35
|
};
|
|
42
36
|
return acc;
|
|
43
|
-
}, getPackageInstallConfig(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion));
|
|
44
|
-
Object.entries(getExternalDependenciesVersionRange(dependenciesToInstall, packageJsonPath, context.logger)).forEach(([dep, range]) => {
|
|
37
|
+
}, (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion));
|
|
38
|
+
Object.entries((0, schematics_2.getExternalDependenciesVersionRange)(dependenciesToInstall, packageJsonPath, context.logger)).forEach(([dep, range]) => {
|
|
45
39
|
dependencies[dep] = {
|
|
46
40
|
inManifest: [{
|
|
47
41
|
range,
|
|
@@ -49,19 +43,19 @@ function ngAddFn(options) {
|
|
|
49
43
|
}]
|
|
50
44
|
};
|
|
51
45
|
});
|
|
52
|
-
const registerDevtoolRule =
|
|
46
|
+
const registerDevtoolRule = (0, devtools_registration_1.registerDevtools)(options);
|
|
53
47
|
return (0, schematics_1.chain)([
|
|
54
48
|
updateLocalization(options, __dirname),
|
|
55
49
|
updateI18n(options),
|
|
56
|
-
options.skipLinter ? (0, schematics_1.noop)() : applyEsLintFix(),
|
|
57
|
-
setupDependencies({
|
|
50
|
+
options.skipLinter ? (0, schematics_1.noop)() : (0, schematics_2.applyEsLintFix)(),
|
|
51
|
+
(0, schematics_2.setupDependencies)({
|
|
58
52
|
projectName: options.projectName,
|
|
59
53
|
dependencies,
|
|
60
54
|
ngAddToRun: depsInfo.o3rPeerDeps
|
|
61
55
|
}),
|
|
62
56
|
(0, cms_adapter_1.updateCmsAdapter)(options),
|
|
63
|
-
registerPackageCollectionSchematics(packageJson),
|
|
64
|
-
setupSchematicsParamsForProject({ '@o3r/core:component*': { useLocalization: true } }, options.projectName),
|
|
57
|
+
(0, schematics_2.registerPackageCollectionSchematics)(packageJson),
|
|
58
|
+
(0, schematics_2.setupSchematicsParamsForProject)({ '@o3r/core:component*': { useLocalization: true } }, options.projectName),
|
|
65
59
|
registerDevtoolRule
|
|
66
60
|
]);
|
|
67
61
|
};
|
|
@@ -70,9 +64,6 @@ function ngAddFn(options) {
|
|
|
70
64
|
* Add Otter localization to an Angular Project
|
|
71
65
|
* @param options for the dependencies installations
|
|
72
66
|
*/
|
|
73
|
-
const ngAdd = (options) =>
|
|
74
|
-
const { createOtterSchematic } = await Promise.resolve().then(() => require('@o3r/schematics')).catch(reportMissingSchematicsDep(logger));
|
|
75
|
-
return createOtterSchematic(ngAddFn)(options);
|
|
76
|
-
};
|
|
67
|
+
const ngAdd = (options) => (0, schematics_2.createOtterSchematic)(ngAddFn)(options);
|
|
77
68
|
exports.ngAdd = ngAdd;
|
|
78
69
|
//# sourceMappingURL=index.js.map
|