Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/wolfstar-project/wolfstar i…
Browse files Browse the repository at this point in the history
…nto refactor/add-tsup
  • Loading branch information
RedStar071 committed Jan 9, 2025
2 parents 86ef03c + 8025d19 commit ba1b85c
Show file tree
Hide file tree
Showing 10 changed files with 592 additions and 497 deletions.
574 changes: 287 additions & 287 deletions .yarn/releases/yarn-4.5.3.cjs → .yarn/releases/yarn-4.6.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-git-hooks.cjs
spec: 'https://raw.githubusercontent.com/trufflehq/yarn-plugin-git-hooks/main/bundles/%40yarnpkg/plugin-git-hooks.js'

yarnPath: .yarn/releases/yarn-4.5.3.cjs
yarnPath: .yarn/releases/yarn-4.6.0.cjs
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@
"update": "yarn upgrade-interactive"
},
"dependencies": {
"@discordjs/builders": "^1.9.0",
"@discordjs/builders": "^1.10.0",
"@discordjs/collection": "^2.1.1",
"@discordjs/core": "^1.2.0",
"@influxdata/influxdb-client": "^1.35.0",
"@influxdata/influxdb-client-apis": "^1.35.0",
"@prisma/client": "^6.1.0",
"@prisma/client": "^6.2.1",
"@sapphire/async-queue": "^1.5.5",
"@sapphire/bitfield": "^1.2.4",
"@sapphire/decorators": "^6.1.1",
"@sapphire/discord.js-utilities": "7.3.1",
"@sapphire/discord.js-utilities": "7.3.2",
"@sapphire/fetch": "^3.0.5",
"@sapphire/framework": "5.3.1",
"@sapphire/framework": "5.3.2",
"@sapphire/iterator-utilities": "^2.0.1",
"@sapphire/plugin-api": "^7.0.3",
"@sapphire/plugin-editable-commands": "^4.0.3",
"@sapphire/plugin-api": "^8.0.0",
"@sapphire/plugin-editable-commands": "^4.0.4",
"@sapphire/plugin-i18next": "^7.1.3",
"@sapphire/plugin-logger": "^4.0.2",
"@sapphire/plugin-subcommands": "^7.0.1",
Expand All @@ -74,18 +74,19 @@
"@sapphire/stopwatch": "^1.5.4",
"@sapphire/time-utilities": "^1.7.14",
"@sapphire/utilities": "^3.18.1",
"@sentry/node": "^8.47.0",
"@sentry/node": "^8.48.0",
"@skyra/ai": "^1.2.0",
"@skyra/char": "^1.0.3",
"@skyra/env-utilities": "^1.3.0",
"@skyra/jaro-winkler": "^1.1.1",
"bufferutil": "^4.0.8",
"bufferutil": "^4.0.9",
"colorette": "^2.0.20",
"confusables": "^1.1.1",
"diff": "^7.0.0",
"discord-api-types": "0.37.98",
"discord.js": "~14.16.3",
"discord.js": "~14.17.3",
"he": "^1.2.0",
"tsup": "^8.3.5",
"zlib-sync": "^0.1.9"
},
"devDependencies": {
Expand All @@ -108,12 +109,12 @@
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"lint-staged": "^15.2.11",
"lint-staged": "^15.3.0",
"prettier": "^3.4.2",
"prisma": "^6.1.0",
"prisma": "^6.2.1",
"prisma-json-types-generator": "^3.2.2",
"tsup": "^8.3.5",
"typescript": "~5.4.5",
"tsc-watch": "^6.2.1",
"typescript": "~5.7.2",
"vitest": "^2.1.8"
},
"resolutions": {
Expand Down Expand Up @@ -143,7 +144,7 @@
}
},
"prettier": "@sapphire/prettier-config",
"packageManager": "yarn@4.5.3",
"packageManager": "yarn@4.6.0",
"volta": {
"node": "22.12.0"
}
Expand Down
16 changes: 9 additions & 7 deletions src/lib/database/settings/structures/PermissionNodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const enum PermissionNodeAction {
Deny
}

type PermissionNodeValueResolvable = Role | GuildMember | User;

