mirror of
https://github.com/sern-handler/templates
synced 2026-06-05 17:06:56 +00:00
feat: add typescript template
This commit is contained in:
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* @EvolutionX-10
|
||||
65
.github/workflows/codeql-analysis.yml
vendored
Normal file
65
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: 'CodeQL'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [main]
|
||||
schedule:
|
||||
- cron: '40 13 * * 2'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ['javascript']
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
38
.github/workflows/linter.yml
vendored
Normal file
38
.github/workflows/linter.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
# Trigger the workflow on push or pull request,
|
||||
# but only for the main branch
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
run-linters:
|
||||
name: Run linters
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # tag=v3
|
||||
with:
|
||||
node-version: 17
|
||||
|
||||
# ESLint and Prettier must be in `package.json`
|
||||
- name: Install Node.js dependencies
|
||||
run: npm i
|
||||
|
||||
- name: Run linters
|
||||
uses: wearerequired/lint-action@42567b31ed576cdd5a431d77ca5bc8822430d1d0 # tag=v1
|
||||
with:
|
||||
eslint: false
|
||||
prettier: true
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
auto_fix: false
|
||||
commit_message: "style(auto): fix code style issues with ${linter}"
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/node_modules
|
||||
2395
package-lock.json
generated
Normal file
2395
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
30
package.json
Normal file
30
package.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "templates",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "Project templates for sern",
|
||||
"workspaces": [
|
||||
"templates/*"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sern-handler/templates.git"
|
||||
},
|
||||
"keywords": [
|
||||
"sern",
|
||||
"cli",
|
||||
"discord.js"
|
||||
],
|
||||
"author": "EvolutionX",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sern-handler/templates/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sern-handler/templates#readme",
|
||||
"devDependencies": {
|
||||
"prettier": "^2.6.2"
|
||||
}
|
||||
}
|
||||
3
templates/typescript/.gitignore
vendored
Normal file
3
templates/typescript/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
package-lock.json
|
||||
/node_modules
|
||||
/dist
|
||||
1
templates/typescript/README.md
Normal file
1
templates/typescript/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# TODO
|
||||
25
templates/typescript/package.json
Normal file
25
templates/typescript/package.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "ts-example",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"sern",
|
||||
"discord.js",
|
||||
"cli"
|
||||
],
|
||||
"author": "EvolutionX",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"@sern/handler": "^0.0.1",
|
||||
"discord.js": "^14.0.0-dev.1650672498-3617093"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^17.0.25",
|
||||
"typescript": "^4.6.3"
|
||||
}
|
||||
}
|
||||
13
templates/typescript/src/commands/ping.ts
Normal file
13
templates/typescript/src/commands/ping.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { Interaction } from 'discord.js';
|
||||
import { apply, sernModule } from '@sern/handler/dist/handler/plugins/plugin';
|
||||
import { CommandType } from '@sern/handler/dist/handler/sern';
|
||||
import type { Context } from '@sern/handler/dist/handler/structures/structxports';
|
||||
|
||||
export const module = sernModule(apply(), {
|
||||
type: CommandType.Text,
|
||||
description: 'A ping command',
|
||||
alias: [],
|
||||
execute: (ctx: Context, args: unknown) => {
|
||||
ctx.channel?.send('Pong 🏓');
|
||||
},
|
||||
});
|
||||
17
templates/typescript/src/index.ts
Normal file
17
templates/typescript/src/index.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Client, GatewayIntentBits } from 'discord.js';
|
||||
import { Sern } from '@sern/handler';
|
||||
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
],
|
||||
});
|
||||
|
||||
Sern.init({
|
||||
client,
|
||||
commands: 'dist/commands',
|
||||
});
|
||||
|
||||
client.login();
|
||||
16
templates/typescript/tsconfig.json
Normal file
16
templates/typescript/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true,
|
||||
"target": "ESNext",
|
||||
"module": "CommonJS",
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"importsNotUsedAsValues": "error",
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user