Skip to content

Commit

Permalink
chore(python): introduce typescript generators for pydantic + fastapi (
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi authored Nov 2, 2024
1 parent cc4cad7 commit 5333551
Show file tree
Hide file tree
Showing 44 changed files with 227 additions and 126 deletions.
1 change: 0 additions & 1 deletion generators/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"vitest": "^2.0.5",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
Expand Down
15 changes: 15 additions & 0 deletions generators/python-v2/fastapi/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ignores": [
"@types/jest",
"globals",
"globals",
"@types/node",
"esbuild",
"@yarnpkg/esbuild-plugin-pnp",
"@fern-fern/ir-sdk"
],
"ignore-patterns": [
"lib",
"dist"
]
}
1 change: 1 addition & 0 deletions generators/python-v2/fastapi/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../../../.prettierrc.json");
3 changes: 3 additions & 0 deletions generators/python-v2/fastapi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM node:18.1.0-alpine
COPY generators/python-v2/fastapi/dist /dist
ENTRYPOINT ["node", "/dist/cli.cjs"]
44 changes: 44 additions & 0 deletions generators/python-v2/fastapi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@fern-api/python-fastapi",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "https://github.com/fern-api/fern.git",
"directory": "generators/csharp/sdk"
},
"files": [
"lib"
],
"type": "module",
"source": "src/index.ts",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"sideEffects": false,
"scripts": {
"clean": "rm -rf ./lib && tsc --build --clean",
"compile": "tsc --build",
"test": "vitest --passWithNoTests --run",
"test:update": "vitest --passWithNoTests --run -u",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../../.eslintignore",
"lint:eslint:fix": "yarn lint:eslint --fix",
"format": "prettier --write --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"format:check": "prettier --check --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"organize-imports": "organize-imports-cli tsconfig.json",
"depcheck": "depcheck",
"dist:cli": "pnpm compile && tsup ./src/cli.ts --format cjs",
"publish:cli": "pnpm dist:cli && cd dist && yarn npm publish",
"dockerTagLatest": "pnpm dist:cli && docker build -f ./Dockerfile -t fernapi/fern-fastapi-server-v2:latest ../../.."
},
"devDependencies": {
"@types/node": "18.7.18",
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.14",
"depcheck": "^1.4.6",
"esbuild": "^0.24.0",
"eslint": "^8.56.0",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"tsup": "^8.0.2",
"typescript": "4.6.4",
"vitest": "^2.0.5"
}
}
6 changes: 6 additions & 0 deletions generators/python-v2/fastapi/src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void runCli();

export async function runCli(): Promise<void> {
// eslint-disable-next-line no-console
console.log("Noop...");
}
11 changes: 11 additions & 0 deletions generators/python-v2/fastapi/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib", "rootDir": "src" },
"include": ["./src/**/*"],
"references": [
{ "path": "../../../packages/commons/core-utils" },
{ "path": "../../../packages/commons/fs-utils" },
{ "path": "../../commons" },
{ "path": "../codegen" }
]
}
15 changes: 15 additions & 0 deletions generators/python-v2/pydantic-model/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ignores": [
"@types/jest",
"globals",
"globals",
"@types/node",
"esbuild",
"@yarnpkg/esbuild-plugin-pnp",
"@fern-fern/ir-sdk"
],
"ignore-patterns": [
"lib",
"dist"
]
}
1 change: 1 addition & 0 deletions generators/python-v2/pydantic-model/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("../../../.prettierrc.json");
3 changes: 3 additions & 0 deletions generators/python-v2/pydantic-model/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM node:18.1.0-alpine
COPY generators/python-v2/pydantic-model/dist /dist
ENTRYPOINT ["node", "/dist/cli.cjs"]
44 changes: 44 additions & 0 deletions generators/python-v2/pydantic-model/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@fern-api/fern-pydantic-model",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "https://github.com/fern-api/fern.git",
"directory": "generators/csharp/sdk"
},
"files": [
"lib"
],
"type": "module",
"source": "src/index.ts",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"sideEffects": false,
"scripts": {
"clean": "rm -rf ./lib && tsc --build --clean",
"compile": "tsc --build",
"test": "vitest --passWithNoTests --run",
"test:update": "vitest --passWithNoTests --run -u",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../../.eslintignore",
"lint:eslint:fix": "yarn lint:eslint --fix",
"format": "prettier --write --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"format:check": "prettier --check --ignore-unknown --ignore-path ../../../shared/.prettierignore \"**\"",
"organize-imports": "organize-imports-cli tsconfig.json",
"depcheck": "depcheck",
"dist:cli": "pnpm compile && tsup ./src/cli.ts --format cjs",
"publish:cli": "pnpm dist:cli && cd dist && yarn npm publish",
"dockerTagLatest": "pnpm dist:cli && docker build -f ./Dockerfile -t fernapi/fern-pydantic-model-v2:latest ../../.."
},
"devDependencies": {
"@types/node": "18.7.18",
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.14",
"depcheck": "^1.4.6",
"esbuild": "^0.24.0",
"eslint": "^8.56.0",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"tsup": "^8.0.2",
"typescript": "4.6.4",
"vitest": "^2.0.5"
}
}
6 changes: 6 additions & 0 deletions generators/python-v2/pydantic-model/src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void runCli();

