Skip to content

Commit

Permalink
feat: move api-client as core's monorepo
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Dec 20, 2022
1 parent 06ab476 commit a281f45
Show file tree
Hide file tree
Showing 101 changed files with 7,992 additions and 299 deletions.
14 changes: 14 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
assets/types/type.declare.ts

node_modules
dist
out
packages/*/node_modules
packages/*/dist
packages/*/out
packages/*/lib
packages/*/build
packages/*/coverage
packages/*/test
packages/*/tests
packages/*/esm
packages/*/types
45 changes: 45 additions & 0 deletions .github/workflows/api-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build @mx-space/api-client

on:
push:
paths:
- 'package.json'
- 'packages/api-client/**'
pull_request:
branches: [master, main]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.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: Cache pnpm modules
uses: actions/cache@v3
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
- uses: pnpm/[email protected]
with:
version: 7.x.x
run_install: true
- run: pnpm run test
- run: pnpm run package
env:
CI: true
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules
dist
out
packages/*/node_modules
packages/*/dist
packages/*/out
packages/*/lib
packages/*/build
packages/*/coverage
packages/*/test
packages/*/tests
packages/*/esm
packages/*/types
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"dev": "npm run start",
"repl": "npm run start -- --entryFile repl",
"bundle": "rimraf out && npm run build && cd dist/src && npx ncc build main.js -o ../../out -m -t && cd ../.. && chmod +x out/index.js",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"packages/**/*.ts\"",
"start": "cross-env NODE_ENV=development nest start -w --path tsconfig.json",
"start:debug": "cross-env NODE_ENV=development nest start --debug --watch",
"start:cluster": "cross-env NODE_ENV=development nest start --watch -- --cluster --workers 2",
"start:prod": "cross-env NODE_ENV=production node dist/src/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"lint": "eslint \"{src,apps,libs,test,packages}/**/*.ts\" --fix",
"prod": "cross-env NODE_ENV=production pm2-runtime start ecosystem.config.js",
"prod:pm2": "cross-env NODE_ENV=production pm2 restart ecosystem.config.js",
"prod:stop": "pm2 stop ecosystem.config.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/api-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
esm
lib
dist
build

types
3 changes: 3 additions & 0 deletions packages/api-client/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
registry=https://registry.npmjs.org

strict-peer-dependencies=false
7 changes: 7 additions & 0 deletions packages/api-client/__tests__/adaptors/axios.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { axiosAdaptor } from '~/adaptors/axios'

import { testAdaptor } from '../helpers/adaptor-test'

describe('test axios adaptor', () => {
testAdaptor(axiosAdaptor)
})
9 changes: 9 additions & 0 deletions packages/api-client/__tests__/adaptors/ky.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import '../helpers/global-fetch'

import { defaultKyAdaptor } from '~/adaptors/ky'

import { testAdaptor } from '../helpers/adaptor-test'

describe('test ky adaptor', () => {
testAdaptor(defaultKyAdaptor)
})
7 changes: 7 additions & 0 deletions packages/api-client/__tests__/adaptors/umi-request.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { umiAdaptor } from '~/adaptors/umi-request'

import { testAdaptor } from '../helpers/adaptor-test'

describe('test umi-request adaptor', () => {
testAdaptor(umiAdaptor)
})
Loading

0 comments on commit a281f45

Please sign in to comment.