Skip to content

Commit 00b1c15

Browse files
chore: update SDK settings
1 parent ad426ca commit 00b1c15

24 files changed

+94
-46
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: 18
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lemma%2Flemma-584f07ea035720c85ecac56802077189e3ef8e2970d3a7f9ffb75a605df61fef.yml
33
openapi_spec_hash: 941d7b54bafb4c217116dc8fea329900
4-
config_hash: 72ff939dec5dfcab3dc4d166f0718554
4+
config_hash: 3911423d0a218a9e0813f5fe6370ae95

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 @uselemma/api
5959

6060
# With pnpm
6161
$ pnpm link --global
6262
$ cd ../my-package
63-
$ pnpm link -—global lemma
63+
$ pnpm link -—global @uselemma/api
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/@uselemma/api.svg?label=npm%20(stable)>)](https://npmjs.org/package/@uselemma/api) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@uselemma/api)
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 @uselemma/api
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 '@uselemma/api';
2724

2825
const client = new Lemma({
2926
apiKey: process.env['LEMMA_API_KEY'], // This is the default and can be omitted
@@ -38,7 +35,7 @@ This library includes TypeScript definitions for all request params and response
3835

3936
<!-- prettier-ignore -->
4037
```ts
41-
import Lemma from 'lemma';
38+
import Lemma from '@uselemma/api';
4239

4340
const client = new Lemma({
4441
apiKey: process.env['LEMMA_API_KEY'], // This is the default and can be omitted
@@ -60,7 +57,7 @@ Request parameters that correspond to file uploads can be passed in many differe
6057

6158
```ts
6259
import fs from 'fs';
63-
import Lemma, { toFile } from 'lemma';
60+
import Lemma, { toFile } from '@uselemma/api';
6461

6562
const client = new Lemma();
6663

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

191188
```ts
192-
import Lemma from 'lemma';
189+
import Lemma from '@uselemma/api';
193190

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

219216
```ts
220-
import Lemma from 'lemma';
217+
import Lemma from '@uselemma/api';
221218
import pino from 'pino';
222219

223220
const logger = pino();
@@ -286,7 +283,7 @@ globalThis.fetch = fetch;
286283
Or pass it to the client:
287284

288285
```ts
289-
import Lemma from 'lemma';
286+
import Lemma from '@uselemma/api';
290287
import fetch from 'my-fetch';
291288

292289
const client = new Lemma({ fetch });
@@ -297,7 +294,7 @@ const client = new Lemma({ fetch });
297294
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.)
298295

299296
```ts
300-
import Lemma from 'lemma';
297+
import Lemma from '@uselemma/api';
301298

302299
const client = new Lemma({
303300
fetchOptions: {
@@ -314,7 +311,7 @@ options to requests:
314311
<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>
315312

316313
```ts
317-
import Lemma from 'lemma';
314+
import Lemma from '@uselemma/api';
318315
import * as undici from 'undici';
319316

320317
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
@@ -328,7 +325,7 @@ const client = new Lemma({
328325
<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>
329326

330327
```ts
331-
import Lemma from 'lemma';
328+
import Lemma from '@uselemma/api';
332329

333330
const client = new Lemma({
334331
fetchOptions: {
@@ -340,7 +337,7 @@ const client = new Lemma({
340337
<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>
341338

342339
```ts
343-
import Lemma from 'npm:lemma';
340+
import Lemma from 'npm:@uselemma/api';
344341

345342
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
346343
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: '^@uselemma/api(/.*)?',
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+
'^@uselemma/api$': '<rootDir>/src/index.ts',
11+
'^@uselemma/api/(.*)$': '<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": "@uselemma/api",
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 `"@uselemma/api/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("@uselemma/api")')
46+
(cd dist && node -e 'import("@uselemma/api")' --input-type=module)
4747

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

0 commit comments

Comments
 (0)