Skip to content

Commit

Permalink
feat: build to cjs and esm (#39)
Browse files Browse the repository at this point in the history
* feat: build to cjs and esm

* chore: update readme

* chore: update readme

* fix: linting
  • Loading branch information
killbasa authored Dec 6, 2023
1 parent 37616d8 commit 60eb5b0
Show file tree
Hide file tree
Showing 31 changed files with 4,675 additions and 3,374 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
root: true,
extends: ['@kbotdev/eslint-config'],
parserOptions: {
project: './tsconfig.eslint.json',
Expand Down
1 change: 0 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
patreon: kbot
ko_fi: killbasa
15 changes: 4 additions & 11 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"group:allNonMajor"
],
"schedule": [
"before 10am on Saturday"
],
"labels": [
"dependencies"
]
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", "group:allNonMajor"],
"schedule": ["before 10am on Saturday"],
"labels": ["dependencies"]
}
12 changes: 6 additions & 6 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CD
on:
push:
tags:
- '@kbotdev/plugin-*@[0-9]+.[0-9]+.[0-9]+'
- "@kbotdev/plugin-*@[0-9]+.[0-9]+.[0-9]+"

jobs:
release:
Expand All @@ -22,13 +22,13 @@ jobs:
- name: Create archive
uses: thedoctor0/zip-release@0.7.1
with:
type: 'zip'
filename: 'release.zip'
type: "zip"
filename: "release.zip"

- name: Create release
uses: ncipollo/release-action@v1.12.0
with:
artifacts: 'release.zip'
artifacts: "release.zip"
token: ${{ secrets.GITHUB_TOKEN }}

publish:
Expand All @@ -41,8 +41,8 @@ jobs:
fail-fast: false
matrix:
include:
- package: '@kbotdev/plugin-modules'
folder: 'modules'
- package: "@kbotdev/plugin-modules"
folder: "modules"

steps:
- name: Check out Git repository
Expand Down
83 changes: 5 additions & 78 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: CI

on:
push:
branches:
- main
pull_request:
paths-ignore:
- "**/*.md"

permissions:
contents: read
Expand All @@ -14,16 +13,16 @@ concurrency:
cancel-in-progress: true

jobs:
lint:
checks:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up NodeJS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
Expand All @@ -34,77 +33,5 @@ jobs:
- name: Run lint
run: yarn lint

build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
cache: yarn

- name: Install dependencies
run: yarn --immutable

- name: Run build
run: yarn build

# test:
# name: Test
# runs-on: ubuntu-latest

# strategy:
# fail-fast: false

# steps:
# - name: Check out Git repository
# uses: actions/checkout@v3

# - name: Set up NodeJS
# uses: actions/setup-node@v3
# with:
# node-version: 20
# cache: yarn

# - name: Install dependencies
# run: yarn --immutable

# - name: Run tests
# run: |
# yarn test:build
# yarn test

# - name: Save coverage report
# uses: actions/upload-artifact@v3
# with:
# name: nodejs-coverage
# path: coverage/

#coverage:
# name: Coverage
# needs: test
# runs-on: ubuntu-latest

# steps:
# - name: Check out Git repository
# uses: actions/checkout@v3
# with:
# fetch-depth: 2

# - name: Download NodeJS Unit Test Coverage report
# uses: actions/download-artifact@v3
# with:
# name: nodejs-coverage
# path: coverage/

# - name: Codecov upload
# uses: codecov/codecov-action@v3.1.1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: coverage/
# fail_ci_if_error: true
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.git*
.git/
.husky/
.idea/
.turbo/
Expand Down
13 changes: 12 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
module.exports = require('@kbotdev/prettier-config');
module.exports = {
...require('@kbotdev/prettier-config'),
overrides: [
{
files: '*.{yml,yaml}',
options: {
singleQuote: false,
useTabs: false
}
}
]
};
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "./node_modules/typescript/lib",
"eslint.format.enable": true,
"eslint.validate": ["javascript", "typescript"],
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
}
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

873 changes: 0 additions & 873 deletions .yarn/releases/yarn-3.5.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
compressionLevel: mixed

enableGlobalCache: true

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.5.1.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Repository that holds all of KBot's Sapphire Plugins.

### Packages

- [Modules](packages/modules)
- [Modules](packages/modules)
49 changes: 31 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,49 @@
"test": "turbo run ci:test",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"format": "turbo run format"
"format": "turbo run format",
"update": "yarn upgrade-interactive",
"dd": "yarn dedupe --strategy highest"
},
"devDependencies": {
"@commitlint/cli": "^17.6.5",
"@commitlint/config-conventional": "^17.6.5",
"@kbotdev/eslint-config": "^0.1.1",
"@kbotdev/prettier-config": "^0.1.0",
"@kbotdev/ts-config": "^0.1.0",
"@types/node": "^20.3.1",
"eslint": "^8.42.0",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@favware/rollup-type-bundler": "^3.2.1",
"@kbotdev/eslint-config": "^1.1.1",
"@kbotdev/prettier-config": "^1.0.1",
"@kbotdev/ts-config": "^1.0.1",
"@types/node": "^20.10.3",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"concurrently": "^8.2.2",
"esbuild-plugin-file-path-extensions": "^2.0.0",
"esbuild-plugin-version-injector": "^1.2.1",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"gen-esm-wrapper": "^1.1.3",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"prettier": "^2.8.8",
"turbo": "^1.10.3",
"typescript": "^5.1.3"
"lint-staged": "^15.2.0",
"prettier": "^3.1.0",
"tsx": "^4.6.2",
"turbo": "^1.11.0",
"typescript": "^5.3.2"
},
"lint-staged": {
"*.{mjs,ts,js}": [
"eslint --fix --ext mjs,js,ts",
"prettier --write --loglevel=warn \"**/*.{js,ts}\""
"*.{mjs,cjs,js,ts}": [
"eslint --fix --ext mjs,cjs,js,ts",
"prettier --write --loglevel=warn \"**/*.{mjs,cjs,js,ts}\""
],
"*.json": [
"prettier --write --loglevel=warn \"**/*.json\""
"*.{json,yml,yaml,md}": [
"prettier --write --loglevel=warn \"**/*.{json,yml,yaml,md}\""
]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"packageManager": "yarn@3.5.1"
"packageManager": "yarn@4.0.2"
}
4 changes: 4 additions & 0 deletions packages/modules/.rollup-type-bundlerrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
onlyBundle: true
excludeFromClean:
- dist/esm/register.d.mts
- dist/cjs/register.d.ts
5 changes: 3 additions & 2 deletions packages/modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# KBot Modules Plugin

**Plugin for [@sapphire/framework](https://github.com/sapphiredev/framework) to group commands and features into modules.**

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/KBot-discord/plugins/blob/main/LICENSE)

[![npm](https://img.shields.io/npm/v/@kbotdev/plugin-modules?color=crimson&logo=npm&label=@kbotdev/plugin-modules)](https://www.npmjs.com/package/@kbotdev/plugin-modules)
Expand All @@ -11,8 +13,7 @@

## Description

A common design of Discord bots is to separate functionality into distinct domains (such as moderation, server management, etc.). Every command that
is registered to a module will have access to that module, and by extension any properties/methods exposed in that module.
This plugin allows developers to seperate commands and features into distinct modules, as well as allow them to be dynamically enabled and disabled.

## Installation

Expand Down
Loading

0 comments on commit 60eb5b0

Please sign in to comment.