Skip to content

Commit

Permalink
adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Sep 11, 2023
1 parent 8467d0e commit ffb122c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion generators/languages/files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const clientI18nFiles = {
],
},
{
condition: ctx => ctx.clientFrameworkVue,
condition: ctx => ctx.clientFrameworkVue && !ctx.translationLoad,
path: `${CLIENT_MAIN_SRC_DIR}/i18n/`,
renameTo: context => `${context.clientSrcDir}/i18n/${context.lang}/${context.lang}.js`,
templates: ['index.js'],
Expand Down
6 changes: 4 additions & 2 deletions generators/languages/translation-data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class TranslationData {
const translationFiles = await this.generator.writeFiles({
sections: entityClientI18nFiles,
rootTemplatesPath,
context: { ...entity, clientSrcDir: '__tmp__', frontendAppName, lang: 'en' },
context: { ...entity, clientSrcDir: '__tmp__', frontendAppName, lang: 'en', translationLoad: true },
});

// Add entities to menu translation.
Expand All @@ -61,7 +61,7 @@ export default class TranslationData {
...(await this.generator.writeFiles({
sections: entityClientI18nFiles,
rootTemplatesPath,
context: { ...entity, clientSrcDir: '__tmp__', frontendAppName, lang: nativeLanguage },
context: { ...entity, clientSrcDir: '__tmp__', frontendAppName, lang: nativeLanguage, translationLoad: true },
})),
);
}
Expand All @@ -86,6 +86,7 @@ export default class TranslationData {
...application,
lang: 'en',
clientSrcDir: '__tmp__',
translationLoad: true,
},
});

Expand All @@ -99,6 +100,7 @@ export default class TranslationData {
...application,
lang: application.nativeLanguage,
clientSrcDir: '__tmp__',
translationLoad: true,
},
})),
);
Expand Down
13 changes: 7 additions & 6 deletions generators/vue/resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
"devDependencies": {
"@pinia/testing": "0.1.3",
"@rushstack/eslint-patch": "1.3.3",
"@tsconfig/node18": "18.2.0",
"@types/node": "18.17.15",
"@types/sinon": "10.0.16",
"@vitejs/plugin-vue": "4.3.4",
"@vue/eslint-config-prettier": "8.0.0",
"@vue/eslint-config-typescript": "10.0.0",
"@vue/test-utils": "2.4.1",
"@vue/tsconfig": "0.4.0",
"autoprefixer": "10.4.15",
"axios-mock-adapter": "1.21.5",
"browser-sync-webpack-plugin": "2.3.0",
Expand All @@ -45,25 +47,24 @@
"postcss-loader": "7.3.3",
"postcss-url": "10.1.3",
"rimraf": "5.0.1",
"rollup-plugin-copy": "3.5.0",
"sass": "1.66.1",
"sass-loader": "13.3.2",
"sinon": "15.2.0",
"terser-webpack-plugin": "5.3.9",
"ts-loader": "9.4.4",
"typescript": "5.2.2",
"vite": "^4.4.9",
"vitest": "0.34.4",
"vitest-sonar-reporter": "0.4.1",
"vue-loader": "17.2.2",
"vue-style-loader": "4.1.3",
"vue-tsc": "^1.8.8",
"webpack": "5.88.2",
"webpack-bundle-analyzer": "4.9.1",
"webpack-cli": "5.1.4",
"webpack-dev-server": "4.15.1",
"webpack-merge": "5.9.0",
"workbox-webpack-plugin": "7.0.0",
"vue-tsc": "^1.8.8",
"vite": "^4.4.9",
"@vue/tsconfig": "0.4.0",
"@tsconfig/node18": "18.2.0"
"workbox-webpack-plugin": "7.0.0"
}
}
}
1 change: 0 additions & 1 deletion generators/vue/support/update-languages.mts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ function updateLanguagesInConfigTask(this: BaseGenerator, { application, control
);
}


export default function updateLanguagesTask(this: BaseGenerator, taskParam: UpdateClientLanguagesTaskParam) {
updateLanguagesInPipeTask.call(this, taskParam);
updateLanguagesInConfigTask.call(this, taskParam);
Expand Down
1 change: 1 addition & 0 deletions generators/vue/templates/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"cypress": "<%= nodeDependencies['cypress'] %>",
<%_ } _%>
"rimraf": "<%= nodeDependencies['rimraf'] %>",
"rollup-plugin-copy": "<%= nodeDependencies['rollup-plugin-copy'] %>",
"sass": "<%= nodeDependencies['sass'] %>",
"sinon": "<%= nodeDependencies['sinon'] %>",
"swagger-ui-dist": "<%= nodeDependencies['swagger-ui-dist'] %>",
Expand Down
16 changes: 16 additions & 0 deletions generators/vue/templates/vite.config.ts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
limitations under the License.
-%>
import { fileURLToPath, URL } from 'node:url';
import { dirname, join } from 'node:path';

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import copy from 'rollup-plugin-copy'

export default defineConfig({
plugins: [
Expand All @@ -32,6 +34,20 @@ export default defineConfig({
},
},
}),
copy({
targets: [
{
src: [
`${require('swagger-ui-dist').getAbsoluteFSPath()}/*.{js,css,html,png}`,
`!${require('swagger-ui-dist').getAbsoluteFSPath()}/**/index.html`,
// join(dirname(import.resolve('axios/package.json')), 'dist/axios.min.js'),
fileURLToPath(new URL('./<%- clientSrcDir %>swagger-ui/index.html', import.meta.url)),
],
dest: '<%= clientDistDir %>swagger-ui',
},
],
hook: 'writeBundle',
}),
],
root: fileURLToPath(new URL('./<%- clientSrcDir %>', import.meta.url)),
publicDir: fileURLToPath(new URL('./<%- clientDistDir %>public', import.meta.url)),
Expand Down

0 comments on commit ffb122c

Please sign in to comment.