export async function runCli(): Promise<void> {
// eslint-disable-next-line no-console
console.log("Noop...");
}
11 changes: 11 additions & 0 deletions generators/python-v2/pydantic-model/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib", "rootDir": "src" },
"include": ["./src/**/*"],
"references": [
{ "path": "../../../packages/commons/core-utils" },
{ "path": "../../../packages/commons/fs-utils" },
{ "path": "../../commons" },
{ "path": "../codegen" }
]
}
2 changes: 0 additions & 2 deletions generators/typescript/sdk/generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
"@types/url-join": "4.0.1",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"vitest": "^2.0.5",
"jest-specific-snapshot": "^8.0.0",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/api-importers/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"devDependencies": {
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@types/js-yaml": "^4.0.8",
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"@types/swagger2openapi": "^7.0.4",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/docs-importers/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/docs-importers/mintlify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/docs-markdown-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"depcheck": "^1.4.6",
"diff": "^5.2.0",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/docs-preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"@types/xml2js": "^0.4.14",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/docs-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/dynamic-snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"typescript": "4.6.4",
"vitest": "^2.0.5"
Expand Down
1 change: 0 additions & 1 deletion packages/cli/ete-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"form-data": "4.0.0",
"globals": "link:@types/vitest/globals",
"vitest": "^2.0.5",
"jest-environment-jsdom": "^29.7.0",
"organize-imports-cli": "^0.10.0",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/fern-definition/formatter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@types/prettier": "^2.7.1",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/fern-definition/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"vitest": "^2.0.5",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/fern-definition/validator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"vitest": "^2.0.5",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/generation/ir-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"@types/url-join": "4.0.1",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"typescript": "4.6.4",
"vitest": "^2.0.5"
Expand Down
1 change: 0 additions & 1 deletion packages/cli/generation/ir-migrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"@types/terminal-link": "^1.2.0",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"lodash-es": "^4.17.21",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/lazy-fern-workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@types/tar": "^6.1.11",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"vitest": "^2.0.5",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/mock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@
"@types/url-join": "4.0.1",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
"vitest": "^2.0.5"
}
}
}
1 change: 0 additions & 1 deletion packages/cli/register/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
"typescript": "4.6.4",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/workspace-commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"vitest": "^2.0.5",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/workspace-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@types/node": "18.7.18",
"depcheck": "^1.4.6",
"eslint": "^8.56.0",
"globals": "link:@types/vitest/globals",
"vitest": "^2.0.5",
"organize-imports-cli": "^0.10.0",
"prettier": "^2.7.1",
Expand Down
Loading

0 comments on commit 5333551

Please sign in to comment.