mirror of
https://github.com/openai/codex.git
synced 2025-12-03 18:35:00 +00:00
TypeScript SDK scaffold (#4455)
This commit is contained in:
@@ -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
|
||||
|
||||
1
.github/workflows/codespell.yml
vendored
1
.github/workflows/codespell.yml
vendored
@@ -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
4436
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
packages:
|
||||
- docs
|
||||
- sdk/typescript
|
||||
|
||||
ignoredBuiltDependencies:
|
||||
- esbuild
|
||||
|
||||
40
sdk/typescript/.eslintrc.json
Normal file
40
sdk/typescript/.eslintrc.json
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
3
sdk/typescript/.prettierignore
Normal file
3
sdk/typescript/.prettierignore
Normal file
@@ -0,0 +1,3 @@
|
||||
dist
|
||||
node_modules
|
||||
coverage
|
||||
5
sdk/typescript/.prettierrc
Normal file
5
sdk/typescript/.prettierrc
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
56
sdk/typescript/package.json
Normal file
56
sdk/typescript/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
4
sdk/typescript/src/index.ts
Normal file
4
sdk/typescript/src/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class Codex {
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
9
sdk/typescript/tests/index.test.ts
Normal file
9
sdk/typescript/tests/index.test.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
22
sdk/typescript/tsconfig.json
Normal file
22
sdk/typescript/tsconfig.json
Normal 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"]
|
||||
}
|
||||
12
sdk/typescript/tsup.config.ts
Normal file
12
sdk/typescript/tsup.config.ts
Normal 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,
|
||||
});
|
||||
11
sdk/typescript/vitest.config.ts
Normal file
11
sdk/typescript/vitest.config.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { defineConfig } from "vitest/config";
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
coverage: {
|
||||
provider: "v8",
|
||||
reporter: ["text", "lcov"],
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user