Skip to content

Commit

Permalink
Look for assets
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Mar 7, 2022
1 parent dafcf29 commit 2c72df3
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 24 deletions.
10 changes: 1 addition & 9 deletions generators/client/templates/angular/angular.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,7 @@
"<%= MAIN_SRC_DIR %>content",
"<%= MAIN_SRC_DIR %>favicon.ico",
"<%= MAIN_SRC_DIR %>manifest.webapp",
"<%= MAIN_SRC_DIR %>robots.txt",
{
"glob": "*.{js,css,html,png}",
"input": "./node_modules/swagger-ui-dist",
"output": "swagger-ui",
"ignore": ["**/index.html"]
},
{ "glob": "axios.min.js", "input": "./node_modules/axios/dist", "output": "swagger-ui" },
{ "glob": "**/*", "input": "<%= MAIN_SRC_DIR %>swagger-ui/", "output": "swagger-ui" }
"<%= MAIN_SRC_DIR %>robots.txt"
],
"styles": ["<%= MAIN_SRC_DIR %>content/scss/vendor.scss", "<%= MAIN_SRC_DIR %>content/scss/global.scss"],
"scripts": []
Expand Down
2 changes: 1 addition & 1 deletion generators/client/templates/angular/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"ngx-webstorage": "<%= dependabotPackageJson.dependencies['ngx-webstorage'] %>",
"@popperjs/core": "<%= dependabotPackageJson.dependencies['@popperjs/core'] %>",
"rxjs": "<%= dependabotPackageJson.dependencies['rxjs'] %>",
"swagger-ui-dist": "<%= dependabotPackageJson.dependencies['swagger-ui-dist'] %>",
<%_ if (websocket === 'spring-websocket') { _%>
"sockjs-client": "1.5.0",
"webstomp-client": "1.2.6",
Expand Down Expand Up @@ -127,6 +126,7 @@
"postcss-rtlcss": "<%= dependabotPackageJson.devDependencies['postcss-rtlcss'] %>",
<%_ } _%>
"rimraf": "<%= dependabotPackageJson.devDependencies['rimraf'] %>",
"swagger-ui-dist": "<%= dependabotPackageJson.devDependencies['swagger-ui-dist'] %>",
"ts-jest": "<%= dependabotPackageJson.devDependencies['ts-jest'] %>",
"typescript": "<%= dependabotPackageJson.devDependencies['typescript'] %>",
"webpack-bundle-analyzer": "<%= dependabotPackageJson.devDependencies['webpack-bundle-analyzer'] %>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const ESLintPlugin = require('eslint-webpack-plugin');
const environment = require('./environment');
const proxyConfig = require('./proxy.conf');


