Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Commit

Permalink
chore: Update packages and switch to biome (#48)
Browse files Browse the repository at this point in the history
* chore: Update packages and switch to biome

* final fixes

* fix: CI using wrong biome version

* fix: run build script
  • Loading branch information
thewilloftheshadow authored Nov 4, 2023
1 parent 7273b54 commit b4c739a
Show file tree
Hide file tree
Showing 75 changed files with 3,118 additions and 5,131 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false

[*.yml]
indent_style = space
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

56 changes: 0 additions & 56 deletions .eslintrc.js

This file was deleted.

8 changes: 2 additions & 6 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

"documentation":
- "apps/website"
- "typedoc*"
-

"package: crossbuild":
- "packages/crossbuild/**"
Expand All @@ -17,11 +19,5 @@
"package: discord":
- "packages/discord/**"

"package: functions":
- "packages/functions/**"

"package: guilded":
- "packages/guilded/**"

"package: types":
- "packages/types/**"
39 changes: 19 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
runs-on: ubuntu-latest
needs: [skip_ci]
if: ${{ needs.skip_ci.outputs.canSkip != 'true' }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -30,24 +33,20 @@ jobs:
uses: ./.github/actions/setup

- name: Build
run: pnpm build
run: pnpm run build

# eslint:
# name: Check Formatting
# timeout-minutes: 15
# runs-on: ubuntu-latest
# needs: [skip_ci]
# if: ${{ needs.skip_ci.outputs.canSkip != 'true' }}
# steps:
# - name: Check out code
# uses: actions/checkout@v3

# - name: Setup
# uses: ./.github/actions/setup

# - name: Run ESLint
# uses: sibiraj-s/action-eslint@v2
# with:
# eslint-args: "--quiet"
# extensions: "js,jsx,ts,tsx"
# annotations: true
biome:
name: Check Formatting
timeout-minutes: 15
runs-on: ubuntu-latest
needs: [skip_ci]
if: ${{ needs.skip_ci.outputs.canSkip != 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v1
with:
version: "latest"
- name: Run Biome
run: biome ci .
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: ./.github/actions/setup

- name: Build
run: pnpm build
run: pnpm web:build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": ["biomejs.biome", "streetsidesoftware.code-spell-checker"],
"unwantedRecommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
}
11 changes: 8 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"dotenv.enableAutocloaking": false,
"findUnusedExports.detectCircularImports": true,
"cSpell.words": [
"argstest",
"automerge",
"buape",
"buapebot",
"buttonping",
"clsx",
"crossbuild",
Expand All @@ -16,6 +16,11 @@
"Rsvps",
"slowmode",
"typecheck",
"typedoc",
"undici"
]
}
],
"editor.defaultFormatter": "biomejs.biome",
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
}
}
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ To get ready to work on the codebase, please do the following:
4. Add your feature or bug fix!
5. Create a `.env` file for the test bot, copying the `.env.example` file.
6. Test your new feature or bug fix using the `test-bot` app by running `pnpm dev`, adding tests if needed.
7. Run `pnpm pretty` to format your code (this uses ESLint and Prettier)
7. Run `pnpm pretty` to format your code (this uses Biome)
- You can also just do `pnpm lint` or `pnpm format` to run only one of those, but both must be done before submitting a PR.
8. [Submit a pull request](https://github.com/crossbuildjs/crossbuild/compare)
2 changes: 1 addition & 1 deletion apps/test-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"discord.js": "^14.13.0"
},
"devDependencies": {
"@types/node": "^18.17.5"
"@types/node": "^18.18.7"
}
}
3 changes: 1 addition & 2 deletions apps/test-bot/src/components/buttons/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { Component, CrossBuild, ReceivedInteraction } from "crossbuild"

