@egen-civitas/egen 2.1.1 → 2.3.0
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/CHANGELOG.md +32 -0
- package/README.md +11 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +25 -3
- package/dist/commands/build.d.ts +2 -0
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +1 -0
- package/dist/commands/develop.d.ts.map +1 -1
- package/dist/commands/develop.js +10 -1
- package/dist/utils/brand.d.ts +18 -0
- package/dist/utils/brand.d.ts.map +1 -0
- package/dist/utils/brand.js +31 -0
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +10 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @egen-civitas/egen
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 669cbd6: Réforme multiplateforme, lot P0 (docs/EGEN-FRAMEWORK-DEV.md) :
|
|
8
|
+
|
|
9
|
+
- esm-globals : `EgenTarget`, `CapabilityName`, `getEgenTarget()`, `isNativeTarget()`.
|
|
10
|
+
- esm-platform (nouveau package, 1.0.0) : contrats des capacités (annexe 2), `PlatformError`, détection de la cible, `getPlatform()` (adaptateur Web : session vide, `openExternal`, `lifecycle`, `files.select`, `camera`, `permissions` ; jamais de faux coffre ni de biométrie simulée. En natif, aucune capacité tant que le client de pont n'est pas branché, `ready` rejette `INCOMPATIBLE` sans Host), `createMockPlatform` (sous-chemin `/testing`).
|
|
11
|
+
- esm-framework : ré-export de `@egen-civitas/esm-platform` (`index`, `internal`, mocks).
|
|
12
|
+
- egen (CLI) : option `build --platform web|android|ios`.
|
|
13
|
+
- esm-api : `setAuthorizationProvider` (jeton fourni par la plateforme, rafraîchissement unique sur 401, rejeu GET/HEAD, politique `credentials`) ; `FetchConfig.replayOnUnauthorized` ; `isDevAuthBypassEnabled()` inerte en natif. Sans fournisseur, comportement inchangé.
|
|
14
|
+
- esm-dynamic-loading : overrides d'import map et de route map désactivés en cible native.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [d1d2d7d]
|
|
19
|
+
- Updated dependencies [b3d9419]
|
|
20
|
+
- Updated dependencies [ef3c97f]
|
|
21
|
+
- Updated dependencies [478e80c]
|
|
22
|
+
- @egen-civitas/esm-app-shell@2.9.0
|
|
23
|
+
|
|
24
|
+
## 2.2.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- 33f2197: Support de `EGEN_BRAND_DIR` (variable d'environnement ou `.env*` du monorepo consommateur) : `egen develop` sert ce dossier avant le `dist` pré-compilé de l'app-shell, et `egen build` le transmet au shell avec un chemin absolu (le build s'exécute depuis `node_modules`, où un chemin relatif ne désignerait plus rien). Le projet client peut ainsi fournir son favicon et son icône PWA sans qu'aucune identité visuelle ne soit embarquée dans le framework. Un chemin invalide est ignoré avec un avertissement.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [33f2197]
|
|
33
|
+
- @egen-civitas/esm-app-shell@2.7.0
|
|
34
|
+
|
|
3
35
|
## 2.1.1
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -69,3 +69,14 @@ Example:
|
|
|
69
69
|
# run the command
|
|
70
70
|
npx @egen-civitas/egen assemble
|
|
71
71
|
```
|
|
72
|
+
|
|
73
|
+
## Client branding (favicon, PWA icon)
|
|
74
|
+
|
|
75
|
+
`egen` and the app shell are generic and ship no brand identity, only neutral placeholders. A client project supplies its own favicon and installable-app icon by pointing `EGEN_BRAND_DIR` to a folder containing `favicon.ico` and/or `icon-512.png`:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
# .env.development (or .env.production, or the process environment)
|
|
79
|
+
EGEN_BRAND_DIR=branding/shell
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
A relative path is resolved from the root of the consuming monorepo. `develop` serves that folder ahead of the app shell's own assets, and `build` copies it over them. Missing files fall back to the neutral ones, and an invalid path is ignored with a warning.
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAc,EAAE,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAc,EAAE,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAiEzC,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,YAsX/B"}
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import yargs from "yargs";
|
|
3
3
|
import { fork } from "child_process";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
|
-
import { getAvailablePort, getImportmapAndRoutes, isPortAvailable, startLogHub, childColorEnv, getLogHub, logFail, mergeImportmapAndRoutes, proxyImportmapAndRoutes, resolvePackages, runProject, trimEnd } from "./utils/index.js";
|
|
5
|
+
import { BRAND_DIR_ENV, getAvailablePort, getImportmapAndRoutes, isPortAvailable, startLogHub, childColorEnv, getLogHub, logFail, mergeImportmapAndRoutes, proxyImportmapAndRoutes, resolveBrandDir, resolvePackages, runProject, trimEnd } from "./utils/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* Port explicite de l'URL du backend (ex. 8082 pour http://localhost:8082), à réserver : les serveurs de
|
|
8
8
|
* dev des apps sont alloués à partir de `port + 1` et ne doivent JAMAIS prendre le port du backend, même
|
|
@@ -22,10 +22,21 @@ const runner = resolve(import.meta.dirname, `runner.js`);
|
|
|
22
22
|
const root = resolve(import.meta.dirname, '..');
|
|
23
23
|
function runCommand(type, args) {
|
|
24
24
|
const hub = type === 'runDevelop' ? getLogHub() : undefined;
|
|
25
|
+
// Le dossier de branding est résolu ICI, dans le processus parent : `runBuild` s'exécute depuis `root`
|
|
26
|
+
// (dans node_modules), où un chemin relatif ne désignerait plus rien.
|
|
27
|
+
const env = {
|
|
28
|
+
...hub ? childColorEnv() : process.env
|
|
29
|
+
};
|
|
30
|
+
const brandDir = resolveBrandDir(process.cwd(), type === 'runBuild' ? 'production' : 'development');
|
|
31
|
+
if (brandDir) {
|
|
32
|
+
env[BRAND_DIR_ENV] = brandDir;
|
|
33
|
+
} else {
|
|
34
|
+
delete env[BRAND_DIR_ENV];
|
|
35
|
+
}
|
|
25
36
|
const ps = fork(runner, [], {
|
|
26
37
|
cwd: type === 'runBuild' ? root : process.cwd(),
|
|
27
38
|
silent: !!hub,
|
|
28
|
-
env
|
|
39
|
+
env
|
|
29
40
|
});
|
|
30
41
|
hub?.attachChild(ps, 'egen-develop');
|
|
31
42
|
ps.send({
|
|
@@ -218,6 +229,15 @@ export function buildCli(y) {
|
|
|
218
229
|
default: 'production',
|
|
219
230
|
describe: 'The environment to build for. e.g., development, production.',
|
|
220
231
|
type: 'string'
|
|
232
|
+
}).option('platform', {
|
|
233
|
+
default: 'web',
|
|
234
|
+
choices: [
|
|
235
|
+
'web',
|
|
236
|
+
'android',
|
|
237
|
+
'ios'
|
|
238
|
+
],
|
|
239
|
+
describe: 'The target platform of the build. `android` and `ios` produce a self-contained, locked-down SPA for a native host (requires an absolute https API URL and inline importmap/routes).',
|
|
240
|
+
type: 'string'
|
|
221
241
|
}).option('asset', {
|
|
222
242
|
default: [],
|
|
223
243
|
describe: "The path to CSS or JS assets to copy into 'assets/' in the build directory, and include as <link> and <script> tags in the generated HTML. Can be used multiple times.",
|
|
@@ -227,7 +247,9 @@ export function buildCli(y) {
|
|
|
227
247
|
...args,
|
|
228
248
|
configUrls: args['config-url'],
|
|
229
249
|
configPaths: args['config-path'],
|
|
230
|
-
assets: args['asset']
|
|
250
|
+
assets: args['asset'],
|
|
251
|
+
// yargs ne type pas `choices` : la valeur est déjà restreinte à web | android | ios à l'exécution.
|
|
252
|
+
platform: args.platform
|
|
231
253
|
}));
|
|
232
254
|
y.command('assemble', 'Assembles an import map incl. all required resources.', (argv)=>argv.option('target', {
|
|
233
255
|
default: 'dist',
|
package/dist/commands/build.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface BuildArgs {
|
|
|
5
5
|
importmap?: string;
|
|
6
6
|
routes?: string;
|
|
7
7
|
spaPath: string;
|
|
8
|
+
platform?: 'web' | 'android' | 'ios';
|
|
8
9
|
fresh?: boolean;
|
|
9
10
|
apiUrl: string;
|
|
10
11
|
pageTitle: string;
|
|
@@ -25,6 +26,7 @@ export type BuildConfig = Partial<{
|
|
|
25
26
|
importmap: string;
|
|
26
27
|
routes: string;
|
|
27
28
|
spaPath: string;
|
|
29
|
+
platform: 'web' | 'android' | 'ios';
|
|
28
30
|
env: string;
|
|
29
31
|
assets: Array<string>;
|
|
30
32
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,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;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvB,CAAC,CAAC;AAiBH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,SAAS,iBAqG7C"}
|
package/dist/commands/build.js
CHANGED
|
@@ -56,6 +56,7 @@ export async function runBuild(args) {
|
|
|
56
56
|
pageTitle: buildConfig.pageTitle || args.pageTitle,
|
|
57
57
|
supportOffline: buildConfig.supportOffline ?? args.supportOffline,
|
|
58
58
|
spaPath: buildConfig.spaPath || args.spaPath,
|
|
59
|
+
platform: buildConfig.platform || args.platform,
|
|
59
60
|
fresh: args.fresh ?? false,
|
|
60
61
|
assets: args.assets || buildConfig.assets || []
|
|
61
62
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"develop.d.ts","sourceRoot":"","sources":["../../src/commands/develop.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"develop.d.ts","sourceRoot":"","sources":["../../src/commands/develop.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EAKvB,MAAM,UAAU,CAAC;AAyClB,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,oBAAoB,CAAC;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,iBAsOvE"}
|
package/dist/commands/develop.js
CHANGED
|
@@ -5,7 +5,7 @@ import { basename, resolve } from "node:path";
|
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
7
|
import { resolvePublicEnv } from "@egen-civitas/rspack-config";
|
|
8
|
-
import { logInfo, logWarn, removeTrailingSlash } from "../utils/index.js";
|
|
8
|
+
import { logInfo, logWarn, removeTrailingSlash, resolveBrandDir } from "../utils/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* Variables qui doivent atteindre @egen-civitas/esm-app-shell au RUNTIME
|
|
11
11
|
* plutôt qu'au build. Nécessaire uniquement parce que ce paquet est
|
|
@@ -212,6 +212,15 @@ export async function runDevelop(args, signal) {
|
|
|
212
212
|
// Route for custom `index.html` goes above static assets
|
|
213
213
|
app.get(indexHtmlPathMatcher, (_, res)=>res.contentType('text/html').send(indexContent));
|
|
214
214
|
// Return static assets for any request for which we have one, except importmap.json and index.html
|
|
215
|
+
// Branding du projet client (favicon…) : servi AVANT le dist pré-compilé du shell, dont il remplace les
|
|
216
|
+
// assets neutres du même nom. Un fichier absent du dossier retombe naturellement sur ceux du shell.
|
|
217
|
+
const brandDir = resolveBrandDir(process.cwd(), 'development');
|
|
218
|
+
if (brandDir) {
|
|
219
|
+
logInfo(`Branding : assets de ${brandDir} servis à la place de ceux, neutres, de l'app-shell.`);
|
|
220
|
+
app.use(spaPath, express.static(brandDir, {
|
|
221
|
+
index: false
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
215
224
|
app.use(spaPath, express.static(source, {
|
|
216
225
|
index: false
|
|
217
226
|
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Variable d'environnement désignant le dossier de branding (favicon, icône PWA) du projet client. */
|
|
2
|
+
export declare const BRAND_DIR_ENV = "EGEN_BRAND_DIR";
|
|
3
|
+
/**
|
|
4
|
+
* Résout le dossier de branding fourni par le projet client, qui remplace les assets neutres de l'app-shell
|
|
5
|
+
* (favicon, icône PWA). Le framework reste ainsi générique : aucune identité visuelle n'y est embarquée.
|
|
6
|
+
*
|
|
7
|
+
* - Source : `EGEN_BRAND_DIR` dans l'environnement, sinon dans les `.env*` du monorepo consommateur.
|
|
8
|
+
* - Un chemin relatif est résolu depuis la racine du monorepo consommateur (ou `cwd` hors monorepo), jamais
|
|
9
|
+
* depuis le dossier de travail d'un sous-processus : `egen build` s'exécute depuis `node_modules`.
|
|
10
|
+
* - Valeur absente → `undefined` (aucun avertissement). Valeur invalide → avertissement et `undefined`, sans
|
|
11
|
+
* jamais faire échouer la commande.
|
|
12
|
+
*
|
|
13
|
+
* @param cwd Dossier de départ pour trouver la racine du monorepo consommateur.
|
|
14
|
+
* @param mode Mode `.env` à lire (`development`, `production`…).
|
|
15
|
+
* @returns Le chemin absolu du dossier, ou `undefined`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveBrandDir(cwd: string, mode?: string): string | undefined;
|
|
18
|
+
//# sourceMappingURL=brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../src/utils/brand.ts"],"names":[],"mappings":"AAKA,uGAAuG;AACvG,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAgB,GAAG,MAAM,GAAG,SAAS,CAcrF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { existsSync, statSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { findMonorepoRoot, loadMonorepoEnv } from "@egen-civitas/rspack-config";
|
|
4
|
+
import { logWarn } from "./logger.js";
|
|
5
|
+
/** Variable d'environnement désignant le dossier de branding (favicon, icône PWA) du projet client. */ export const BRAND_DIR_ENV = 'EGEN_BRAND_DIR';
|
|
6
|
+
/**
|
|
7
|
+
* Résout le dossier de branding fourni par le projet client, qui remplace les assets neutres de l'app-shell
|
|
8
|
+
* (favicon, icône PWA). Le framework reste ainsi générique : aucune identité visuelle n'y est embarquée.
|
|
9
|
+
*
|
|
10
|
+
* - Source : `EGEN_BRAND_DIR` dans l'environnement, sinon dans les `.env*` du monorepo consommateur.
|
|
11
|
+
* - Un chemin relatif est résolu depuis la racine du monorepo consommateur (ou `cwd` hors monorepo), jamais
|
|
12
|
+
* depuis le dossier de travail d'un sous-processus : `egen build` s'exécute depuis `node_modules`.
|
|
13
|
+
* - Valeur absente → `undefined` (aucun avertissement). Valeur invalide → avertissement et `undefined`, sans
|
|
14
|
+
* jamais faire échouer la commande.
|
|
15
|
+
*
|
|
16
|
+
* @param cwd Dossier de départ pour trouver la racine du monorepo consommateur.
|
|
17
|
+
* @param mode Mode `.env` à lire (`development`, `production`…).
|
|
18
|
+
* @returns Le chemin absolu du dossier, ou `undefined`.
|
|
19
|
+
*/ export function resolveBrandDir(cwd, mode = 'development') {
|
|
20
|
+
const monorepoRoot = findMonorepoRoot(cwd);
|
|
21
|
+
const requested = process.env[BRAND_DIR_ENV] || loadMonorepoEnv(cwd, mode)[BRAND_DIR_ENV];
|
|
22
|
+
if (!requested) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const brandDir = resolve(monorepoRoot ?? cwd, requested);
|
|
26
|
+
if (!existsSync(brandDir) || !statSync(brandDir).isDirectory()) {
|
|
27
|
+
logWarn(`${BRAND_DIR_ENV}="${requested}" ne désigne pas un dossier existant (${brandDir}) : ignoré.`);
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return brandDir;
|
|
31
|
+
}
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface BuildOptions {
|
|
|
6
6
|
routes?: RoutesDeclaration;
|
|
7
7
|
apiUrl?: string;
|
|
8
8
|
spaPath?: string;
|
|
9
|
+
/** Cible de build : web (défaut), android ou ios. Voir `tools/targets.js` du shell. */
|
|
10
|
+
platform?: 'web' | 'android' | 'ios';
|
|
9
11
|
pageTitle?: string;
|
|
10
12
|
supportOffline?: boolean;
|
|
11
13
|
configUrls?: Array<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG3E,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OA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AAE,YAAiB,wCAmB3D"}
|
package/dist/utils/config.js
CHANGED
|
@@ -8,7 +8,12 @@ import { setEnvVariables } from "./variables.js";
|
|
|
8
8
|
if (typeof options.backend === 'string') {
|
|
9
9
|
variables.EGEN_PROXY_TARGET = options.backend;
|
|
10
10
|
}
|
|
11
|
-
if (typeof options.
|
|
11
|
+
if (typeof options.platform === 'string') {
|
|
12
|
+
variables.EGEN_TARGET = options.platform;
|
|
13
|
+
}
|
|
14
|
+
// Cibles natives : le chemin public est IMPOSÉ par la cible (voir tools/targets.js du shell) ; on ne
|
|
15
|
+
// transmet donc pas le `--spa-path` (dont la valeur par défaut est celle du Web).
|
|
16
|
+
if (typeof options.spaPath === 'string' && (options.platform === undefined || options.platform === 'web')) {
|
|
12
17
|
variables.EGEN_PUBLIC_PATH = options.spaPath;
|
|
13
18
|
}
|
|
14
19
|
if (typeof options.apiUrl === 'string') {
|
|
@@ -67,6 +72,10 @@ import { setEnvVariables } from "./variables.js";
|
|
|
67
72
|
export function loadBundlerConfig(options = {}) {
|
|
68
73
|
setBundlerEnv(options);
|
|
69
74
|
const require = createRequire(import.meta.url);
|
|
75
|
+
// La config rspack lit `process.env` à l'ÉVALUATION du module (constantes de tête) : Node met les modules CJS en
|
|
76
|
+
// cache, donc un second appel dans le même processus (mode watch, usage programmatique, tests) réutiliserait
|
|
77
|
+
// silencieusement les valeurs du premier (apiUrl, configUrls…), malgré `setBundlerEnv` ci-dessus.
|
|
78
|
+
delete require.cache[require.resolve('@egen-civitas/esm-app-shell/rspack.config.js')];
|
|
70
79
|
const config = require('@egen-civitas/esm-app-shell/rspack.config.js');
|
|
71
80
|
if (typeof config === 'function') {
|
|
72
81
|
return config({});
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egen-civitas/egen",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
],
|
|
61
61
|
"homepage": "https://github.com/amourgit/Frontend-esm-framework/tree/main/packages/tooling/egen#readme",
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@egen-civitas/esm-app-shell": "^2.
|
|
63
|
+
"@egen-civitas/esm-app-shell": "^2.9.0",
|
|
64
64
|
"@egen-civitas/rspack-config": "^1.1.0",
|
|
65
65
|
"@egen-civitas/webpack-config": "^1.0.0",
|
|
66
66
|
"@inquirer/prompts": "8.3.2",
|