Skip to content

Commit

Permalink
feat: esm support, fix: some things
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Feb 13, 2022
1 parent fa51f8b commit 9447747
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 27 deletions.
107 changes: 107 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"eslint": "8.9.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "4.0.0",
"gen-esm-wrapper": "^1.1.3",
"prettier": "2.5.1"
}
}
7 changes: 7 additions & 0 deletions packages/plugin-blacklist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
"description": "Easy to use blacklist system",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "bash ../../scripts/build.bash",
"build:babel": "npx babel --extensions .ts ./src -d ./dist --minified --copy-files --config-file ../../babel.config.js",
"build:esm": "gen-esm-wrapper dist/index.js dist/index.mjs",
"build:types": "tsc --emitDeclarationOnly",
"lint": "npx eslint . --fix -c ../../.eslintrc.json"
},
Expand Down
9 changes: 8 additions & 1 deletion packages/plugin-cooldowns/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{
"name": "@gcommands/plugin-cooldowns",
"version": "1.0.3",
"version": "1.0.4",
"description": "Set cooldown for your command",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "bash ../../scripts/build.bash",
"build:babel": "npx babel --extensions .ts ./src -d ./dist --minified --copy-files --config-file ../../babel.config.js",
"build:esm": "gen-esm-wrapper dist/index.js dist/index.mjs",
"build:types": "tsc --emitDeclarationOnly",
"lint": "npx eslint . --fix -c ../../.eslintrc.json"
},
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"keywords": [
"gcommands",
"plugin",
Expand Down
20 changes: 10 additions & 10 deletions packages/plugin-cooldowns/src/utils/CooldownManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export class CooldownManager {
if (this.cache.get(userId)) return this.cache.get(userId);
let result = 0;

if (db.type === 'mongodb') {
result = (await db.get('plugin-cooldowns', { userId }))?.cooldown;
} else if (db.type === 'prismaio') {
result = (await db.get('plugin-cooldowns', { userId }))?.cooldown;
if (db?.type === 'mongodb') {
result = (await db?.get('plugin-cooldowns', { userId }))?.cooldown;
} else if (db?.type === 'prismaio') {
result = (await db?.get('plugin-cooldowns', { userId }))?.cooldown;
} else {
result = (await db.get(`plugin-cooldowns-${userId}}`));
result = (await db?.get(`plugin-cooldowns-${userId}}`));
}

this.cache.set(userId, result);
Expand All @@ -47,12 +47,12 @@ export class CooldownManager {

this.cache.set(userId, cldwn);

if (db.type === 'mongodb') {
return await db.insert('plugin-cooldowns', { userId, cooldown: cldwn, expires: new Date(cldwn) });
} else if (db.type === 'prismaio') {
return await db.insert('plugin-cooldowns', { userId, cooldown: cldwn });
if (db?.type === 'mongodb') {
return await db?.insert('plugin-cooldowns', { userId, cooldown: cldwn, expires: new Date(cldwn) });
} else if (db?.type === 'prismaio') {
return await db?.insert('plugin-cooldowns', { userId, cooldown: cldwn });
} else {
return await db.insert(`plugin-cooldowns-${userId}}`, cldwn);
return await db?.insert(`plugin-cooldowns-${userId}}`, cldwn);
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion packages/plugin-language/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{
"name": "@gcommands/plugin-language",
"version": "1.0.3",
"version": "1.0.4",
"description": "Extend default discord.js events for GCommands",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "bash ../../scripts/build.bash",
"build:babel": "npx babel --extensions .ts ./src -d ./dist --minified --copy-files --config-file ../../babel.config.js",
"build:esm": "gen-esm-wrapper dist/index.js dist/index.mjs",
"build:types": "tsc --emitDeclarationOnly",
"lint": "npx eslint . --fix -c ../../.eslintrc.json"
},
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"keywords": [
"gcommands",
"plugin",
Expand Down
9 changes: 8 additions & 1 deletion packages/plugin-moreevents/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{
"name": "@gcommands/plugin-moreevents",
"version": "1.0.2",
"version": "1.0.3",
"description": "Extend default discord.js events for GCommands",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "bash ../../scripts/build.bash",
"build:babel": "npx babel --extensions .ts ./src -d ./dist --minified --copy-files --config-file ../../babel.config.js",
"build:esm": "gen-esm-wrapper dist/index.js dist/index.mjs",
"build:types": "tsc --emitDeclarationOnly",
"lint": "npx eslint . --fix -c ../../.eslintrc.json"
},
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"keywords": [
"gcommands",
"plugin",
Expand Down
7 changes: 7 additions & 0 deletions packages/plugin-premium/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
"test": "echo \"Error: no test specified\" && exit 1",
"build": "bash ../../scripts/build.bash",
"build:babel": "npx babel --extensions .ts ./src -d ./dist --minified --copy-files --config-file ../../babel.config.js",
"build:esm": "gen-esm-wrapper dist/index.js dist/index.mjs",
"build:types": "tsc --emitDeclarationOnly",
"lint": "npx eslint . --fix -c ../../.eslintrc.json"
},
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"keywords": [
"gcommands",
"plugin",
Expand Down
9 changes: 8 additions & 1 deletion packages/plugin-votes/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{
"name": "@gcommands/plugin-votes",
"version": "1.0.2",
"version": "1.0.3",
"description": "Check if user has vote",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "bash ../../scripts/build.bash",
"build:babel": "npx babel --extensions .ts ./src -d ./dist --copy-files --config-file ../../babel.config.js",
"build:esm": "gen-esm-wrapper dist/index.js dist/index.mjs",
"build:types": "tsc --emitDeclarationOnly",
"lint": "npx eslint . --fix -c ../../.eslintrc.json"
},
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"keywords": [
"gcommands",
"plugin",
Expand Down
Loading

0 comments on commit 9447747

Please sign in to comment.