Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
feat: 完成项目必须脚手架安装
Browse files Browse the repository at this point in the history
  • Loading branch information
CaoMeiYouRen committed May 27, 2020
1 parent ee87a8c commit da97ce8
Show file tree
Hide file tree
Showing 12 changed files with 755 additions and 22 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Expand Up @@ -26,4 +26,3 @@ tsconfig.json

#git but keep the git commit hash
.git
src
4 changes: 2 additions & 2 deletions .gitignore
@@ -1,7 +1,7 @@
.DS_Store
node_modules
/dist

# /dist
# !/dist/index.js
# local env files
.env.local
.env.*.local
Expand Down
33 changes: 33 additions & 0 deletions .releaserc.js
@@ -0,0 +1,33 @@
module.exports = {
plugins: [
[
"@semantic-release/commit-analyzer",//此处只导入解析规则 parserOpts
{
"config": "conventional-changelog-cmyr-config"
}
],
["@semantic-release/release-notes-generator",//此处导入解析和生成规则 parserOpts, writerOpts
{
config: "conventional-changelog-cmyr-config"
}],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md",
"changelogTitle": "# super-search-hub"
}
],
'@semantic-release/github',
[
"@semantic-release/git",
{
"assets": [
"dist",
"CHANGELOG.md",
"README.md",
"package.json",
]
}
]
]
}
16 changes: 16 additions & 0 deletions .travis.yml
@@ -0,0 +1,16 @@
language: node_js
node_js: 12

script:
- npm run build

deploy:
provider: script
skip_cleanup: true
on:
branch: master
script:
- npm run release
cache:
directories:
- node_modules
19 changes: 19 additions & 0 deletions Dockerfile
@@ -0,0 +1,19 @@
FROM alpine:3.11

WORKDIR /home/app

ENV NODE_ENV production
ENV NODE_VERSION 12.15.0-r1

# 安装nodejs环境
RUN echo "https://mirrors.aliyun.com/alpine/v3.11/main/" > /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/v3.11/community/" >> /etc/apk/repositories \
&& apk update \
&& apk add --no-cache --update "nodejs=${NODE_VERSION}" \
&& node -v

COPY package.json .env dist /home/app/

EXPOSE 80

CMD ["npm", "start"]
25 changes: 25 additions & 0 deletions Dockerfile.build
@@ -0,0 +1,25 @@
FROM alpine:3.11

WORKDIR /home/app

ENV NODE_ENV production
ENV NODE_VERSION 12.15.0-r1

# 安装nodejs环境
RUN echo "https://mirrors.aliyun.com/alpine/v3.11/main/" > /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/v3.11/community/" >> /etc/apk/repositories \
&& apk update \
&& apk add --no-cache --update "nodejs=${NODE_VERSION}" "nodejs-npm=${NODE_VERSION}" \
&& node -v && npm -v && npm config set registry https://registry.npm.taobao.org

COPY package.json /home/app/

RUN npm install --production

COPY . /home/app

RUN npm run build

EXPOSE 80

CMD ["npm", "start"]
17 changes: 13 additions & 4 deletions README.md
@@ -1,9 +1,16 @@
# super-search-hub

设计参考:[RSSHub](https://github.com/DIYgod/RSSHub)

设计目标:
将任何能搜索的网页的搜索结果处理成标准的RSS规范格式。
同时支持json和xml。
返回结果以json优先,xml通过转换产生

- 将任何能搜索的网页的搜索结果处理成标准的RSS规范格式。
同时支持json和xml。
- 返回结果以json优先,xml通过转换产生
- 目标并不是支持RSS阅读器,而是将搜索结果转换为一种统一的格式,方便进行二次开发。仅参考RSS规范进行设计
- 项目的dist文件应当可以在node.js环境下直接运行,无需其他依赖【除redis缓存外】



通用参数约定

Expand Down Expand Up @@ -38,4 +45,6 @@ routes规范约定
- 但是先建的文件夹可以不包含顶级域名
- 文件夹下必须有 index.ts
- index.ts 中只允许挂载路由,业务逻辑请在其他文件完成
- 路由一律采用默认导出的形式,即`export default router`
- 路由一律采用默认导出的形式,即`export default router`

文档约定【待补充】
11 changes: 11 additions & 0 deletions commitlint.config.js
@@ -0,0 +1,11 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', [
'feat', 'fix', 'docs', 'style', 'refactor', 'test',
'chore', 'revert', 'upgrade', 'revert', 'build', 'perf'
]],
'subject-full-stop': [0, 'never'],
'subject-case': [0, 'never']
}
}
542 changes: 542 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions docker-compose.build.yml
@@ -0,0 +1,24 @@
version: "3"

