mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
ci(Testing): add TypeScript test job (#4002)
* ci(Testing): add TypeScript job * chore: add eol before eof
This commit is contained in:
18
.github/tsc.json
vendored
Normal file
18
.github/tsc.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"owner": "tsc",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+),(\\d+)\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"severity": 4,
|
||||||
|
"code": 5,
|
||||||
|
"message": 6
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
21
.github/workflows/test-cron.yml
vendored
21
.github/workflows/test-cron.yml
vendored
@@ -39,6 +39,27 @@ jobs:
|
|||||||
- name: Run TSLint
|
- name: Run TSLint
|
||||||
run: npm run lint:typings
|
run: npm run lint:typings
|
||||||
|
|
||||||
|
typescript:
|
||||||
|
name: TypeScript
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Node v12
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Register Problem Matcher
|
||||||
|
run: echo "##[add-matcher].github/tsc.json"
|
||||||
|
|
||||||
|
- name: Run TypeScript compiler
|
||||||
|
run: npm run test:typescript
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
name: Documentation
|
name: Documentation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
@@ -37,6 +37,27 @@ jobs:
|
|||||||
- name: Run TSLint
|
- name: Run TSLint
|
||||||
run: npm run lint:typings
|
run: npm run lint:typings
|
||||||
|
|
||||||
|
typescript:
|
||||||
|
name: TypeScript
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Node v12
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Register Problem Matcher
|
||||||
|
run: echo "##[add-matcher].github/tsc.json"
|
||||||
|
|
||||||
|
- name: Run TypeScript compiler
|
||||||
|
run: npm run test:typescript
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
name: Documentation
|
name: Documentation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,4 +19,5 @@ deploy/deploy_key.pub
|
|||||||
.tmp/
|
.tmp/
|
||||||
.vscode/
|
.vscode/
|
||||||
docs/docs.json
|
docs/docs.json
|
||||||
|
typings/index.js
|
||||||
webpack/
|
webpack/
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"types": "./typings/index.d.ts",
|
"types": "./typings/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npm run lint && npm run docs:test && npm run lint:typings",
|
"test": "npm run lint && npm run docs:test && npm run lint:typings",
|
||||||
|
"test:typescript": "tsc",
|
||||||
"docs": "docgen --source src --custom docs/index.yml --output docs/docs.json",
|
"docs": "docgen --source src --custom docs/index.yml --output docs/docs.json",
|
||||||
"docs:test": "docgen --source src --custom docs/index.yml",
|
"docs:test": "docgen --source src --custom docs/index.yml",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
|
|||||||
@@ -5,11 +5,17 @@
|
|||||||
"declaration": false,
|
"declaration": false,
|
||||||
"removeComments": false,
|
"removeComments": false,
|
||||||
"alwaysStrict": true,
|
"alwaysStrict": true,
|
||||||
"pretty": true,
|
"pretty": false,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es2019",
|
"target": "es2019",
|
||||||
"lib": ["esnext", "esnext.array", "esnext.asynciterable", "esnext.intl", "esnext.symbol"],
|
"lib": [
|
||||||
|
"esnext",
|
||||||
|
"esnext.array",
|
||||||
|
"esnext.asynciterable",
|
||||||
|
"esnext.intl",
|
||||||
|
"esnext.symbol"
|
||||||
|
],
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"skipLibCheck": true
|
"skipDefaultLibCheck": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
28
typings/index.ts
Normal file
28
typings/index.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/// <reference path="index.d.ts" />
|
||||||
|
|
||||||
|
import { Client } from 'discord.js';
|
||||||
|
|
||||||
|
const client: Client = new Client();
|
||||||
|
|
||||||
|
client.on('ready', () => {
|
||||||
|
console.log(`Client is logged in as ${client.user!.tag} and ready!`);
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('guildCreate', g => {
|
||||||
|
const channel = g.channels.cache.random();
|
||||||
|
if (!channel) return;
|
||||||
|
|
||||||
|
channel.setName('foo').then(updatedChannel => {
|
||||||
|
console.log(`New channel name: ${updatedChannel.name}`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('messageReactionRemoveAll', async message => {
|
||||||
|
console.log(`messageReactionRemoveAll - id: ${message.id} (${message.id.length})`);
|
||||||
|
|
||||||
|
if (message.partial) message = await message.fetch();
|
||||||
|
|
||||||
|
console.log(`messageReactionRemoveAll - content: ${message.content}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
client.login('absolutely-valid-token');
|
||||||
Reference in New Issue
Block a user