diff --git a/gulpfile.ts b/gulpfile.ts index 718d0e2d..8377a562 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -242,16 +242,6 @@ gulp.task('zip-release', (): any => .pipe(gulp.dest('.')) ); -gulp.task( - 'create-release', - gulp.series( - 'build-frontend', - 'build-backend', - 'copy-static', - 'copy-package', - 'zip-release' - ) -); const simpleBuild = (isProd: boolean): any => { const tasks = []; @@ -389,10 +379,61 @@ gulp.task('generate-man', async (cb): Promise => { cb(); }); +// this is a workaround for bundle hash is not considering localization +// so all the js files would have the same name and caching would not be possible to use +// prefixing main.js with localization to force reload +// see: https://github.com/angular/angular-cli/issues/17416 +gulp.task('localize-bundles', async (cb): Promise => { + const bundlesToUpdate = ['main']; + const foldersToCheck = ['./dist', './release/dist']; + for (let f = 0; f < foldersToCheck.length; ++f) { + const folder = foldersToCheck[f]; + if (!fs.existsSync(folder)) { + continue; + } + const builds = fs.readdirSync(folder); + + for (let i = 0; i < builds.length; ++i) { + const dir = path.join(folder, builds[i]); + const indexhtmlPath = path.join(dir, 'index.html'); + + let indexhtml = fs.readFileSync(indexhtmlPath, 'utf8'); + + for (let j = 0; j < bundlesToUpdate.length; ++j) { + + const rgx = new RegExp('