Merge pull request #14600 from iptv-org/freearhey-patch1

Patch 2024.12.1
This commit is contained in:
PopeyeTheSai10r 2024-12-07 06:19:54 -08:00 committed by GitHub
commit f8bce428fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 1964 additions and 1951 deletions

View file

@ -1,39 +0,0 @@
{
"env": {
"node": true,
"es2021": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"no-case-declarations": "off",
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"semi": [
"error",
"never"
]
}
}

View file

@ -13,7 +13,7 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
if: ${{ !env.ACT }} if: ${{ !env.ACT }}
with: with:
node-version: '18.18.2' node-version: '22.12.0'
cache: 'npm' cache: 'npm'
- uses: tj-actions/changed-files@v35 - uses: tj-actions/changed-files@v35
id: files id: files

View file

@ -12,7 +12,7 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
if: ${{ !env.ACT }} if: ${{ !env.ACT }}
with: with:
node-version: '18.18.2' node-version: '22.12.0'
cache: 'npm' cache: 'npm'
- name: install dependencies - name: install dependencies
run: npm install run: npm install

View file

@ -21,7 +21,7 @@ jobs:
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
if: ${{ !env.ACT }} if: ${{ !env.ACT }}
with: with:
node-version: '18.18.2' node-version: '22.12.0'
cache: 'npm' cache: 'npm'
- name: install dependencies - name: install dependencies
run: npm install run: npm install

51
eslint.config.mjs Normal file
View file

@ -0,0 +1,51 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
})
export default [
...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'),
{
plugins: {
'@typescript-eslint': typescriptEslint
},
languageOptions: {
globals: {
...globals.node,
...globals.jest
},
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module'
},
rules: {
'@typescript-eslint/no-var-requires': 'off',
'no-case-declarations': 'off',
'linebreak-style': ['error', 'unix'],
quotes: [
'error',
'single',
{
avoidEscape: true
}
],
semi: ['error', 'never']
}
}
]

2785
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,7 @@
"test": "jest --runInBand" "test": "jest --runInBand"
}, },
"engines": { "engines": {
"node": ">=18.0.0 <18.19.0" "node": ">=18.0.0 <=22.12.0"
}, },
"pre-commit": [ "pre-commit": [
"db:validate" "db:validate"
@ -34,18 +34,23 @@
"@octokit/plugin-paginate-rest": "^6.0.0", "@octokit/plugin-paginate-rest": "^6.0.0",
"@octokit/plugin-rest-endpoint-methods": "^7.1.3", "@octokit/plugin-rest-endpoint-methods": "^7.1.3",
"@types/jest": "^29.5.5", "@types/jest": "^29.5.5",
"@typescript-eslint/eslint-plugin": "^6.7.4", "@typescript-eslint/eslint-plugin": "^8.17.0",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"commander": "^9.0.0", "commander": "^9.0.0",
"csvtojson": "^2.0.10", "csvtojson": "^2.0.10",
"eslint": "^8.50.0", "eslint": "^9.16.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"fs-extra": "^11.2.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"joi": "^17.6.0", "joi": "^17.13.3",
"ts-jest": "^29.1.1", "ts-jest": "^29.1.1",
"tsx": "^4.10.5" "tsx": "^4.10.5"
}, },
"devDependencies": { "devDependencies": {
"pre-commit": "^1.2.2" "@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.16.0",
"@types/joi": "^17.2.3",
"globals": "^15.13.0",
"pre-commit": "^1.0.10"
} }
} }

View file

