From c0c96489c099a53b0f4cdf5192c4c7fdb9d006bf Mon Sep 17 00:00:00 2001 From: Zack Campbell Date: Thu, 6 Jul 2017 15:00:31 -0500 Subject: [PATCH] Enforce Node 8+, update compilation target to es2017 No more compiling down async/await! Debugging should be much less confusing now. Also updated `Command#overloads` docs --- README.md | 3 ++- package.json | 3 +++ src/command/Command.ts | 4 +++- src/index.ts | 1 + test/commands/test_command.ts | 18 ++++++++++++++---- tsconfig.json | 2 +- 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0f300139..efbc36d1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ making it simple to get a bot up and running with minimal effort and configurati >Note: Features described here are representative of the state of the master branch. Installing directly from GitHub is currently preferred due to the proximity to release and dependency issues in the latest stable release. ->Use `npm install --save zajrik/yamdbf` to install from GitHub. This requires `git` to be installed and in your PATH. +>Use `npm install --save zajrik/yamdbf` to install from GitHub. This requires `git` to be installed and in your PATH, +and also requires > Node 8.0.0 to run. >Documentation for the master branch can be found [here](https://yamdbf.js.org/indev). diff --git a/package.json b/package.json index e593115f..1f516eb9 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,9 @@ "node", "discordapp" ], + "engines": { + "node": ">=8.0.0" + }, "dependencies": { "chalk": "^1.1.3", "discord.js": "github:hydrabolt/discord.js#11.1-dev", diff --git a/src/command/Command.ts b/src/command/Command.ts index 8182bf3e..20122883 100644 --- a/src/command/Command.ts +++ b/src/command/Command.ts @@ -152,7 +152,9 @@ export class Command /** * The name of a base command to overload. Commands may only overload * base commands so the {@link Command#group} must be set to 'base' in - * order to overload. Commands may only be overloaded by name, not by alias + * order to overload. You must also be sure to **not** disable the base + * command that you are overloading. Commands may only be overloaded by + * name, not by alias * @name Command#overloads * @type {string} */ diff --git a/src/index.ts b/src/index.ts index 7f31003d..04edffb5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,6 +27,7 @@ export { Logger } from './util/logger/Logger'; export { logger } from './util/logger/LoggerDecorator'; export { LogLevel } from './types/LogLevel'; export { Lang } from './localization/Lang'; +export { ResourceLoader } from './types/ResourceLoader'; export { deprecated } from './util/DeprecatedDecorator'; diff --git a/test/commands/test_command.ts b/test/commands/test_command.ts index 191f8190..645cd9ba 100644 --- a/test/commands/test_command.ts +++ b/test/commands/test_command.ts @@ -1,8 +1,16 @@ -import { Client, Command, Message, CommandDecorators, Logger, logger } from '../../bin'; -import { Middleware } from '../../bin'; +import { + Client, + Command, + Message, + CommandDecorators, + Logger, + logger, + ResourceLoader, + Middleware +} from '../../bin'; import * as util from 'util'; const { using, guildOnly, group, ownerOnly } = CommandDecorators; -const { resolve, expect } = Middleware; +const { resolve, expect, localize } = Middleware; // @ownerOnly // @guildOnly @@ -23,8 +31,10 @@ export default class extends Command // @using((message, args) => [message, args.map(a => a.toUpperCase())]) @using(resolve(`test: Number, foo: String`)) @using(expect(`test: Number, foo: ['foo', 'bar']`)) - public action(message: Message, args: string[]): void + @using(localize) + public action(message: Message, [res, ...args]: [ResourceLoader, string[]]): void { + message.channel.send(res('FOO_BAR_BAZ')); message.channel.send(args.join(' ') || 'MISSING ARGS'); this.logger.debug('Command:test', util.inspect(this.group)); } diff --git a/tsconfig.json b/tsconfig.json index 58f9d412..a02f30e0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ // "noUnusedLocals": true, // "noUnusedParameters": true, "module": "commonjs", - "target": "es6", + "target": "es2017", "lib": [ "es7" ],