services:
super-search-hub:
container_name: super-search-hub-container
build: .
restart: always
ports:
- "80:80"
environment:
NODE_ENV: production
CACHE_TYPE: redis
REDIS_URL: "redis://redis:6379/"
REDIS_HOST: "redis"
REDIS_PORT: 6379
depends_on:
- redis
redis:
image: redis:alpine
restart: always
volumes:
- redis-data:/data
volumes:
redis-data:
23 changes: 23 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,23 @@
version: "3"

services:
super-search-hub:
image: caomeiyouren/super-search-hub
restart: always
ports:
- "80:80"
environment:
NODE_ENV: production
CACHE_TYPE: redis
REDIS_URL: "redis://redis:6379/"
REDIS_HOST: "redis"
REDIS_PORT: 6379
depends_on:
- redis
redis:
image: redis:alpine
restart: always
volumes:
- redis-data:/data
volumes:
redis-data:
62 changes: 47 additions & 15 deletions package.json
@@ -1,8 +1,8 @@
{
"name": "super-search-hub",
"version": "1.0.0",
"version": "0.1.0",
"private": true,
"description": "",
"description": "将任何能搜索的网页的搜索结果处理成一种统一的格式",
"main": "dist/index.js",
"scripts": {
"lint": "eslint src --fix --ext .ts,.js",
Expand All @@ -12,7 +12,35 @@
"prebuild": "rimraf dist",
"build:test": "tsc && webpack --config ./webpack.config.js && node dist/index.js",
"rm": "rimraf node_modules",
"debug": "cross-env DEBUG=express:* npm run dev"
"debug": "cross-env DEBUG=koa:* npm run dev",
"commit": "git add . && git cz",
"changelog": "conventional-changelog -p cmyr-config -i CHANGELOG.md -s -r 0",
"release": "semantic-release"
},
"engines": {
"node": ">=12"
},
"repository": {
"type": "git",
"url": "git+https://github.com/CaoMeiYouRen/super-search-hub.git"
},
"bugs": {
"url": "https://github.com/CaoMeiYouRen/super-search-hub/issues"
},
"homepage": "https://github.com/CaoMeiYouRen/super-search-hub#readme",
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"lint-staged": {
".{ts,js}": [
"npm run lint",
"git add ."
]
},
"changelog": {
"language": "zh"
},
"dependencies": {
"@koa/cors": "^3.1.0",
Expand All @@ -22,8 +50,8 @@
"colors": "^1.4.0",
"connect-timeout": "^1.9.0",
"cookie-parser": "^1.4.5",
"debug": "^4.1.1",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"file-stream-rotator": "^0.5.7",
"fs-extra": "^9.0.0",
"http-status": "^1.4.2",
Expand All @@ -43,14 +71,17 @@
"module-alias": "^2.2.2",
"moment": "^2.26.0",
"morgan": "^1.10.0",
"require-all": "^3.0.0"
"require-all": "^3.0.0",
"rimraf": "^3.0.2",
"ts-loader": "^7.0.4",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
},
"devDependencies": {
"@types/cheerio": "^0.22.18",
"@types/connect-timeout": "0.0.34",
"@types/cookie-parser": "^1.4.2",
"@types/debug": "^4.1.5",
"@types/express": "^4.17.6",
"@types/fs-extra": "^9.0.1",
"@types/ioredis": "^4.16.2",
"@types/koa": "^2.11.3",
Expand All @@ -67,20 +98,21 @@
"@types/module-alias": "^2.0.0",
"@types/morgan": "^1.9.0",
"@types/node": "^14.0.5",
"@types/saslprep": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^3.0.0",
"@typescript-eslint/parser": "^3.0.0",
"babel-eslint": "^10.1.0",
"commitizen": "^4.1.2",
"conventional-changelog-cli": "^2.0.34",
"conventional-changelog-cmyr-config": "^1.2.0",
"cross-env": "^7.0.2",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^7.1.0",
"rimraf": "^3.0.2",
"ts-loader": "^7.0.4",
"husky": "^4.2.5",
"nyc": "^15.0.1",
"release-it": "^13.6.1",
"should": "^13.2.3",
"ts-node-dev": "^1.0.0-pre.44",
"typescript": "^3.9.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
},
"engines": {
"node": ">=12"
"validate-commit-msg": "^2.14.0"
}
}
}

0 comments on commit da97ce8

Please sign in to comment.