TypeScript SDK scaffold (#4455)

This commit is contained in:
pakrym-oai
2025-09-29 13:27:13 -07:00
committed by GitHub
parent 83a4d4d8ed
commit adbc38a978
13 changed files with 4600 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git*,vendor,*-lock.yaml,*.lock,.codespellrc,*test.ts,*.jsonl
skip = .git*,vendor,*-lock.yaml,*.lock,.codespellrc,*test.ts,*.jsonl,frame*.txt
check-hidden = true
ignore-regex = ^\s*"image/\S+": ".*|\b(afterAll)\b
ignore-words-list = ratatui,ser

View File

@@ -25,4 +25,3 @@ jobs:
uses: codespell-project/actions-codespell@406322ec52dd7b488e48c1c4b82e2a8b3a1bf630 # v2.1
with:
ignore_words_file: .codespellignore
skip: frame*.txt

4436
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
packages:
- docs
- sdk/typescript
ignoredBuiltDependencies:
- esbuild

View File

@@ -0,0 +1,40 @@
{
"root": true,
"env": {
"node": true,
"es2022": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "import"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier"
],
"settings": {
"import/resolver": {
"typescript": {}
}
},
"rules": {
"import/order": [
"error",
{
"newlines-between": "always",
"alphabetize": { "order": "asc", "caseInsensitive": true }
}
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": "allow-with-description"
}
]
}
}

View File

@@ -0,0 +1,3 @@
dist
node_modules
coverage

View File

@@ -0,0 +1,5 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}

View File

@@ -0,0 +1,56 @@
{
"name": "@openai/codex-sdk",
"version": "0.0.0-dev",
"description": "TypeScript SDK for Codex APIs.",
"keywords": [
"openai",
"codex",
"sdk",
"typescript",
"api"
],
"license": "Apache-2.0",
"type": "module",
"engines": {
"node": ">=18"
},
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"files": [
"dist"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"build": "tsup",
"build:watch": "tsup --watch",
"lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\"",
"lint:fix": "pnpm run lint -- --fix",
"test": "vitest run",
"test:watch": "vitest watch",
"coverage": "vitest run --coverage",
"format": "prettier --check .",
"format:fix": "prettier --write .",
"prepare": "pnpm run build"
},
"devDependencies": {
"@types/node": "^20.19.18",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitest/coverage-v8": "^1.6.1",
"eslint": "^9.36.0",
"eslint-config-prettier": "^9.1.2",
"eslint-import-resolver-typescript": "^3.10.1",
"eslint-plugin-import": "^2.32.0",
"prettier": "^3.6.2",
"tsup": "^8.5.0",
"typescript": "^5.9.2",
"vitest": "^1.6.1"
}
}

View File

@@ -0,0 +1,4 @@
export class Codex {
constructor() {
}
}

View File

@@ -0,0 +1,9 @@
import { describe, expect, it } from "vitest";
import { Codex } from "../src/index.js";
describe("Codex", () => {
it("exposes the placeholder API", () => {
const client = new Codex();
});
});

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"lib": ["ES2022"],
"types": ["node", "vitest"],
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"outDir": "dist"
},
"include": ["src", "tests", "vitest.config.ts", "tsup.config.ts"],
"exclude": ["dist", "node_modules"]
}

View File

@@ -0,0 +1,12 @@
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
format: ["esm"],
dts: true,
sourcemap: true,
clean: true,
minify: false,
target: "node18",
shims: false,
});

View File

@@ -0,0 +1,11 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
globals: true,
coverage: {
provider: "v8",
reporter: ["text", "lcov"],
},
},
});