export class PermissionNodeManager {
private sorted = new Collection<string, PermissionsManagerNode>();
#cachedRawPermissionRoles: readonly PermissionsNode[] = [];
Expand All @@ -20,7 +22,7 @@ export class PermissionNodeManager {
this.refresh(settings);
}

public settingsPropertyFor(target: Role | GuildMember | User) {
public settingsPropertyFor(target: PermissionNodeValueResolvable) {
return (target instanceof Role ? 'permissionsRoles' : 'permissionsUsers') satisfies keyof ReadonlyGuildData;
}

Expand All @@ -32,7 +34,7 @@ export class PermissionNodeManager {
return this.sorted.has(roleId);
}

public add(target: Role | GuildMember | User, command: string, action: PermissionNodeAction): readonly PermissionsNode[] {
public add(target: PermissionNodeValueResolvable, command: string, action: PermissionNodeAction): readonly PermissionsNode[] {
const nodes = this.#getPermissionNodes(target);

const nodeIndex = nodes.findIndex((n) => n.id === target.id);
Expand Down Expand Up @@ -63,7 +65,7 @@ export class PermissionNodeManager {
return nodes.with(nodeIndex, node);
}

public remove(target: Role | GuildMember | User, command: string, action: PermissionNodeAction): readonly PermissionsNode[] {
public remove(target: PermissionNodeValueResolvable, command: string, action: PermissionNodeAction): readonly PermissionsNode[] {
const nodes = this.#getPermissionNodes(target);

const nodeIndex = nodes.findIndex((n) => n.id === target.id);
Expand All @@ -80,16 +82,16 @@ export class PermissionNodeManager {

const node: PermissionsNode = {
id: target.id,
allow: 'allow' ? previous.allow.toSpliced(commandIndex, 1) : previous.allow,
deny: 'deny' ? previous.deny.toSpliced(commandIndex, 1) : previous.deny
allow: action === PermissionNodeAction.Allow ? previous.allow.toSpliced(commandIndex, 1) : previous.allow,
deny: action === PermissionNodeAction.Deny ? previous.deny.toSpliced(commandIndex, 1) : previous.deny
};

return node.allow.length === 0 && node.deny.length === 0 //
? nodes.toSpliced(nodeIndex, 1)
: nodes.with(nodeIndex, node);
}

public reset(target: Role | GuildMember | User): readonly PermissionsNode[] {
public reset(target: PermissionNodeValueResolvable): readonly PermissionsNode[] {
const nodes = this.#getPermissionNodes(target);

const nodeIndex = nodes.findIndex((n) => n.id === target.id);
Expand Down Expand Up @@ -226,7 +228,7 @@ export class PermissionNodeManager {
}
}

#getPermissionNodes(target: Role | GuildMember | User): readonly PermissionsNode[] {
#getPermissionNodes(target: PermissionNodeValueResolvable): readonly PermissionsNode[] {
return target instanceof Role ? this.#cachedRawPermissionRoles : this.#cachedRawPermissionUsers;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/structures/data/SortedCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class SortedCollection<K extends number | string | bigint, V> implements
/**
* Returns an iterator that contains all the keys in the collection.
*/
public *keys(): IterableIterator<K> {
public *keys(): MapIterator<K> {
for (const [key] of this.#entries) {
yield key;
}
Expand All @@ -201,7 +201,7 @@ export class SortedCollection<K extends number | string | bigint, V> implements
/**
* Returns an iterator that yields all the values in the collection.
*/
public *values(): IterableIterator<V> {
public *values(): MapIterator<V> {
for (const [, value] of this.#entries) {
yield value;
}
Expand All @@ -210,14 +210,14 @@ export class SortedCollection<K extends number | string | bigint, V> implements
/**
* Returns an iterator that yields all the entries in the collection.
*/
public *entries(): IterableIterator<[K, V]> {
public *entries(): MapIterator<[K, V]> {
yield* this.#entries;
}

/**
* Returns an iterator that yields all the entries in the collection.
*/
public *[Symbol.iterator](): IterableIterator<[K, V]> {
public *[Symbol.iterator](): MapIterator<[K, V]> {
yield* this.#entries;
}

Expand Down
2 changes: 1 addition & 1 deletion src/listeners/guilds/members/rawGuildMemberUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class UserListener extends Listener {
action_type: AuditLogEvent.MemberRoleUpdate
});

const updatedRoleId = this.getChange(auditLogs, data.user!.id);
const updatedRoleId = this.getChange(auditLogs, data.user.id);
if (updatedRoleId === null) return;

let memberRoles = data.roles;
Expand Down
3 changes: 2 additions & 1 deletion src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"outDir": "../dist",
"rootDir": ".",
"baseUrl": ".",
"resolvePackageJsonImports": true
"resolvePackageJsonImports": true,
"skipLibCheck": true
},
"include": [".", "./**/*.json"],
"exclude": ["./tsconfig.json"]
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"allowJs": true,
"checkJs": true
},
"include": ["src", "tests", "scripts", "ormconfig.js", "vitest.config.ts"]
"include": ["src", "tests", "scripts", "ormconfig.js", "vitest.config.ts", "tsup.config.ts"]
}
4 changes: 2 additions & 2 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export default defineConfig({
bundle: false,
dts: false,
entry: ['src/**/*.ts', '!src/**/*.d.ts'],
format: ['esm'],
format: 'esm',
minify: false,
tsconfig: 'tsconfig.json',
tsconfig: 'src/tsconfig.json',
target: 'es2024',
splitting: false,
skipNodeModulesBundle: true,
Expand Down
Loading

0 comments on commit ba1b85c

Please sign in to comment.