Skip to content

Commit

Permalink
feat: adding root, shell, project
Browse files Browse the repository at this point in the history
  • Loading branch information
schirrel committed Jul 11, 2021
0 parents commit b5b0a8d
Show file tree
Hide file tree
Showing 19 changed files with 9,047 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NODE_ENV=development
PUBLIC_PATH=http://localhost:3000/

# remotes

REMOTE_CART=cart@http://localhost:3001/remoteEntry.js
REMOTE_PRODUCTS=products@http://localhost:3002/remoteEntry.js
REMOTE_PROFILE=profile@http://localhost:3003/remoteEntry.js
8 changes: 8 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NODE_ENV=production
PUBLIC_PATH=https://mfe-module-federation-vue-root.profile.app/

# remotes

REMOTE_CART=cart@https://mfe-module-federation-vue-cart.netlify.app/remoteEntry.js
REMOTE_PRODUCTS=products@https://mfe-module-federation-vue-products.netlify.app/remoteEntry.js
REMOTE_PROFILE=profile@https://mfe-module-federation-vue-profile.netlify.app/remoteEntry.js
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
52 changes: 52 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "@microfrontend-vue/root",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build --mode production",
"lint": "vue-cli-service lint",
"clean": "rm -rf dist",
"start": "http-server -c-1 -p 9000 ./dist"
},
"dependencies": {
"core-js": "^3.6.5",
"http-server": "^0.12.3",
"vue": "^2.6.11",
"vue-router": "^3.5.2",
"vuetify": "^2.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "5.0.0-beta.2",
"@vue/cli-plugin-eslint": "4.5.13",
"@vue/cli-service": "5.0.0-beta.2",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"sass": "~1.32.0",
"sass-loader": "^10.0.0",
"vue-cli-plugin-vuetify": "~2.4.1",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.7.0",
"webpack": "^5.35.1"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
Binary file added public/favicon.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
39 changes: 39 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<v-app>
<Navbar @menuToggle="changeMenuState" />

<Menu :showMenu="drawer" />

<Main />
</v-app>
</template>

<script>
import Navbar from "./components/Navbar.vue";
import Menu from "./components/Menu.vue";
import Main from "./components/Main.vue";
export default {
name: "App",
components: {
Navbar,
Menu,
Main,
},
data: () => ({
drawer: true,
items: [
{ title: "Dashboard", icon: "mdi-view-dashboard" },
{ title: "Photos", icon: "mdi-image" },
{ title: "About", icon: "mdi-help-box" },
],
}),
methods: {
changeMenuState() {
this.drawer = !this.drawer;
},
},
};
</script>
Binary file added src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Vue from "vue";
import App from "./App.vue";
import vuetify from "./plugins/vuetify";
import VueRouter from "vue-router";
import router from "./router";
Vue.config.productionTip = false;
Vue.use(VueRouter);

new Vue({
vuetify,
router,
render: (h) => h(App),
}).$mount("#app");
66 changes: 66 additions & 0 deletions src/components/Main.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<template>
<v-main>
<v-container fluid>
<router-view />
</v-container>
</v-main>
</template>

<script>
export default {
name: "Main",
data: () => ({
ecosystem: [
{
text: "vuetify-loader",
href: "https://github.com/vuetifyjs/vuetify-loader",
},
{
text: "github",
href: "https://github.com/vuetifyjs/vuetify",
},
{
text: "awesome-vuetify",
href: "https://github.com/vuetifyjs/awesome-vuetify",
},
],
importantLinks: [
{
text: "Documentation",
href: "https://vuetifyjs.com",
},
{
text: "Chat",
href: "https://community.vuetifyjs.com",
},
{
text: "Made with Vuetify",
href: "https://madewithvuejs.com/vuetify",
},
{
text: "Twitter",
href: "https://twitter.com/vuetifyjs",
},
{
text: "Articles",
href: "https://medium.com/vuetify",
},
],
whatsNext: [
{
text: "Explore components",
href: "https://vuetifyjs.com/components/api-explorer",
},
{
text: "Select a layout",
href: "https://vuetifyjs.com/getting-started/pre-made-layouts",
},
{
text: "Frequently Asked Questions",
href: "https://vuetifyjs.com/getting-started/frequently-asked-questions",
},
],
}),
};
</script>
40 changes: 40 additions & 0 deletions src/components/Menu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<v-navigation-drawer app v-model="showMenu" absolute clipped>
<v-list nav>
<v-list-item
v-for="item in items"
:key="item.title"
link
:to="item.route"
>
<v-list-item-icon>
<v-icon>{{ item.icon }}</v-icon>
</v-list-item-icon>

<v-list-item-content>
<v-list-item-title>{{ item.title }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-navigation-drawer>
</template>

<script>
export default {
name: "Menu",
props: ["showMenu"],
data() {
return {
items: [
{ title: "Products", icon: "mdi-tag-heart", route: "/products" },
{ title: "Cart", icon: "mdi-cart", route: "/cart" },
{ title: "My Account", icon: "mdi-account", route: "/profile" },
],
right: null,
};
},
};
</script>

<style>
</style>
18 changes: 18 additions & 0 deletions src/components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<v-app-bar app color="primary" dark clipped-left>
<v-app-bar-nav-icon @click="menuToggle"></v-app-bar-nav-icon>
<v-toolbar-title>Title</v-toolbar-title>
</v-app-bar>
</template>

<script>
export default {
name: "Navbar",
data: () => ({ drawer: null }),
methods: {
menuToggle() {
this.$emit("menuToggle");
},
},
};
</script>
1 change: 1 addition & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import('./bootstrap');
7 changes: 7 additions & 0 deletions src/plugins/vuetify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Vue from 'vue';
import Vuetify from 'vuetify/lib/framework';

Vue.use(Vuetify);

export default new Vuetify({
});
17 changes: 17 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import VueRouter from "vue-router";

const Cart = () => import("cart/Cart");
const Profile = () => import("profile/Profile");
const Products = () => import("products/Products");

const routes = [
{ path: "/cart", component: Cart },
{ path: "/products", component: Products },
{ path: "/profile", component: Profile },
];

const router = new VueRouter({
routes,
});

export default router;
29 changes: 29 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const dependencies = require("./package.json").dependencies;

console.log();

module.exports = {
publicPath: process.env.PUBLIC_PATH,
transpileDependencies: ["vuetify"],
configureWebpack: {
plugins: [
new ModuleFederationPlugin({
name: "root",
filename: "remoteEntry.js",
exposes: {},
remotes: {
cart: process.env.REMOTE_CART,
products: process.env.REMOTE_PRODUCTS,
profile: process.env.REMOTE_PROFILE,
},
shared: dependencies,
}),
],
},
devServer: {
port: 3000,
progress: false,
},
};
Loading

0 comments on commit b5b0a8d

Please sign in to comment.