Skip to content

Commit 330b6ad

Browse files
fixing build issues with DB (#410)
* fixing build issues with DB * pin apollo version * fixing build issues with DB * Fixes * move tokens to .env file * rmpty env file * ignore all env files * ignore all env files * ignore all env files Co-authored-by: Jack Herrington <[email protected]>
1 parent d1ba3fc commit 330b6ad

File tree

27 files changed

+3490
-2643
lines changed

27 files changed

+3490
-2643
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ typings/
7474
.yarn/install-state.gz
7575

7676
# dotenv environment variables file
77-
.env
77+
*.env
7878
env.json
7979
.env.test
8080

dashboard-example/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DASHBOARD_READ_TOKEN=ENTERWRITETOKEN
2+
DASHBOARD_READ_WRITE=ENTERREADTOKEN

dashboard-example/dsl/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dashboard/dsl",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"private": true,
55
"devDependencies": {
66
"@babel/core": "7.15.5",
@@ -17,7 +17,7 @@
1717
"style-loader": "2.0.0",
1818
"webpack": "5.61.0",
1919
"webpack-cli": "4.7.2",
20-
"webpack-dev-server": "3.11.2"
20+
"webpack-dev-server": "^4.7.4"
2121
},
2222
"scripts": {
2323
"start": "node ../../node_modules/webpack-cli/bin/cli.js serve --liveReload",

dashboard-example/dsl/webpack.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
require("dotenv").config({ path: "../.env" });
12
const HtmlWebpackPlugin = require("html-webpack-plugin");
23
const DashboardPlugin = require("@module-federation/dashboard-plugin");
34
const { ModuleFederationPlugin } = require("webpack").container;
45
const path = require("path");
5-
66
module.exports = {
77
entry: "./src/index",
88
mode: "development",
@@ -76,12 +76,15 @@ module.exports = {
7676
new HtmlWebpackPlugin({
7777
template: "./public/index.html",
7878
}),
79-
process.env.VERCEL_GIT_COMMIT_REF === "master"
79+
process.env.VERCEL_GIT_COMMIT_REF === "master" || !process.env.VERCEL_URL
8080
? new DashboardPlugin({
8181
publishVersion: require("./package.json").version,
8282
filename: "dashboard.json",
83-
dashboardURL:
84-
"https://federation-dashboard-alpha.vercel.app/api/update?token=ca9e136d-0ec1-4f46-9d11-817d24219531",
83+
dashboardURL: `${
84+
process.env.VERCEL_URL
85+
? "https://federation-dashboard-alpha.vercel.app"
86+
: "http://localhost:3000"
87+
}/api/update?token=${process.env.DASHBOARD_READ_WRITE}`,
8588
metadata: {
8689
baseUrl: process.env.VERCEL_URL
8790
? "https://" + process.env.VERCEL_URL

dashboard-example/home/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"style-loader": "2.0.0",
1717
"webpack": "5.61.0",
1818
"webpack-cli": "4.7.2",
19-
"webpack-dev-server": "3.11.2"
19+
"webpack-dev-server": "^4.7.4"
2020
},
2121
"scripts": {
2222
"start": "webpack-cli serve --liveReload",

dashboard-example/home/public/index.html

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<html>
22
<head>
3-
<link rel="preconnect" href="https://federation-dashboard-alpha.vercel.app/">
4-
<link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e&currentHost=home&remoteName=utils">
5-
<link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e&currentHost=home&remoteName=home">
6-
<link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e&currentHost=home&remoteName=search">
7-
<link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e&currentHost=home&remoteName=nav">
8-
<link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e&currentHost=home&remoteName=dsl">
9-
<script src="https://medusa-example-dsl.vercel.app/remoteEntry.js"></script>
10-
<!-- <script src="http://localhost:3002/remoteEntry.js"></script>-->
11-
<script src="https://medusa-example-nav.vercel.app/remoteEntry.js"></script>
12-
<!-- <script src="http://localhost:3003/remoteEntry.js"></script>-->
13-
<script src="https://medusa-example-search.vercel.app/remoteEntry.js"></script>
14-
<!-- <script src="http://localhost:3004/remoteEntry.js"></script>-->
15-
<script src="https://medusa-example-utils.vercel.app/remoteEntry.js"></script>
16-
<!-- <script src="http://localhost:3005/remoteEntry.js"></script>-->
3+
<!-- <link rel="preconnect" href="https://federation-dashboard-alpha.vercel.app/">-->
4+
<!-- <link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=e75c10ba-749d-4451-8fb0-4ad972ebf970&currentHost=home&remoteName=utils">-->
5+
<!-- <link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=e75c10ba-749d-4451-8fb0-4ad972ebf970&currentHost=home&remoteName=home">-->
6+
<!-- <link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=e75c10ba-749d-4451-8fb0-4ad972ebf970&currentHost=home&remoteName=search">-->
7+
<!-- <link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=e75c10ba-749d-4451-8fb0-4ad972ebf970&currentHost=home&remoteName=nav">-->
8+
<!-- <link rel="prefetch" as="document" href="https://federation-dashboard-alpha.vercel.app/api/get-remote?token=e75c10ba-749d-4451-8fb0-4ad972ebf970&currentHost=home&remoteName=dsl">-->
9+
<!-- <script src="https://medusa-example-dsl.vercel.app/remoteEntry.js"></script>-->
10+
<script src="http://localhost:3002/remoteEntry.js"></script>
11+
<!-- <script src="https://medusa-example-nav.vercel.app/remoteEntry.js"></script>-->
12+
<script src="http://localhost:3003/remoteEntry.js"></script>
13+
<!-- <script src="https://medusa-example-search.vercel.app/remoteEntry.js"></script>-->
14+
<script src="http://localhost:3004/remoteEntry.js"></script>
15+
<!-- <script src="https://medusa-example-utils.vercel.app/remoteEntry.js"></script>-->
16+
<script src="http://localhost:3005/remoteEntry.js"></script>
1717
</head>
1818
<body>
1919
<div id="root"></div>

dashboard-example/home/webpack.config.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require("dotenv").config({ path: "../.env" });
12
const HtmlWebpackPlugin = require("html-webpack-plugin");
23
const DashboardPlugin = require("@module-federation/dashboard-plugin");
34
const clientVersion = require("../../dashboard-plugin/client-version");
@@ -73,7 +74,7 @@ module.exports = {
7374
process.env.VERCEL_URL
7475
? "https://federation-dashboard-alpha.vercel.app"
7576
: "http://localhost:3000"
76-
}/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e`,
77+
}/api/get-remote?token=${process.env.DASHBOARD_READ_TOKEN}`,
7778
}),
7879
search: clientVersion({
7980
currentHost: "home",
@@ -82,7 +83,7 @@ module.exports = {
8283
process.env.VERCEL_URL
8384
? "https://federation-dashboard-alpha.vercel.app"
8485
: "http://localhost:3000"
85-
}/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e`,
86+
}/api/get-remote?token=${process.env.DASHBOARD_READ_TOKEN}`,
8687
}),
8788
nav: clientVersion({
8889
currentHost: "home",
@@ -91,7 +92,7 @@ module.exports = {
9192
process.env.VERCEL_URL
9293
? "https://federation-dashboard-alpha.vercel.app"
9394
: "http://localhost:3000"
94-
}/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e`,
95+
}/api/get-remote?token=${process.env.DASHBOARD_READ_TOKEN}`,
9596
}),
9697
utils: clientVersion({
9798
currentHost: "home",
@@ -100,7 +101,7 @@ module.exports = {
100101
process.env.VERCEL_URL
101102
? "https://federation-dashboard-alpha.vercel.app"
102103
: "http://localhost:3000"
103-
}/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e`,
104+
}/api/get-remote?token=${process.env.DASHBOARD_READ_TOKEN}`,
104105
}),
105106
},
106107
exposes: {
@@ -114,12 +115,13 @@ module.exports = {
114115
template: "./public/index.html",
115116
excludeChunks: ["remoteEntry"],
116117
}),
117-
process.env.VERCEL_GIT_COMMIT_REF === "master"
118+
process.env.VERCEL_GIT_COMMIT_REF === "master" || !process.env.VERCEL_URL
118119
? new DashboardPlugin({
119120
publishVersion: require("./package.json").version,
120121
filename: "dashboard.json",
121-
dashboardURL:
122-
"https://federation-dashboard-alpha.vercel.app/api/update?token=ca9e136d-0ec1-4f46-9d11-817d24219531",
122+
dashboardURL: process.env.VERCEL_URL
123+
? "https://federation-dashboard-alpha.vercel.app/api/update?token=c754d13b-a294-462e-b0ef-71d2ad307426"
124+
: "http://localhost:3000/api/update?token=c754d13b-a294-462e-b0ef-71d2ad307426",
123125
versionChangeWebhook: "http://cnn.com/",
124126
metadata: {
125127
clientUrl: "http://localhost:3000",

dashboard-example/nav/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"style-loader": "2.0.0",
1717
"webpack": "5.61.0",
1818
"webpack-cli": "4.7.2",
19-
"webpack-dev-server": "3.11.2"
19+
"webpack-dev-server": "^4.7.4"
2020
},
2121
"scripts": {
2222
"start": "webpack-cli serve --liveReload",

dashboard-example/nav/webpack.config.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require("dotenv").config({ path: "../.env" });
12
const HtmlWebpackPlugin = require("html-webpack-plugin");
23
const DashboardPlugin = require("@module-federation/dashboard-plugin");
34
const clientVersion = require("../../dashboard-plugin/client-version");
@@ -65,8 +66,11 @@ module.exports = {
6566
dsl: clientVersion({
6667
currentHost: "nav",
6768
remoteName: "dsl",
68-
dashboardURL:
69-
"https://federation-dashboard-alpha.vercel.app/api/get-remote?token=d9a72038-a1cd-4069-85e2-d8f56d84372e",
69+
dashboardURL: `${
70+
process.env.VERCEL_URL
71+
? "https://federation-dashboard-alpha.vercel.app"
72+
: "http://localhost:3000"
73+
}/api/get-remote?token=${process.env.DASHBOARD_READ_TOKEN}`,
7074
}),
7175
search: "search",
7276
utils: "utils",
@@ -81,12 +85,13 @@ module.exports = {
8185
new HtmlWebpackPlugin({
8286
template: "./public/index.html",
8387
}),
84-
process.env.VERCEL_GIT_COMMIT_REF === "master"
88+
process.env.VERCEL_GIT_COMMIT_REF === "master" || !process.env.VERCEL_URL
8589
? new DashboardPlugin({
8690
publishVersion: require("./package.json").version,
8791
filename: "dashboard.json",
88-
dashboardURL:
89-
"https://federation-dashboard-alpha.vercel.app/api/update?token=ca9e136d-0ec1-4f46-9d11-817d24219531",
92+
dashboardURL: process.env.VERCEL_URL
93+
? `https://federation-dashboard-alpha.vercel.app/api/update?token=${process.env.DASHBOARD_WRITE_TOKEN}`
94+
: `http://localhost:3000/api/update?token=${process.env.DASHBOARD_WRITE_TOKEN}`,
9095
versionChangeWebhook: "http://cnn.com/",
9196
metadata: {
9297
baseUrl: process.env.VERCEL_URL

dashboard-example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"start": "concurrently \"cd dsl; yarn start\" \"cd home; yarn start\" \"cd nav; yarn start\" \"cd search; yarn start\" \"cd utils; yarn start\"",
55
"build": "concurrently \"cd dsl; yarn build\" \"cd home; yarn build\" \"cd nav; yarn build\" \"cd search; yarn build\" \"cd utils; yarn build\"",
66
"serve": "concurrently \"cd dsl; yarn serve\" \"cd home; yarn serve\" \"cd nav; yarn serve\" \"cd search; yarn serve\" \"cd utils; yarn serve\"",
7-
"clean": "lerna run --scope @dashboard/* --parallel clean"
7+
"clean": "lerna run --scope @dashboard/* --parallel clean",
8+
"postinstall": "yarn link @module-federation/dashboard-plugin"
89
},
910
"workspaces": {
1011
"packages": [

0 commit comments

Comments
 (0)