@o3r/application 10.2.0-prerelease.14 → 10.2.0-prerelease.15
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 +6 -6
- package/schematics/ng-add/helpers/cms-registration.d.ts.map +1 -1
- package/schematics/ng-add/helpers/cms-registration.js +4 -4
- package/schematics/ng-add/helpers/cms-registration.js.map +1 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +54 -54
- package/schematics/ng-add/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/application",
|
|
3
|
-
"version": "10.2.0-prerelease.
|
|
3
|
+
"version": "10.2.0-prerelease.15",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"@angular-devkit/schematics": "~17.2.0",
|
|
29
29
|
"@angular/common": "~17.2.0",
|
|
30
30
|
"@angular/core": "~17.2.0",
|
|
31
|
-
"@o3r/core": "^10.2.0-prerelease.
|
|
32
|
-
"@o3r/logger": "^10.2.0-prerelease.
|
|
33
|
-
"@o3r/routing": "^10.2.0-prerelease.
|
|
34
|
-
"@o3r/schematics": "^10.2.0-prerelease.
|
|
35
|
-
"@o3r/testing": "^10.2.0-prerelease.
|
|
31
|
+
"@o3r/core": "^10.2.0-prerelease.15",
|
|
32
|
+
"@o3r/logger": "^10.2.0-prerelease.15",
|
|
33
|
+
"@o3r/routing": "^10.2.0-prerelease.15",
|
|
34
|
+
"@o3r/schematics": "^10.2.0-prerelease.15",
|
|
35
|
+
"@o3r/testing": "^10.2.0-prerelease.15",
|
|
36
36
|
"@schematics/angular": "~17.2.0",
|
|
37
37
|
"rxjs": "^7.8.1",
|
|
38
38
|
"typescript": "~5.3.3"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-registration.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/cms-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,IAAI,EAAiB,MAAM,4BAA4B,CAAC;AAC7H,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cms-registration.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/cms-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,IAAI,EAAiB,MAAM,4BAA4B,CAAC;AAC7H,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,YAAa,qBAAqB,KAAG,IActE,CAAC"}
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateCmsConfigFile = void 0;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const schematics_2 = require("@o3r/schematics");
|
|
6
5
|
/**
|
|
7
6
|
* Register Otter Application module to the application
|
|
8
7
|
* @param options
|
|
9
8
|
*/
|
|
10
9
|
const generateCmsConfigFile = (options) => {
|
|
11
|
-
return (tree
|
|
12
|
-
const
|
|
10
|
+
return async (tree) => {
|
|
11
|
+
const { getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
12
|
+
const workingDirectory = options?.projectName && getWorkspaceConfig(tree)?.projects[options.projectName]?.root || '.';
|
|
13
13
|
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
|
|
14
14
|
(0, schematics_1.template)({}),
|
|
15
15
|
(0, schematics_1.renameTemplateFiles)(),
|
|
16
16
|
(0, schematics_1.move)(workingDirectory)
|
|
17
17
|
]);
|
|
18
|
-
return (0, schematics_1.mergeWith)(templateSource, schematics_1.MergeStrategy.Default)
|
|
18
|
+
return (0, schematics_1.mergeWith)(templateSource, schematics_1.MergeStrategy.Default);
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
exports.generateCmsConfigFile = generateCmsConfigFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-registration.js","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/cms-registration.ts"],"names":[],"mappings":";;;AAAA,2DAA6H;
|
|
1
|
+
{"version":3,"file":"cms-registration.js","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/cms-registration.ts"],"names":[],"mappings":";;;AAAA,2DAA6H;AAG7H;;;GAGG;AACI,MAAM,qBAAqB,GAAG,CAAC,OAA8B,EAAQ,EAAE;IAC5E,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,EAAE,kBAAkB,EAAE,GAAG,2CAAa,iBAAiB,EAAC,CAAC;QAC/D,MAAM,gBAAgB,GAAG,OAAO,EAAE,WAAW,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,IAAI,IAAI,GAAG,CAAC;QACtH,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,aAAa,CAAC,EAC7C;YACE,IAAA,qBAAQ,EAAC,EAAE,CAAC;YACZ,IAAA,gCAAmB,GAAE;YACrB,IAAA,iBAAI,EAAC,gBAAgB,CAAC;SACvB,CACF,CAAC;QAEF,OAAO,IAAA,sBAAS,EAAC,cAAc,EAAE,0BAAa,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,qBAAqB,yBAchC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAG/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AA0GtD;;;GAGG;AACH,eAAO,MAAM,KAAK,YAAa,qBAAqB,KAAG,IAGtD,CAAC"}
|
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ngAdd = void 0;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const schematics_2 = require("@o3r/schematics");
|
|
6
5
|
const path = require("node:path");
|
|
7
6
|
const devtools_registration_1 = require("./helpers/devtools-registration");
|
|
8
7
|
const cms_registration_1 = require("./helpers/cms-registration");
|
|
8
|
+
const reportMissingSchematicsDep = (logger) => (reason) => {
|
|
9
|
+
logger.error(`[ERROR]: Adding @o3r/application has failed.
|
|
10
|
+
If the error is related to missing @o3r dependencies you need to install '@o3r/core' to be able to use the o3r application package. Please run 'ng add @o3r/core' .
|
|
11
|
+
Otherwise, use the error message as guidance.`);
|
|
12
|
+
throw reason;
|
|
13
|
+
};
|
|
9
14
|
/**
|
|
10
15
|
* Add Otter application to an Angular Project
|
|
11
16
|
* @param options The options to pass to ng-add execution
|
|
@@ -13,65 +18,60 @@ const cms_registration_1 = require("./helpers/cms-registration");
|
|
|
13
18
|
function ngAddFn(options) {
|
|
14
19
|
/* ng add rules */
|
|
15
20
|
return async (tree, context) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
if (!moduleFilePath) {
|
|
26
|
-
return tree;
|
|
27
|
-
}
|
|
28
|
-
const sourceFileContent = tree.readText(moduleFilePath);
|
|
29
|
-
const sourceFile = ts.createSourceFile(moduleFilePath, sourceFileContent, ts.ScriptTarget.ES2015, true);
|
|
30
|
-
if (isImported(sourceFile, 'prefersReducedMotion', '@o3r/application')) {
|
|
31
|
-
context.logger.info('[LOG]: prefersReducedMotion from @o3r/application is already imported.');
|
|
32
|
-
return tree;
|
|
33
|
-
}
|
|
34
|
-
const recorder = tree.beginUpdate(moduleFilePath);
|
|
35
|
-
const { moduleIndex } = getModuleIndex(sourceFile, sourceFileContent);
|
|
36
|
-
insertImportToModuleFile('prefersReducedMotion', '@o3r/application', sourceFile, recorder, moduleFilePath);
|
|
37
|
-
addImportToModuleFile('BrowserAnimationsModule', '@angular/platform-browser/animations', sourceFile, sourceFileContent, context, recorder, moduleFilePath, moduleIndex, '.withConfig({disableAnimations: prefersReducedMotion()})', true);
|
|
38
|
-
tree.commitUpdate(recorder);
|
|
21
|
+
const { addImportToModuleFile, getAppModuleFilePath, getModuleIndex, getWorkspaceConfig, insertImportToModuleFile, setupDependencies, getO3rPeerDeps, getProjectNewDependenciesTypes, getPackageInstallConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
22
|
+
const { isImported } = await Promise.resolve().then(() => require('@schematics/angular/utility/ast-utils'));
|
|
23
|
+
const ts = await Promise.resolve().then(() => require('typescript'));
|
|
24
|
+
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
25
|
+
const depsInfo = getO3rPeerDeps(packageJsonPath);
|
|
26
|
+
const workspaceProject = options.projectName ? getWorkspaceConfig(tree)?.projects[options.projectName] : undefined;
|
|
27
|
+
const addAngularAnimationPreferences = () => {
|
|
28
|
+
const moduleFilePath = getAppModuleFilePath(tree, context, options.projectName);
|
|
29
|
+
if (!moduleFilePath) {
|
|
39
30
|
return tree;
|
|
31
|
+
}
|
|
32
|
+
const sourceFileContent = tree.readText(moduleFilePath);
|
|
33
|
+
const sourceFile = ts.createSourceFile(moduleFilePath, sourceFileContent, ts.ScriptTarget.ES2015, true);
|
|
34
|
+
if (isImported(sourceFile, 'prefersReducedMotion', '@o3r/application')) {
|
|
35
|
+
context.logger.info('[LOG]: prefersReducedMotion from @o3r/application is already imported.');
|
|
36
|
+
return tree;
|
|
37
|
+
}
|
|
38
|
+
const recorder = tree.beginUpdate(moduleFilePath);
|
|
39
|
+
const { moduleIndex } = getModuleIndex(sourceFile, sourceFileContent);
|
|
40
|
+
insertImportToModuleFile('prefersReducedMotion', '@o3r/application', sourceFile, recorder, moduleFilePath);
|
|
41
|
+
addImportToModuleFile('BrowserAnimationsModule', '@angular/platform-browser/animations', sourceFile, sourceFileContent, context, recorder, moduleFilePath, moduleIndex, '.withConfig({disableAnimations: prefersReducedMotion()})', true);
|
|
42
|
+
tree.commitUpdate(recorder);
|
|
43
|
+
return tree;
|
|
44
|
+
};
|
|
45
|
+
const dependencies = depsInfo.o3rPeerDeps.reduce((acc, dep) => {
|
|
46
|
+
acc[dep] = {
|
|
47
|
+
inManifest: [{
|
|
48
|
+
range: `${options.exactO3rVersion ? '' : '~'}${depsInfo.packageVersion}`,
|
|
49
|
+
types: getProjectNewDependenciesTypes(workspaceProject)
|
|
50
|
+
}],
|
|
51
|
+
ngAddOptions: { exactO3rVersion: options.exactO3rVersion }
|
|
40
52
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
projectName: options.projectName,
|
|
55
|
-
dependencies,
|
|
56
|
-
ngAddToRun: depsInfo.o3rPeerDeps
|
|
57
|
-
}),
|
|
58
|
-
addAngularAnimationPreferences,
|
|
59
|
-
registerDevtoolRule,
|
|
60
|
-
(0, cms_registration_1.generateCmsConfigFile)(options)
|
|
61
|
-
])(tree, context);
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
// o3r application needs o3r/core as peer dep. o3r/core will install o3r/schematics
|
|
65
|
-
context.logger.error(`[ERROR]: Adding @o3r/application has failed.
|
|
66
|
-
If the error is related to missing @o3r dependencies you need to install '@o3r/core' to be able to use the o3r application package. Please run 'ng add @o3r/core' .
|
|
67
|
-
Otherwise, use the error message as guidance.`);
|
|
68
|
-
throw (e);
|
|
69
|
-
}
|
|
53
|
+
return acc;
|
|
54
|
+
}, getPackageInstallConfig(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion));
|
|
55
|
+
const registerDevtoolRule = await (0, devtools_registration_1.registerDevtools)(options);
|
|
56
|
+
return () => (0, schematics_1.chain)([
|
|
57
|
+
setupDependencies({
|
|
58
|
+
projectName: options.projectName,
|
|
59
|
+
dependencies,
|
|
60
|
+
ngAddToRun: depsInfo.o3rPeerDeps
|
|
61
|
+
}),
|
|
62
|
+
addAngularAnimationPreferences,
|
|
63
|
+
registerDevtoolRule,
|
|
64
|
+
(0, cms_registration_1.generateCmsConfigFile)(options)
|
|
65
|
+
])(tree, context);
|
|
70
66
|
};
|
|
71
67
|
}
|
|
72
68
|
/**
|
|
73
69
|
* Add Otter application to an Angular Project
|
|
74
70
|
* @param options The options to pass to ng-add execution
|
|
75
71
|
*/
|
|
76
|
-
|
|
72
|
+
const ngAdd = (options) => async (_, { logger }) => {
|
|
73
|
+
const { createSchematicWithMetricsIfInstalled } = await Promise.resolve().then(() => require('@o3r/schematics')).catch(reportMissingSchematicsDep(logger));
|
|
74
|
+
return createSchematicWithMetricsIfInstalled(ngAddFn)(options);
|
|
75
|
+
};
|
|
76
|
+
exports.ngAdd = ngAdd;
|
|
77
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AACA,2DAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AACA,2DAAmD;AACnD,kCAAkC;AAElC,2EAAmE;AACnE,iEAAmE;AAEnE,MAAM,0BAA0B,GAAG,CAAC,MAA2C,EAAE,EAAE,CAAC,CAAC,MAAW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