mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 09:20:08 +00:00
Merge branch 'node-migration-clean' of https://github.com/discordeno/discordeno into node-migration-clean
This commit is contained in:
35
.github/workflows/lint.yml
vendored
Normal file
35
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
run-linters:
|
||||
name: Run linters
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- run: yarn install --immutable
|
||||
- name: Run linters
|
||||
uses: wearerequired/lint-action@v2
|
||||
with:
|
||||
auto_fix: true
|
||||
eslint: true
|
||||
eslint_extensions: "js,ts"
|
||||
prettier: true
|
||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -173,7 +173,7 @@ jobs:
|
||||
rest-e2e-test:
|
||||
name: Rest
|
||||
needs: rest-unit-and-integration-test
|
||||
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/node-migration' }}
|
||||
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/node-migration' || github.ref == 'refs/heads/node-migration-clean' }}
|
||||
uses: ./.github/workflows/e2e-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
|
||||
@@ -3,7 +3,7 @@ module.exports = {
|
||||
es2021: true,
|
||||
node: true
|
||||
},
|
||||
extends: 'standard-with-typescript',
|
||||
extends: ['standard-with-typescript','prettier'],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.spec.ts'],
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||
"@typescript-eslint/parser": "^5.45.0",
|
||||
"eslint": "^8.0.1",
|
||||
"eslint-config-prettier": "8.6.0",
|
||||
"eslint-config-standard-with-typescript": "^23.0.0",
|
||||
"eslint-plugin-import": "^2.25.2",
|
||||
"eslint-plugin-n": "^15.0.0",
|
||||
|
||||
@@ -8,8 +8,10 @@ export const RoleToggle = {
|
||||
managed: 1 << 1,
|
||||
/** Whether this role is mentionable */
|
||||
mentionable: 1 << 2,
|
||||
/** Whether this is the guilds premium subscriber role */
|
||||
premiumSubscriber: 1 << 3
|
||||
/** Whether this is the guild's premium subscriber role */
|
||||
premiumSubscriber: 1 << 3,
|
||||
/** Whether this role is a guild's linked role */
|
||||
guildConnections: 1 << 4
|
||||
}
|
||||
|
||||
export class RoleToggles extends ToggleBitfield {
|
||||
@@ -26,6 +28,9 @@ export class RoleToggles extends ToggleBitfield {
|
||||
if (role.tags?.premium_subscriber === null) {
|
||||
this.add(RoleToggle.premiumSubscriber)
|
||||
}
|
||||
if (role.tags?.guild_connections === null) {
|
||||
this.add(RoleToggle.guildConnections)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +54,11 @@ export class RoleToggles extends ToggleBitfield {
|
||||
return this.has('premiumSubscriber')
|
||||
}
|
||||
|
||||
/** Whether this role is a guild's linked role */
|
||||
get guildConnections (): boolean {
|
||||
return this.has('guildConnections')
|
||||
}
|
||||
|
||||
/** Checks whether or not the permissions exist in this */
|
||||
has (permissions: RoleToggleKeys | RoleToggleKeys[]): boolean {
|
||||
if (!Array.isArray(permissions)) {
|
||||
|
||||
@@ -77,7 +77,8 @@ export async function createGuild (
|
||||
tags: role.tags && {
|
||||
botId: role.tags.bot_id,
|
||||
integrationId: role.tags.integration_id,
|
||||
premiumSubscriber: role.tags.premium_subscriber
|
||||
premiumSubscriber: role.tags.premium_subscriber,
|
||||
guildConnections: role.tags.guild_connections
|
||||
}
|
||||
})),
|
||||
emojis: result.emojis,
|
||||
|
||||
@@ -8,8 +8,10 @@ export const RoleToggle = {
|
||||
managed: 1 << 1,
|
||||
/** Whether this role is mentionable */
|
||||
mentionable: 1 << 2,
|
||||
/** Whether this is the guilds premium subscriber role */
|
||||
premiumSubscriber: 1 << 3
|
||||
/** Whether this is the guild's premium subscriber role */
|
||||
premiumSubscriber: 1 << 3,
|
||||
/** Whether this role is a guild's linked role */
|
||||
guildConnections: 1 << 4
|
||||
}
|
||||
|
||||
export class RoleToggles extends ToggleBitfield {
|
||||
@@ -26,6 +28,9 @@ export class RoleToggles extends ToggleBitfield {
|
||||
if (role.tags?.premium_subscriber === null) {
|
||||
this.add(RoleToggle.premiumSubscriber)
|
||||
}
|
||||
if (role.tags?.guild_connections === null) {
|
||||
this.add(RoleToggle.guildConnections)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +54,11 @@ export class RoleToggles extends ToggleBitfield {
|
||||
return this.has('premiumSubscriber')
|
||||
}
|
||||
|
||||
/** Whether this role is a guild's linked role */
|
||||
get guildConnections (): boolean {
|
||||
return this.has('guildConnections')
|
||||
}
|
||||
|
||||
/** Checks whether or not the permissions exist in this */
|
||||
has (permissions: RoleToggleKeys | RoleToggleKeys[]): boolean {
|
||||
if (!Array.isArray(permissions)) {
|
||||
|
||||
@@ -15,7 +15,8 @@ export function c1amelize1Role (payload: DiscordRole): Camelize<DiscordRole> {
|
||||
tags: payload.tags && {
|
||||
botId: payload.tags.bot_id,
|
||||
integrationId: payload.tags.integration_id,
|
||||
premiumSubscriber: payload.tags.premium_subscriber
|
||||
premiumSubscriber: payload.tags.premium_subscriber,
|
||||
guildConnections: payload.tags.guild_connections
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ export function s1nakelize1Role (payload: Camelize<DiscordRole>): DiscordRole {
|
||||
tags: payload.tags && {
|
||||
bot_id: payload.tags.botId,
|
||||
integration_id: payload.tags.integrationId,
|
||||
premium_subscriber: payload.tags.premiumSubscriber
|
||||
premium_subscriber: payload.tags.premiumSubscriber,
|
||||
guild_connections: payload.tags.guildConnections
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
"test:test-type": "tsc --project tsconfig.test.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordeno/transformer": "18.0.0-alpha.1",
|
||||
"@discordeno/utils": "18.0.0-alpha.1",
|
||||
"dotenv": "^16.0.3"
|
||||
},
|
||||
|
||||
@@ -693,6 +693,8 @@ export interface DiscordRoleTags {
|
||||
integration_id?: string
|
||||
/** Whether this is the guild's premium subscriber role */
|
||||
premium_subscriber?: null
|
||||
/** Whether this is a guild's linked role */
|
||||
guild_connections?: null
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure */
|
||||
@@ -1264,7 +1266,7 @@ export interface DiscordSticker {
|
||||
// /** All button components have type 2 */
|
||||
// type: MessageComponentTypes.Button
|
||||
// /** for what the button says (max 80 characters) */
|
||||
// label: string
|
||||
// label?: string
|
||||
// /** a dev-defined unique string sent on click (max 100 characters). type 5 Link buttons can not have a custom_id */
|
||||
// custom_id?: string
|
||||
// /** For different styles/colors of the buttons */
|
||||
|
||||
@@ -83,7 +83,7 @@ export interface CreateMessageOptions {
|
||||
// /** All button components have type 2 */
|
||||
// type: MessageComponentTypes.Button
|
||||
// /** for what the button says (max 80 characters) */
|
||||
// label: string
|
||||
// label?: string
|
||||
// /** a dev-defined unique string sent on click (max 100 characters). type 5 Link buttons can not have a custom_id */
|
||||
// customId?: string
|
||||
// /** For different styles/colors of the buttons */
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
/*
|
||||
import { expect } from 'chai'
|
||||
import { beforeEach, describe, it } from 'mocha'
|
||||
import sinon from 'sinon'
|
||||
// import { Collection } from '../src/collection.js'
|
||||
let Collection
|
||||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class, @typescript-eslint/no-unused-vars
|
||||
class Collection<T, U> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
constructor(item?: any) {}
|
||||
}
|
||||
|
||||
describe.skip('[collection]', () => {
|
||||
let collection: Collection<any, any>
|
||||
@@ -14,7 +19,7 @@ describe.skip('[collection]', () => {
|
||||
it('[collection] collection values to array', () => {
|
||||
const testCollection = new Collection([
|
||||
['best', 'tri'],
|
||||
['proficient', 'yui']
|
||||
['proficient', 'yui'],
|
||||
])
|
||||
expect(testCollection.array()).to.be.deep.equal(['tri', 'yui'])
|
||||
})
|
||||
@@ -52,7 +57,7 @@ describe.skip('[collection]', () => {
|
||||
const maxSize = 2
|
||||
|
||||
const maxCollection = new Collection([], {
|
||||
maxSize
|
||||
maxSize,
|
||||
})
|
||||
|
||||
expect(maxCollection).to.exist
|
||||
@@ -80,7 +85,7 @@ describe.skip('[collection]', () => {
|
||||
const testCollection = new Collection([
|
||||
['a', 1],
|
||||
['b', 2],
|
||||
['c', 3]
|
||||
['c', 3],
|
||||
])
|
||||
|
||||
it('[collection] find by key or value', () => {
|
||||
@@ -94,11 +99,7 @@ describe.skip('[collection]', () => {
|
||||
})
|
||||
|
||||
it('[collection] map', () => {
|
||||
expect(testCollection.map((k, v) => `${v}${k}`)).to.be.deep.equal([
|
||||
'a1',
|
||||
'b2',
|
||||
'c3'
|
||||
])
|
||||
expect(testCollection.map((k, v) => `${v}${k}`)).to.be.deep.equal(['a1', 'b2', 'c3'])
|
||||
})
|
||||
|
||||
it('[collection] some', () => {
|
||||
@@ -120,14 +121,14 @@ describe.skip('[collection]', () => {
|
||||
const sweeperCollection = new Collection(
|
||||
[
|
||||
['a', 1],
|
||||
['b', 2]
|
||||
['b', 2],
|
||||
],
|
||||
{
|
||||
sweeper: {
|
||||
filter: (v, _) => v === 1,
|
||||
interval: 50
|
||||
}
|
||||
}
|
||||
interval: 50,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
try {
|
||||
@@ -145,3 +146,4 @@ describe.skip('[collection]', () => {
|
||||
clock.restore()
|
||||
})
|
||||
})
|
||||
*/
|
||||
|
||||
100
yarn.lock
100
yarn.lock
@@ -50,7 +50,6 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@discordeno/rest@workspace:packages/rest"
|
||||
dependencies:
|
||||
"@discordeno/transformer": 18.0.0-alpha.1
|
||||
"@discordeno/types": 18.0.0-alpha.1
|
||||
"@discordeno/utils": 18.0.0-alpha.1
|
||||
"@swc/cli": ^0.1.57
|
||||
@@ -74,31 +73,6 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@discordeno/transformer@18.0.0-alpha.1, @discordeno/transformer@workspace:packages/transformer":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@discordeno/transformer@workspace:packages/transformer"
|
||||
dependencies:
|
||||
"@discordeno/types": 18.0.0-alpha.1
|
||||
"@swc/cli": ^0.1.57
|
||||
"@swc/core": ^1.3.21
|
||||
"@types/benchmark": ^2.1.2
|
||||
"@types/chai": ^4
|
||||
"@types/mocha": ^10
|
||||
"@types/node": ^18.11.9
|
||||
"@types/sinon": ^10.0.13
|
||||
benchmark: ^2.1.4
|
||||
c8: ^7.12.0
|
||||
chai: ^4.3.7
|
||||
eslint: ^8.0.1
|
||||
eslint-config-discordeno: "*"
|
||||
microtime: ^3.1.1
|
||||
mocha: ^10.1.0
|
||||
sinon: ^15.0.0
|
||||
tsconfig: "*"
|
||||
typescript: ^4.9.3
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@discordeno/types@18.0.0-alpha.1, @discordeno/types@workspace:packages/types":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@discordeno/types@workspace:packages/types"
|
||||
@@ -487,13 +461,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/benchmark@npm:^2.1.2":
|
||||
version: 2.1.2
|
||||
resolution: "@types/benchmark@npm:2.1.2"
|
||||
checksum: dc5e544ffca59bdc61008d89f007c14c281c17e80d50385da81eb9182e4466a9208ceb7af72ddfb4df1e2445ea35f2af36854168f698edd4c015a4262232462d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/chai-as-promised@npm:^7":
|
||||
version: 7.1.5
|
||||
resolution: "@types/chai-as-promised@npm:7.1.5"
|
||||
@@ -952,16 +919,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"benchmark@npm:^2.1.4":
|
||||
version: 2.1.4
|
||||
resolution: "benchmark@npm:2.1.4"
|
||||
dependencies:
|
||||
lodash: ^4.17.4
|
||||
platform: ^1.3.3
|
||||
checksum: aa466561d4f2b0a2419a3069b8f90fd35ffacf26849697eea9de525ecfbd10b44da11070cc51c88d772076db8cb2415641b493de7d6c024fdf8551019c6fcf1c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"bin-check@npm:^4.1.0":
|
||||
version: 4.1.0
|
||||
resolution: "bin-check@npm:4.1.0"
|
||||
@@ -1864,6 +1821,7 @@ __metadata:
|
||||
"@typescript-eslint/eslint-plugin": ^5.0.0
|
||||
"@typescript-eslint/parser": ^5.45.0
|
||||
eslint: ^8.0.1
|
||||
eslint-config-prettier: 8.6.0
|
||||
eslint-config-standard-with-typescript: ^23.0.0
|
||||
eslint-plugin-import: ^2.25.2
|
||||
eslint-plugin-n: ^15.0.0
|
||||
@@ -1872,6 +1830,17 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"eslint-config-prettier@npm:8.6.0":
|
||||
version: 8.6.0
|
||||
resolution: "eslint-config-prettier@npm:8.6.0"
|
||||
peerDependencies:
|
||||
eslint: ">=7.0.0"
|
||||
bin:
|
||||
eslint-config-prettier: bin/cli.js
|
||||
checksum: ff0d0dfc839a556355422293428637e8d35693de58dabf8638bf0b6529131a109d0b2ade77521aa6e54573bb842d7d9d322e465dd73dd61c7590fa3834c3fa81
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"eslint-config-standard-with-typescript@npm:^23.0.0":
|
||||
version: 23.0.0
|
||||
resolution: "eslint-config-standard-with-typescript@npm:23.0.0"
|
||||
@@ -3415,13 +3384,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lodash@npm:^4.17.4":
|
||||
version: 4.17.21
|
||||
resolution: "lodash@npm:4.17.21"
|
||||
checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"log-symbols@npm:4.1.0":
|
||||
version: 4.1.0
|
||||
resolution: "log-symbols@npm:4.1.0"
|
||||
@@ -3582,17 +3544,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"microtime@npm:^3.1.1":
|
||||
version: 3.1.1
|
||||
resolution: "microtime@npm:3.1.1"
|
||||
dependencies:
|
||||
node-addon-api: ^5.0.0
|
||||
node-gyp: latest
|
||||
node-gyp-build: ^4.4.0
|
||||
checksum: 1161571d9c994070139d8dd65160bb5ebb87044cb0ea9828a65fde201fcf9b90da9c2897e352a26e852a7fa9dd7b6774128b50854462d117be1b019abff41887
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"mime-db@npm:^1.28.0":
|
||||
version: 1.52.0
|
||||
resolution: "mime-db@npm:1.52.0"
|
||||
@@ -3853,26 +3804,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"node-addon-api@npm:^5.0.0":
|
||||
version: 5.0.0
|
||||
resolution: "node-addon-api@npm:5.0.0"
|
||||
dependencies:
|
||||
node-gyp: latest
|
||||
checksum: 7c5e2043ac37f6108784d94ed73a44ae6d3e68eb968de60680922fc6bc3d17fa69448c0feb4e0c9d3f4c74a0324822e566a8340a56916d9d6f23cb3e85620334
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"node-gyp-build@npm:^4.4.0":
|
||||
version: 4.5.0
|
||||
resolution: "node-gyp-build@npm:4.5.0"
|
||||
bin:
|
||||
node-gyp-build: bin.js
|
||||
node-gyp-build-optional: optional.js
|
||||
node-gyp-build-test: build-test.js
|
||||
checksum: d888bae0fb88335f69af1b57a2294a931c5042f36e413d8d364c992c9ebfa0b96ffe773179a5a2c8f04b73856e8634e09cce108dbb9804396d3cc8c5455ff2db
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"node-gyp@npm:latest":
|
||||
version: 9.3.1
|
||||
resolution: "node-gyp@npm:9.3.1"
|
||||
@@ -4256,13 +4187,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"platform@npm:^1.3.3":
|
||||
version: 1.3.6
|
||||
resolution: "platform@npm:1.3.6"
|
||||
checksum: 6f472a09c61d418c7e26c1c16d0bdc029549d512dbec6526216a1e59ec68100d07007d0097dcba69dddad883d6f2a83361b4bdfe0094a3d9a2af24158643d85e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"prelude-ls@npm:^1.2.1":
|
||||
version: 1.2.1
|
||||
resolution: "prelude-ls@npm:1.2.1"
|
||||
|
||||
Reference in New Issue
Block a user