Skip to content

Commit bfe8aba

Browse files
committed
feat: Add initial project files and configurations
- Add .npmrc file to enable pre and post scripts - Add .eslintignore file to ignore dist, *.js, and *.mjs files - Add .env.example file with placeholder values - Add src/lib/db.ts file to import PrismaClient - Add .gitignore file to ignore .env, node_modules, dist, prisma/data.db, logs, and configs/*.json, configs/*.yml, tsconfig.tsbuildinfo, cache.json - Add src/commands/index.ts file to export empty array of commands - Add .husky/commit-msg file for commit message validation - Add renovate.json file for Renovate configuration - Add src/inhibitors/index.ts file to export empty array of inhibitors - Add src/utils/mustache.ts file for mustache template rendering - Add .eslintrc file with basic configuration - Add .vscode/settings.json file with editor and eslint settings - Add src/events/index.ts file to export empty array of events - Add .prettierrc file with Prettier configuration - Add .vscode/launch.json file with launch configuration - Add src/utils/types.ts file with type definitions - Add src/utils/merge.ts file for object merging - Add src/utils/chunk.ts file for array chunking - Add src/classes/client.ts file with extended Discord Client class - Add prisma/schema.prisma file with User and Item models - Add src/lib/fs.ts file with file system utility functions - Add src/lib/logger.ts file with logger configuration - Add .github/workflows/release.yml file for release workflow
0 parents  commit bfe8aba

33 files changed

+4102
-0
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DISCORD_GUILD_ID=
2+
DISCORD_TOKEN=
3+
DATABASE_URL=file:./data.db

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
*.js
3+
*.mjs

.eslintrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://json.schemastore.org/eslintrc",
3+
"root": true,
4+
"extends": [
5+
"prettier"
6+
],
7+
"plugins": [],
8+
"rules": {},
9+
"overrides": [
10+
{
11+
"files": [
12+
"*.ts"
13+
],
14+
"parser": "@typescript-eslint/parser"
15+
}
16+
]
17+
}

.github/workflows/pr-staging.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Staging - Pull Request
2+
3+
on:
4+
pull_request_target:
5+
branches: [main]
6+
paths-ignore:
7+
- .husky/**
8+
- .vscode/**
9+
- .env.example
10+
- .gitignore
11+
- "*.md"
12+
- renovate.json
13+
14+
jobs:
15+
pre_ci:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- run: echo "commit_message=$(git log --format=%B -n 1 HEAD^2)" > $GITHUB_ENV
22+
23+
outputs:
24+
commit_message: $( echo "${{ env.commit_message }}" )
25+
26+
lint:
27+
needs: pre_ci
28+
runs-on: ubuntu-latest
29+
if: "(!contains(needs.pre_ci.outputs.commit_message, '[skip lint]') && !contains(needs.pre_ci.outputs.commit_message, 'chore(release): '))"
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
36+
- uses: pnpm/action-setup@v2
37+
id: pnpm-install
38+
with:
39+
version: 8
40+
run_install: false
41+
42+
- id: pnpm-cache
43+
shell: bash
44+
run: |
45+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
46+
47+
- uses: actions/cache@v4
48+
with:
49+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
50+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
51+
restore-keys: |
52+
${{ runner.os }}-pnpm-store-
53+
54+
- run: pnpm install
55+
56+
- run: pnpm lint
57+
58+
test:
59+
needs: pre_ci
60+
runs-on: ubuntu-latest
61+
if: "(!contains(needs.pre_ci.outputs.commit_message, '[skip test]') && !contains(needs.pre_ci.outputs.commit_message, 'chore(release): '))"
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: actions/setup-node@v4
65+
with:
66+
node-version: 20
67+
68+
- uses: pnpm/action-setup@v2
69+
id: pnpm-install
70+
with:
71+
version: 8
72+
run_install: false
73+
74+
- id: pnpm-cache
75+
shell: bash
76+
run: |
77+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
78+
79+
- uses: actions/cache@v4
80+
with:
81+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
82+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
83+
restore-keys: |
84+
${{ runner.os }}-pnpm-store-
85+
86+
- run: pnpm install
87+
88+
- run: pnpm test

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [production]
6+
tags:
7+
- "v*.*.*"
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 20
18+
19+
- uses: pnpm/action-setup@v2
20+
id: pnpm-install
21+
with:
22+
version: 8
23+
run_install: false
24+
25+
- id: pnpm-cache
26+
shell: bash
27+
run: |
28+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
29+
30+
- uses: actions/cache@v4
31+
with:
32+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
33+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pnpm-store-
36+
37+
- run: pnpm install
38+
- run: pnpm build
39+
40+
- run: tar -cvzf ${{ github.event.repository.name }}.tar.gz src .env.example .eslintignore .eslintrc .gitignore .npmrc .prettierrc package.json pnpm-lock.yaml tsconfig.json
41+
42+
- run: |
43+
SUM=`sha256sum nem.tar.gz`
44+
echo $SUM > checksum.txt
45+
46+
- uses: softprops/action-gh-release@v2
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
files: |
51+
${{ github.event.repository.name }}.tar.gz
52+
checksum.txt

.github/workflows/staging.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Staging
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths-ignore:
7+
- .husky/**
8+
- .vscode/**
9+
- .env.example
10+
- .gitignore
11+
- "*.md"
12+
- renovate.json
13+
14+
jobs:
15+
pre_ci:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- run: echo "commit_message=$(git log --format=%B -n 1 HEAD)" > $GITHUB_ENV
22+
23+
outputs:
24+
commit_message: $( echo "${{ env.commit_message }}" )
25+
26+
lint:
27+
needs: pre_ci
28+
runs-on: ubuntu-latest
29+
environment: Lint
30+
if: "(!contains(needs.pre_ci.outputs.commit_message, '[skip lint]') && !contains(needs.pre_ci.outputs.commit_message, 'chore(release): '))"
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: 20
36+
37+
- uses: pnpm/action-setup@v2
38+
id: pnpm-install
39+
with:
40+
version: 8
41+
run_install: false
42+
43+
- id: pnpm-cache
44+
shell: bash
45+
run: |
46+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
47+
48+
- uses: actions/cache@v4
49+
with:
50+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
51+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
restore-keys: |
53+
${{ runner.os }}-pnpm-store-
54+
55+
- run: pnpm install
56+
57+
- run: pnpm lint
58+
59+
test:
60+
needs: pre_ci
61+
runs-on: ubuntu-latest
62+
environment: Test
63+
if: "(!contains(needs.pre_ci.outputs.commit_message, '[skip test]') && !contains(needs.pre_ci.outputs.commit_message, 'chore(release): '))"
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: actions/setup-node@v4
67+
with:
68+
node-version: 20
69+
70+
- uses: pnpm/action-setup@v2
71+
id: pnpm-install
72+
with:
73+
version: 8
74+
run_install: false
75+
76+
- id: pnpm-cache
77+
shell: bash
78+
run: |
79+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
80+
81+
- uses: actions/cache@v4
82+
with:
83+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
84+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
85+
restore-keys: |
86+
${{ runner.os }}-pnpm-store-
87+
88+
- run: pnpm install
89+
90+
- run: pnpm test

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.env
2+
node_modules/
3+
dist/
4+
prisma/data.db
5+
logs/
6+
configs/*.json
7+
configs/*.yml
8+
tsconfig.tsbuildinfo
9+
cache.json

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit $1

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enable-pre-post-scripts=true

.prettierrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"useTabs": false,
3+
"endOfLine": "lf",
4+
"semi": true,
5+
"singleQuote": false,
6+
"tabWidth": 2,
7+
"trailingComma": "es5",
8+
"importOrder": [
9+
"<THIRD_PARTY_MODULES>",
10+
"",
11+
"^[./]"
12+
],
13+
"importOrderParserPlugins": [
14+
"typescript",
15+
"decorators-legacy"
16+
],
17+
"plugins": [
18+
"@ianvs/prettier-plugin-sort-imports"
19+
]
20+
}

0 commit comments

Comments
 (0)