feat: api scaffold
This commit is contained in:
parent
bea91a9285
commit
ca54bc9127
7 changed files with 212 additions and 17 deletions
33
.github/workflows/main.yml
vendored
33
.github/workflows/main.yml
vendored
|
@ -80,6 +80,39 @@ jobs:
|
|||
with:
|
||||
name: build-artifacts
|
||||
path: packages/app/dist
|
||||
build-api:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build API
|
||||
needs: setup
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
id: node-setup
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
- name: Yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache-restore
|
||||
with:
|
||||
path: |
|
||||
.yarn
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
|
||||
- name: Parcel cache
|
||||
uses: actions/cache@v3
|
||||
id: parcel-cache-restore
|
||||
with:
|
||||
path: |
|
||||
.parcel-cache
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}-parcel
|
||||
- run: |
|
||||
. script/bootstrap
|
||||
yarn build:api
|
||||
- name: Build Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-artifacts-api
|
||||
path: packages/api/dist
|
||||
|
||||
preview:
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploy preview
|
||||
|
|
|
@ -9,13 +9,15 @@
|
|||
],
|
||||
"scripts": {
|
||||
"start:app": "yarn workspace app start",
|
||||
"lint": "eslint packages",
|
||||
"lint:fix": "eslint packages netlify --fix",
|
||||
"start:api": "yarn workspace api start",
|
||||
"lint": "eslint packages/**/*.ts",
|
||||
"lint:fix": "eslint packages/**/*.ts netlify --fix",
|
||||
"types": "tsc --noEmit",
|
||||
"clean": "rm -rf dist/*",
|
||||
"build:app": "yarn workspace app build",
|
||||
"build:app:watch": "yarn workspace app watch",
|
||||
"build:app:bundlesize": "yarn workspace app build:bundlesize"
|
||||
"build:app:bundlesize": "yarn workspace app build:bundlesize",
|
||||
"build:api": "yarn workspace api build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/reporter-bundle-analyzer": "^2.9.3",
|
||||
|
|
19
packages/api/package.json
Normal file
19
packages/api/package.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "api",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"license": "GPL-3.0",
|
||||
"scripts": {
|
||||
"start": "test -f dist/index.js && yarn node dist/index.js",
|
||||
"build": "yarn tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.18.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/node": "^20.3.2",
|
||||
"typescript": "*"
|
||||
}
|
||||
}
|
0
packages/api/src/index.js
Normal file
0
packages/api/src/index.js
Normal file
14
packages/api/src/index.ts
Normal file
14
packages/api/src/index.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import {
|
||||
type Express,
|
||||
type Request,
|
||||
type Response,
|
||||
default as express,
|
||||
} from 'express'
|
||||
|
||||
const app: Express = express()
|
||||
|
||||
app.get('/', (req: Request, res: Response) => {
|
||||
res.send('ok')
|
||||
})
|
||||
|
||||
app.listen(8081, () => {})
|
10
packages/api/tsconfig.json
Normal file
10
packages/api/tsconfig.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
145
yarn.lock
145
yarn.lock
|
@ -3647,6 +3647,49 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/body-parser@npm:*":
|
||||
version: 1.19.2
|
||||
resolution: "@types/body-parser@npm:1.19.2"
|
||||
dependencies:
|
||||
"@types/connect": "*"
|
||||
"@types/node": "*"
|
||||
checksum: e17840c7d747a549f00aebe72c89313d09fbc4b632b949b2470c5cb3b1cb73863901ae84d9335b567a79ec5efcfb8a28ff8e3f36bc8748a9686756b6d5681f40
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/connect@npm:*":
|
||||
version: 3.4.35
|
||||
resolution: "@types/connect@npm:3.4.35"
|
||||
dependencies:
|
||||
"@types/node": "*"
|
||||
checksum: fe81351470f2d3165e8b12ce33542eef89ea893e36dd62e8f7d72566dfb7e448376ae962f9f3ea888547ce8b55a40020ca0e01d637fab5d99567673084542641
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/express-serve-static-core@npm:^4.17.33":
|
||||
version: 4.17.35
|
||||
resolution: "@types/express-serve-static-core@npm:4.17.35"
|
||||
dependencies:
|
||||
"@types/node": "*"
|
||||
"@types/qs": "*"
|
||||
"@types/range-parser": "*"
|
||||
"@types/send": "*"
|
||||
checksum: cc8995d10c6feda475ec1b3a0e69eb0f35f21ab6b49129ad5c6f279e0bc5de8175bc04ec51304cb79a43eec3ed2f5a1e01472eb6d5f827b8c35c6ca8ad24eb6e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/express@npm:^4.17.17":
|
||||
version: 4.17.17
|
||||
resolution: "@types/express@npm:4.17.17"
|
||||
dependencies:
|
||||
"@types/body-parser": "*"
|
||||
"@types/express-serve-static-core": ^4.17.33
|
||||
"@types/qs": "*"
|
||||
"@types/serve-static": "*"
|
||||
checksum: 0196dacc275ac3ce89d7364885cb08e7fb61f53ca101f65886dbf1daf9b7eb05c0943e2e4bbd01b0cc5e50f37e0eea7e4cbe97d0304094411ac73e1b7998f4da
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/graceful-fs@npm:^4.1.3":
|
||||
version: 4.1.5
|
||||
resolution: "@types/graceful-fs@npm:4.1.5"
|
||||
|
@ -3663,6 +3706,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/http-errors@npm:*":
|
||||
version: 2.0.1
|
||||
resolution: "@types/http-errors@npm:2.0.1"
|
||||
checksum: 3bb0c50b0a652e679a84c30cd0340d696c32ef6558518268c238840346c077f899315daaf1c26c09c57ddd5dc80510f2a7f46acd52bf949e339e35ed3ee9654f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/http-proxy@npm:^1.17.8":
|
||||
version: 1.17.9
|
||||
resolution: "@types/http-proxy@npm:1.17.9"
|
||||
|
@ -3711,6 +3761,20 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/mime@npm:*":
|
||||
version: 3.0.1
|
||||
resolution: "@types/mime@npm:3.0.1"
|
||||
checksum: 4040fac73fd0cea2460e29b348c1a6173da747f3a87da0dbce80dd7a9355a3d0e51d6d9a401654f3e5550620e3718b5a899b2ec1debf18424e298a2c605346e7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/mime@npm:^1":
|
||||
version: 1.3.2
|
||||
resolution: "@types/mime@npm:1.3.2"
|
||||
checksum: 0493368244cced1a69cb791b485a260a422e6fcc857782e1178d1e6f219f1b161793e9f87f5fae1b219af0f50bee24fcbe733a18b4be8fdd07a38a8fb91146fd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:*":
|
||||
version: 16.3.1
|
||||
resolution: "@types/node@npm:16.3.1"
|
||||
|
@ -3718,6 +3782,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/node@npm:^20.3.2":
|
||||
version: 20.3.2
|
||||
resolution: "@types/node@npm:20.3.2"
|
||||
checksum: 5929ce2b9b12b1e2a2304a0921a953c72a81f5753ad39ac43b99ce6312fbb2b4fb5bc6b60d64a2550704e3223cd5de1299467d36085ac69888899db978f2653a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/normalize-package-data@npm:^2.4.1":
|
||||
version: 2.4.1
|
||||
resolution: "@types/normalize-package-data@npm:2.4.1"
|
||||
|
@ -3746,6 +3817,20 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/qs@npm:*":
|
||||
version: 6.9.7
|
||||
resolution: "@types/qs@npm:6.9.7"
|
||||
checksum: 7fd6f9c25053e9b5bb6bc9f9f76c1d89e6c04f7707a7ba0e44cc01f17ef5284adb82f230f542c2d5557d69407c9a40f0f3515e8319afd14e1e16b5543ac6cdba
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/range-parser@npm:*":
|
||||
version: 1.2.4
|
||||
resolution: "@types/range-parser@npm:1.2.4"
|
||||
checksum: b7c0dfd5080a989d6c8bb0b6750fc0933d9acabeb476da6fe71d8bdf1ab65e37c136169d84148034802f48378ab94e3c37bb4ef7656b2bec2cb9c0f8d4146a95
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react-transition-group@npm:^4.2.0":
|
||||
version: 4.4.2
|
||||
resolution: "@types/react-transition-group@npm:4.4.2"
|
||||
|
@ -3787,6 +3872,27 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/send@npm:*":
|
||||
version: 0.17.1
|
||||
resolution: "@types/send@npm:0.17.1"
|
||||
dependencies:
|
||||
"@types/mime": ^1
|
||||
"@types/node": "*"
|
||||
checksum: 10b620a5960058ef009afbc17686f680d6486277c62f640845381ec4baa0ea683fdd77c3afea4803daf5fcddd3fb2972c8aa32e078939f1d4e96f83195c89793
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/serve-static@npm:*":
|
||||
version: 1.15.2
|
||||
resolution: "@types/serve-static@npm:1.15.2"
|
||||
dependencies:
|
||||
"@types/http-errors": "*"
|
||||
"@types/mime": "*"
|
||||
"@types/node": "*"
|
||||
checksum: 15c261dbfc57890f7cc17c04d5b22b418dfa0330c912b46c5d8ae2064da5d6f844ef7f41b63c7f4bbf07675e97ebe6ac804b032635ec742ae45d6f1274259b3e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/stack-utils@npm:^2.0.0":
|
||||
version: 2.0.1
|
||||
resolution: "@types/stack-utils@npm:2.0.1"
|
||||
|
@ -4494,6 +4600,17 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"api@workspace:packages/api":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "api@workspace:packages/api"
|
||||
dependencies:
|
||||
"@types/express": ^4.17.17
|
||||
"@types/node": ^20.3.2
|
||||
express: ^4.18.2
|
||||
typescript: "*"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"app@workspace:packages/app":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "app@workspace:packages/app"
|
||||
|
@ -7592,7 +7709,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"express@npm:4.18.2":
|
||||
"express@npm:4.18.2, express@npm:^4.18.2":
|
||||
version: 4.18.2
|
||||
resolution: "express@npm:4.18.2"
|
||||
dependencies:
|
||||
|
@ -15711,6 +15828,16 @@ resolve@^1.20.0:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@npm:*, typescript@npm:^5.0.0, typescript@npm:^5.0.4":
|
||||
version: 5.1.3
|
||||
resolution: "typescript@npm:5.1.3"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: d9d51862d98efa46534f2800a1071a613751b1585dc78884807d0c179bcd93d6e9d4012a508e276742f5f33c480adefc52ffcafaf9e0e00ab641a14cde9a31c7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@npm:^4.9.4":
|
||||
version: 4.9.4
|
||||
resolution: "typescript@npm:4.9.4"
|
||||
|
@ -15721,13 +15848,13 @@ resolve@^1.20.0:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@npm:^5.0.0, typescript@npm:^5.0.4":
|
||||
"typescript@patch:typescript@*#~builtin<compat/typescript>, typescript@patch:typescript@^5.0.0#~builtin<compat/typescript>, typescript@patch:typescript@^5.0.4#~builtin<compat/typescript>":
|
||||
version: 5.1.3
|
||||
resolution: "typescript@npm:5.1.3"
|
||||
resolution: "typescript@patch:typescript@npm%3A5.1.3#~builtin<compat/typescript>::version=5.1.3&hash=ad5954"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: d9d51862d98efa46534f2800a1071a613751b1585dc78884807d0c179bcd93d6e9d4012a508e276742f5f33c480adefc52ffcafaf9e0e00ab641a14cde9a31c7
|
||||
checksum: 32a25b2e128a4616f999d4ee502aabb1525d5647bc8955e6edf05d7fbc53af8aa98252e2f6ba80bcedfc0260c982b885f3c09cfac8bb65d2924f3133ad1e1e62
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -15741,16 +15868,6 @@ resolve@^1.20.0:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript@patch:typescript@^5.0.0#~builtin<compat/typescript>, typescript@patch:typescript@^5.0.4#~builtin<compat/typescript>":
|
||||
version: 5.1.3
|
||||
resolution: "typescript@patch:typescript@npm%3A5.1.3#~builtin<compat/typescript>::version=5.1.3&hash=ad5954"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
checksum: 32a25b2e128a4616f999d4ee502aabb1525d5647bc8955e6edf05d7fbc53af8aa98252e2f6ba80bcedfc0260c982b885f3c09cfac8bb65d2924f3133ad1e1e62
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"uid-safe@npm:2.1.5":
|
||||
version: 2.1.5
|
||||
resolution: "uid-safe@npm:2.1.5"
|
||||
|
|
Loading…
Reference in a new issue