@o3r/core 11.1.0-prerelease.49 → 11.1.0-prerelease.50
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/core",
|
|
3
|
-
"version": "11.1.0-prerelease.
|
|
3
|
+
"version": "11.1.0-prerelease.50",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@ngrx/entity": "~18.0.0",
|
|
26
26
|
"@ngrx/store": "~18.0.0",
|
|
27
27
|
"@nx/angular": "~19.5.0",
|
|
28
|
-
"@o3r/telemetry": "^11.1.0-prerelease.
|
|
28
|
+
"@o3r/telemetry": "^11.1.0-prerelease.50",
|
|
29
29
|
"@schematics/angular": "~18.1.0",
|
|
30
30
|
"chokidar": "^3.5.2",
|
|
31
31
|
"globby": "^11.1.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@o3r/schematics": "^11.1.0-prerelease.
|
|
62
|
+
"@o3r/schematics": "^11.1.0-prerelease.50",
|
|
63
63
|
"tslib": "^2.6.2",
|
|
64
64
|
"uuid": "^10.0.0"
|
|
65
65
|
},
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@ngrx/router-store": "~18.0.0",
|
|
70
70
|
"@ngrx/effects": "~18.0.0",
|
|
71
71
|
"@ngrx/store-devtools": "~18.0.0",
|
|
72
|
-
"@o3r/store-sync": "^11.1.0-prerelease.
|
|
72
|
+
"@o3r/store-sync": "^11.1.0-prerelease.50",
|
|
73
73
|
"@types/jest": "~29.5.2",
|
|
74
74
|
"nx": "~19.5.0",
|
|
75
75
|
"@typescript-eslint/parser": "^7.14.1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/page/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA8F,IAAI,EAAoD,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/page/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA8F,IAAI,EAAoD,MAAM,4BAA4B,CAAC;AAehM,OAAO,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AA6O1D;;;GAGG;AACH,eAAO,MAAM,cAAc,mDAA0D,CAAC"}
|
package/schematics/page/index.js
CHANGED
|
@@ -134,7 +134,29 @@ function ngGeneratePageFn(options) {
|
|
|
134
134
|
import: `./${indexFilePath.replace(/[\\/]/g, '/')}`,
|
|
135
135
|
module: `${pageName}${options.standalone ? 'Component' : 'Module'}`
|
|
136
136
|
};
|
|
137
|
-
|
|
137
|
+
if (options.appRoutingModulePath) {
|
|
138
|
+
return (0, schematics_2.insertRoute)(tree, context, options.appRoutingModulePath, route, options.standalone);
|
|
139
|
+
}
|
|
140
|
+
const appModuleFilePath = (0, schematics_2.getAppModuleFilePath)(tree, context, options.projectName);
|
|
141
|
+
if (appModuleFilePath) {
|
|
142
|
+
const text = tree.readText(appModuleFilePath);
|
|
143
|
+
const match = text.match(/(provideRouter|RouterModule\.forRoot)\((\s*)?(?<routeVarName>[^,\s)]*)/);
|
|
144
|
+
const routeVariableName = match?.groups?.routeVarName;
|
|
145
|
+
if (routeVariableName) {
|
|
146
|
+
const sourceFile = ts.createSourceFile(appModuleFilePath, text, ts.ScriptTarget.ES2015, true);
|
|
147
|
+
const importStatement = sourceFile.statements.find((statement) => ts.isImportDeclaration(statement)
|
|
148
|
+
&& !!statement?.moduleSpecifier
|
|
149
|
+
&& ts.isStringLiteral(statement.moduleSpecifier)
|
|
150
|
+
&& !!statement.importClause?.namedBindings
|
|
151
|
+
&& ts.isNamedImports(statement.importClause.namedBindings)
|
|
152
|
+
&& statement.importClause.namedBindings.elements.some((element) => element.name.escapedText === routeVariableName));
|
|
153
|
+
const importRouteVariablePath = importStatement?.moduleSpecifier?.text;
|
|
154
|
+
// If importRouteVariablePath is undefined it is because the variable is defined in this file
|
|
155
|
+
const appRoutingModulePath = importRouteVariablePath ? path.join(path.dirname(appModuleFilePath), `${importRouteVariablePath}.ts`) : appModuleFilePath;
|
|
156
|
+
return (0, schematics_2.insertRoute)(tree, context, appRoutingModulePath, route, options.standalone);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
throw new schematics_2.O3rCliError('No routes definition found. Please use the option `appRoutingModulePath` to specify the path of the routes definition.');
|
|
138
160
|
};
|
|
139
161
|
return (0, schematics_1.chain)([
|
|
140
162
|
isApplication,
|
|
@@ -7,7 +7,7 @@ export interface NgGeneratePageSchematicsSchema extends SchematicOptionObject {
|
|
|
7
7
|
/** Page scope */
|
|
8
8
|
scope: string;
|
|
9
9
|
/** Application routing module path */
|
|
10
|
-
appRoutingModulePath
|
|
10
|
+
appRoutingModulePath?: string | undefined;
|
|
11
11
|
/** Selector prefix */
|
|
12
12
|
prefix?: string | undefined;
|
|
13
13
|
/** Directory containing the pages */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/page/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,8BAA+B,SAAQ,qBAAqB;IAC3E,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,oBAAoB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/page/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,8BAA+B,SAAQ,qBAAqB;IAC3E,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1C,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IAEpB,kEAAkE;IAClE,eAAe,EAAE,OAAO,CAAC;IAEzB,2DAA2D;IAC3D,cAAc,EAAE,OAAO,CAAC;IAExB,oDAAoD;IACpD,eAAe,EAAE,OAAO,CAAC;IAEzB,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;IAEpB,uCAAuC;IACvC,eAAe,EAAE,OAAO,CAAC;IAEzB,4BAA4B;IAC5B,aAAa,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -28,9 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"appRoutingModulePath": {
|
|
30
30
|
"type": "string",
|
|
31
|
-
"description": "Application routing module path"
|
|
32
|
-
"default": "./src/app/app-routing.module.ts",
|
|
33
|
-
"x-prompt": "Application routing module path?"
|
|
31
|
+
"description": "Application routing module path"
|
|
34
32
|
},
|
|
35
33
|
"prefix": {
|
|
36
34
|
"type": "string",
|
|
@@ -74,7 +72,6 @@
|
|
|
74
72
|
},
|
|
75
73
|
"additionalProperties": true,
|
|
76
74
|
"required": [
|
|
77
|
-
"name"
|
|
78
|
-
"appRoutingModulePath"
|
|
75
|
+
"name"
|
|
79
76
|
]
|
|
80
77
|
}
|