Skip to content

Commit 9868631

Browse files
initial commit
1 parent 93d5d74 commit 9868631

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+15936
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
3+
{
4+
"name": "Development",
5+
"image": "mcr.microsoft.com/devcontainers/typescript-node:latest",
6+
"features": {
7+
"ghcr.io/devcontainers/features/node:1": {}
8+
},
9+
"postCreateCommand": "pnpm install",
10+
"customizations": {
11+
"vscode": {
12+
"extensions": ["esbenp.prettier-vscode"]
13+
}
14+
}
15+
}

.github/workflows/ci.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: CI
2+
on:
3+
push:
4+
branches-ignore:
5+
- 'generated'
6+
- 'codegen/**'
7+
- 'integrated/**'
8+
- 'stl-preview-head/**'
9+
- 'stl-preview-base/**'
10+
pull_request:
11+
branches-ignore:
12+
- 'stl-preview-head/**'
13+
- 'stl-preview-base/**'
14+
15+
jobs:
16+
lint:
17+
timeout-minutes: 10
18+
name: lint
19+
runs-on: ${{ github.repository == 'stainless-sdks/context.dev-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
20+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
21+
steps:
22+
- uses: actions/checkout@v6
23+
24+
- name: Set up Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
29+
- name: Set up pnpm
30+
uses: pnpm/action-setup@v4
31+
with:
32+
version: '10.30.1'
33+
34+
- name: Bootstrap
35+
run: ./scripts/bootstrap
36+
37+
- name: Check types
38+
run: ./scripts/lint
39+
40+
build:
41+
timeout-minutes: 5
42+
name: build
43+
runs-on: ${{ github.repository == 'stainless-sdks/context.dev-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
44+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
45+
permissions:
46+
contents: read
47+
id-token: write
48+
steps:
49+
- uses: actions/checkout@v6
50+
51+
- name: Set up Node
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: '20'
55+
56+
- name: Set up pnpm
57+
uses: pnpm/action-setup@v4
58+
with:
59+
version: '10.30.1'
60+
61+
- name: Bootstrap
62+
run: ./scripts/bootstrap
63+
64+
- name: Check build
65+
run: ./scripts/build
66+
67+
- name: Get GitHub OIDC Token
68+
if: |-
69+
github.repository == 'stainless-sdks/context.dev-typescript' &&
70+
!startsWith(github.ref, 'refs/heads/stl/')
71+
id: github-oidc
72+
uses: actions/github-script@v8
73+
with:
74+
script: core.setOutput('github_token', await core.getIDToken());
75+
76+
- name: Upload tarball
77+
if: |-
78+
github.repository == 'stainless-sdks/context.dev-typescript' &&
79+
!startsWith(github.ref, 'refs/heads/stl/')
80+
env:
81+
URL: https://pkg.stainless.com/s
82+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
83+
SHA: ${{ github.sha }}
84+
run: ./scripts/utils/upload-artifact.sh
85+
test:
86+
timeout-minutes: 10
87+
name: test
88+
runs-on: ${{ github.repository == 'stainless-sdks/context.dev-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
89+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
90+
steps:
91+
- uses: actions/checkout@v6
92+
93+
- name: Set up Node
94+
uses: actions/setup-node@v4
95+
with:
96+
node-version: '20'
97+
98+
- name: Set up pnpm
99+
uses: pnpm/action-setup@v4
100+
with:
101+
version: '10.30.1'
102+
103+
- name: Bootstrap
104+
run: ./scripts/bootstrap
105+
106+
- name: Run tests
107+
run: ./scripts/test

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.prism.log
2+
node_modules
3+
yarn-error.log
4+
codegen.log
5+
Brewfile.lock.json
6+
dist
7+
dist-deno
8+
/*.tgz
9+
.idea/
10+
.eslintcache
11+

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG.md
2+
/ecosystem-tests/*/**
3+
/node_modules
4+
/deno
5+
6+
# don't format tsc output, will break source maps
7+
/dist

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"arrowParens": "always",
3+
"experimentalTernaries": true,
4+
"printWidth": 110,
5+
"singleQuote": true,
6+
"trailingComma": "all"
7+
}

.stats.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
configured_endpoints: 19
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-21652c2d2e6a5aab678ca435ba09ef698ff34270021f349660b84d5d98bf3923.yml
3+
openapi_spec_hash: 356a7298b2abac3fdf72ad5ee046b952
4+
config_hash: 44e5a212e49a8e96ae9ee64e273109d4

Brewfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
brew "node"

CONTRIBUTING.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
## Setting up the environment
2+
3+
This repository uses [`pnpm`](https://pnpm.io/).
4+
Other package managers may work but are not officially supported for development.
5+
6+
To set up the repository, run:
7+
8+
```sh
9+
$ pnpm install
10+
$ pnpm build
11+
```
12+
13+
This will install all the required dependencies and build output files to `dist/`.
14+
15+
## Modifying/Adding code
16+
17+
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
18+
result in merge conflicts between manual patches and changes from the generator. The generator will never
19+
modify the contents of the `src/lib/` and `examples/` directories.
20+
21+
## Adding and running examples
22+
23+
All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.
24+
25+
```ts
26+
// add an example to examples/<your-example>.ts
27+
28+
#!/usr/bin/env -S npm run tsn -T
29+
30+
```
31+
32+
```sh
33+
$ chmod +x examples/<your-example>.ts
34+
# run the example against your api
35+
$ pnpm tsn -T examples/<your-example>.ts
36+
```
37+
38+
## Using the repository from source
39+
40+
If you’d like to use the repository from source, you can either install from git or link to a cloned repository:
41+
42+
To install via git:
43+
44+
```sh
45+
$ npm install git+ssh://git@github.com:stainless-sdks/context.dev-typescript.git
46+
```
47+
48+
Alternatively, to link a local copy of the repo:
49+
50+
```sh
51+
# Clone
52+
$ git clone https://www.github.com/stainless-sdks/context.dev-typescript
53+
$ cd context.dev-typescript
54+
55+
# With yarn
56+
$ yarn link
57+
$ cd ../my-package
58+
$ yarn link context.dev
59+
60+
# With pnpm
61+
$ pnpm link --global
62+
$ cd ../my-package
63+
$ pnpm link --global context.dev
64+
```
65+
66+
## Running tests
67+
68+
```sh
69+
$ pnpm run test
70+
```
71+
72+
## Linting and formatting
73+
74+
This repository uses [prettier](https://www.npmjs.com/package/prettier) and
75+
[eslint](https://www.npmjs.com/package/eslint) to format the code in the repository.
76+
77+
To lint:
78+
79+
```sh
80+
$ pnpm lint
81+
```
82+
83+
To format and fix all lint issues automatically:
84+
85+
```sh
86+
$ pnpm fix
87+
```

0 commit comments

Comments
 (0)