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

Meta: Build system overhaul #1057

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See: https://github.com/codespell-project/codespell#using-a-config-file
[codespell]
skip = ./node_modules,./build,yarn.lock
skip = ./node_modules,./build,pnpm-lock.yaml
contex=6
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
# Maintain dependencies for our yarn packages.
# Maintain dependencies for our npm packages.
- package-ecosystem: "npm"
directory: "/"
schedule:
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,25 @@ jobs:
env:
NODE_ENV: ${{ matrix.node-env }}
steps:
- name: Checkout
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 16
node-version: 18

- run: yarn install
- uses: pnpm/action-setup@v4
with:
version: 9

- run: pnpm install

- run: yarn build
- run: pnpm build

- run: yarn lint
- run: pnpm lint
if: ${{ matrix.node-env == 'development' }}

- run: yarn test
- run: pnpm test
if: ${{ matrix.node-env == 'development' }}

4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ repos:
- repo: local
hooks:
- id: lint
name: running yarn lint to ensure changes will pass linting on CI
entry: yarn lint
name: running pnpm lint to ensure changes will pass linting on CI
entry: pnpm lint
language: system
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
types: [file]
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ This is the source for the SerenityOS Discord Bot.

### Setup

The bot is written in [TypeScript](https://www.typescriptlang.org), `nodejs` and `yarn` are pre-requisites.
The bot is written in [TypeScript](https://www.typescriptlang.org), `nodejs` and `pnpm` are pre-requisites.

Then setup your environment:

```
$ git clone https://github.com/SerenityOS/discord-bot
$ cd discord-bot
$ yarn install
$ yarn build
$ pnpm install
$ pnpm build
```

### Configuration
Expand All @@ -23,16 +23,7 @@ guild_id=<your-guild-id-goes-here>
```
See: https://www.writebots.com/discord-bot-token/

Now you can run `yarn start:dev` and the bot will startup, and then restart as you save changes to the source files:
```
$ yarn start:dev
[nodemon] 2.0.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/*
[nodemon] watching extensions: ts,js
[nodemon] starting `ts-node ./src/index.ts`
Buggie bot has started
```
CommandMC marked this conversation as resolved.
Show resolved Hide resolved
Now you can run `pnpm start:dev` and the bot will startup, and then restart as you save changes to the source files.

### Running Tests

Expand Down
20 changes: 6 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,22 @@
"description": "SerenityOS Discord Bot",
"main": "index.js",
"license": "BSD-2-Clause",
"engines": {
"node": ">=16 <=18.17.1"
},
"scripts": {
"lint": "eslint . --ext .ts",
"lint-and-fix": "eslint . --ext .ts --fix",
"start:dev": "nodemon --watch './src/**' --ext 'ts,js,json' --exec \"ts-node --files ./src/index.ts\"",
"prebuild": "rimraf ./build",
"build": "tsc",
"start:dev": "nodemon",
"build": "esbuild src/index.ts --minify --bundle --platform=node --packages=external --outfile=build/index.js",
"prestart": "npm run build",
"start": "node build/index.js",
"test": "mocha -r ts-node/register tests/**/*.test.ts"
"test": "vitest"
},
"nodemonConfig": {
"watch": [
"src"
],
"ext": ".ts,.js",
"ignore": [],
"exec": "ts-node --files ./src/index.ts"
"exec": "npm run start"
},
"repository": {
"type": "git",
Expand All @@ -41,19 +37,15 @@
"homepage": "https://github.com/SerenityOS/discord-bot#readme",
"devDependencies": {
"@octokit/types": "^9.1.2",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.1",
"chai": "^4.3.7",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-unused-imports": "^2.0.0",
"mocha": "^10.2.0",
"nodemon": "^2.0.22",
"prettier": "^2.8.8",
"ts-node": "^10.9.1"
"vitest": "^1.6.0"
},
"dependencies": {
"@octokit/plugin-throttling": "^5.1.1",
Expand All @@ -63,9 +55,9 @@
"bufferutil": "^4.0.7",
"discord.js": "^14.7.1",
"dotenv": "^16.0.3",
"esbuild": "^0.21.2",
"mastodon": "^1.2.2",
"octokit-plugin-create-pull-request": "^4.1.1",
"rimraf": "^5.0.0",
"typescript": "^5.0.4",
"utf-8-validate": "^6.0.3",
"zlib-sync": "^0.1.8"
Expand Down
Loading
Loading