Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Nov 16, 2023
2 parents 466ca83 + 3576b6a commit 9a6bd53
Show file tree
Hide file tree
Showing 17 changed files with 6,154 additions and 6,147 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
redis-version: [6]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -42,9 +42,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ coverage/
.pnp.*
.yarn/sdks/


dist/
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

550 changes: 0 additions & 550 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

10 changes: 1 addition & 9 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@ nodeLinker: pnpm

npmRegistryServer: "https://registry.npmmirror.com"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-3.6.1.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
39 changes: 21 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
"description": "Fast & Powerful Hitokoto API Framework.",
"main": "core.js",
"engines": {
"node": ">=14"
"node": ">= 18"
},
"scripts": {
"start": "node core",
"dev": "yarn nodemon -e js,mjs,cjs,json,yml,yaml core.js -- -D",
"pnpify": "yarn dlx @yarnpkg/pnpify",
"build:": "esbuild --bundle --minify --platform=node --outfile=dist/server.js core.js",
"lint": "eslint ./src/**/*.js ./adapter/**/*.js ./test/**/*.js core.js",
"watch": "yarn dlx supervisor --watch \".\" --extensions \"js,json\" --exec \"yarn\" -- \"start\"",
"test": "jest --verbose",
"commit": "yarn dlx git-cz",
"release": "yarn dlx release-it",
"changelog": "yarn dlx -p conventional-changelog-cli conventional-changelog -p conventionalcommits -i CHANGELOG.md -s -r 0 -n .changelog.config.js",
"prepare": "husky install",
"postinstall": "sh -c 'if [ command -v ./node_modules/.bin/husky ]; then ./node_modules/.bin/husky install; fi;'"
"postinstall": "husky install"
},
"repository": "https://github.com/hitokoto-osc/hitokoto-api",
"author": "a632079 <[email protected]>",
Expand All @@ -36,34 +37,36 @@
},
"devDependencies": {
"@babel/core": "7.22.8",
"@babel/eslint-parser": "7.22.7",
"@babel/eslint-parser": "7.23.3",
"@babel/preset-env": "7.22.7",
"@commitlint/cli": "17.6.6",
"@commitlint/config-conventional": "17.6.6",
"@commitlint/cli": "17.8.1",
"@commitlint/config-conventional": "17.8.1",
"@types/jest": "29.5.2",
"commitizen": "4.3.0",
"conventional-changelog-conventionalcommits": "6.1.0",
"conventional-changelog-conventionalcommits": "7.0.2",
"cz-conventional-changelog": "3.3.0",
"eslint": "8.44.0",
"eslint-config-prettier": "8.8.0",
"esbuild": "^0.19.5",
"eslint": "8.53.0",
"eslint-config-prettier": "9.0.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-html": "7.1.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jest": "27.2.2",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-prettier": "5.0.0-alpha.2",
"eslint-plugin-n": "16.3.1",
"eslint-plugin-prettier": "5.0.1",
"eslint-plugin-promise": "6.1.1",
"husky": "8.0.3",
"jest": "29.6.1",
"jest-extended": "4.0.0",
"lint-staged": "13.2.3",
"lint-staged": "14.0.1",
"nodemon": "3.0.1",
"nyc": "15.1.0",
"prettier": "3.0.0",
"prettier": "3.1.0",
"regenerator-runtime": "0.13.11",
"release-it": "16.1.0",
"supertest": "6.3.3",
"supervisor": "0.12.0"
"supervisor": "0.12.0",
"webpack": "^5.89.0"
},
"dependencies": {
"@hitokoto/koa-jsonp": "3.0.7",
Expand All @@ -73,13 +76,13 @@
"@sentry/integrations": "7.57.0",
"@sentry/node": "7.57.0",
"@sentry/tracing": "7.57.0",
"NeteaseCloudMusicApi": "4.8.10",
"NeteaseCloudMusicApi": "4.13.6",
"async": "3.2.4",
"bytes": "3.1.2",
"chalk": "4.1.2",
"commander": "11.0.0",
"cron": "2.3.1",
"fast-json-stringify": "5.7.0",
"fast-json-stringify": "5.8.0",
"flatstr": "1.0.12",
"got": "11.8.6",
"humanize-number": "0.0.2",
Expand All @@ -94,7 +97,7 @@
"koa-router": "12.0.0",
"lodash": "4.17.21",
"mysql2": "3.5.0",
"nconf": "0.12.0",
"nconf": "0.12.1",
"nconf-yaml": "1.0.2",
"nodemailer": "6.9.3",
"passthrough-counter": "1.0.0",
Expand All @@ -104,5 +107,5 @@
"uuid": "9.0.0",
"winston": "3.9.0"
},
"packageManager": "yarn@3.6.1"
"packageManager": "yarn@4.0.2"
}
10 changes: 9 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"default:automergeMinor",
"default:disableRateLimiting",
"default:rebaseStalePrs",
"default:pinVersions",
"group:allNonMajor"
],
"packageRules": [

{
"groupName": "Web Basement & Middleware",
"matchPackagePatterns": [
Expand Down Expand Up @@ -56,6 +57,13 @@
"jest",
"nodemon"
]
},
{
"description": "Ignore nodejs",
"matchPackageNames": ["node"],
"matchManagers": ["npm"],
"matchDepTypes": [ "engines" ],
"enabled": false
}
]
}
9 changes: 3 additions & 6 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,9 @@ class controllers {

register(controller) {
try {
return require(path.join(
__dirname,
'../',
'./src/controllers',
controller,
))
return require(
path.join(__dirname, '../', './src/controllers', controller),
)
} catch (e) {
logger.error(chalk.red(e))
// mail.error(e)
Expand Down
16 changes: 6 additions & 10 deletions src/cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,15 @@ class Cron {
const dir = fs.readdirSync(path.join(__dirname, '../', './src/crons'))
if (isArray) {
await dir.forEach((item, index, input) => {
crons[index] = require(path.join(
__dirname,
'../',
'./src/crons/' + item,
))
crons[index] = require(
path.join(__dirname, '../', './src/crons/' + item),
)
})
} else {
await dir.forEach((item, index, input) => {
crons[item.substring(0, item.length - 3)] = require(path.join(
__dirname,
'../',
'./src/crons/' + item,
))
crons[item.substring(0, item.length - 3)] = require(
path.join(__dirname, '../', './src/crons/' + item),
)
})
}
return crons
Expand Down
9 changes: 3 additions & 6 deletions src/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ class db {
return this[model]
} else {
// Register Model
const modelArray = require(path.join(
__dirname,
'../',
'./src/models/databases',
model,
))
const modelArray = require(
path.join(__dirname, '../', './src/models/databases', model),
)
this[model] = this.sequelize.define(model, modelArray[0], modelArray[1])
return this[model]
}
Expand Down
7 changes: 3 additions & 4 deletions src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ module.exports = {
let middlewares = require(path.join(__dirname, '../adapter/plugins'))
checkMiddlewaresFileValid(middlewares)
if (isDev) {
const devMiddlewares = require(path.join(
__dirname,
'../adapter/plugins.dev',
))
const devMiddlewares = require(
path.join(__dirname, '../adapter/plugins.dev'),
)
checkMiddlewaresFileValid(devMiddlewares)
middlewares = middlewares.concat(devMiddlewares)
}
Expand Down
4 changes: 2 additions & 2 deletions src/middlewares/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ function log(ctx, start, len, err, event) {
const upstream = err
? chalk.red('xxx')
: event === 'close'
? chalk.yellow('-x-')
: chalk.gray('-->')
? chalk.yellow('-x-')
: chalk.gray('-->')
logger.verbose(
'[web] ' +
upstream +
Expand Down
10 changes: 4 additions & 6 deletions src/task/update_sentences_utils/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ function notifyMasterSwitchDB(targetDatabase) {
}

async function fullSentencesUpgrade(remoteVersionData, SideAB) {
const remoteCategoriesData = await fetchRemoteCategoriesData(
remoteVersionData,
)
const remoteCategoriesData =
await fetchRemoteCategoriesData(remoteVersionData)
await SideAB.set('hitokoto:bundle:categories', remoteCategoriesData)
let sentencesTotal = 0
for (const category of remoteCategoriesData) {
Expand All @@ -143,9 +142,8 @@ async function UpgradeSentencesThatShouldBeUpdated(
remoteVersionData.categories.timestamp !==
local.bundleVersionData.categories.timestamp // 检测分类列表是否更新
) {
const remoteCategoriesData = await fetchRemoteCategoriesData(
remoteVersionData,
)
const remoteCategoriesData =
await fetchRemoteCategoriesData(remoteVersionData)
const categoriesNeededToAppend = getCategoriesThatShouldBeAppended(
localCategoriesData,
remoteCategoriesData,
Expand Down
Loading

0 comments on commit 9a6bd53

Please sign in to comment.