Skip to content

Commit dc0e439

Browse files
author
Andres Castillo
committed
IAM-4282 Migrate Vue CLI v4 to v5
1 parent bef85ee commit dc0e439

File tree

16 files changed

+3465
-4352
lines changed

16 files changed

+3465
-4352
lines changed

babel.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
2-
* @license
3-
* Copyright (c) 2020 ForgeRock. All rights reserved.
2+
* Copyright (c) 2020-2023 ForgeRock. All rights reserved.
43
*
54
* This software may be modified and distributed under the terms
65
* of the MIT license. See the LICENSE file for details.
76
*/
7+
88
module.exports = {
99
// Disabled temporarily due a bug in babel: https://github.com/babel/babel/issues/12314
1010
// babelrcRoots: [
@@ -21,6 +21,6 @@ module.exports = {
2121
},
2222
},
2323
presets: [
24-
['@vue/app', { useBuiltIns: 'entry' }],
24+
['@vue/cli-plugin-babel/preset', { useBuiltIns: 'entry' }],
2525
],
2626
};

dev-entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export VUE_APP_BUILD_NUMBER=local
1414
export VUE_APP_BUILD_DATE_TIME="$(date +%s)"
1515

1616
cd /home/app/packages/$1
17-
sed -i 's!\\!!g' .env
1817

