Skip to content

Commit 7e0f5e5

Browse files
chore: update SDK settings
1 parent a380082 commit 7e0f5e5

26 files changed

Lines changed: 99 additions & 47 deletions

.github/workflows/publish-npm.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to NPM in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/sentdm/sent-dm-typescript/actions/workflows/publish-npm.yml
4+
name: Publish NPM
5+
on:
6+
workflow_dispatch:
7+
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
publish:
13+
name: publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v6
18+
19+
- name: Set up Node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '20'
23+
24+
- name: Set up pnpm
25+
uses: pnpm/action-setup@v4
26+
27+
- name: Install dependencies
28+
run: |
29+
pnpm install
30+
31+
- name: Publish to NPM
32+
run: |
33+
bash ./bin/publish-npm
34+
env:
35+
NPM_TOKEN: ${{ secrets.SENT_DM_NPM_TOKEN || secrets.NPM_TOKEN }}

.github/workflows/release-doctor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ jobs:
1717
- name: Check release environment
1818
run: |
1919
bash ./bin/check-release-environment
20+
env:
21+
NPM_TOKEN: ${{ secrets.SENT_DM_NPM_TOKEN || secrets.NPM_TOKEN }}
2022

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 19
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sent%2Fsent-dm-67fa00cfa520b681534cdcfc26f133783e4c796b1dbc5bd18b91daf4e7c8a3f2.yml
33
openapi_spec_hash: 23cf4045a307cd8ebae6c6162a7f4902
4-
config_hash: d39935e88fd43becb8680e5e543f6f29
4+
config_hash: d4dca0d79cdc2d51014761274600b34f

CONTRIBUTING.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ $ cd sent-dm-typescript
5555
# With yarn
5656
$ yarn link
5757
$ cd ../my-package
58-
$ yarn link sent-dm
58+
$ yarn link sentdm
5959

6060
# With pnpm
6161
$ pnpm link --global
6262
$ cd ../my-package
63-
$ pnpm link -—global sent-dm
63+
$ pnpm link -—global sentdm
6464
```
6565

6666
## Running tests
@@ -91,3 +91,17 @@ To format and fix all lint issues automatically:
9191
```sh
9292
$ pnpm fix
9393
```
94+
95+
## Publishing and releases
96+
97+
Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
98+
the changes aren't made through the automated pipeline, you may want to make releases manually.
99+
100+
### Publish with a GitHub workflow
101+
102+
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/sentdm/sent-dm-typescript/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
103+
104+
### Publish manually
105+
106+
If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
107+
the environment.

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sent Dm TypeScript API Library
22

3-
[![NPM version](<https://img.shields.io/npm/v/sent-dm.svg?label=npm%20(stable)>)](https://npmjs.org/package/sent-dm) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/sent-dm)
3+
[![NPM version](<https://img.shields.io/npm/v/sentdm.svg?label=npm%20(stable)>)](https://npmjs.org/package/sentdm) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/sentdm)
44

55
This library provides convenient access to the Sent Dm REST API from server-side TypeScript or JavaScript.
66

@@ -11,19 +11,16 @@ It is generated with [Stainless](https://www.stainless.com/).
1111
## Installation
1212

1313
```sh
14-
npm install git+ssh://git@github.com:sentdm/sent-dm-typescript.git
14+
npm install sentdm
1515
```
1616

17-
> [!NOTE]
18-
> Once this package is [published to npm](https://www.stainless.com/docs/guides/publish), this will become: `npm install sent-dm`
19-
2017
## Usage
2118

2219
The full API of this library can be found in [api.md](api.md).
2320

2421
<!-- prettier-ignore -->
2522
```js
26-
import SentDm from 'sent-dm';
23+
import SentDm from 'sentdm';
2724

2825
const client = new SentDm({
2926
apiKey: process.env['SENT_DM_API_KEY'], // This is the default and can be omitted
@@ -42,7 +39,7 @@ This library includes TypeScript definitions for all request params and response
4239

4340
<!-- prettier-ignore -->
4441
```ts
45-
import SentDm from 'sent-dm';
42+
import SentDm from 'sentdm';
4643

4744
const client = new SentDm({
4845
apiKey: process.env['SENT_DM_API_KEY'], // This is the default and can be omitted
@@ -175,7 +172,7 @@ The log level can be configured in two ways:
175172
2. Using the `logLevel` client option (overrides the environment variable if set)
176173

177174
```ts
178-
import SentDm from 'sent-dm';
175+
import SentDm from 'sentdm';
179176

180177
const client = new SentDm({
181178
logLevel: 'debug', // Show all log messages
@@ -203,7 +200,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
203200
below the configured level will not be sent to your logger.
204201

205202
```ts
206-
import SentDm from 'sent-dm';
203+
import SentDm from 'sentdm';
207204
import pino from 'pino';
208205

209206
const logger = pino();
@@ -272,7 +269,7 @@ globalThis.fetch = fetch;
272269
Or pass it to the client:
273270

274271
```ts
275-
import SentDm from 'sent-dm';
272+
import SentDm from 'sentdm';
276273
import fetch from 'my-fetch';
277274

278275
const client = new SentDm({ fetch });
@@ -283,7 +280,7 @@ const client = new SentDm({ fetch });
283280
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
284281

285282
```ts
286-
import SentDm from 'sent-dm';
283+
import SentDm from 'sentdm';
287284

288285
const client = new SentDm({
289286
fetchOptions: {
@@ -300,7 +297,7 @@ options to requests:
300297
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
301298

302299
```ts
303-
import SentDm from 'sent-dm';
300+
import SentDm from 'sentdm';
304301
import * as undici from 'undici';
305302

306303
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
@@ -314,7 +311,7 @@ const client = new SentDm({
314311
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
315312

316313
```ts
317-
import SentDm from 'sent-dm';
314+
import SentDm from 'sentdm';
318315

319316
const client = new SentDm({
320317
fetchOptions: {
@@ -326,7 +323,7 @@ const client = new SentDm({
326323
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
327324

328325
```ts
329-
import SentDm from 'npm:sent-dm';
326+
import SentDm from 'npm:sentdm';
330327

331328
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
332329
const client = new SentDm({

bin/check-release-environment

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
errors=()
44

5+
if [ -z "${NPM_TOKEN}" ]; then
6+
errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
7+
fi
8+
59
lenErrors=${#errors[@]}
610

711
if [[ lenErrors -gt 0 ]]; then

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default tseslint.config(
2525
{
2626
patterns: [
2727
{
28-
regex: '^sent-dm(/.*)?',
28+
regex: '^sentdm(/.*)?',
2929
message: 'Use a relative import, not a package import.',
3030
},
3131
],

jest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const config: JestConfigWithTsJest = {
77
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
88
},
99
moduleNameMapper: {
10-
'^sent-dm$': '<rootDir>/src/index.ts',
11-
'^sent-dm/(.*)$': '<rootDir>/src/$1',
10+
'^sentdm$': '<rootDir>/src/index.ts',
11+
'^sentdm/(.*)$': '<rootDir>/src/$1',
1212
},
1313
modulePathIgnorePatterns: [
1414
'<rootDir>/ecosystem-tests/',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "sent-dm",
2+
"name": "sentdm",
33
"version": "0.0.2",
44
"description": "The official TypeScript library for the Sent Dm API",
55
"author": "Sent Dm <>",

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ onlyBuiltDependencies:
22
- '@swc/core'
33
minimumReleaseAge: 1440
44
minimumReleaseAgeExclude:
5-
- sent-dm
5+
- sentdm

0 commit comments

Comments
 (0)