From 23e8b57273e4608800281d87640b217809e41e82 Mon Sep 17 00:00:00 2001 From: sinkaroid Date: Tue, 18 Apr 2023 11:14:49 +0700 Subject: [PATCH] ci: tdd --- .github/workflows/pornhub.yml | 30 +++++++++++++++ .github/workflows/status.yml | 29 +++++++++++++++ package.json | 69 +++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 .github/workflows/pornhub.yml create mode 100644 .github/workflows/status.yml create mode 100644 package.json diff --git a/.github/workflows/pornhub.yml b/.github/workflows/pornhub.yml new file mode 100644 index 0000000..bdab147 --- /dev/null +++ b/.github/workflows/pornhub.yml @@ -0,0 +1,30 @@ +name: Pornhub test + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: npm install + - name: Build + run: npm run build + + - name: Pornhub test + run: npm run test:pornhub \ No newline at end of file diff --git a/.github/workflows/status.yml b/.github/workflows/status.yml new file mode 100644 index 0000000..70b4a8b --- /dev/null +++ b/.github/workflows/status.yml @@ -0,0 +1,29 @@ +name: Check status + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: npm install + - name: Build + run: npm run build + - name: Check status code + run: npm run test \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..ec75306 --- /dev/null +++ b/package.json @@ -0,0 +1,69 @@ +{ + "name": "lustpress", + "version": "1.6.0-alpha", + "description": "RESTful and experimental API for PornHub and other porn sites, which official is lack even isn't exist.", + "main": "build/src/index.js", + "scripts": { + "build": "rimraf build && tsc", + "start": "node build/src/index.js", + "test": "ts-node test/test.ts", + "test:mock": "ts-node test/mock.ts", + "start:prod": "npm run build && node build/src/index.js", + "start:dev": "ts-node-dev src/index.ts", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --fix", + "build:freshdoc": "rimraf docs && rimraf template && rimraf theme.zip", + "build:template": " npm run build:freshdoc && curl https://codeload.github.com/ScathachGrip/apidocjs-theme/zip/refs/tags/v11 -o theme.zip && unzip theme.zip && mv apidocjs-theme-11 template", + "build:apidoc": "npm run build:template && apidoc -i src -o ./docs -t ./template/template-scarlet", + "test:pornhub": "start-server-and-test 3000 \"curl -v http://localhost:3000/pornhub/random | jq '.'\"", + "test:xnxx": "start-server-and-test 3000 \"curl -v http://localhost:3000/xnxx/random | jq '.'\"", + "test:redtube": "start-server-and-test 3000 \"curl -v http://localhost:3000/redtube/random | jq '.'\"", + "test:xvideos": "start-server-and-test 3000 \"curl -v http://localhost:3000/xvideos/random | jq '.'\"", + "test:xhamster": "start-server-and-test 3000 \"curl -v http://localhost:3000/xhamster/random | jq '.'\"", + "test:youporn": "start-server-and-test 3000 \"curl -v http://localhost:3000/youporn/random | jq '.'\"" + }, + "apidoc": { + "title": "Lustpress API Documentation", + "url": "https://lust.scathach.id", + "sampleUrl": "https://lust.scathach.id", + "name": "Lustpress" + }, + "keywords": [], + "author": "sinkaroid", + "repository": { + "type": "git", + "url": "git+https://github.com/sinkaroid/lustpress.git" + }, + "license": "MIT", + "dependencies": { + "@keyv/redis": "^2.5.7", + "cheerio": "^1.0.0-rc.12", + "cors": "^2.8.5", + "dotenv": "^16.0.3", + "express": "^4.18.2", + "express-rate-limit": "^6.7.0", + "express-slow-down": "^1.6.0", + "keyv": "^4.5.2", + "phin": "^3.7.0", + "pino": "^8.11.0", + "pino-pretty": "^10.0.0" + }, + "devDependencies": { + "@types/cors": "^2.8.13", + "@types/express": "^4.17.17", + "@types/express-slow-down": "^1.3.2", + "@types/node": "^18.15.11", + "@typescript-eslint/eslint-plugin": "^5.58.0", + "@typescript-eslint/parser": "^5.58.0", + "apidoc": "0.29.0", + "eslint": "^8.38.0", + "rimraf": "^5.0.0", + "start-server-and-test": "^2.0.0", + "ts-node": "^10.9.1", + "ts-node-dev": "^2.0.0", + "typescript": "5.0.4" + }, + "engines": { + "node": ">=14" + } +}