@@ -14,7 +14,6 @@ import {
14
14
createBuilder ,
15
15
} from '@angular-devkit/architect' ;
16
16
17
- import { DevServerBuilderOptions } from '@angular-devkit/build-angular' ;
18
17
import { normalizeOptions } from '@angular-devkit/build-angular/src/builders/dev-server/options' ;
19
18
20
19
import { setLogLevel , logger } from '@softarc/native-federation/build' ;
@@ -33,7 +32,7 @@ import { targetFromTargetString } from '@angular-devkit/architect';
33
32
import { NfBuilderSchema } from './schema' ;
34
33
import { reloadBrowser , setError } from '../../utils/dev-server' ;
35
34
import { RebuildHubs } from '../../utils/rebuild-events' ;
36
- import { updateIndexHtml , updateScriptTags } from '../../utils/updateIndexHtml' ;
35
+ import { updateScriptTags } from '../../utils/updateIndexHtml' ;
37
36
import { existsSync , mkdirSync , rmSync } from 'fs' ;
38
37
import {
39
38
EsBuildResult ,
@@ -45,6 +44,8 @@ import { createSharedMappingsPlugin } from '../../utils/shared-mappings-plugin';
45
44
// import { NextHandleFunction } from 'vite';
46
45
import { PluginBuild } from 'esbuild' ;
47
46
import { FederationInfo } from '@softarc/native-federation-runtime' ;
47
+ import { getI18nConfig , translateFederationArtefacts } from '../../utils/i18n' ;
48
+ import { createOrUpdateGithubRelease } from 'nx/src/command-line/release/utils/github' ;
48
49
49
50
function _buildApplication ( options , context , pluginsOrExtensions ) {
50
51
let extensions ;
@@ -122,7 +123,7 @@ export async function* runBuilder(
122
123
options . baseHref = nfOptions . baseHref ;
123
124
}
124
125
125
- if ( nfOptions . outputPath ) {
126
+ if ( nfOptions . outputPath ) {
126
127
options . outputPath = nfOptions . outputPath ;
127
128
}
128
129
@@ -134,7 +135,6 @@ export async function* runBuilder(
134
135
setLogLevel ( options . verbose ? 'verbose' : 'info' ) ;
135
136
136
137
const outputPath = options . outputPath ;
137
-
138
138
const outputOptions : Required <
139
139
Exclude < ApplicationBuilderOptions [ 'outputPath' ] , string >
140
140
> = {
@@ -145,9 +145,12 @@ export async function* runBuilder(
145
145
base : typeof outputPath === 'string' ? outputPath : outputPath . base ,
146
146
} ;
147
147
148
+ const i18n = await getI18nConfig ( context ) ;
149
+
148
150
const browserOutputPath = path . join (
149
151
outputOptions . base ,
150
- outputOptions . browser
152
+ outputOptions . browser ,
153
+ i18n ?. sourceLocale || ''
151
154
) ;
152
155
153
156
const fedOptions : FederationOptions = {
@@ -235,12 +238,18 @@ export async function* runBuilder(
235
238
} ) ;
236
239
}
237
240
241
+ let federationResult : FederationInfo ;
238
242
try {
239
- await buildForFederation ( config , fedOptions , externals ) ;
243
+ federationResult = await buildForFederation ( config , fedOptions , externals ) ;
240
244
} catch ( e ) {
241
245
process . exit ( 1 ) ;
242
246
}
243
247
248
+ const hasLocales = i18n ?. locales && Object . keys ( i18n . locales ) . length > 0 ;
249
+ if ( ! runServer && hasLocales ) {
250
+ translateFederationArtefacts ( i18n , outputOptions . base , federationResult ) ;
251
+ }
252
+
244
253
options . deleteOutputPath = false ;
245
254
246
255
const appBuilderName = '@angular-devkit/build-angular:application' ;
@@ -261,6 +270,7 @@ export async function* runBuilder(
261
270
)
262
271
: buildApplication ( options , context , {
263
272
codePlugins : plugins as any ,
273
+ indexHtmlTransformer : transformIndexHtml ( nfOptions ) ,
264
274
} ) ;
265
275
266
276
// builderRun.output.subscribe(async (output) => {
@@ -285,9 +295,9 @@ export async function* runBuilder(
285
295
) ;
286
296
}
287
297
288
- if ( write && ! runServer && ! nfOptions . skipHtmlTransform ) {
289
- updateIndexHtml ( fedOptions , nfOptions ) ;
290
- }
298
+ // if (write && !runServer && !nfOptions.skipHtmlTransform) {
299
+ // updateIndexHtml(fedOptions, nfOptions);
300
+ // }
291
301
292
302
// if (!runServer) {
293
303
// yield output;
0 commit comments