Skip to content

chore: re-writing ./web using RSPack and tailwind #591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 77 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
b8c3997
chore: Remove "web" from the list of workspace directories in package…
ZibanPirate Jul 8, 2024
b95f9ce
added blank rspack project
ZibanPirate Jul 8, 2024
791c238
chore: Add Tailwind CSS configuration files and update dependencies
ZibanPirate Jul 8, 2024
a0fc192
added daisyui
ZibanPirate Jul 8, 2024
9a0cd0c
added custom html template
ZibanPirate Jul 8, 2024
926b431
added navbar + redux setup
ZibanPirate Jul 8, 2024
a5fd9e1
added footer
ZibanPirate Jul 8, 2024
1537806
added lazily loaded pages
ZibanPirate Jul 8, 2024
c275a13
show version in navbar
ZibanPirate Jul 8, 2024
edd1530
added language switch capability
ZibanPirate Jul 9, 2024
a8ce092
removed unwanted tab
ZibanPirate Jul 9, 2024
89c9d1d
inject language code into local component
ZibanPirate Jul 9, 2024
f00a3d9
max char per line 100
ZibanPirate Jul 9, 2024
4c316b9
fixed lint errors
ZibanPirate Jul 9, 2024
6801669
chore: Add support for rendering Markdown content with React Markdown
ZibanPirate Jul 23, 2024
fb63f58
feat: Add functionFactory for localized text rendering
ZibanPirate Jul 23, 2024
5a05796
feat: Add FAQ page data and render it dynamically
ZibanPirate Jul 23, 2024
8f619e1
added loading component
ZibanPirate Jul 23, 2024
2ba6ea7
removed /learn and /articles
ZibanPirate Jul 24, 2024
5e9a60d
refactoring
ZibanPirate Jul 24, 2024
9ee3aa8
projects page with mocked data
ZibanPirate Jul 24, 2024
673b2be
async action to mock-fetch projects
ZibanPirate Jul 25, 2024
537873c
moved webv2 to web
ZibanPirate Jul 25, 2024
5dcf5d5
got project types from API
ZibanPirate Jul 25, 2024
0fba9cc
fetch projects from api
ZibanPirate Jul 25, 2024
be661aa
moved main.html to _entry
ZibanPirate Jul 25, 2024
c7ce5fa
removed extra info from /projects endpoint
ZibanPirate Jul 25, 2024
2b585d9
deploy script
ZibanPirate Jul 25, 2024
9b7b176
fixed lint issues
ZibanPirate Jul 25, 2024
182bb49
fix: make ts-node work on Windows
ZibanPirate Aug 30, 2024
d75c199
fix: one simple e2e test
ZibanPirate Aug 30, 2024
322a86b
feat: setup unit tests with coverage
ZibanPirate Aug 31, 2024
247d48a
feat: deploy on push to rspack
ZibanPirate Aug 31, 2024
9365c6a
chore: Skip API deployment for now
ZibanPirate Aug 31, 2024
675d25a
feat: Update dev scripts
ZibanPirate Aug 31, 2024
00b0f9e
feat: added team page
ZibanPirate Aug 31, 2024
49d7c9f
feat: added contribute page
ZibanPirate Aug 31, 2024
913bba3
feat: added milestones to landing page
ZibanPirate Aug 31, 2024
7b94c06
chore: removed ./mobile
ZibanPirate Aug 31, 2024
d789bbf
fix: eslint
ZibanPirate Aug 31, 2024
e250a82
chore: updated browserlist
ZibanPirate Aug 31, 2024
7bf3feb
fix: deploy api
ZibanPirate Aug 31, 2024
4c730c5
chore: Update node version to 20.x in GitHub workflows
ZibanPirate Aug 31, 2024
8d1be98
fix: deploy api to oracle cloud again
ZibanPirate Aug 31, 2024
8820381
fix: ui tweaks
ZibanPirate Aug 31, 2024
491b657
chore: test deploying api to prod from CI
ZibanPirate Aug 31, 2024
28ddf70
chore: updatex deploy workflows
ZibanPirate Aug 31, 2024
6ad44ea
chore: removed old code cov
ZibanPirate Aug 31, 2024
235b674
chore: removed old web
ZibanPirate Aug 31, 2024
398cda9
chore: removed old ui package
ZibanPirate Aug 31, 2024
db003dc
chore: change stage trigger to workflow dispatch
ZibanPirate Aug 31, 2024
e194e18
fix: cypress and ts issue
ZibanPirate Aug 31, 2024
9cb1a25
chore: removed unused files
ZibanPirate Sep 1, 2024
7dae2cd
chore: put back deploy script for web
ZibanPirate Sep 1, 2024
9eb17c3
chore: removed unused files
ZibanPirate Sep 1, 2024
2f2b815
chore: max-width xl
ZibanPirate Sep 1, 2024
b07f9a2
chore brought back helmet
ZibanPirate Sep 1, 2024
0dce00a
chore: added SEO and GA
ZibanPirate Sep 1, 2024
4d1c15c
chore: temp deploy
ZibanPirate Sep 1, 2024
a06c7cd
chore: generate HTML files during CI build for @dzcode.io/web
ZibanPirate Sep 1, 2024
50da9ef
chore: hide googleAnalytics when on dev
ZibanPirate Sep 2, 2024
003fb48
chore: added sentry back to web
ZibanPirate Sep 2, 2024
9c36796
feat: reported caught errors to sentry
ZibanPirate Sep 2, 2024
ad5e326
moved ts types to utils package
ZibanPirate Sep 2, 2024
42f3203
chore: tooling fixes
ZibanPirate Sep 2, 2024
d0c6b2a
chore: upped firebase-tools
ZibanPirate Sep 2, 2024
06d66ca
feat: 404 page
ZibanPirate Sep 2, 2024
97e4dc8
fix: navbar selection bug
ZibanPirate Sep 2, 2024
051429d
chore: migrate web
ZibanPirate Sep 2, 2024
71d2fa7
chore: update CodeQL analysis workflow to include TypeScript support
ZibanPirate Sep 3, 2024
ac142c8
chore: Remove outdated README.md file
ZibanPirate Sep 3, 2024
22c3b05
feat: use jest config from tooling package
ZibanPirate Sep 3, 2024
d372eac
chore: defined typeof STAGE globally
ZibanPirate Sep 3, 2024
4f3931f
chore: moved footerSections instantiation to module level
ZibanPirate Sep 3, 2024
b65b158
chore: moved topBarLinks instantiation to module level
ZibanPirate Sep 3, 2024
af49a78
chore: better error handling
ZibanPirate Sep 3, 2024
b66cef1
Refactor loadable.ts to use PascalCase for type name
ZibanPirate Sep 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions .github/workflows/cd.deploy.stg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ on:
push:
tags:
- "stg-v*"
workflow_dispatch:

