Skip to content

Commit

Permalink
✨ v2.0.0 (#784)
Browse files Browse the repository at this point in the history
* ✨ Use Svelte 5 (TypeScript x Rune)
* ✨ Use Tailwind CSS 4
* ✨ Replace Nhost with Supabase
* ✨ Use eslint 9 (Flat Config)
* ♻️ Prepend @repo/ to custom package names
* ♻️ Merge eslint-config-custom-typescript into eslint-config-custom
* 📝 Update README.md
  • Loading branch information
usagizmo committed Apr 27, 2024
1 parent 10c0c10 commit f5960fd
Show file tree
Hide file tree
Showing 194 changed files with 6,905 additions and 15,021 deletions.
14 changes: 6 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# WebApp (`apps/web`)
# Supabase (`apps/backend`)

PUBLIC_GOOGLE_ANALYTICS_ID=

# Nhost (`apps/nhost`)
SUPABASE_DIRECT_URL=postgresql://postgres:postgres@127.0.0.1:54322/postgres

PUBLIC_NHOST_SUBDOMAIN=local
PUBLIC_NHOST_REGION=
# SvelteKit (`apps/web`)

PUBLIC_GRAPHQL_ENDPOINT=http://localhost:8080/v1/graphql
HASURA_ADMIN_SECRET=nhost-admin-secret
PUBLIC_GOOGLE_ANALYTICS_ID=
PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
PUBLIC_SUPABASE_ANON_KEY=
4 changes: 0 additions & 4 deletions .eslintrc.cjs

This file was deleted.

11 changes: 5 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
uses: actions/checkout@v3

- name: Setup pnpm 📦
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v3
with:
version: 8
version: 9.0.4

- name: Setup node 🏗
uses: actions/setup-node@v3
Expand All @@ -57,10 +57,9 @@ jobs:
- name: Run build 🐣
run: pnpm build
env:
PUBLIC_NHOST_SUBDOMAIN: ${{ secrets.PUBLIC_NHOST_SUBDOMAIN }}
PUBLIC_NHOST_REGION: ${{ secrets.PUBLIC_NHOST_REGION }}
PUBLIC_GRAPHQL_ENDPOINT: ${{ secrets.PUBLIC_GRAPHQL_ENDPOINT }}
HASURA_ADMIN_SECRET: ${{ secrets.HASURA_ADMIN_SECRET }}
PUBLIC_GOOGLE_ANALYTICS_ID: ${{ secrets.PUBLIC_GOOGLE_ANALYTICS_ID }}
PUBLIC_SUPABASE_URL: ${{ secrets.PUBLIC_SUPABASE_URL }}
PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.PUBLIC_SUPABASE_ANON_KEY }}

