Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit df6870e

Browse files
committed
sync upstream and add roles support for apps menu
1 parent c0ec1b3 commit df6870e

File tree

62 files changed

+3031
-2525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3031
-2525
lines changed

.circleci/config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ builddeploy_steps: &builddeploy_steps
2828
- setup_remote_docker
2929
- run: *install_dependency
3030
- run: *install_deploysuite
31-
- run:
31+
- run:
3232
command: |
3333
./awsconfiguration.sh $DEPLOY_ENV
3434
source awsenvconf
3535
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
36-
- run:
36+
- run:
3737
command: |
3838
source buildenvvar
39-
./build.sh ${APPNAME}
39+
./build.sh ${APPNAME}
4040
- deploy:
4141
name: Running MasterScript.
4242
command: |

README.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Make sure you have [Heroky CLI](https://devcenter.heroku.com/articles/heroku-cli
5959
### Cross microfrontend imports
6060

6161
This app exports functions to be imported by other microapps.
62+
6263
- `login` - redirects to login page
6364
- `logout` - clears session storage and redirects to logout page
6465
- `setAppMenu` - sets sidebar menu for the app by app's `path`
@@ -83,6 +84,7 @@ When we want to use methods exported in the navbar microapp in other apps we hav
8384
For example see https://github.com/topcoder-platform/micro-frontends-react-app
8485

8586
1. Add `@topcoder/micro-frontends-navbar-app` to `externals` in webpack config:
87+
8688
```js
8789
externals: {
8890
"@topcoder/micro-frontends-navbar-app": "@topcoder/micro-frontends-navbar-app",
@@ -92,13 +94,13 @@ For example see https://github.com/topcoder-platform/micro-frontends-react-app
9294
2. As `importmaps` only work in browser and don't work in unit test, we have to mock this module in unit tests. For example by creating a file `src/__mocks__/@topcoder/micro-frontends-navbar-app.js` with the content like:
9395
```js
9496
module.exports = {
95-
login: () => {},
96-
logout: () => {},
97-
setAppMenu: () => {},
98-
getAuthUserTokens: () => new Promise(() => {}),
99-
getAuthUserProfile: () => new Promise(() => {}),
100-
disableSidebarForRoute: () => {},
101-
enableSidebarForRoute: () => {},
97+
login: () => {},
98+
logout: () => {},
99+
setAppMenu: () => {},
100+
getAuthUserTokens: () => new Promise(() => {}),
101+
getAuthUserProfile: () => new Promise(() => {}),
102+
disableSidebarForRoute: () => {},
103+
enableSidebarForRoute: () => {},
102104
};
103105
```
104106

@@ -107,13 +109,15 @@ For example see https://github.com/topcoder-platform/micro-frontends-react-app
107109
For example see https://github.com/topcoder-platform/micro-frontends-angular-app
108110

109111
1. Add `@topcoder/micro-frontends-navbar-app` to `externals` in webpack config:
112+
110113
```js
111114
externals: {
112115
"@topcoder/micro-frontends-navbar-app": "@topcoder/micro-frontends-navbar-app",
113116
},
114117
```
115118

116119
2. Add type definition in `src/typings.d.ts`:
120+
117121
```js
118122
declare module '@topcoder/micro-frontends-navbar-app' {
119123
export const login: any;
@@ -123,7 +127,7 @@ For example see https://github.com/topcoder-platform/micro-frontends-angular-app
123127
export const getAuthUserProfile: any;
124128
export const disableSidebarForRoute: any;
125129
export const enableSidebarForRoute: any;
126-
}
130+
}
127131
```
128132

129133
3. TODO: How to make e2e tests work for Angular? So far they fail with error `Module not found: Error: Can't resolve '@topcoder/micro-frontends-navbar-app'`

babel.config.js