jobs:
install-build-deploy:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]
os: [ubuntu-latest]

env:
CI: true
STAGE: staging
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
SSH_ADDRESS_STG: ${{ secrets.SSH_ADDRESS_STG }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
DEPLOY_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || format('stg-0.0.0-{0}-{1}-{2}', github.ref_name, github.run_number, github.run_attempt) }}

steps:
- name: "Git"
Expand All @@ -37,11 +37,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: "Expo"
uses: expo/expo-github-action@v8
with:
expo-version: 4.x
token: ${{ secrets.EXPO_TOKEN }}

- name: "Install"
shell: bash
Expand All @@ -51,7 +46,7 @@ jobs:
- name: "Bundle info"
shell: bash
run: |
yarn generate:bundle-info ${{ github.ref_name }} stage
yarn generate:bundle-info $DEPLOY_VERSION stage

- name: "Build"
shell: bash
Expand All @@ -62,7 +57,7 @@ jobs:
- name: "Sentry Release"
shell: bash
run: |
yarn generate:sentry-release ${{ github.ref_name }} stage ${{ secrets.SENTRY_AUTH_TOKEN }}
yarn generate:sentry-release $DEPLOY_VERSION stage ${{ secrets.SENTRY_AUTH_TOKEN }}

- name: "Deploy"
shell: bash
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/cd.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]
os: [ubuntu-latest]

env:
CI: true
STAGE: production
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
SSH_ADDRESS_PRD: ${{ secrets.SSH_ADDRESS_PRD }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
DEPLOY_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || format('0.0.0-{0}-{1}-{2}', github.ref_name, github.run_number, github.run_attempt) }}

steps:
- name: "Git"
Expand All @@ -38,11 +37,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: "Expo"
uses: expo/expo-github-action@v8
with:
expo-version: 4.x
token: ${{ secrets.EXPO_TOKEN }}