@ -15,19 +15,24 @@ export class IssueLoader {
if (TESTING) { if (TESTING) {
switch (labels) { switch (labels) {
case 'channels:add,approved': case 'channels:add,approved':
issues = require('../../tests/__data__/input/issues/channels_add_approved.js') issues = (await import('../../tests/__data__/input/issues/channels_add_approved.js'))
.default
break break
case 'channels:edit,approved': case 'channels:edit,approved':
issues = require('../../tests/__data__/input/issues/channels_edit_approved.js') issues = (await import('../../tests/__data__/input/issues/channels_edit_approved.js'))
.default
break break
case 'channels:remove,approved': case 'channels:remove,approved':
issues = require('../../tests/__data__/input/issues/channels_remove_approved.js') issues = (await import('../../tests/__data__/input/issues/channels_remove_approved.js'))
.default
break break
case 'blocklist:add,approved': case 'blocklist:add,approved':
issues = require('../../tests/__data__/input/issues/blocklist_add_approved.js') issues = (await import('../../tests/__data__/input/issues/blocklist_add_approved.js'))
.default
break break
case 'blocklist:remove,approved': case 'blocklist:remove,approved':
issues = require('../../tests/__data__/input/issues/blocklist_remove_approved.js') issues = (await import('../../tests/__data__/input/issues/blocklist_remove_approved.js'))
.default
break break
} }
} else { } else {

View file

@ -1,5 +1,6 @@
import { Collection, Storage, File, Dictionary, Logger } from '@freearhey/core' import { Collection, Storage, File, Dictionary, Logger } from '@freearhey/core'
import { DATA_DIR } from '../constants' import { DATA_DIR } from '../constants'
import schemesData from '../schemes'
import { program } from 'commander' import { program } from 'commander'
import Joi from 'joi' import Joi from 'joi'
import { CSVParser, IDCreator } from '../core' import { CSVParser, IDCreator } from '../core'
@ -10,7 +11,7 @@ program.argument('[filepath]', 'Path to file to validate').parse(process.argv)
const logger = new Logger() const logger = new Logger()
const buffer = new Dictionary() const buffer = new Dictionary()
const files = new Dictionary() const files = new Dictionary()
const schemes: { [key: string]: object } = require('../schemes') const schemes: { [key: string]: object } = schemesData
async function main() { async function main() {
const dataStorage = new Storage(DATA_DIR) const dataStorage = new Storage(DATA_DIR)

View file

@ -1,8 +0,0 @@
const Joi = require('joi')
module.exports = {
channel: Joi.string()
.regex(/^[A-Za-z0-9]+\.[a-z]{2}$/)
.required(),
ref: Joi.string().uri().required()
}

View file

@ -0,0 +1,8 @@
import Joi from 'joi'
export default {
channel: Joi.string()
.regex(/^[A-Za-z0-9]+\.[a-z]{2}$/)
.required(),
ref: Joi.string().uri().required()
}

View file

@ -1,10 +0,0 @@
const Joi = require('joi')
module.exports = {
id: Joi.string()
.regex(/^[a-z]+$/)
.required(),
name: Joi.string()
.regex(/^[A-Z]+$/i)
.required()
}

View file

@ -0,0 +1,10 @@
import Joi from 'joi'
export default {
id: Joi.string()
.regex(/^[a-z]+$/)
.required(),
name: Joi.string()
.regex(/^[A-Z]+$/i)
.required()
}

View file

@ -1,8 +1,11 @@
const Joi = require('joi').extend(require('@joi/date')) import BaseJoi from 'joi'
const path = require('path') import JoiDate from '@joi/date'
const url = require('url') import path from 'path'
import url from 'url'
module.exports = { const Joi = BaseJoi.extend(JoiDate)
export default {
id: Joi.string() id: Joi.string()
.regex(/^[A-Za-z0-9]+\.[a-z]{2}$/) .regex(/^[A-Za-z0-9]+\.[a-z]{2}$/)
.required(), .required(),

View file

@ -1,18 +0,0 @@
const Joi = require('joi')
module.exports = {
name: Joi.string()
.regex(/^[\sA-Z\u00C0-\u00FF().-]+$/i)
.required(),
code: Joi.string()
.regex(/^[A-Z]{2}$/)
.required(),
languages: Joi.array().items(
Joi.string()
.regex(/^[a-z]{3}$/)
.required()
),
flag: Joi.string()
.regex(/^[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]$/)
.required()
}

View file

@ -0,0 +1,18 @@
import Joi from 'joi'
export default {
name: Joi.string()
.regex(/^[\sA-Z\u00C0-\u00FF().-]+$/i)
.required(),
code: Joi.string()
.regex(/^[A-Z]{2}$/)
.required(),
languages: Joi.array().items(
Joi.string()
.regex(/^[a-z]{3}$/)
.required()
),
flag: Joi.string()
.regex(/^[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]$/)
.required()
}

View file

@ -1,7 +0,0 @@
exports.channels = require('./channels')
exports.categories = require('./categories')
exports.countries = require('./countries')
exports.languages = require('./languages')
exports.regions = require('./regions')
exports.subdivisions = require('./subdivisions')
exports.blocklist = require('./blocklist')

17
scripts/schemes/index.ts Normal file
View file

@ -0,0 +1,17 @@
import { default as channels } from './channels'
import { default as categories } from './categories'
import { default as countries } from './countries'
import { default as languages } from './languages'
import { default as regions } from './regions'
import { default as subdivisions } from './subdivisions'
import { default as blocklist } from './blocklist'
export default {
channels,
categories,
countries,
languages,
regions,
subdivisions,
blocklist
}

View file

@ -1,8 +0,0 @@
const Joi = require('joi')
module.exports = {
code: Joi.string()
.regex(/^[a-z]{3}$/)
.required(),
name: Joi.string().required()
}

View file

@ -0,0 +1,8 @@
import Joi from 'joi'
export default {
code: Joi.string()
.regex(/^[a-z]{3}$/)
.required(),
name: Joi.string().required()
}

View file

@ -1,6 +1,6 @@
const Joi = require('joi') import Joi from 'joi'
module.exports = { export default {
name: Joi.string() name: Joi.string()
.regex(/^[\sA-Z\u00C0-\u00FF().,-]+$/i) .regex(/^[\sA-Z\u00C0-\u00FF().,-]+$/i)
.required(), .required(),

View file

@ -1,11 +0,0 @@
const Joi = require('joi')
module.exports = {
country: Joi.string()
.regex(/^[A-Z]{2}$/)
.required(),
name: Joi.string().required(),
code: Joi.string()
.regex(/^[A-Z]{2}-[A-Z0-9]{1,3}$/)
.required()
}

View file

@ -0,0 +1,11 @@
import Joi from 'joi'
export default {
country: Joi.string()
.regex(/^[A-Z]{2}$/)
.required(),
name: Joi.string().required(),
code: Joi.string()
.regex(/^[A-Z]{2}-[A-Z0-9]{1,3}$/)
.required()
}

840
yarn.lock

File diff suppressed because it is too large Load diff