Skip to content

Commit 000e19c

Browse files
authored
feat!: Initialize micro-frontend (#17)
* build(web): move web entrypoint to grouped folder * docs: remove unused devops section in README.md * build: PoC micro-frontned in prod * build(web-landing): add ui as dependencies
1 parent 6879695 commit 000e19c

Some content is hidden

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

87 files changed

+829
-168
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
3+
vite.config.ts

.github/workflows/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ env:
1212
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1313
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
1414
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
15-
CLOUDFLARE_PAGES_PROJECT_NAME: ${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME }}
1615
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
1716

1817
jobs:
@@ -57,4 +56,6 @@ jobs:
5756
run: pnpm nx affected -t build
5857

5958
- name: Run deploy task
60-
run: pnpm nx affected -t deploy -- --project-name=$CLOUDFLARE_PAGES_PROJECT_NAME --branch=$BRANCH_NAME
59+
env:
60+
VITE_ROOT_FRAGMENT_URL: ${{ vars.ROOT_FRAGMENT_URL }}
61+
run: pnpm nx affected -t deploy -- --branch=$BRANCH_NAME

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
<h1 align="center">Producktivity</h1>
2+
3+
## References
4+
5+
### Design
6+
7+
- https://m3.material.io/
8+
9+
### Micro-Frontend
10+
11+
- https://qwik.builder.io/docs/advanced/containers/
12+
- https://blog.cloudflare.com/better-micro-frontends/
13+
- https://github.com/gioboa/qwik-dream-demo

apps/web-e2e/.eslintrc.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

apps/web-e2e/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/web-e2e/playwright.config.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

apps/web-e2e/project.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

apps/web-e2e/src/example.spec.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

apps/web/landing/.eslintrc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:qwik/recommended", "../../../.eslintrc.json"],
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"project": ["apps/web/landing/tsconfig.*?.json"],
6+
"ecmaVersion": 2021,
7+
"sourceType": "module",
8+
"ecmaFeatures": {
9+
"jsx": true
10+
}
11+
},
12+
"plugins": ["@typescript-eslint"],
13+
"ignorePatterns": ["!**/*"],
14+
"overrides": [
15+
{
16+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
17+
"rules": {}
18+
},
19+
{
20+
"files": ["*.ts", "*.tsx"],
21+
"rules": {}
22+
},
23+
{
24+
"files": ["*.js", "*.jsx"],
25+
"rules": {}
26+
}
27+
]
28+
}
File renamed without changes.

