@mkody/twitch-emoticons 2.8.1 → 2.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TwitchEmoticons.min.js +22 -0
- package/dist/TwitchEmoticons.min.js.map +7 -0
- package/docs/BTTVEmote.html +1 -111
- package/docs/Channel.html +4 -4
- package/docs/Collection.html +1 -1
- package/docs/Emote.html +2 -107
- package/docs/EmoteFetcher.html +1 -1
- package/docs/EmoteParser.html +1 -1
- package/docs/FFZEmote.html +1 -111
- package/docs/SevenTVEmote.html +1 -111
- package/docs/TwitchEmote.html +1 -111
- package/docs/index.html +2 -2
- package/docs/struct_BTTVEmote.js.html +1 -1
- package/docs/struct_Channel.js.html +6 -1
- package/docs/struct_Emote.js.html +8 -1
- package/docs/struct_EmoteFetcher.js.html +2 -2
- package/docs/struct_EmoteParser.js.html +1 -1
- package/docs/struct_FFZEmote.js.html +1 -1
- package/docs/struct_SevenTVEmote.js.html +1 -1
- package/docs/struct_TwitchEmote.js.html +1 -1
- package/docs/util_Collection.js.html +1 -1
- package/jest.config.js +198 -0
- package/package.json +12 -8
- package/src/struct/Channel.js +5 -0
- package/src/struct/Emote.js +7 -0
- package/src/struct/EmoteFetcher.js +1 -1
- package/test/BTTV.test.js +48 -0
- package/test/FFZ.test.js +71 -0
- package/test/SevenTV.test.js +70 -0
- package/test/ToFromObject.test.js +155 -0
- package/test/Twitch.test.js +64 -0
- package/test/__snapshots__/ToFromObject.test.js.snap +121 -0
- package/test/other.test.js +13 -0
- package/typings/index.d.ts +1 -1
- package/.github/codeql/codeql-config.yml +0 -5
- package/.github/workflows/codeql.yml +0 -50
- package/.github/workflows/eslint.yml +0 -51
- package/.github/workflows/release.yml +0 -22
- package/.github/workflows/yarn-test.yml +0 -17
- package/test/index.js +0 -482
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
const { describe, expect, test, beforeEach } = require('@jest/globals');
|
|
2
|
+
const { env } = require('process');
|
|
3
|
+
const { EmoteFetcher, EmoteParser } = require('../src/index.js');
|
|
4
|
+
|
|
5
|
+
describe('Test toObject', () => {
|
|
6
|
+
let emoteFetcher;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
// Make a fresh EmoteFetcher object before each tests
|
|
10
|
+
// This prevents surprises in case there's an emote name used in multiple sources
|
|
11
|
+
emoteFetcher = new EmoteFetcher(env.TWITCH_ID, env.TWITCH_SECRET);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('BTTV Global Emote', async() => {
|
|
15
|
+
await emoteFetcher.fetchBTTVEmotes();
|
|
16
|
+
expect(emoteFetcher.emotes.get('SourPls').toObject()).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('BTTV User Emote', async() => {
|
|
20
|
+
await emoteFetcher.fetchBTTVEmotes(56648155);
|
|
21
|
+
expect(emoteFetcher.emotes.get('tppUrn').toObject()).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('BTTV User Animated Emote', async() => {
|
|
25
|
+
await emoteFetcher.fetchBTTVEmotes(56648155);
|
|
26
|
+
expect(emoteFetcher.emotes.get('MODS').toObject()).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('FFZ Global Emote', async() => {
|
|
30
|
+
await emoteFetcher.fetchFFZEmotes();
|
|
31
|
+
expect(emoteFetcher.emotes.get('CatBag').toObject()).toMatchSnapshot();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('FFZ User Emote', async() => {
|
|
35
|
+
await emoteFetcher.fetchFFZEmotes(13638332);
|
|
36
|
+
expect(emoteFetcher.emotes.get('SanaeSip').toObject()).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('FFZ User Animated Emote', async() => {
|
|
40
|
+
await emoteFetcher.fetchFFZEmotes(44317909);
|
|
41
|
+
expect(emoteFetcher.emotes.get('MikuSway').toObject()).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('7TV Global Emote (AVIF)', async() => {
|
|
45
|
+
await emoteFetcher.fetchSevenTVEmotes(null, 'avif');
|
|
46
|
+
expect(emoteFetcher.emotes.get('EZ').toObject()).toMatchSnapshot();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('7TV User Emote', async() => {
|
|
50
|
+
await emoteFetcher.fetchSevenTVEmotes(44317909);
|
|
51
|
+
expect(emoteFetcher.emotes.get('modCheck').toObject()).toMatchSnapshot();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (env.TWITCH_ID === undefined || env.TWITCH_SECRET === undefined
|
|
55
|
+
|| env.TWITCH_ID === '' || env.TWITCH_SECRET === '') {
|
|
56
|
+
test.todo('Notice: Twitch client id/secret missing, not testing with Twitch emotes.');
|
|
57
|
+
} else {
|
|
58
|
+
test('Twitch Global Emote', async() => {
|
|
59
|
+
await emoteFetcher.fetchTwitchEmotes();
|
|
60
|
+
// Use inline to not fail when the environment variables are not set
|
|
61
|
+
expect(emoteFetcher.emotes.get('Kappa').toObject()).toMatchInlineSnapshot(`
|
|
62
|
+
{
|
|
63
|
+
"animated": false,
|
|
64
|
+
"channel_id": null,
|
|
65
|
+
"code": "Kappa",
|
|
66
|
+
"id": "25",
|
|
67
|
+
"set": undefined,
|
|
68
|
+
"type": "twitch",
|
|
69
|
+
}
|
|
70
|
+
`);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('Twitch User Emote', async() => {
|
|
74
|
+
await emoteFetcher.fetchTwitchEmotes(56648155);
|
|
75
|
+
// Use inline to not fail when the environment variables are not set
|
|
76
|
+
expect(emoteFetcher.emotes.get('tppD').toObject()).toMatchInlineSnapshot(`
|
|
77
|
+
{
|
|
78
|
+
"animated": false,
|
|
79
|
+
"channel_id": 56648155,
|
|
80
|
+
"code": "tppD",
|
|
81
|
+
"id": "307609315",
|
|
82
|
+
"set": undefined,
|
|
83
|
+
"type": "twitch",
|
|
84
|
+
}
|
|
85
|
+
`);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('Test fromObject', () => {
|
|
91
|
+
const emoteFetcher = new EmoteFetcher();
|
|
92
|
+
const emoteParser = new EmoteParser(emoteFetcher, {
|
|
93
|
+
type: 'markdown',
|
|
94
|
+
match: /(\w+)+?/g
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const emotes_obj = [
|
|
98
|
+
{
|
|
99
|
+
code: 'tppD',
|
|
100
|
+
id: '307609315',
|
|
101
|
+
channel_id: 56648155,
|
|
102
|
+
animated: false,
|
|
103
|
+
set: undefined,
|
|
104
|
+
type: 'twitch'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
code: 'SourPls',
|
|
108
|
+
id: '566ca38765dbbdab32ec0560',
|
|
109
|
+
channel_id: null,
|
|
110
|
+
animated: true,
|
|
111
|
+
ownerName: null,
|
|
112
|
+
type: 'bttv'
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
code: 'modCheck',
|
|
116
|
+
id: '60abf171870d317bef23d399',
|
|
117
|
+
channel_id: 44317909,
|
|
118
|
+
animated: true,
|
|
119
|
+
sizes: ['1x.webp', '2x.webp', '3x.webp', '4x.webp'],
|
|
120
|
+
ownerName: 'Laden',
|
|
121
|
+
type: '7tv',
|
|
122
|
+
imageType: 'webp'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
code: 'MikuSway',
|
|
126
|
+
id: 723102,
|
|
127
|
+
channel_id: 44317909,
|
|
128
|
+
animated: true,
|
|
129
|
+
sizes: ['1', '2', '4'],
|
|
130
|
+
ownerName: 'brian6932',
|
|
131
|
+
type: 'ffz',
|
|
132
|
+
modifier: false
|
|
133
|
+
}
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
test('Execute fromObject', () => {
|
|
137
|
+
expect(emoteFetcher.fromObject(emotes_obj)).toBeInstanceOf(Array);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('Get emote (SourPls)', () => {
|
|
141
|
+
const emote = emoteFetcher.emotes.get('SourPls');
|
|
142
|
+
expect(emote.toLink()).toBe('https://cdn.betterttv.net/emote/566ca38765dbbdab32ec0560/1x.webp');
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('Parse string with emotes (tppD, SourPls, modCheck, MikuSway)', () => {
|
|
146
|
+
expect(emoteParser.parse('tppD SourPls modCheck MikuSway')).toBe(
|
|
147
|
+
[
|
|
148
|
+
'',
|
|
149
|
+
'',
|
|
150
|
+
'',
|
|
151
|
+
''
|
|
152
|
+
].join(' ')
|
|
153
|
+
);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const { describe, expect, test } = require('@jest/globals');
|
|
2
|
+
const { env } = require('process');
|
|
3
|
+
const { EmoteFetcher, EmoteParser, Collection } = require('../src/index.js');
|
|
4
|
+
|
|
5
|
+
describe('Test Twitch emotes', () => {
|
|
6
|
+
test('Test failing when environment variables are not set', () => {
|
|
7
|
+
const emoteFetcher = new EmoteFetcher();
|
|
8
|
+
|
|
9
|
+
expect(() => {
|
|
10
|
+
emoteFetcher.fetchTwitchEmotes();
|
|
11
|
+
}).toThrow(
|
|
12
|
+
new Error('Client id or client secret not provided.')
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (env.TWITCH_ID === undefined || env.TWITCH_SECRET === undefined
|
|
17
|
+
|| env.TWITCH_ID === '' || env.TWITCH_SECRET === '') {
|
|
18
|
+
test.todo('Notice: Twitch client id/secret missing, not testing fetching and parsing.');
|
|
19
|
+
} else {
|
|
20
|
+
describe('Test global emotes', () => {
|
|
21
|
+
const emoteFetcher = new EmoteFetcher(env.TWITCH_ID, env.TWITCH_SECRET);
|
|
22
|
+
const emoteParser = new EmoteParser(emoteFetcher, {
|
|
23
|
+
type: 'markdown',
|
|
24
|
+
match: /:(.+?):/g
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('Execute fetchTwitchEmotes without any parameters', async() => {
|
|
28
|
+
expect(await emoteFetcher.fetchTwitchEmotes()).toBeInstanceOf(Collection);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('Get emote (Kappa)', () => {
|
|
32
|
+
const emote = emoteFetcher.emotes.get('Kappa');
|
|
33
|
+
expect(emote.toLink(2)).toBe('https://static-cdn.jtvnw.net/emoticons/v2/25/default/dark/3.0');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('Parse string with emote (CoolCat)', () => {
|
|
37
|
+
const text = emoteParser.parse('This is a test string with :CoolCat: in it.');
|
|
38
|
+
expect(text).toBe('This is a test string with  in it.');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('Test user emotes', () => {
|
|
43
|
+
const emoteFetcher = new EmoteFetcher(env.TWITCH_ID, env.TWITCH_SECRET);
|
|
44
|
+
const emoteParser = new EmoteParser(emoteFetcher, {
|
|
45
|
+
type: 'markdown',
|
|
46
|
+
match: /:(.+?):/g
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('Execute fetchTwitchEmotes with user ID', async() => {
|
|
50
|
+
expect(await emoteFetcher.fetchTwitchEmotes(56648155)).toBeInstanceOf(Collection);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('Get emote (tppD)', () => {
|
|
54
|
+
const emote = emoteFetcher.emotes.get('tppD');
|
|
55
|
+
expect(emote.toLink(2)).toBe('https://static-cdn.jtvnw.net/emoticons/v2/307609315/default/dark/3.0');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('Parse string with emote (tppD)', () => {
|
|
59
|
+
const text = emoteParser.parse('This is a test string with :tppD: in it.');
|
|
60
|
+
expect(text).toBe('This is a test string with  in it.');
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Test toObject 7TV Global Emote (AVIF) 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"animated": false,
|
|
6
|
+
"channel_id": null,
|
|
7
|
+
"code": "EZ",
|
|
8
|
+
"id": "61525bba20eaf897465aab47",
|
|
9
|
+
"imageType": "avif",
|
|
10
|
+
"ownerName": "CycIoneTM",
|
|
11
|
+
"sizes": [
|
|
12
|
+
"1x.avif",
|
|
13
|
+
"2x.avif",
|
|
14
|
+
"3x.avif",
|
|
15
|
+
"4x.avif",
|
|
16
|
+
],
|
|
17
|
+
"type": "7tv",
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`Test toObject 7TV User Emote 1`] = `
|
|
22
|
+
{
|
|
23
|
+
"animated": true,
|
|
24
|
+
"channel_id": 44317909,
|
|
25
|
+
"code": "modCheck",
|
|
26
|
+
"id": "60abf171870d317bef23d399",
|
|
27
|
+
"imageType": "webp",
|
|
28
|
+
"ownerName": "Laden",
|
|
29
|
+
"sizes": [
|
|
30
|
+
"1x.webp",
|
|
31
|
+
"2x.webp",
|
|
32
|
+
"3x.webp",
|
|
33
|
+
"4x.webp",
|
|
34
|
+
],
|
|
35
|
+
"type": "7tv",
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`Test toObject BTTV Global Emote 1`] = `
|
|
40
|
+
{
|
|
41
|
+
"animated": true,
|
|
42
|
+
"channel_id": null,
|
|
43
|
+
"code": "SourPls",
|
|
44
|
+
"id": "566ca38765dbbdab32ec0560",
|
|
45
|
+
"ownerName": null,
|
|
46
|
+
"type": "bttv",
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
exports[`Test toObject BTTV User Animated Emote 1`] = `
|
|
51
|
+
{
|
|
52
|
+
"animated": true,
|
|
53
|
+
"channel_id": 56648155,
|
|
54
|
+
"code": "MODS",
|
|
55
|
+
"id": "5f2c4f9e65fe924464ef6d61",
|
|
56
|
+
"ownerName": "bearrrr_",
|
|
57
|
+
"type": "bttv",
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
exports[`Test toObject BTTV User Emote 1`] = `
|
|
62
|
+
{
|
|
63
|
+
"animated": false,
|
|
64
|
+
"channel_id": 56648155,
|
|
65
|
+
"code": "tppUrn",
|
|
66
|
+
"id": "5f5f7d5f68d9d86c020e8672",
|
|
67
|
+
"ownerName": null,
|
|
68
|
+
"type": "bttv",
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
exports[`Test toObject FFZ Global Emote 1`] = `
|
|
73
|
+
{
|
|
74
|
+
"animated": false,
|
|
75
|
+
"channel_id": null,
|
|
76
|
+
"code": "CatBag",
|
|
77
|
+
"id": 25927,
|
|
78
|
+
"modifier": false,
|
|
79
|
+
"ownerName": "wolsk",
|
|
80
|
+
"sizes": [
|
|
81
|
+
"1",
|
|
82
|
+
"2",
|
|
83
|
+
"4",
|
|
84
|
+
],
|
|
85
|
+
"type": "ffz",
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
exports[`Test toObject FFZ User Animated Emote 1`] = `
|
|
90
|
+
{
|
|
91
|
+
"animated": true,
|
|
92
|
+
"channel_id": 44317909,
|
|
93
|
+
"code": "MikuSway",
|
|
94
|
+
"id": 723102,
|
|
95
|
+
"modifier": false,
|
|
96
|
+
"ownerName": "brian6932",
|
|
97
|
+
"sizes": [
|
|
98
|
+
"1",
|
|
99
|
+
"2",
|
|
100
|
+
"4",
|
|
101
|
+
],
|
|
102
|
+
"type": "ffz",
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
exports[`Test toObject FFZ User Emote 1`] = `
|
|
107
|
+
{
|
|
108
|
+
"animated": false,
|
|
109
|
+
"channel_id": 13638332,
|
|
110
|
+
"code": "SanaeSip",
|
|
111
|
+
"id": 305078,
|
|
112
|
+
"modifier": false,
|
|
113
|
+
"ownerName": "shizuka_natsume",
|
|
114
|
+
"sizes": [
|
|
115
|
+
"1",
|
|
116
|
+
"2",
|
|
117
|
+
"4",
|
|
118
|
+
],
|
|
119
|
+
"type": "ffz",
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { describe, expect, test } = require('@jest/globals');
|
|
2
|
+
const { Emote } = require('../src/index.js');
|
|
3
|
+
|
|
4
|
+
describe('Emote class', () => {
|
|
5
|
+
test('Base Emote class should not be used by itself', () => {
|
|
6
|
+
expect(() => {
|
|
7
|
+
// eslint-disable-next-line no-unused-vars
|
|
8
|
+
const emote = new Emote();
|
|
9
|
+
}).toThrow(
|
|
10
|
+
new Error('Base Emote class cannot be used')
|
|
11
|
+
);
|
|
12
|
+
});
|
|
13
|
+
});
|
package/typings/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ declare module '@mkody/twitch-emoticons' {
|
|
|
35
35
|
|
|
36
36
|
public fetchTwitchEmotes(id?: number): Promise<Collection<string, TwitchEmote>>;
|
|
37
37
|
public fetchBTTVEmotes(id?: number): Promise<Collection<string, BTTVEmote>>;
|
|
38
|
-
public fetchFFZEmotes(id
|
|
38
|
+
public fetchFFZEmotes(id?: number): Promise<Collection<string, FFZEmote>>;
|
|
39
39
|
public fetchSevenTVEmotes(id?: number, format?: 'webp' | 'avif'): Promise<Collection<string, SevenTVEmote>>;
|
|
40
40
|
public fromObject(emotesArray: EmoteObject[]): Emote[];
|
|
41
41
|
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
name: "CodeQL"
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ "master" ]
|
|
6
|
-
pull_request:
|
|
7
|
-
# The branches below must be a subset of the branches above
|
|
8
|
-
branches: [ "master" ]
|
|
9
|
-
schedule:
|
|
10
|
-
- cron: '23 11 * * 0'
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
analyze:
|
|
14
|
-
name: Analyze
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
permissions:
|
|
17
|
-
actions: read
|
|
18
|
-
contents: read
|
|
19
|
-
security-events: write
|
|
20
|
-
|
|
21
|
-
strategy:
|
|
22
|
-
fail-fast: false
|
|
23
|
-
matrix:
|
|
24
|
-
language: [ 'javascript' ]
|
|
25
|
-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
26
|
-
# Use only 'java' to analyze code written in Java, Kotlin or both
|
|
27
|
-
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
|
28
|
-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
29
|
-
|
|
30
|
-
steps:
|
|
31
|
-
- name: Checkout repository
|
|
32
|
-
uses: actions/checkout@v3
|
|
33
|
-
|
|
34
|
-
# Initializes the CodeQL tools for scanning.
|
|
35
|
-
- name: Initialize CodeQL
|
|
36
|
-
uses: github/codeql-action/init@v2
|
|
37
|
-
with:
|
|
38
|
-
languages: ${{ matrix.language }}
|
|
39
|
-
config-file: ./.github/codeql/codeql-config.yml
|
|
40
|
-
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
41
|
-
# By default, queries listed here will override any specified in a config file.
|
|
42
|
-
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
43
|
-
|
|
44
|
-
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
45
|
-
# queries: security-extended,security-and-quality
|
|
46
|
-
|
|
47
|
-
- name: Perform CodeQL Analysis
|
|
48
|
-
uses: github/codeql-action/analyze@v2
|
|
49
|
-
with:
|
|
50
|
-
category: "/language:${{matrix.language}}"
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
-
# They are provided by a third-party and are governed by
|
|
3
|
-
# separate terms of service, privacy policy, and support
|
|
4
|
-
# documentation.
|
|
5
|
-
# ESLint is a tool for identifying and reporting on patterns
|
|
6
|
-
# found in ECMAScript/JavaScript code.
|
|
7
|
-
# More details at https://github.com/eslint/eslint
|
|
8
|
-
# and https://eslint.org
|
|
9
|
-
|
|
10
|
-
name: ESLint
|
|
11
|
-
|
|
12
|
-
on:
|
|
13
|
-
push:
|
|
14
|
-
branches: [ "master" ]
|
|
15
|
-
pull_request:
|
|
16
|
-
# The branches below must be a subset of the branches above
|
|
17
|
-
branches: [ "master" ]
|
|
18
|
-
schedule:
|
|
19
|
-
- cron: '26 14 * * 6'
|
|
20
|
-
|
|
21
|
-
jobs:
|
|
22
|
-
eslint:
|
|
23
|
-
name: Run eslint scanning
|
|
24
|
-
runs-on: ubuntu-latest
|
|
25
|
-
permissions:
|
|
26
|
-
contents: read
|
|
27
|
-
security-events: write
|
|
28
|
-
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
|
29
|
-
steps:
|
|
30
|
-
- name: Checkout code
|
|
31
|
-
uses: actions/checkout@v3
|
|
32
|
-
|
|
33
|
-
- name: Install ESLint
|
|
34
|
-
run: |
|
|
35
|
-
npm install eslint@8.29.0
|
|
36
|
-
npm install @microsoft/eslint-formatter-sarif@3.0.0
|
|
37
|
-
|
|
38
|
-
- name: Run ESLint
|
|
39
|
-
run: npx eslint ./src ./test
|
|
40
|
-
--config .eslintrc.json
|
|
41
|
-
--ext .js,.jsx,.ts,.tsx
|
|
42
|
-
--format @microsoft/eslint-formatter-sarif
|
|
43
|
-
--output-file eslint-results.sarif
|
|
44
|
-
continue-on-error: true
|
|
45
|
-
|
|
46
|
-
- name: Upload analysis results to GitHub
|
|
47
|
-
uses: github/codeql-action/upload-sarif@v2
|
|
48
|
-
if: ${{ !env.ACT }}
|
|
49
|
-
with:
|
|
50
|
-
sarif_file: eslint-results.sarif
|
|
51
|
-
wait-for-processing: true
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: Publish Package to npmjs
|
|
2
|
-
on:
|
|
3
|
-
release:
|
|
4
|
-
types: [ created ]
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
permissions:
|
|
9
|
-
contents: write
|
|
10
|
-
id-token: write
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v3
|
|
13
|
-
- uses: actions/setup-node@v3
|
|
14
|
-
with:
|
|
15
|
-
node-version-file: '.nvmrc'
|
|
16
|
-
registry-url: 'https://registry.npmjs.org'
|
|
17
|
-
- run: npm install -g npm
|
|
18
|
-
- run: yarn install --frozen-lockfile
|
|
19
|
-
- run: yarn test
|
|
20
|
-
- run: npm publish --provenance --access public
|
|
21
|
-
env:
|
|
22
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
name: Yarn Test
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
test:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- uses: actions/checkout@v3
|
|
10
|
-
- uses: actions/setup-node@v3
|
|
11
|
-
with:
|
|
12
|
-
node-version-file: '.nvmrc'
|
|
13
|
-
- run: yarn install --frozen-lockfile
|
|
14
|
-
- run: yarn test
|
|
15
|
-
env:
|
|
16
|
-
TWITCH_ID: ${{ secrets.TWITCH_ID }}
|
|
17
|
-
TWITCH_SECRET: ${{ secrets.TWITCH_SECRET }}
|