- name: Run lint 👀
run: pnpm lint
Expand Down
7 changes: 2 additions & 5 deletions .husky/pre-commit
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged --concurrent false
npm test
pnpm lint-staged
pnpm test
9 changes: 5 additions & 4 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export default {
'*': ['cspell --no-must-find-files', 'prettier --ignore-unknown --write'],
'*.{js,cjs,mjs,jsx,ts,tsx}': ['eslint --fix'],
'*.svelte': ['markuplint', 'eslint --fix'],
'*.html': ['markuplint'],
'*': ['cspell --no-must-find-files', 'prettier --write --ignore-unknown'],
'*.html': ['markuplint', 'prettier --write'],
'*.css': ['prettier --write'],
'*.{js,cjs,mjs,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
'*.svelte': ['markuplint', 'eslint --fix', 'prettier --write'],
};
3 changes: 2 additions & 1 deletion .markuplintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = {
// TODO: Once the overrides option is fixed, remove these lines
// ref. https://github.com/markuplint/markuplint/issues/1119
'./apps/web/src/app.html',
'./apps/web/src/routes/CommentForm.svelte',
// TODO: for Svelte 5 (preview)
'./apps/web/**/*.svelte',
],
rules: {
'character-reference': false,
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-manager-strict=false
17 changes: 5 additions & 12 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
# Ignore files for PNPM
pnpm-lock.yaml
pnpm-workspace.yaml
package-lock.json
yarn.lock

# custom
/apps/mockup/public/styles.css
/apps/nhost/.nhost/
/apps/nhost/nhost/*
!/apps/nhost/nhost/emails/
/apps/story/storybook-static/
/apps/web/.svelte-kit
/apps/web/$houdini/
/apps/web/schema.graphql
/apps/web/src/lib/$generated

# prettier-plugin-svelte (waiting for Svelte 5 support)
*.svelte
7 changes: 1 addition & 6 deletions .prettierignore.root
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
# Ignore files for PNPM
pnpm-lock.yaml
pnpm-workspace.yaml
package-lock.json
yarn.lock

# custom
/apps/
Expand Down
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

7 changes: 2 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
"editor.formatOnSave": true,
"prettier.requireConfig": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"editor.quickSuggestions": {
"strings": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.workingDirectories": [{ "mode": "auto" }],
"eslint.validate": ["svelte"]
"eslint.useFlatConfig": true
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 usagizmo
Copyright (c) 2024 usagizmo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
71 changes: 43 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Monorepo template for creating a web application.

- [Turborepo](https://turborepo.org/) x [pnpm](https://pnpm.io/)
- [Prettier](https://prettier.io/) (w/ [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte) + [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss))
- [ESLint](https://eslint.org/) (w/ [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import)) / [CSpell](https://cspell.org/)
- [ESLint](https://eslint.org/) / [CSpell](https://cspell.org/)
- [lint-staged](https://github.com/okonet/lint-staged) / [husky](https://github.com/typicode/husky)
- GitHub Actions (Linting + Testing (Validate `href` and `src` paths))
- Execute `eslint --fix` and `prettier` when saving with VS Code
Expand All @@ -17,27 +17,21 @@ Monorepo template for creating a web application.

#### `apps/`

- [`nhost`](./apps/nhost/)
Local environment test server and production [Nhost](https://nhost.io/) migration.
- [`backend`](./apps/backend/)
A [Supabase](https://supabase.io/) [Local Dev / CLI](https://supabase.com/docs/guides/cli).
- [`mockup`](./apps/mockup/) [[Demo](https://webapp-template-mockup.usagizmo.com/)]
A starting point for building a static site.
[Tailwind CSS](https://tailwindcss.com/) + Vanilla JS + [Vitest](https://vitest.dev/) (Check links + file names)
- [`story`](./apps/story/)
Stories for the Svelte Components.
[Storybook](https://storybook.js.org/) (w/ [Svelte](https://svelte.jp/) + [Tailwind CSS](https://tailwindcss.com/))
- [`web`](./apps/web/) [[Demo](https://webapp-template.usagizmo.com/)]
A starting point for building Svelte application.
[SvelteKit](https://kit.svelte.dev/) (w/ [Tailwind CSS](https://tailwindcss.com/))
[Nhost](https://nhost.io/) (w/ [Houdini](https://www.houdinigraphql.com/)) / [Vitest](https://vitest.dev/)
[Supabase](https://supabase.io/) / [Vitest](https://vitest.dev/)

#### `packages/`

- `ui`
A stub Svelte component library.
- `tailwind-preset-base`
A preset for use with `tailwind.config.js` and `global.css`.
- `eslint-config-custom`
`eslint` configurations. (w/ [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte) + eslint-config-[[prettier](https://github.com/prettier/eslint-config-prettier)|[turbo](https://www.npmjs.com/package/eslint-config-turbo)])
- `eslint-config`
ESLint 9 (flat) configuration for JavaScript and TypeScript.
[eslint-plugin-svelte](https://github.com/sveltejs/eslint-plugin-svelte) + [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)

### VS Code Extensions (Recommend)

Expand All @@ -49,18 +43,39 @@ Monorepo template for creating a web application.

## Breaking changes

### v2.0.0

- **Update Framework/Library Versions:**
- Switch to Svelte 5 (integrated with TypeScript and using the Rune compiler)
- Update to Tailwind CSS 4
- **Backend Change:**
- Replace [Next.js](https://nextjs.org/) with [Supabase](https://supabase.com/) for backend services

### v1.9.0

- **Language and Compiler Changes:**
- Migrated codebase from JavaScript to TypeScript
- Upgraded from Svelte 4 to Svelte 5 (Rune)
- **Package Naming and Structure:**
- Custom package names now prefixed with `@repo/`
- Merged `eslint-config-custom-typescript` into `eslint-config-custom`

### v1.6.0

- Change from TypeScript to JavaScript + JSDoc
- **Language Reversion and Documentation:**
- Reverted codebase from TypeScript back to JavaScript, supplementing with JSDoc for documentation

### v1.0.0

- Change frontend framework (`apps/web`): [Next.js](https://nextjs.org/)[SvelteKit](https://kit.svelte.jp/)
- Change repository name: `nextjs-template``webapp-template`
- **Frontend Framework Change:**
- Switched from [Next.js](https://nextjs.org/) to [SvelteKit](https://kit.svelte.jp/) for the frontend framework in `apps/web`
- **Repository Rebranding:**
- Renamed `nextjs-template` repository to `webapp-template`

### v0.23.0

- Replace [Firebase](https://firebase.google.com/) (`apps/firebase`) and [Hasura](https://hasura.io/) (`apps/hasura`) apps with [Nhost](https://nhost.io/) (`apps/nhost`)
- **Backend Services Integration:**
- Replaced individual [Firebase](https://firebase.google.com/) and [Hasura](https://hasura.io/) applications with a unified [Nhost](https://nhost.io/) application in `apps/nhost`

## Commands

Expand All @@ -70,23 +85,23 @@ pnpm i # Resolve dependency packages and prepare .env files

pnpm build # Build all apps and packages
pnpm dev # Set up file monitoring builds and local servers for development
pnpm lint # eslint + markuplint | prettier --check
pnpm lint # markuplint + eslint + prettier --check
pnpm test # Testing
pnpm format # eslint --fix + prettier --write + format project-words.txt
```

## List of listening port numbers

- `1337`: `apps/nhost/` - Hasura
- `3030`: Nhost Dashboard
- `5432`: Postgres
- `8080`: GraphQL Endpoint
- `8025`: MailHog
- `9695`: Hasura Console
- `5173`: `apps/web/` - SvelteKit application
- `6006`: `apps/story/` - Storybook
- `8000`: `apps/mockup/` - Static site
- `49160`: `apps/mockup/` - Express server
- `apps/backend/` - Supabase Local Dev / CLI
- `54321`: API / GraphQL / S3 Storage
- `54322`: DB (Postgres)
- `54323`: Studio
- `54324`: Inbucket
- `apps/web/` - SvelteKit application
- `5173`: Development server
- `apps/mockup/` - Static site
- `8000`: BrowserSync server
- `49160`: Express server

## Registering environment variables for GitHub / Vercel

Expand Down
3 changes: 3 additions & 0 deletions apps/backend/#vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["denoland.vscode-deno"]
}
8 changes: 8 additions & 0 deletions apps/backend/#vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"deno.enablePaths": ["supabase/functions"],
"deno.lint": true,
"deno.unstable": true,
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
}
}
11 changes: 11 additions & 0 deletions apps/backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `backend` app

This app is a [Supabase](https://supabase.io/) [Local Dev / CLI](https://supabase.com/docs/guides/cli).

## Commands

```bash
pnpm pull # Pull the latest changes from the supabase server
pnpm start # Start the supabase server
pnpm stop # Stop the supabase server
```
13 changes: 13 additions & 0 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "backend",
"version": "0.0.0",
"type": "module",
"scripts": {
"pull": "supabase db pull --local --schema auth --schema storage",
"start": "supabase start",
"stop": "supabase stop"
},
"devDependencies": {
"supabase": "^1.163.6"
}
}
4 changes: 4 additions & 0 deletions apps/backend/supabase/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Supabase
.branches
.temp
.env
Loading

0 comments on commit f5960fd

Please sign in to comment.