cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v3.0.0-beta.6

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

CONTRIBUTING.md

107lines · modecode

1## Setting up the environment
2
3This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable).
4Other package managers may work but are not officially supported for development.
5
6To set up the repository, run:
7
8```bash
9yarn
10yarn build
11```
12
13This will install all the required dependencies and build output files to `dist/`.
14
15## Modifying/Adding code
16
17Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
18`src/lib/` and `examples/` directories are exceptions and will never be overridden.
19
20## Adding and running examples
21
22All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or
23added to.
24
25```bash
26// add an example to examples/<your-example>.ts
27
28#!/usr/bin/env -S npm run tsn -T
29
30```
31
32```
33chmod +x examples/<your-example>.ts
34# run the example against your api
35yarn tsn -T examples/<your-example>.ts
36```
37
38## Using the repository from source
39
40If you’d like to use the repository from source, you can either install from git or link to a cloned repository:
41
42To install via git:
43
44```bash
45npm install git+ssh://git@github.com:cloudflare/cloudflare-typescript.git
46```
47
48Alternatively, to link a local copy of the repo:
49
50```bash
51# Clone
52git clone https://www.github.com/cloudflare/cloudflare-typescript
53cd cloudflare-typescript
54
55# With yarn
56yarn link
57cd ../my-package
58yarn link cloudflare
59
60# With pnpm
61pnpm link --global
62cd ../my-package
63pnpm link -—global cloudflare
64```
65
66## Running tests
67
68Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
69
70```bash
71npx prism path/to/your/openapi.yml
72```
73
74```bash
75yarn run test
76```
77
78## Linting and formatting
79
80This repository uses [prettier](https://www.npmjs.com/package/prettier) and
81[eslint](https://www.npmjs.com/package/eslint) to format the code in the repository.
82
83To lint:
84
85```bash
86yarn lint
87```
88
89To format and fix all lint issues automatically:
90
91```bash
92yarn fix
93```
94
95## Publishing and releases
96
97Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
98the changes aren't made through the automated pipeline, you may want to make releases manually.
99
100### Publish with a GitHub workflow
101
102You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/cloudflare/cloudflare-typescript/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
103
104### Publish manually
105
106If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
107the environment.
108