+29-31
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,57 @@
11
let cssLocalIdent;
2-
if (process.env.APPMODE == 'development') {
3-
cssLocalIdent = 'navbar_[path][name]___[local]___[hash:base64:6]';
2+
if (process.env.APPMODE == "development") {
3+
cssLocalIdent = "navbar_[path][name]___[local]___[hash:base64:6]";
44
} else {
5-
cssLocalIdent = '[hash:base64:6]';
5+
cssLocalIdent = "[hash:base64:6]";
66
}
77

88
const config = {
9-
presets: ['@babel/preset-env', '@babel/preset-react'],
9+
presets: ["@babel/preset-env", "@babel/preset-react"],
1010
plugins: [
1111
[
12-
'@babel/plugin-transform-runtime',
12+
"@babel/plugin-transform-runtime",
1313
{
1414
useESModules: true,
15-
regenerator: false
16-
}
15+
regenerator: false,
16+
},
1717
],
1818
[
19-
'module-resolver',
19+
"module-resolver",
2020
{
21-
extensions: ['.js', '.jsx'],
22-
root: [
23-
'./src'
24-
]
25-
}
21+
extensions: [".js", ".jsx"],
22+
root: ["./src"],
23+
},
2624
],
2725
[
28-
'inline-react-svg',
26+
"inline-react-svg",
2927
{
30-
ignorePattern: '[/\/]assets[/\/]images'
31-
}
28+
ignorePattern: "[//]assets[//]images",
29+
},
3230
],
3331
[
34-
'react-css-modules',
32+
"react-css-modules",
3533
{
3634
filetypes: {
37-
'.scss': {
38-
syntax: 'postcss-scss'
39-
}
35+
".scss": {
36+
syntax: "postcss-scss",
37+
},
4038
},
41-
generateScopedName: cssLocalIdent
42-
}
43-
]
39+
generateScopedName: cssLocalIdent,
40+
},
41+
],
4442
],
4543
env: {
4644
test: {
4745
presets: [
4846
[
49-
'@babel/preset-env',
47+
"@babel/preset-env",
5048
{
51-
targets: 'current node'
52-
}
53-
]
54-
]
55-
}
56-
}
57-
}
49+
targets: "current node",
50+
},
51+
],
52+
],
53+
},
54+
},
55+
};
5856

5957
module.exports = config;

config/dev.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module.exports = {
22
URL: {
33
ACCOUNTS_APP_CONNECTOR: "https://accounts-auth0.topcoder-dev.com", // "http://localhost:5000"
44
AUTH: "https://accounts-auth0.topcoder-dev.com", // "http://localhost:5000"
5-
TC_NOTIFICATION_URL: 'https://api.topcoder-dev.com/v5/notifications',
6-
CONNECT_DOMAIN: 'https://connect.topcoder-dev.com',
7-
COMMUNITY_DOMAIN: 'https://www.topcoder-dev.com',
5+
TC_NOTIFICATION_URL: "https://api.topcoder-dev.com/v5/notifications",
6+
CONNECT_DOMAIN: "https://connect.topcoder-dev.com",
7+
COMMUNITY_DOMAIN: "https://www.topcoder-dev.com",
88
},
99
API: {
1010
V3: "https://api.topcoder-dev.com/v3",

config/prod.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module.exports = {
22
URL: {
33
ACCOUNTS_APP_CONNECTOR: "https://accounts-auth0.topcoder.com",
44
AUTH: "https://accounts-auth0.topcoder.com",
5-
TC_NOTIFICATION_URL: 'https://api.topcoder.com/v5/notifications',
6-
CONNECT_DOMAIN: 'https://connect.topcoder.com',
7-
COMMUNITY_DOMAIN: 'https://www.topcoder.com',
5+
TC_NOTIFICATION_URL: "https://api.topcoder.com/v5/notifications",
6+
CONNECT_DOMAIN: "https://connect.topcoder.com",
7+
COMMUNITY_DOMAIN: "https://www.topcoder.com",
88
},
99
API: {
1010
V3: "https://api.topcoder.com/v3",

docker/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: "3"
22
services:
33
micro-frontends-navbar-app:
44
image: micro-frontends-navbar-app:latest

0 commit comments

Comments
 (0)