Skip to content

Commit 20559f5

Browse files
committed
feat(repo): init monorepo
0 parents  commit 20559f5

File tree

142 files changed

+14537
-0
lines changed

Some content is hidden

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

142 files changed

+14537
-0
lines changed

.eslintrc.cjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
root: true,
3+
// This tells ESLint to load the config from the package `eslint-config-custom`
4+
extends: ["custom"],
5+
};

.github/actions/release/action.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: "Release"
2+
description: "Release versioning for production"
3+
runs:
4+
using: "node20"
5+
main: "./index.js"
6+
inputs:
7+
type:
8+
description: "Versioning type"
9+
required: true
10+
default: patch
11+
outputs:
12+
tag:
13+
description: "The tag version of the release"

.github/actions/release/index.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const { execSync } = require("child_process");
2+
const core = require("@actions/core");
3+
4+
const bash = (command) => execSync(command, { encoding: "utf8" }).trim();
5+
6+
const generateVersion = (lastVersion, type) => {
7+
const [major, minor, patch] = lastVersion.split(".");
8+
9+
switch (type) {
10+
case "major":
11+
return `${+major + 1}.0.0`;
12+
case "minor":
13+
return `${major}.${+minor + 1}.0`;
14+
case "patch":
15+
return `${major}.${minor}.${+patch + 1}`;
16+
default:
17+
throw new Error("Unknown version type: " + type);
18+
}
19+
};
20+
21+
try {
22+
const type = core.getInput("type");
23+
24+
const lastTag = bash("git tag -l | sort -r --version-sort | head -n 1");
25+
26+
const lastVersion = lastTag.replace(/^v/, "");
27+
28+
const newVersion = lastTag ? "0.0.1" : generateVersion(lastVersion, type);
29+
30+
const newTag = `v${newVersion}`;
31+
32+
bash(`git tag ${newTag}`);
33+
34+
bash("git push --tags --no-verify");
35+
36+
core.setOutput("tag", newTag);
37+
} catch (error) {
38+
core.setFailed(error.message);
39+
}

.github/workflows/preview.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Preview Deployment
2+
3+
on: pull_request
4+
5+
permissions:
6+
checks: write
7+
contents: read
8+
pull-requests: write
9+
10+
env:
11+
PUBLIC_DEPLOY_ENV: preview
12+
13+
jobs:
14+
check:
15+
name: Check
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Install Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
cache: npm
26+
node-version-file: ".nvmrc"
27+
28+
- name: Install dependencies
29+
run: npm install
30+
31+
- name: Install Playwright Browsers
32+
run: npx playwright install --with-deps
33+
34+
- name: Run tests
35+
run: npm run test
36+
37+
- name: Run linter
38+
run: npm run lint
39+
40+
- name: Run type checker
41+
run: npm run check
42+
43+
- name: Run formatter check
44+
run: npm run format:check
45+
46+
# deploy-preview:
47+
# name: Deploy Preview
48+
# runs-on: ubuntu-latest
49+
# needs: check
50+
#
51+
# steps:
52+
# - name: Checkout
53+
# uses: actions/checkout@v4
54+
#
55+
# - name: Install Node.js
56+
# uses: actions/setup-node@v4
57+
# with:
58+
# cache: npm
59+
# node-version-file: ".nvmrc"
60+
#
61+
# - name: Install dependencies
62+
# run: npm install
63+
#
64+
# - name: Build app (Web)
65+
# run: npm run build -w apps/web

.github/workflows/production.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Production Deployment
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
hash:
6+
type: string
7+
description: "Commit hash"
8+
required: true
9+
type:
10+
type: choice
11+
description: "Versioning type"
12+
required: true
13+
default: patch
14+
options:
15+
- major
16+
- minor
17+
- patch
18+
19+
permissions:
20+
contents: write
21+
deployments: write
22+
23+
env:
24+
PUBLIC_DEPLOY_ENV: production
25+
26+
jobs:
27+
deploy-production:
28+
name: Deploy Production
29+
runs-on: ubuntu-latest
30+
environment: Production
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Install Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
cache: npm
40+
node-version-file: ".nvmrc"
41+
42+
- name: Install dependencies
43+
run: npm install
44+
45+
- name: Build app (Web)
46+
run: npm run build -w apps/web
47+
48+
release:
49+
name: Set Release
50+
runs-on: ubuntu-latest
51+
needs: deploy-production
52+
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0
58+
ref: ${{ github.event.inputs.hash }}
59+
60+
- name: Install Node.js
61+
uses: actions/setup-node@v4
62+
with:
63+
cache: npm
64+
node-version-file: ".nvmrc"
65+
66+
- name: Install dependencies
67+
run: npm install
68+
69+
- name: Set release version
70+
id: release
71+
uses: ./.github/actions/release
72+
with:
73+
type: ${{ github.event.inputs.type }}

.github/workflows/staging.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Staging Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
PUBLIC_DEPLOY_ENV: staging
10+
11+
jobs:
12+
check:
13+
name: Check
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
cache: npm
24+
node-version-file: ".nvmrc"
25+
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Install Playwright Browsers
30+
run: npx playwright install --with-deps
31+
32+
- name: Run tests
33+
run: npm run test
34+
35+
- name: Run linter
36+
run: npm run lint
37+
38+
- name: Run type checker
39+
run: npm run check
40+
41+
- name: Run formatter check
42+
run: npm run format:check
43+
44+
# deploy-staging:
45+
# name: Deploy Staging
46+
# runs-on: ubuntu-latest
47+
# environment: Staging
48+
# needs: check
49+
#
50+
# steps:
51+
# - name: Checkout
52+
# uses: actions/checkout@v4
53+
#
54+
# - name: Install Node.js
55+
# uses: actions/setup-node@v4
56+
# with:
57+
# cache: npm
58+
# node-version-file: ".nvmrc"
59+
#
60+
# - name: Install dependencies
61+
# run: npm install
62+
#
63+
# - name: Build app (Web)
64+
# run: npm run build -w apps/web

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
node_modules
5+
.pnp
6+
.pnp.js
7+
8+
# testing
9+
coverage
10+
test-results
11+
12+
# misc
13+
.DS_Store
14+
Thumbs.db
15+
*.pem
16+
17+
# output
18+
.output
19+
.vercel
20+
.netlify
21+
.svelte-kit
22+
.wrangler
23+
build
24+
dist
25+
26+
# debug
27+
npm-debug.log*
28+
yarn-debug.log*
29+
yarn-error.log*
30+
vite.config.*.timestamp-*
31+
32+
# env files
33+
.env
34+
.env.*
35+
!.env.example
36+
!.env.test
37+
38+
# turbo
39+
.turbo
40+
41+
# IDE
42+
.idea

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
npm run format:check
2+
npm run check
3+
npm run lint
4+
npm run test

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run build

0 commit comments

Comments
 (0)