- name: "Install"
shell: bash
Expand All @@ -52,13 +46,13 @@ jobs:
- name: "Version"
shell: bash
run: |
yarn version:apply ${{ github.ref_name }}
yarn version:push ${{ github.ref_name }}
yarn version:apply $DEPLOY_VERSION
yarn version:push $DEPLOY_VERSION

- name: "Bundle info"
shell: bash
run: |
yarn generate:bundle-info ${{ github.ref_name }} production
yarn generate:bundle-info $DEPLOY_VERSION production

- name: "Build"
shell: bash
Expand All @@ -69,7 +63,7 @@ jobs:
- name: "Sentry Release"
shell: bash
run: |
yarn generate:sentry-release ${{ github.ref_name }} production ${{ secrets.SENTRY_AUTH_TOKEN }}
yarn generate:sentry-release $DEPLOY_VERSION production ${{ secrets.SENTRY_AUTH_TOKEN }}

- name: "Deploy"
shell: bash
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/ci.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]
os: [macos-latest, ubuntu-latest, windows-latest]
fail-fast: false

Expand Down Expand Up @@ -67,13 +67,6 @@ jobs:
name: codecov-data
directory: ./data
fail_ci_if_error: false # put it back to true once we have tests in ./data
- uses: codecov/codecov-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
flags: mobile
name: codecov-mobile
directory: ./mobile
fail_ci_if_error: true
- uses: codecov/codecov-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
Expand All @@ -88,19 +81,13 @@ jobs:
name: codecov-utils
directory: ./packages/utils
fail_ci_if_error: true
- uses: codecov/codecov-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
flags: ui
name: codecov-ui
directory: ./packages/ui
fail_ci_if_error: true

- name: "Misc"
shell: bash
run: |
yarn lerna run bundle:alone --scope @dzcode.io/web
yarn lerna run generate:sitemap --scope @dzcode.io/web
yarn lerna run generate:htmls --scope @dzcode.io/web

env:
CI: true
2 changes: 1 addition & 1 deletion .github/workflows/ci.pr.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]
os: [ubuntu-latest]
browser: [chrome, firefox, edge]
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]
os: [macos-latest, ubuntu-latest, windows-latest]
fail-fast: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
fail-fast: false
matrix:
language: ["javascript"]
node-version: [18.x]
node-version: [20.x]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ If you use VSCode, please make sure to have a `.vscode/settings.json` file with

