Skip to content

Commit

Permalink
Release v0.1.0 (#13)
Browse files Browse the repository at this point in the history
* Add keyboard navigation on suggestions

* Tab management

* added override for chat/chat commands with ':' and '/' chars respectively

* added Max Suggestions module setting

* Command namespacing v1

* locking navegability from ... placeholder

* cleaned up CommandHandler and bugfixed 'tab' with no suggestions going back to just command name

* simplified npm cache on pipelines

Co-authored-by: Miguel Galante <[email protected]>
  • Loading branch information
ccjmk and mgalante authored Mar 18, 2022
1 parent 9cd8bd4 commit be14c3d
Show file tree
Hide file tree
Showing 38 changed files with 618 additions and 316 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,10 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
cache: 'npm'

- name: Install dependencies
run: npm ci --cache .npm --prefer-offline
run: npm ci

- name: Build
run: npm run build
24 changes: 4 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,10 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
cache: 'npm'

- name: Install dependencies
run: npm ci --cache .npm --prefer-offline
run: npm ci

- name: Lint
run: npm run lint
Expand All @@ -44,18 +36,10 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
cache: 'npm'

- name: Install dependencies
run: npm ci --cache .npm --prefer-offline
run: npm ci

- name: Extract tag version number
id: get_version
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const typescript = require('@rollup/plugin-typescript');
const { nodeResolve } = require('@rollup/plugin-node-resolve');

module.exports = {
input: 'src/module/commander.ts',
input: { ['commander']: 'src/module/module.ts' },
output: {
dir: 'dist/module',
format: 'es',
Expand Down
11 changes: 10 additions & 1 deletion src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
"OnlyGM": {
"Name": "Restrict to GM only",
"Hint": "Overrides command permissions to allow commands only for the Gamemaster"
},
"MaxSuggestions": {
"Name": "Max suggestions",
"Hint": "Maximum number of suggestions to show under the command prompt"
}
},
"Handler": {
"RetrievingCommands": "Retrieving persisted commands from module settings",
"Exec": {
"DebugRegex": "Regex for {commandName} ([ ] not part of regex): [{regex}]",
"DebugRunningWithArgs": "Executing '{commandName}' with args: {paramObj}`",
Expand All @@ -21,14 +26,18 @@
"NoGmAttempt": "Running commands disabled for non-GMs by module setting"
},
"Reg": {
"DebugNotReplaced": "Skipping existing command {commandName} for non-replacing registration",
"CommandRegistered": "Command '{commandName}' registered successfully",
"CommandAlreadyExists": "Command '{commandName}' already exists",
"InvalidString": "Unable to register command with incorrect data - '{fieldName}' required",
"InvalidArray": "Unable to register command with incorrect data - array 'args' required",
"InvalidArgument": "Unable to register command with incorrect data - type is not a supported argument type {argTypes}",
"InvalidFunction": "Unable to register command with incorrect data - '{function}' must be a function",
"InvalidRole": "Unable to register command with incorrect role: {role}",
"InvalidPermission": "Unable to register command with incorrect permission: {permission}"
"InvalidPermission": "Unable to register command with incorrect permission: {permission}",
"CommandNameNotLowercase": "Command name must be lowercase",
"SchemaNotStartingWithCommandName": "Schema must start with command name",
"ForbiddenArgumentName": "Argument name '{argName}' is forbidden"
}
},
"Keybindings": {
Expand Down
8 changes: 8 additions & 0 deletions src/module/argument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Suggestion from './suggestion';
import { ARGUMENT_TYPES } from './utils/moduleUtils';

export default interface Argument {
name: string;
type: ARGUMENT_TYPES;
suggestions?: (...params: any) => Suggestion[];
}
4 changes: 2 additions & 2 deletions src/module/arguments/stringArg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ARGUMENT_TYPES } from '../utils/moduleUtils';

const stringArg: ArgumentType = {
type: ARGUMENT_TYPES.STRING,
replace: `([a-zA-Z0-9]+|"[^"]+"|'[^']+')`,
transform: (arg) => (["'", '"'].includes(arg.charAt(0)) ? arg.substring(1, arg.length - 1) : arg),
replace: `([a-zA-Z0-9]+|"[^"]+")`,
transform: (arg) => (arg.charAt(0) === '"' ? arg.substring(1, arg.length - 1) : arg),
};
export default stringArg;
13 changes: 2 additions & 11 deletions src/module/command.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import { ARGUMENT_TYPES } from './utils/moduleUtils';

export interface Suggestion {
displayName: string;
}

export interface Argument {
name: string;
type: ARGUMENT_TYPES;
suggestions?: (...params: any) => Suggestion[];
}
import Argument from './argument';

export default interface Command {
name: string;
namespace: string;
description?: string;
schema: string;
args: Argument[];
Expand Down
Loading

0 comments on commit be14c3d

Please sign in to comment.