@@ -7,7 +7,7 @@ import * as chokidar from "chokidar";
77import * as fs from "node:fs" ;
88import _ from "lodash" ;
99import webpack from "webpack" ;
10- import type { Translations } from "matrix-web-i18n" ;
10+ import { type Translations } from "matrix-web-i18n" ;
1111
1212const EW_I18N_BASE_PATH = "src/i18n/strings/" ;
1313const SC_I18N_BASE_PATH = "packages/shared-components/src/i18n/strings/" ;
@@ -28,16 +28,13 @@ function errCheck(err: unknown): void {
2828 }
2929}
3030
31- // Check if webapp exists
32- if ( ! fs . existsSync ( "webapp" ) ) {
33- fs . mkdirSync ( "webapp" ) ;
34- }
35- // Check if i18n exists
36- if ( ! fs . existsSync ( "webapp/i18n/" ) ) {
37- fs . mkdirSync ( "webapp/i18n/" ) ;
31+ const I18N_DEST = "webapp/i18n/" ;
32+ // Check if webapp/i18n exists
33+ if ( ! fs . existsSync ( I18N_DEST ) ) {
34+ fs . mkdirSync ( I18N_DEST , { recursive : true } ) ;
3835}
3936
40- const logWatch = ( path : string ) => {
37+ const logWatch = ( path : string ) : void => {
4138 if ( verbose ) {
4239 console . log ( `Watching: ${ path } ` ) ;
4340 }
@@ -72,7 +69,7 @@ function prepareLangFile(lang: string): [filename: string, json: string] {
7269 return [ filename , json ] ;
7370}
7471
75- function genLangFile ( dest : string , filename : string , json : string ) {
72+ function genLangFile ( dest : string , filename : string , json : string ) : void {
7673 fs . writeFileSync ( dest + filename , json ) ;
7774 if ( verbose ) {
7875 console . log ( "Generated language file: " + filename ) ;
@@ -139,7 +136,6 @@ function watchLanguage(lang: string, dest: string, langFileMap: Record<string, s
139136}
140137
141138// language resources
142- const I18N_DEST = "webapp/i18n/" ;
143139const I18N_FILENAME_MAP = INCLUDE_LANGS . reduce < Record < string , string >> ( ( m , l ) => {
144140 const [ filename , json ] = prepareLangFile ( l ) ;
145141 if ( ! watch ) {
0 commit comments