```json
{
"files.associations": {
"*.css": "tailwindcss"
},
"prettier.configPath": "packages/tooling/.prettierrc",
"eslint.options": { "overrideConfigFile": "packages/tooling/.eslintrc.json" },
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll.eslint": "always",
"source.fixAll.ts": "always"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion api/oracle-cloud/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16
FROM node:20
# Create app directory
WORKDIR /usr/src/repo

Expand Down
7 changes: 4 additions & 3 deletions api/oracle-cloud/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// can be ran locally from ./api:
// SSH_ADDRESS_STG="root@x.x.x.x" SSH_PATH="path/to/private/ssh/key" yarn deploy:stg

import { execSync } from "child_process";
import { copySync, existsSync } from "fs-extra";
import { join } from "path";
Expand Down Expand Up @@ -82,8 +85,6 @@ logs = execSync(
console.log("✅ New code uploaded.");

console.log("\n⚙️ Starting up the app");
logs = execSync(
sshPrefix + '"sudo docker-compose -f ' + appPath + '/docker-compose.yml up -d --build"',
);
logs = execSync(sshPrefix + '"cd ' + appPath + ' && docker compose up -d --build"');
console.log(String(logs));
console.log("✅ Deployment successful.");
4 changes: 2 additions & 2 deletions api/oracle-cloud/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ services:
ports:
- "80:7070"
env_file:
- /home/opc/app-env/api.env
- /home/ubuntu/app-env/api.env
volumes:
- /home/opc/app-data/api/fetch_cache:/usr/src/repo/api/fetch_cache
- /home/ubuntu/app-data/api/fetch_cache:/usr/src/repo/api/fetch_cache
6 changes: 3 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
},
"scripts": {
"build": "lerna run build:alone --scope=@dzcode.io/api --include-dependencies --stream",
"build:alone": "tsc",
"build:alone:watch": "tsc --watch --preserveWatchOutput",
"build:alone": "tspc",
"build:alone:watch": "tspc --watch --preserveWatchOutput",
"build:watch": "lerna run build:alone:watch --scope=@dzcode.io/api --include-dependencies --parallel",
"clean": "lerna run clean:alone --scope=@dzcode.io/api --include-dependencies --stream",
"clean:alone": "rimraf dist coverage fetch_cache oracle-cloud/build",
Expand All @@ -80,7 +80,7 @@
"lint:fix:alone": "yarn lint:eslint --fix . && yarn lint:prettier --write .",
"lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --loglevel warn",
"lint:ts-prune": "ts-node ../packages/tooling/setup-ts-prune.ts && ts-prune --error",
"lint:tsc": "tsc --noEmit",
"lint:tsc": "tspc --noEmit",
"start": "node dist/app/index.js",
"start:dev": "ts-node ../packages/tooling/nodemon.ts @dzcode.io/api && nodemon dist/app/index.js",
"test": "yarn build && yarn test:alone",
Expand Down
6 changes: 6 additions & 0 deletions api/src/contribution/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export class ContributionRepository {
)
).reduce((pV, cV) => [...pV, ...cV], []);
if (filterFn) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
contributions = contributions.filter(filterFn);
}
contributions = contributions.sort(
Expand All @@ -93,11 +95,15 @@ export class ContributionRepository {
this.pushUniqueOption([{ name: project.slug, label: project.name }], filters[0].options);

this.pushUniqueOption(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
languages.map((language) => ({ name: language })),
filters[1].options,
);

this.pushUniqueOption(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
labels.map((label) => ({ name: label })),
filters[2].options,
);
Expand Down
47 changes: 1 addition & 46 deletions api/src/project/controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AccountEntity } from "@dzcode.io/models/dist/account";
import { Controller, Get } from "routing-controllers";
import { OpenAPI, ResponseSchema } from "routing-controllers-openapi";
import { DataService } from "src/data/service";
Expand Down Expand Up @@ -26,52 +25,8 @@ export class ProjectController {
// get projects from /data folder:
const projects = await this.dataService.listProjects();

// fetch info about these projects from github:
const infoRichProjects: GetProjectsResponseDto["projects"] = await Promise.all(
projects.map(async (project) => {
const { repositories } = project;
return {
...project,
repositories: await Promise.all(
repositories.map(async ({ provider, owner, repository }) => {
let contributionCount = 0;
let contributors: AccountEntity[] = [];
let languages: string[] = [];
try {
[contributionCount, contributors, languages] = await Promise.all([
(await this.githubService.listRepositoryIssues({ owner, repository })).length,
await Promise.all(
(
await this.githubService.listRepositoryContributors({ owner, repository })
).map(async ({ login }) => {
const githubUser = await this.githubService.getUser({ username: login });
return this.githubService.githubUserToAccountEntity(githubUser);
}),
),
await this.githubService.listRepositoryLanguages({ owner, repository }),
]);
} catch (error) {
this.loggerService.error({
message: `Failed to fetch rich info for project: ${owner}/${repository}`,
meta: { owner, repository, error },
});
}

return {
provider,
owner,
repository,
stats: { contributionCount, languages },
contributors,
};
}),
),
};
}),
);

return {
projects: infoRichProjects,
projects,
};
}
}
6 changes: 1 addition & 5 deletions api/src/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,5 @@ import { GeneralResponseDto } from "src/app/types";
export class GetProjectsResponseDto extends GeneralResponseDto {
@ValidateNested({ each: true })
@Type(() => ProjectEntity)
// @TODO-ZM: find a way to DRY this, eg:
// projects!: Model<ProjectEntity, 'repositories' | 'repositories.contributors' | 'repositories.stats'>[]
projects!: Array<
Model<ProjectEntity> & { repositories: Model<RepositoryEntity, "contributors" | "stats">[] }
>;
projects!: Array<Model<ProjectEntity> & { repositories: Model<RepositoryEntity>[] }>;
}
2 changes: 1 addition & 1 deletion api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@dzcode.io/tooling/tsconfig.json",
"extends": "../packages/tooling/tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"baseUrl": "."
Expand Down
2 changes: 1 addition & 1 deletion data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@types/fs-extra": "^9.0.13",
"@types/glob": "^7.1.4",
"cpx": "^1.5.0",
"firebase-tools": "^9.1.0"
"firebase-tools": "^13.16.0"
},
"engines": {
"node": ">=16",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packages": ["packages/*", "api", "data", "web", "mobile"],
"packages": ["packages/*", "api", "data", "web"],
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true
Expand Down
Loading
Loading