Skip to content

Commit 536ac09

Browse files
chore: update SDK settings
1 parent 9040d22 commit 536ac09

31 files changed

+101
-53
lines changed

.github/workflows/publish-npm.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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/uselemma/sdk-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@v4
18+
19+
- name: Set up Node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '20'
23+
24+
- name: Install dependencies
25+
run: |
26+
yarn install
27+
28+
- name: Publish to NPM
29+
run: |
30+
bash ./bin/publish-npm
31+
env:
32+
NPM_TOKEN: ${{ secrets.LEMMA_NPM_TOKEN || secrets.NPM_TOKEN }}

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21+
NPM_TOKEN: ${{ secrets.LEMMA_NPM_TOKEN || secrets.NPM_TOKEN }}
2122

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 49
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lemma%2Flemma-dc1b1744bf9a13daa82065ecf5dc75e3870d611ab3fabf2b0f91a7b36815b2a4.yml
33
openapi_spec_hash: ae1eb47bf32f7b2c225338a245298e02
4-
config_hash: 007eb8f554a4ea9f6c7d98488fb3a849
4+
config_hash: 4a6c48034b76c35207964d66524a0a15

CONTRIBUTING.md

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

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

6666
## Running tests
@@ -91,3 +91,17 @@ To format and fix all lint issues automatically:
9191
```sh
9292
$ yarn 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/uselemma/sdk-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: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Lemma TypeScript API Library
22

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

55
This library provides convenient access to the Lemma 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:uselemma/sdk-typescript.git
14+
npm install lemma-node
1515
```
1616

17-
> [!NOTE]
18-
> Once this package is [published to npm](https://www.stainless.com/docs/guides/publish), this will become: `npm install lemma`
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 Lemma from 'lemma';
23+
import Lemma from 'lemma-node';
2724

2825
const client = new Lemma({
2926
bearerToken: process.env['LEMMA_BEARER_TOKEN'], // This is the default and can be omitted
@@ -40,7 +37,7 @@ This library includes TypeScript definitions for all request params and response
4037

4138
<!-- prettier-ignore -->
4239
```ts
43-
import Lemma from 'lemma';
40+
import Lemma from 'lemma-node';
4441

4542
const client = new Lemma({
4643
bearerToken: process.env['LEMMA_BEARER_TOKEN'], // This is the default and can be omitted
@@ -63,7 +60,7 @@ Request parameters that correspond to file uploads can be passed in many differe
6360

6461
```ts
6562
import fs from 'fs';
66-
import Lemma, { toFile } from 'lemma';
63+
import Lemma, { toFile } from 'lemma-node';
6764

6865
const client = new Lemma();
6966

@@ -192,7 +189,7 @@ The log level can be configured in two ways:
192189
2. Using the `logLevel` client option (overrides the environment variable if set)
193190

194191
```ts
195-
import Lemma from 'lemma';
192+
import Lemma from 'lemma-node';
196193

197194
const client = new Lemma({
198195
logLevel: 'debug', // Show all log messages
@@ -220,7 +217,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
220217
below the configured level will not be sent to your logger.
221218

222219
```ts
223-
import Lemma from 'lemma';
220+
import Lemma from 'lemma-node';
224221
import pino from 'pino';
225222

226223
const logger = pino();
@@ -289,7 +286,7 @@ globalThis.fetch = fetch;
289286
Or pass it to the client:
290287

291288
```ts
292-
import Lemma from 'lemma';
289+
import Lemma from 'lemma-node';
293290
import fetch from 'my-fetch';
294291

295292
const client = new Lemma({ fetch });
@@ -300,7 +297,7 @@ const client = new Lemma({ fetch });
300297
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.)
301298

302299
```ts
303-
import Lemma from 'lemma';
300+
import Lemma from 'lemma-node';
304301

305302
const client = new Lemma({
306303
fetchOptions: {
@@ -317,7 +314,7 @@ options to requests:
317314
<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>
318315

319316
```ts
320-
import Lemma from 'lemma';
317+
import Lemma from 'lemma-node';
321318
import * as undici from 'undici';
322319

323320
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
@@ -331,7 +328,7 @@ const client = new Lemma({
331328
<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>
332329

333330
```ts
334-
import Lemma from 'lemma';
331+
import Lemma from 'lemma-node';
335332

336333
const client = new Lemma({
337334
fetchOptions: {
@@ -343,7 +340,7 @@ const client = new Lemma({
343340
<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>
344341

345342
```ts
346-
import Lemma from 'npm:lemma';
343+
import Lemma from 'npm:lemma-node';
347344

348345
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
349346
const client = new Lemma({

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: '^lemma(/.*)?',
28+
regex: '^lemma-node(/.*)?',
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-
'^lemma$': '<rootDir>/src/index.ts',
11-
'^lemma/(.*)$': '<rootDir>/src/$1',
10+
'^lemma-node$': '<rootDir>/src/index.ts',
11+
'^lemma-node/(.*)$': '<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": "lemma",
2+
"name": "lemma-node",
33
"version": "0.0.1",
44
"description": "The official TypeScript library for the Lemma API",
55
"author": "Lemma <>",

scripts/build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ node scripts/utils/check-version.cjs
88

99
# Build into dist and will publish the package from there,
1010
# so that src/resources/foo.ts becomes <package root>/resources/foo.js
11-
# This way importing from `"lemma/resources/foo"` works
11+
# This way importing from `"lemma-node/resources/foo"` works
1212
# even with `"moduleResolution": "node"`
1313

1414
rm -rf dist; mkdir dist
@@ -42,8 +42,8 @@ node scripts/utils/postprocess-files.cjs
4242

4343
# make sure that nothing crashes when we require the output CJS or
4444
# import the output ESM
45-
(cd dist && node -e 'require("lemma")')
46-
(cd dist && node -e 'import("lemma")' --input-type=module)
45+
(cd dist && node -e 'require("lemma-node")')
46+
(cd dist && node -e 'import("lemma-node")' --input-type=module)
4747

4848
if [ -e ./scripts/build-deno ]
4949
then

0 commit comments

Comments
 (0)