Skip to content

Commit a281f45

Browse files
committed
feat: move api-client as core's monorepo
Signed-off-by: Innei <[email protected]>
1 parent 06ab476 commit a281f45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+7992
-299
lines changed

.eslintignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
11
assets/types/type.declare.ts
2+
3+
node_modules
4+
dist
5+
out
6+
packages/*/node_modules
7+
packages/*/dist
8+
packages/*/out
9+
packages/*/lib
10+
packages/*/build
11+
packages/*/coverage
12+
packages/*/test
13+
packages/*/tests
14+
packages/*/esm
15+
packages/*/types

.github/workflows/api-client.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Build @mx-space/api-client
5+
6+
on:
7+
push:
8+
paths:
9+
- 'package.json'
10+
- 'packages/api-client/**'
11+
pull_request:
12+
branches: [master, main]
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
matrix:
20+
node-version: [14.x, 16.x]
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
- name: Cache pnpm modules
29+
uses: actions/cache@v3
30+
env:
31+
cache-name: cache-pnpm-modules
32+
with:
33+
path: ~/.pnpm-store
34+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
35+
restore-keys: |
36+
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
37+
38+
- uses: pnpm/[email protected]
39+
with:
40+
version: 7.x.x
41+
run_install: true
42+
- run: pnpm run test
43+
- run: pnpm run package
44+
env:
45+
CI: true

.prettierignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
node_modules
2+
dist
3+
out
4+
packages/*/node_modules
5+
packages/*/dist
6+
packages/*/out
7+
packages/*/lib
8+
packages/*/build
9+
packages/*/coverage
10+
packages/*/test
11+
packages/*/tests
12+
packages/*/esm
13+
packages/*/types

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
"dev": "npm run start",
3434
"repl": "npm run start -- --entryFile repl",
3535
"bundle": "rimraf out && npm run build && cd dist/src && npx ncc build main.js -o ../../out -m -t && cd ../.. && chmod +x out/index.js",
36-
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
36+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"packages/**/*.ts\"",
3737
"start": "cross-env NODE_ENV=development nest start -w --path tsconfig.json",
3838
"start:debug": "cross-env NODE_ENV=development nest start --debug --watch",
3939
"start:cluster": "cross-env NODE_ENV=development nest start --watch -- --cluster --workers 2",
4040
"start:prod": "cross-env NODE_ENV=production node dist/src/main",
41-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
41+
"lint": "eslint \"{src,apps,libs,test,packages}/**/*.ts\" --fix",
4242
"prod": "cross-env NODE_ENV=production pm2-runtime start ecosystem.config.js",
4343
"prod:pm2": "cross-env NODE_ENV=production pm2 restart ecosystem.config.js",
4444
"prod:stop": "pm2 stop ecosystem.config.js",

packages/api-client/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
esm
2+
lib
3+
dist
4+
build
5+
6+
types

packages/api-client/.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
registry=https://registry.npmjs.org
2+
3+
strict-peer-dependencies=false
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { axiosAdaptor } from '~/adaptors/axios'
2+
3+
import { testAdaptor } from '../helpers/adaptor-test'
4+
5+
describe('test axios adaptor', () => {
6+
testAdaptor(axiosAdaptor)
7+
})
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import '../helpers/global-fetch'
2+
3+
import { defaultKyAdaptor } from '~/adaptors/ky'
4+
5+
import { testAdaptor } from '../helpers/adaptor-test'
6+
7+
describe('test ky adaptor', () => {
8+
testAdaptor(defaultKyAdaptor)
9+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { umiAdaptor } from '~/adaptors/umi-request'
2+
3+
import { testAdaptor } from '../helpers/adaptor-test'
4+
5+
describe('test umi-request adaptor', () => {
6+
testAdaptor(umiAdaptor)
7+
})

0 commit comments

Comments
 (0)