Skip to content
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

feat(api): create modularized libraries #113

Merged
merged 50 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b04111b
chore(api/env): generate env library
JowiAoun Sep 14, 2024
c23c0ec
chore(api/db): generate db library
JowiAoun Sep 14, 2024
f336dde
chore(api/api): generate api library
JowiAoun Sep 14, 2024
d9a2cc1
chore(deps): add t3-oss/env-nextjs and zod
JowiAoun Sep 14, 2024
dff14a5
feat(api/env): add relevant env vars
JowiAoun Sep 14, 2024
f568042
chore(api/env/lint): allow dot-notation for env vars
JowiAoun Sep 14, 2024
ba3cf15
refactor(api/env): use brackets instead of dot notation for env vars
JowiAoun Sep 15, 2024
5e884c0
build(api/env): export env vars from barrel file
JowiAoun Sep 15, 2024
d61da75
chore(deps): install initial db dependencies
JowiAoun Sep 15, 2024
c29f3e5
chore(api/db): move drizzle config to library root
JowiAoun Sep 16, 2024
d312e10
feat(api/db): create sample database schema
JowiAoun Sep 16, 2024
12cff16
chore(deps): add tRPC and superjson
JowiAoun Sep 16, 2024
2c896da
chore(api/auth): generate auth library
JowiAoun Sep 16, 2024
351cb48
chore(api/utils): generate utils library
JowiAoun Sep 19, 2024
a7a0288
chore(deps): install lucia and drizzle adapter
JowiAoun Sep 16, 2024
9f5c189
feat(api/api): create initial user route
JowiAoun Sep 17, 2024
1a75c1d
feat(api/auth): create initial auth library
JowiAoun Sep 17, 2024
c7b2fd1
chore(repo): add env to gitignore
JowiAoun Sep 19, 2024
2e618be
fix(config): make libraries public
JowiAoun Sep 24, 2024
3a9d0f7
chore(config): make library builds require builds of used dependencies
JowiAoun Sep 24, 2024
151eb9e
feat(api/db): create docker-compose with postgres database
JowiAoun Sep 24, 2024
2a3badb
fix(api/db): drizzle schema from monorepo root
JowiAoun Sep 28, 2024
26743aa
feat(api/db): create initial database schemas
JowiAoun Sep 28, 2024
f9e10b4
feat(api/api.auth): install required libraried for trpc api & auth
JowiAoun Sep 28, 2024
8703891
feat(api/api.auth): implement trpc communication from portal
JowiAoun Sep 28, 2024
a02ed39
fix(api/db): change monorepo moduleResolution from Node to Bundler
JowiAoun Sep 28, 2024
b626b8f
refactor(api/env): allow dot notation
JowiAoun Sep 28, 2024
404655d
fix(api/db): add database schema as input
JowiAoun Sep 28, 2024
c3029eb
feat(api/utils): create getBaseUrl method
JowiAoun Sep 28, 2024
7b960e6
fix(api/db): build failing in pipeline
JowiAoun Sep 29, 2024
c396966
docs(libraries): create initial monorepo libraries page
JowiAoun Oct 1, 2024
501d69e
docs(libraries): create library documentations
JowiAoun Oct 1, 2024
8d1503a
docs(libraries/template): create template documentation
JowiAoun Oct 1, 2024
beeda9d
fix(libs/db): temporary workaround to get migration command working
MFarabi619 Oct 3, 2024
b207a1e
chore(libs): modify main entry points to use ts
JowiAoun Oct 4, 2024
e8f761e
refactor(config/docker-compose): change db name to 2025-db
JowiAoun Oct 4, 2024
e623f0a
chore(api/portal): update .env.example
JowiAoun Oct 4, 2024
4466a71
docs(tools-overview): replace next-auth with lucia-auth and remove pr…
JowiAoun Oct 4, 2024
9f179b8
ci(build): fix build step failing due to missing env vars
JowiAoun Oct 5, 2024
c39537d
docs(libraries/index): initialize index properly
JowiAoun Oct 5, 2024
93b1a93
test(docs-e2e): fix locator bug on fumadocs
HasithDeAlwis Oct 5, 2024
fa9fa86
ci(build): remove playwright installs
HasithDeAlwis Oct 5, 2024
26481bf
ci(build): update fetch-depth to 1
HasithDeAlwis Oct 5, 2024
c8325aa
ci(e2e): fix failing tests by adding .env variables
HasithDeAlwis Oct 5, 2024
b51132f
ci(build): split up build command for apps
MFarabi619 Oct 5, 2024
b1522f5
chore: remove postinstall script from package.json
MFarabi619 Oct 5, 2024
c48c3bb
chore(deps): add sharp
MFarabi619 Oct 5, 2024
f36968f
chore(docs/config/next): comment out all nx configs
MFarabi619 Oct 5, 2024
fd6fbb4
ci(build): remove nodejs pnpm cache
MFarabi619 Oct 5, 2024
75b33bc
ci(build): add back playwright browser install
MFarabi619 Oct 5, 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
24 changes: 16 additions & 8 deletions .github/workflows/BUILD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: '*'

jobs:
release:
build:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -17,27 +17,35 @@ jobs:
- name: 🛎️ Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # All history for branches and tags
fetch-depth: 1 # Shallow clone (only take latest commit)

- name: 📦 Install pnpm
uses: pnpm/action-setup@v4
# with:
# run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: 🧹 Lint Projects
run: pnpm i; pnpm nx run-many -t lint -p docs docs-e2e website website-e2e portal portal-e2e --verbose

- name: 🎭 Install Playwright Browsers
run: pnpm exec playwright install --with-deps
run: pnpm playwright install --with-deps