apps/web/landing/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Qwik City App ⚡️
2+
3+
- [Qwik Docs](https://qwik.builder.io/)
4+
- [Discord](https://qwik.builder.io/chat)
5+
- [Qwik GitHub](https://github.com/BuilderIO/qwik)
6+
- [@QwikDev](https://twitter.com/QwikDev)
7+
- [Vite](https://vitejs.dev/)
8+
9+
---
10+
11+
## Project Structure
12+
13+
This project is using Qwik with [QwikCity](https://qwik.builder.io/qwikcity/overview/). QwikCity is just a extra set of tools on top of Qwik to make it easier to build a full site, including directory-based routing, layouts, and more.
14+
15+
Inside your project, you'll see the following directory structure:
16+
17+
```
18+
├── public/
19+
│ └── ...
20+
└── src/
21+
├── components/
22+
│ └── ...
23+
└── routes/
24+
└── ...
25+
```
26+
27+
- `src/routes`: Provides the directory based routing, which can include a hierarchy of `layout.tsx` layout files, and an `index.tsx` file as the page. Additionally, `index.ts` files are endpoints. Please see the [routing docs](https://qwik.builder.io/qwikcity/routing/overview/) for more info.
28+
29+
- `src/components`: Recommended directory for components.
30+
31+
- `public`: Any static assets, like images, can be placed in the public directory. Please see the [Vite public directory](https://vitejs.dev/guide/assets.html#the-public-directory) for more info.
32+
33+
## Add Integrations and deployment
34+
35+
Use the `pnpm qwik add` command to add additional integrations. Some examples of integrations include: Cloudflare, Netlify or Express server, and the [Static Site Generator (SSG)](https://qwik.builder.io/qwikcity/static-site-generation/static-site-config/).
36+
37+
```shell
38+
pnpm qwik add # or `yarn qwik add`
39+
```
40+
41+
## Development
42+
43+
Development mode uses [Vite's development server](https://vitejs.dev/). During development, the `dev` command will server-side render (SSR) the output.
44+
45+
```shell
46+
npm start # or `yarn start`
47+
```
48+
49+
> Note: during dev mode, Vite may request a significant number of `.js` files. This does not represent a Qwik production build.
50+
51+
## Preview
52+
53+
The preview command will create a production build of the client modules, a production build of `src/entry.preview.tsx`, and run a local server. The preview server is only for convenience to locally preview a production build, and it should not be used as a production server.
54+
55+
```shell
56+
pnpm preview # or `yarn preview`
57+
```
58+
59+
## Production
60+
61+
The production build will generate client and server modules by running both client and server build commands. Additionally, the build command will use Typescript to run a type check on the source code.
62+
63+
```shell
64+
pnpm build # or `yarn build`
65+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { cloudflarePagesAdapter } from '@builder.io/qwik-city/adapters/cloudflare-pages/vite';
2+
import { extendConfig } from '@builder.io/qwik-city/vite';
3+
import baseConfig from '../../vite.config';
4+
5+
export default extendConfig(baseConfig, () => {
6+
return {
7+
build: {
8+
ssr: true,
9+
rollupOptions: {
10+
input: ['apps/web/landing/src/entry.cloudflare-pages.tsx', '@qwik-city-plan'],
11+
},
12+
},
13+
plugins: [cloudflarePagesAdapter()],
14+
};
15+
});

apps/web/landing/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "web-landing"
3+
}

apps/web/landing/project.json

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"name": "web-landing",
3+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"sourceRoot": "apps/web/landing/src",
6+
"implicitDependencies": ["ui"],
7+
"targets": {
8+
"build": {
9+
"executor": "qwik-nx:build",
10+
"options": {
11+
"runSequence": ["web-landing:build.client", "web-landing:build.ssr", "web-landing:build.server", "web-landing:build.bundle"],
12+
"outputPath": "dist/apps/web/landing"
13+
},
14+
"dependsOn": [
15+
{
16+
"dependencies": true,
17+
"target": "build",
18+
"params": "ignore"
19+
}
20+
],
21+
"configurations": {
22+
"preview": {}
23+
}
24+
},
25+
"build.client": {
26+
"executor": "@nx/vite:build",
27+
"options": {
28+
"outputPath": "dist/apps/web/landing",
29+
"configFile": "apps/web/landing/vite.config.ts"
30+
}
31+
},
32+
"build.ssr": {
33+
"executor": "@nx/vite:build",
34+
"defaultConfiguration": "preview",
35+
"options": {
36+
"outputPath": "dist/apps/web/landing"
37+
},
38+
"configurations": {
39+
"preview": {
40+
"ssr": "src/entry.preview.tsx",
41+
"mode": "production"
42+
}
43+
}
44+
},
45+
"build.server": {
46+
"executor": "@nx/vite:build",
47+
"options": {
48+
"outputPath": "dist/apps/web/landing",
49+
"configFile": "apps/web/landing/adapters/cloudflare-pages/vite.config.ts"
50+
}
51+
},
52+
"build.bundle": {
53+
"executor": "nx:run-commands",
54+
"options": {
55+
"commands": ["mkdir -p dist/apps/web/landing/deploy/", "cp -r dist/apps/web/landing/client/* dist/apps/web/landing/deploy/", "cp -r dist/apps/web/landing/server/ dist/apps/web/landing/deploy/server/", "echo 'Bundled to dist/apps/web/landing/deploy'"],
56+
"parallel": false
57+
}
58+
},
59+
"deploy": {
60+
"executor": "nx:run-commands",
61+
"options": {
62+
"command": "wrangler pages deploy dist/apps/web/landing/deploy --project-name=web-landing"
63+
}
64+
},
65+
"preview": {
66+
"executor": "@nx/vite:preview-server",
67+
"options": {
68+
"buildTarget": "web-landing:build",
69+
"port": 4201
70+
}
71+
},
72+
"test": {
73+
"executor": "@nx/vite:test",
74+
"outputs": ["{options.reportsDirectory}"],
75+
"options": {
76+
"passWithNoTests": true,
77+
"reportsDirectory": "../../../coverage/apps/web/landing"
78+
}
79+
},
80+
"serve": {
81+
"executor": "@nx/vite:dev-server",
82+
"dependsOn": [
83+
{
84+
"projects": "ui",
85+
"target": "build"
86+
}
87+
],
88+
"options": {
89+
"buildTarget": "web-landing:build.client",
90+
"mode": "ssr",
91+
"port": 3001
92+
}
93+
},
94+
"serve.debug": {
95+
"executor": "nx:run-commands",
96+
"options": {
97+
"command": "node --inspect-brk ../../../node_modules/vite/bin/vite.js --mode ssr --force",
98+
"cwd": "apps/web/landing"
99+
}
100+
},
101+
"lint": {
102+
"executor": "@nx/eslint:lint",
103+
"outputs": ["{options.outputFile}"],
104+
"options": {
105+
"lintFilePatterns": ["apps/web/landing/**/*.{ts,tsx,js,jsx}"]
106+
}
107+
}
108+
},
109+
"tags": []
110+
}

apps/web/landing/public/favicon.svg

Lines changed: 1 addition & 0 deletions
Loading

apps/web/landing/public/manifest.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/web-manifest-combined.json",
3+
"name": "qwik-project-name",
4+
"short_name": "Welcome to Qwik",
5+
"start_url": ".",
6+
"display": "standalone",
7+
"background_color": "#fff",
8+
"description": "A Qwik project app."
9+
}
File renamed without changes.

0 commit comments

Comments
 (0)