export default class Cmd extends Component {
constructor(client: CrossBuild) {
super("buttonping", "button", client, {
})
super("buttonping", "button", client, {})
}

public override async run(interaction: ReceivedInteraction) {
Expand Down
12 changes: 10 additions & 2 deletions apps/test-bot/src/components/commands/args.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Component, CrossBuild, OptionsHandler, ReceivedInteraction } from "crossbuild"
import {
Component,
CrossBuild,
OptionsHandler,
ReceivedInteraction
} from "crossbuild"

export default class Cmd extends Component {
constructor(client: CrossBuild) {
Expand Down Expand Up @@ -81,7 +86,10 @@ export default class Cmd extends Component {
})
}

public override async run(interaction: ReceivedInteraction, options: OptionsHandler) {
public override async run(
interaction: ReceivedInteraction,
options: OptionsHandler
) {
console.log(options)
await interaction.reply({
content: `Arguments: ${JSON.stringify(options.data)}`
Expand Down
13 changes: 11 additions & 2 deletions apps/test-bot/src/components/commands/paginator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Component, CrossBuild, Paginator, ReceivedInteraction } from "crossbuild"
import {
Component,
CrossBuild,
Paginator,
ReceivedInteraction
} from "crossbuild"

export default class Cmd extends Component {
constructor(client: CrossBuild) {
Expand All @@ -9,7 +14,11 @@ export default class Cmd extends Component {

public override async run(interaction: ReceivedInteraction) {
if (!interaction.user) return
const paginator = new Paginator({ id: interaction.id, userId: interaction.user.id, crossbuild: this.client })
const paginator = new Paginator({
id: interaction.id,
userId: interaction.user.id,
crossbuild: this.client
})
paginator.addPages([
{
embeds: [{ title: "Page 1" }]
Expand Down
7 changes: 4 additions & 3 deletions apps/test-bot/src/components/selectMenus/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { Component, CrossBuild, ReceivedInteraction } from "crossbuild"

export default class Cmd extends Component {
constructor(client: CrossBuild) {
super("selectping", "selectMenu", client, {
})
super("selectping", "selectMenu", client, {})
}

public override async run(interaction: ReceivedInteraction) {
await interaction.reply({
content: `Dropdown pong: ${interaction.selectMenuValues?.join(", ")}`
content: `Dropdown pong: ${interaction.selectMenuValues?.join(
", "
)}`
})
}
}
7 changes: 5 additions & 2 deletions apps/test-bot/src/customChecks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Component, ReceivedInteraction, GeneratedMessage } from "crossbuild"
import { Component, GeneratedMessage, ReceivedInteraction } from "crossbuild"

export const todayIsSunday = async (interaction: ReceivedInteraction, component: Component): Promise<GeneratedMessage | null> => {
export const todayIsSunday = async (
interaction: ReceivedInteraction,
component: Component
): Promise<GeneratedMessage | null> => {
// check if today is sunday
const today = new Date()
if (today.getDay() !== 0) {
Expand Down
17 changes: 14 additions & 3 deletions apps/test-bot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import { todayIsSunday } from "./customChecks.js"

const cb = new CrossBuild({
name: "Test Bot",
componentPaths: ["/src/components/buttons", "/src/components/commands", "/src/components/selectMenus"],
componentPaths: [
"/src/components/buttons",
"/src/components/commands",
"/src/components/selectMenus"
],
modules: [
new DiscordInteractionModule({
name: "Shadow Testing",
Expand All @@ -24,7 +28,11 @@ const cb = new CrossBuild({
new DiscordMessageModule({
name: "Shadow Testing Messages",
options: {
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
},
token: process.env.DISCORD_TOKEN!,
prefix: "-"
Expand All @@ -39,7 +47,10 @@ const cb = new CrossBuild({
],
customChecks: [
todayIsSunday,
async (interaction: ReceivedInteraction, component: Component): Promise<GeneratedMessage | null> => {
async (
interaction: ReceivedInteraction,
component: Component
): Promise<GeneratedMessage | null> => {
// check if today is sunday
const today = new Date()
if (today.getDay() !== 0) {
Expand Down
6 changes: 0 additions & 6 deletions apps/website/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion apps/website/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
presets: [require.resolve("@docusaurus/core/lib/babel/preset")]
}
Loading

0 comments on commit b4c739a

Please sign in to comment.