- name: 🏗️ Build Projects
run: pnpm nx run-many -t build -p docs website portal --verbose
- name: 📚 Build Docs
run: pnpm nx build docs --verbose

- name: 🌐 Build Website
run: pnpm nx build website --verbose

- name: 🌀 Build Portal
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
run: pnpm nx build portal --verbose

- name: 💰 Profit
run: echo 🐞
5 changes: 5 additions & 0 deletions .github/workflows/TEST_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ jobs:
retention-days: 30

- name: 💀 Run Portal E2E Tests
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
run: pnpm nx run portal-e2e:e2e --reporter=html --verbose

- name: 📄 Upload Portal E2E Playwright Report
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ Thumbs.db
# Next.js
.next
out

# Environment variables files
**/*.env
**/*.env.*
!**/*.env.example
28 changes: 28 additions & 0 deletions .verdaccio/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# path to a directory with all packages
storage: ../tmp/local-registry/storage
Comment on lines +1 to +2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using an absolute path for storage

The current storage path is relative (../tmp/local-registry/storage). This could lead to issues if the working directory changes. Additionally, using a temporary directory for storage might result in data loss.

Consider the following improvements:

  1. Use an absolute path for the storage location.
  2. Choose a more permanent storage location, especially if you plan to persist package data between sessions.

Example:

storage: /path/to/verdaccio/storage


# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
maxage: 60m

packages:
'**':
# give all users (including non-authenticated users) full access
# because it is a local registry
access: $all
publish: $all
unpublish: $all

# if package is not available locally, proxy requests to npm registry
proxy: npmjs

# log settings
logs:
type: stdout
format: pretty
level: warn

publish:
allow_offline: true # set offline to true to allow publish offline
6 changes: 3 additions & 3 deletions apps/docs-e2e/src/pom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export class DocsLayout {
this.page = page

// Desktop Header
this.cuHackingLogoIcon = page.getByRole('img', { name: 'cuHacking logo' })
this.cuHackingLogoText = page.getByRole('link', { name: 'cuHacking logo cuHacking' })
this.cuHackingLogoIcon = page.getByRole('img', { name: 'cuHacking logo' }).first()
this.cuHackingLogoText = page.getByRole('link', { name: 'cuHacking logo cuHacking' }).first()
this.websiteDropdownButton = page.getByRole('button', { name: 'Website' })
this.websiteLink = page.getByRole('dialog').getByRole('link', { name: 'Website' })
this.websiteSourceLink = page.getByRole('dialog').getByRole('link', { name: 'Source' })
Expand All @@ -80,7 +80,7 @@ export class DocsLayout {
this.sectionsDropdownButton = page.getByRole('button', { name: 'Home Leave none behind' })
this.mobileWebsiteLink = page.getByRole('link', { name: 'Website' })
this.mobileHackerPortalSourceLink = page.getByRole('link', { name: 'Source', exact: true })
this.mobileHackerAppLink = page.getByRole('link', { name: 'App' })
this.mobileHackerAppLink = page.getByRole('link', { name: 'App', exact: true })
this.mobileWebsiteSourceLink = page.getByRole('link', { name: 'Source (legacy)' })
this.mobileGithubIcon = page.getByRole('link', { name: 'Github' })
this.mobileHackerPortalProjectBoardLink = page.getByRole('link', { name: 'Project Board' })
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const nextConfig = {
nx: {
// Set this to true if you would like to use SVGR
// See: https://github.com/gregberge/svgr
svgr: false,
reactStrictMode: true,
output: 'standalone',
// svgr: false,
// reactStrictMode: true,
// output: 'standalone',
},
}

Expand Down
9 changes: 8 additions & 1 deletion apps/docs/src/app/docs/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { createElement } from 'react'
import {
GitPullRequestCreateArrow as ContributionGuidelinesIcon,
Dock as HomeIcon,
Library as KnowledgeBaseIcon,
BookOpenText as KnowledgeBaseIcon,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

KnowledgeBaseIcon usage not updated in pages array

The import for KnowledgeBaseIcon has been updated to BookOpenText, but its usage in the pages array within apps/docs/src/app/docs/source.ts still references KnowledgeBaseIcon. Please update the pages array to use the new BookOpenText icon.

🔗 Analysis chain

Verify KnowledgeBaseIcon usage in pages array

The import for KnowledgeBaseIcon has been updated from Library to BookOpenText. However, the usage of this icon in the pages array is not visible in the provided code snippet.

Please run the following script to verify that the KnowledgeBaseIcon is correctly used in the pages array:

If the script doesn't return any results, please update the pages array to use the new KnowledgeBaseIcon.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify KnowledgeBaseIcon usage in pages array

# Test: Search for KnowledgeBaseIcon usage in the file
rg --type typescript 'icon:\s*KnowledgeBaseIcon' apps/docs/src/app/docs/source.ts

Length of output: 118


Script:

#!/bin/bash
# Description: Verify KnowledgeBaseIcon usage in pages array

# Search for KnowledgeBaseIcon usage in the pages array within source.ts
rg 'icon:\s*KnowledgeBaseIcon' apps/docs/src/app/docs/source.ts

Length of output: 94

Library as LibrariesIcon,
Layers as ToolsIcon,
icons,
} from 'lucide-react'
Expand Down Expand Up @@ -36,6 +37,12 @@ export const pages = [
url: 'knowledge-base',
icon: KnowledgeBaseIcon,
},
{
title: 'Libraries',
description: 'Libraries within this monorepo used within the applications.',
url: 'libraries',
icon: LibrariesIcon,
},
]

export const { getPage, getPages, pageTree } = loader({
Expand Down
Loading