module.exports = async (config, options, targetOptions) => {
<%_ if (enableTranslation) { _%>
const languagesHash = await hashElement(path.resolve(__dirname, '../<%= MAIN_SRC_DIR %>i18n'), {
Expand Down Expand Up @@ -111,6 +110,18 @@ module.exports = async (config, options, targetOptions) => {
}

const patterns = [
{
// https://github.com/swagger-api/swagger-ui/blob/v4.6.1/swagger-ui-dist-package/README.md
context: require('swagger-ui-dist').getAbsoluteFSPath(),
from: '*.{js,css,html,png}',
to: 'swagger-ui/',
globOptions: { ignore: ['**/index.html'] },
},
{
from: require.resolve('axios/dist/axios.min.js'),
to: 'swagger-ui/',
},
{ from: './<%= CLIENT_MAIN_SRC_DIR %>swagger-ui/', to: 'swagger-ui/' },
// jhipster-needle-add-assets-to-webpack - JHipster will add/remove third-party resources in this array
];

Expand Down
5 changes: 3 additions & 2 deletions generators/client/templates/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"babel-loader": "8.2.3",
"babel-plugin-istanbul": "6.1.1",
"cypress": "9.5.1",
"eslint-plugin-cypress": "2.12.1",
"cypress-audit": "1.1.0",
"eslint-plugin-cypress": "2.12.1",
"lighthouse": "9.4.0",
"nyc": "15.1.0"
"nyc": "15.1.0",
"swagger-ui-dist": "4.5.0"
},
"dependencies": {
"dayjs": "1.10.8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@import "~bootswatch/dist/<%= clientTheme %>/variables";
<%_ } _%>
// Import Bootstrap source files from node_modules
@import "node_modules/bootstrap/scss/bootstrap";
@import "~bootstrap/scss/bootstrap";
<%_ if (!clientThemeNone) { _%>
@import "~bootswatch/dist/<%= clientTheme %>/bootswatch";
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,16 @@ return merge(
patterns: [
<%_ if (applicationTypeGateway || applicationTypeMonolith) { _%>
{
context: './node_modules/swagger-ui-dist/',
// https://github.com/swagger-api/swagger-ui/blob/v4.6.1/swagger-ui-dist-package/README.md
context: require('swagger-ui-dist').getAbsoluteFSPath(),
from: '*.{js,css,html,png}',
to: 'swagger-ui/',
globOptions: { ignore: ['**/index.html'] },
},
{ from: './node_modules/axios/dist/axios.min.js', to: 'swagger-ui/' },
{
from: require.resolve('axios/dist/axios.min.js'),
to: 'swagger-ui/',
},
{ from: './<%= MAIN_SRC_DIR %>swagger-ui/', to: 'swagger-ui/' },
<%_ } _%>
{ from: './<%= MAIN_SRC_DIR %>content/', to: 'content/' },
Expand Down
2 changes: 1 addition & 1 deletion generators/client/templates/vue/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"bootswatch": "<%= dependabotPackageJson.dependencies['bootswatch'] %>",
<%_ } _%>
"dayjs": "<%= dependabotPackageJson.dependencies['dayjs'] %>",
"swagger-ui-dist": "<%= dependabotPackageJson.dependencies['swagger-ui-dist'] %>",
<%_ if (communicationSpringWebsocket) { _%>
"sockjs-client": "1.5.2",
"@stomp/rx-stomp": "1.1.4",
Expand Down Expand Up @@ -115,6 +114,7 @@
"sass": "<%= dependabotPackageJson.devDependencies['sass'] %>",
"sass-loader": "<%= dependabotPackageJson.devDependencies['sass-loader'] %>",
"sinon": "<%= dependabotPackageJson.devDependencies['sinon'] %>",
"swagger-ui-dist": "<%= dependabotPackageJson.devDependencies['swagger-ui-dist'] %>",
"terser-webpack-plugin": "<%= dependabotPackageJson.devDependencies['terser-webpack-plugin'] %>",
"ts-jest": "<%= dependabotPackageJson.devDependencies['ts-jest'] %>",
"ts-loader": "<%= dependabotPackageJson.devDependencies['ts-loader'] %>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
],
testResultsProcessor: 'jest-sonar-reporter',
testMatch: ['<rootDir>/<%= CLIENT_TEST_SRC_DIR %>spec/**/@(*.)@(spec.ts)'],
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
snapshotSerializers: ['jest-serializer-vue'],
globals: {
<%_ if (enableTranslation) { _%>
I18N_HASH: 'generated_hash',
Expand Down
3 changes: 0 additions & 3 deletions generators/client/templates/vue/tsconfig.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es7", "dom"],
"typeRoots": [
"node_modules/@types"
],
"paths": {
"@/*": ["*"]
},
Expand Down
8 changes: 6 additions & 2 deletions generators/client/templates/vue/webpack/webpack.common.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,16 @@ module.exports = async (env, options) => {
new CopyWebpackPlugin({
patterns: [
{
context: './node_modules/swagger-ui-dist/',
// https://github.com/swagger-api/swagger-ui/blob/v4.6.1/swagger-ui-dist-package/README.md
context: require('swagger-ui-dist').getAbsoluteFSPath(),
from: '*.{js,css,html,png}',
to: 'swagger-ui/',
globOptions: { ignore: ['**/index.html'] },
},
{ from: './node_modules/axios/dist/axios.min.js', to: 'swagger-ui/' },
{
from: require.resolve('axios/dist/axios.min.js'),
to: 'swagger-ui/',
},
{ from: './<%= CLIENT_MAIN_SRC_DIR %>swagger-ui/', to: 'swagger-ui/' },
{ from: './<%= CLIENT_MAIN_SRC_DIR %>content/', to: 'content/' },
{ from: './<%= CLIENT_MAIN_SRC_DIR %>favicon.ico', to: 'favicon.ico' },
Expand Down
2 changes: 1 addition & 1 deletion generators/common/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"npm": "8.5.3",
"wait-on": "6.0.1"
}
}
}

0 comments on commit 2c72df3

Please sign in to comment.