1918
if [[ -v SUBFOLDER ]]; then
2019
echo "Hosting under $SUBFOLDER"

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
"vue-template-compiler": "2.7.14"
5656
},
5757
"resolutions": {
58-
"ramda@npm:^0.25.0": "0.27.1"
58+
"ramda@npm:^0.25.0": "0.27.1",
59+
"autoprefixer": "10.4.5",
60+
"yaml@npm:1.10.0": "1.10.2"
5961
},
6062
"workspaces": {
6163
"packages": [
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
VUE_APP_ADMIN_URL=\\$PLATFORM_ADMIN_URL
2-
VUE_APP_AM_URL=\\$AM_URL
3-
VUE_APP_AM_ADMIN_URL=\\$AM_ADMIN_URL
4-
VUE_APP_AUTO_ACCESS_API_URL=\\$AUTO_ACCESS_API_URL
5-
VUE_APP_AUTO_ACCESS_JAS_URL=\\$AUTO_ACCESS_JAS_URL
6-
VUE_APP_AUTO_ACCESS_TENANT_ID=\\$AUTO_ACCESS_TENANT_ID
7-
VUE_APP_ENABLE_AUTO_ACCESS=\\$ENABLE_AUTO_ACCESS
8-
VUE_APP_ENABLE_GOVERNANCE=\\$ENABLE_GOVERNANCE
9-
VUE_APP_ENABLE_GOVERNANCE_V4=\\$ENABLE_GOVERNANCE_V4
10-
VUE_APP_ENABLE_WORKFORCE=\\$ENABLE_WORKFORCE
11-
VUE_APP_ENDUSER_CLIENT_ID=\\$ENDUSER_CLIENT_ID
12-
VUE_APP_FRAAS=\\$PLATFORM_UI_IS_FRAAS
13-
VUE_APP_GOOGLE_MAPS_API_KEY=\\$GOOGLE_MAPS_API_KEY
14-
VUE_APP_IDM_URL=\\$IDM_REST_URL
15-
VUE_APP_I18N_LOCALE=\\$PLATFORM_UI_LOCALE
1+
VUE_APP_ADMIN_URL=$PLATFORM_ADMIN_URL
2+
VUE_APP_AM_URL=$AM_URL
3+
VUE_APP_AM_ADMIN_URL=$AM_ADMIN_URL
4+
VUE_APP_AUTO_ACCESS_API_URL=$AUTO_ACCESS_API_URL
5+
VUE_APP_AUTO_ACCESS_JAS_URL=$AUTO_ACCESS_JAS_URL
6+
VUE_APP_AUTO_ACCESS_TENANT_ID=$AUTO_ACCESS_TENANT_ID
7+
VUE_APP_ENABLE_AUTO_ACCESS=$ENABLE_AUTO_ACCESS
8+
VUE_APP_ENABLE_GOVERNANCE=$ENABLE_GOVERNANCE
9+
VUE_APP_ENABLE_GOVERNANCE_V4=$ENABLE_GOVERNANCE_V4
10+
VUE_APP_ENABLE_WORKFORCE=$ENABLE_WORKFORCE
11+
VUE_APP_ENDUSER_CLIENT_ID=$ENDUSER_CLIENT_ID
12+
VUE_APP_FRAAS=$PLATFORM_UI_IS_FRAAS
13+
VUE_APP_GOOGLE_MAPS_API_KEY=$GOOGLE_MAPS_API_KEY
14+
VUE_APP_IDM_URL=$IDM_REST_URL
15+
VUE_APP_I18N_LOCALE=$PLATFORM_UI_LOCALE
1616
VUE_APP_I18N_LOCALE=en
17-
VUE_APP_IGA_API_URL=\\$IGA_API_URL
17+
VUE_APP_IGA_API_URL=$IGA_API_URL
1818
THEME=default

packages/platform-enduser/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"bootstrap": "4.6.1",
2626
"bootstrap-vue": "2.22.0",
2727
"brace": "0.11.1",
28-
"core-js": "3.6.5",
28+
"core-js": "3.32.0",
2929
"d3-simple-slider": "1.10.4",
3030
"dayjs": "1.11.7",
3131
"es6-promise": "4.2.4",
@@ -43,13 +43,13 @@
4343
},
4444
"devDependencies": {
4545
"@testing-library/cypress": "7.0.3",
46-
"@vue/cli-plugin-babel": "4.5.18",
47-
"@vue/cli-service": "4.5.18",
46+
"@vue/cli-plugin-babel": "5.0.8",
47+
"@vue/cli-service": "5.0.8",
4848
"@vue/test-utils": "1.3.6",
4949
"@vue/vue2-jest": "29.2.5",
5050
"babel-core": "7.0.0-bridge.0",
5151
"chai": "4.1.2",
52-
"copy-webpack-plugin": "5.0.3",
52+
"copy-webpack-plugin": "11.0.0",
5353
"cypress": "6.9.1",
5454
"cypress-lighthouse": "0.1.0",
5555
"flush-promises": "1.0.2",
@@ -60,7 +60,7 @@
6060
"sass": "1.52.1",
6161
"sass-loader": "8.0.2",
6262
"style-resources-loader": "1.2.1",
63-
"vue-cli-plugin-i18n": "0.6.0",
63+
"vue-cli-plugin-i18n": "2.3.2",
6464
"vue-template-compiler": "2.7.14"
6565
},
6666
"postcss": {

packages/platform-enduser/vue.config.js

Lines changed: 76 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2020-2022 ForgeRock. All rights reserved.
2+
* Copyright (c) 2020-2023 ForgeRock. All rights reserved.
33
*
44
* This software may be modified and distributed under the terms
55
* of the MIT license. See the LICENSE file for details.
@@ -9,6 +9,7 @@
99
const webpack = require('webpack');
1010
const CopyWebpackPlugin = require('copy-webpack-plugin');
1111
const path = require('path');
12+
const dotenv = require('dotenv');
1213

1314
function generateTheme() {
1415
let variableLoad = `
@@ -34,33 +35,35 @@ function getPlugins() {
3435
new webpack.BannerPlugin('Copyright (c) 2020 ForgeRock. All rights reserved. This software may be modified and distributed under the terms of the MIT license. See the LICENSE file for details.'),
3536
];
3637

37-
plugins.push(new CopyWebpackPlugin([
38-
{
39-
from: '../../node_modules/appauthhelper-enduser/appAuthHelperRedirect.html',
40-
to: 'appAuthHelperRedirect.html',
41-
toType: 'file',
42-
},
43-
{
44-
from: '../../node_modules/appauthhelper-enduser/appAuthServiceWorker.js',
45-
to: 'appAuthServiceWorker.js',
46-
toType: 'file',
47-
},
48-
{
49-
from: '../../node_modules/appauthhelper-enduser/appAuthHelperFetchTokensBundle.js',
50-
to: 'appAuthHelperFetchTokensBundle.js',
51-
toType: 'file',
52-
},
53-
{
54-
from: '../../node_modules/oidcsessioncheck-enduser/sessionCheck.html',
55-
to: 'sessionCheck.html',
56-
toType: 'file',
57-
},
58-
{
59-
from: '../../node_modules/oidcsessioncheck-enduser/sessionCheckFrame.js',
60-
to: 'sessionCheckFrame.js',
61-
toType: 'file',
62-
},
63-
]));
38+
plugins.push(new CopyWebpackPlugin({
39+
patterns: [
40+
{
41+
from: '../../node_modules/appauthhelper-enduser/appAuthHelperRedirect.html',
42+
to: 'appAuthHelperRedirect.html',
43+
toType: 'file',
44+
},
45+
{
46+
from: '../../node_modules/appauthhelper-enduser/appAuthServiceWorker.js',
47+
to: 'appAuthServiceWorker.js',
48+
toType: 'file',
49+
},
50+
{
51+
from: '../../node_modules/appauthhelper-enduser/appAuthHelperFetchTokensBundle.js',
52+
to: 'appAuthHelperFetchTokensBundle.js',
53+
toType: 'file',
54+
},
55+
{
56+
from: '../../node_modules/oidcsessioncheck-enduser/sessionCheck.html',
57+
to: 'sessionCheck.html',
58+
toType: 'file',
59+
},
60+
{
61+
from: '../../node_modules/oidcsessioncheck-enduser/sessionCheckFrame.js',
62+
to: 'sessionCheckFrame.js',
63+
toType: 'file',
64+
},
65+
],
66+
}));
6467

6568
return plugins;
6669
}
@@ -76,20 +79,31 @@ module.exports = {
7679
},
7780
},
7881
devServer: {
79-
before: (app) => {
82+
setupMiddlewares: (middlewares, devServer) => {
8083
if (SUBFOLDER !== './') {
81-
app.get(SUBFOLDER.replace(/\/$/, '$'), (req, res) => {
84+
devServer.app.get(SUBFOLDER.replace(/\/$/, '$'), (req, res) => {
8285
res.redirect(SUBFOLDER);
8386
});
8487
} else {
85-
app.all((req, res, next) => {
88+
devServer.app.all((req, res, next) => {
8689
next();
8790
});
8891
}
92+
return middlewares;
8993
},
90-
disableHostCheck: true,
94+
allowedHosts: 'all',
9195
host: process.env.HOST || '0.0.0.0',
9296
port: process.env.DEV_PORT || 8888,
97+
client: {
98+
webSocketURL: {
99+
hostname: 'localhost',
100+
pathname: 'ws',
101+
port: process.env.DEV_PORT || 8888,
102+
},
103+
},
104+
webSocketServer: process.env.NODE_ENV !== 'development' ? false : 'ws',
105+
compress: false,
106+
historyApiFallback: true,
93107
},
94108
chainWebpack: (config) => {
95109
config.module
@@ -99,6 +113,30 @@ module.exports = {
99113
...options,
100114
rootMode: 'upward',
101115
}));
116+
117+
/**
118+
* Regenerates the environment variables using the define plugin of webpack in non-development environments
119+
* - before building load the environment variables from .env file using dotenv module
120+
* - format those variables to fit the string format required by define plugin
121+
* - overwrites the formated variables to the webpack definitions
122+
* This is required due to an error replacing environment variables on the final bundle where they are replaced by empty values
123+
*/
124+
if (process.env.NODE_ENV !== 'development') {
125+
config
126+
.plugin('define')
127+
.tap((definitions) => {
128+
const envs = dotenv.config({ path: `.env.${process.env.NODE_ENV}` });
129+
const envsFormatted = Object.entries(envs.parsed).reduce((newEnvs, [key, value]) => {
130+
newEnvs[key] = JSON.stringify(value);
131+
return newEnvs;
132+
}, {});
133+
definitions[0]['process.env'] = {
134+
...definitions[0]['process.env'],
135+
...envsFormatted,
136+
};
137+
return definitions;
138+
});
139+
}
102140
},
103141
configureWebpack: {
104142
plugins: getPlugins(),
@@ -125,6 +163,12 @@ module.exports = {
125163
],
126164
css: {
127165
loaderOptions: {
166+
css: {
167+
modules: {
168+
auto: () => true,
169+
mode: 'global',
170+
},
171+
},
128172
sass: {
129173
prependData: generateTheme(),
130174
},
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
VUE_APP_ALIGN_GOTO_PRECEDENCE=\\$ALIGN_GOTO_PRECEDENCE
2-
VUE_APP_AM_URL=\\$AM_URL
3-
VUE_APP_AM_ADMIN_URL=\\$AM_ADMIN_URL
4-
VUE_APP_IDM_URL=\\$IDM_REST_URL
5-
VUE_APP_ADMIN_URL=\\$PLATFORM_ADMIN_URL
6-
VUE_APP_ENDUSER_URL=\\$ENDUSER_UI_URL
7-
VUE_APP_I18N_LOCALE=\\$PLATFORM_UI_LOCALE
8-
VUE_APP_FRAAS=\\$PLATFORM_UI_IS_FRAAS
9-
VUE_APP_FRAAS_PROMOTION_CONFIG_INGRESS_URL=\\$LOWER_CONFIG_INGRESS
10-
VUE_APP_FRAAS_PROMOTION_CONFIG_EGRESS_URL=\\$UPPER_CONFIG_EGRESS
1+
VUE_APP_ALIGN_GOTO_PRECEDENCE=$ALIGN_GOTO_PRECEDENCE
2+
VUE_APP_AM_URL=$AM_URL
3+
VUE_APP_AM_ADMIN_URL=$AM_ADMIN_URL
4+
VUE_APP_IDM_URL=$IDM_REST_URL
5+
VUE_APP_ADMIN_URL=$PLATFORM_ADMIN_URL
6+
VUE_APP_ENDUSER_URL=$ENDUSER_UI_URL
7+
VUE_APP_I18N_LOCALE=$PLATFORM_UI_LOCALE
8+
VUE_APP_FRAAS=$PLATFORM_UI_IS_FRAAS
9+
VUE_APP_FRAAS_PROMOTION_CONFIG_INGRESS_URL=$LOWER_CONFIG_INGRESS
10+
VUE_APP_FRAAS_PROMOTION_CONFIG_EGRESS_URL=$UPPER_CONFIG_EGRESS
1111
VUE_APP_I18N_LOCALE=en
12-
THEME=default
12+
THEME=default

packages/platform-login/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"bootstrap": "4.6.1",
2323
"bootstrap-vue": "2.22.0",
2424
"clipboard-polyfill": "3.0.1",
25-
"core-js": "3.6.5",
25+
"core-js": "3.32.0",
2626
"flush-promises": "1.0.2",
2727
"jose": "4.14.4",
2828
"lodash": "4.17.21",
@@ -44,12 +44,12 @@
4444
},
4545
"devDependencies": {
4646
"@testing-library/cypress": "7.0.3",
47-
"@vue/cli-plugin-babel": "4.5.18",
48-
"@vue/cli-service": "4.5.18",
47+
"@vue/cli-plugin-babel": "5.0.8",
48+
"@vue/cli-service": "5.0.8",
4949
"@vue/test-utils": "1.3.6",
5050
"@vue/vue2-jest": "29.2.5",
5151
"babel-core": "7.0.0-bridge.0",
52-
"copy-webpack-plugin": "5.0.3",
52+
"copy-webpack-plugin": "11.0.0",
5353
"cypress": "6.9.1",
5454
"cypress-file-upload": "5.0.6",
5555
"cypress-lighthouse": "0.1.0",
@@ -60,7 +60,7 @@
6060
"sass": "1.52.1",
6161
"sass-loader": "8.0.2",
6262
"style-resources-loader": "1.2.1",
63-
"vue-cli-plugin-i18n": "0.6.0",
63+
"vue-cli-plugin-i18n": "2.3.2",
6464
"vue-template-compiler": "2.7.14"
6565
},
6666
"postcss": {

packages/platform-login/src/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import 'whatwg-fetch';
99
import 'core-js/stable';
10+
import '@forgerock/platform-shared/src/utils/domCollectionsForEach';
1011
import 'regenerator-runtime/runtime';
1112

1213
import Vue from 'vue';

0 commit comments

Comments
 (0)