Skip to content

Commit 9ed145e

Browse files
committed
Move
1 parent f0bfd49 commit 9ed145e

File tree

14 files changed

+1574
-1024
lines changed

14 files changed

+1574
-1024
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
dist
2+
dist
3+
yarn-error.log

package/.npmrc renamed to .npmrc

File renamed without changes.
File renamed without changes.
File renamed without changes.

example-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"serve": "vite preview"
1010
},
1111
"dependencies": {
12-
"create-typed-sdk": "link:../package"
12+
"create-typed-sdk": "link:.."
1313
},
1414
"devDependencies": {
1515
"@types/express": "4.17.13",

example-app/server.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { api } from "./server-api";
2-
import { collectEndpoints } from "create-typed-sdk/core";
2+
import { attachApiToAppWithDefault } from "create-typed-sdk/core";
33
import fastify from "fastify";
44
import cors from "fastify-cors";
55

@@ -9,15 +9,7 @@ app.register(cors, {
99
origin: "*",
1010
});
1111

12-
collectEndpoints(api).forEach(({ fn, path }) => {
13-
app.post<{ Body: { argument: any } }>(
14-
"/" + path.join("/"),
15-
async (req, resp) => {
16-
const val = await fn(req.body.argument);
17-
resp.send(val);
18-
}
19-
);
20-
});
12+
attachApiToAppWithDefault(api, app);
2113

2214
(async () => {
2315
try {

example-app/yarn.lock

Lines changed: 1497 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,56 @@
11
{
2-
"name": "root",
3-
"private": true,
4-
"workspaces": [
5-
"package",
6-
"example-app"
2+
"name": "create-typed-sdk",
3+
"version": "0.0.3",
4+
"description": "A library for quickly created SDKs for your Node.js Typescript backends. No build step, no risk of injecting your server code into your frontend, just sweet, sweet DX goodness.",
5+
"main": "./dist/cjs/reactSDK.js",
6+
"module": "./dist/esm/reactSDK.js",
7+
"types": "./dist/esm/reactSDK.d.ts",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/scottmas/create-typed-sdk.git"
11+
},
12+
"homepage": "https://github.com/scottmas/create-typed-sdk",
13+
"author": "scottmas",
14+
"license": "ISC",
15+
"files": [
16+
"src",
17+
"dist",
18+
"core"
719
],
8-
"description": "Monorepo root package.json. Only used because peer dependencies DO NOT play nicely with linking, which we use in the example app.",
920
"scripts": {
10-
"build": "yarn --cwd ./package build",
1121
"dev": "run-p dev:*",
12-
"dev:package": "yarn --cwd ./package dev",
13-
"dev:example": "yarn --cwd ./example-app dev",
14-
"publish-to-npm": "(cd package && np patch)"
22+
"dev:lib": "yarn build && run-p -l 'build:* --watch'",
23+
"dev:example": "cd example-app && yarn dev",
24+
"postinstall": "cd example-app && yarn",
25+
"test": "echo no-tests",
26+
"build": "run-p build:*",
27+
"build:cjs": "node build.mjs --format cjs --outdir dist/cjs --platform node",
28+
"build:esm": "node build.mjs --format esm --outdir dist/esm --platform browser",
29+
"build:cjs-ts": "tsc --outDir dist/cjs",
30+
"build:esm-ts": "tsc --outDir dist/esm"
31+
},
32+
"devDependencies": {
33+
"@typescript-eslint/eslint-plugin": "5.4.0",
34+
"@typescript-eslint/parser": "5.4.0",
35+
"esbuild": "0.13.15",
36+
"eslint": "8.3.0",
37+
"eslint-plugin-react-hooks": "4.3.0",
38+
"np": "7.6.0",
39+
"npm-run-all": "4.1.5",
40+
"react-query": "3.34.7",
41+
"typescript": "4.5.2",
42+
"yargs-parser": "21.0.0"
1543
},
1644
"dependencies": {
17-
"np": "^7.6.0",
18-
"npm-run-all": "^4.1.5"
45+
"axios": "0.24.0",
46+
"fast-safe-stringify": "2.1.1"
47+
},
48+
"peerDependencies": {
49+
"react-query": "*"
50+
},
51+
"peerDependenciesMeta": {
52+
"react-query": {
53+
"optional": true
54+
}
1955
}
2056
}

package/package.json

Lines changed: 0 additions & 51 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)