Skip to content

Commit a90819e

Browse files
authored
Merge pull request #4 from sentdm/release-please--branches--main--changes--next--components--node
release: 0.1.0-alpha.1
2 parents e1371cc + 974d444 commit a90819e

38 files changed

+254
-93
lines changed

.github/workflows/publish-npm.yml

+32
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/sentdm/sent-node/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: '18'
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.SENT_NPM_TOKEN || secrets.NPM_TOKEN }}

.github/workflows/release-doctor.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release Doctor
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
jobs:
9+
release_doctor:
10+
name: release doctor
11+
runs-on: ubuntu-latest
12+
if: github.repository == 'sentdm/sent-node' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Check release environment
18+
run: |
19+
bash ./bin/check-release-environment
20+
env:
21+
NPM_TOKEN: ${{ secrets.SENT_NPM_TOKEN || secrets.NPM_TOKEN }}
22+

.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.0-alpha.1"
3+
}

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
## 0.1.0-alpha.1 (2024-10-31)
4+
5+
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/sentdm/sent-node/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
6+
7+
### Features
8+
9+
* **api:** update via SDK Studio ([e1371cc](https://github.com/sentdm/sent-node/commit/e1371cc5662176feb85abd05b4a2a37e3aaa0960))
10+
* **api:** update via SDK Studio ([28ff778](https://github.com/sentdm/sent-node/commit/28ff77860ad89c13f096c3c3d2007dce1f9bac65))
11+
12+
13+
### Chores
14+
15+
* go live ([#1](https://github.com/sentdm/sent-node/issues/1)) ([9e7d1ac](https://github.com/sentdm/sent-node/commit/9e7d1ac28875aca0edda778691dfb9657669603c))
16+
* update SDK settings ([#3](https://github.com/sentdm/sent-node/issues/3)) ([637e824](https://github.com/sentdm/sent-node/commit/637e82433f081d79e7d8172aa8901731eec5a050))

CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,25 @@ If you’d like to use the repository from source, you can either install from g
4242
To install via git:
4343

4444
```sh
45-
$ npm install git+ssh://[email protected]:stainless-sdks/sent-node.git
45+
$ npm install git+ssh://[email protected]:sentdm/sent-node.git
4646
```
4747

4848
Alternatively, to link a local copy of the repo:
4949

5050
```sh
5151
# Clone
52-
$ git clone https://www.github.com/stainless-sdks/sent-node
52+
$ git clone https://www.github.com/sentdm/sent-node
5353
$ cd sent-node
5454

5555
# With yarn
5656
$ yarn link
5757
$ cd ../my-package
58-
$ yarn link sent
58+
$ yarn link @sent/node
5959

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

6666
## Running tests
@@ -99,7 +99,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
9999

100100
### Publish with a GitHub workflow
101101

102-
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/stainless-sdks/sent-node/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
102+
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/sentdm/sent-node/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
103103

104104
### Publish manually
105105

README.md

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sent Node API Library
22

3-
[![NPM version](https://img.shields.io/npm/v/sent.svg)](https://npmjs.org/package/sent) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/sent)
3+
[![NPM version](https://img.shields.io/npm/v/@sent/node.svg)](https://npmjs.org/package/@sent/node) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@sent/node)
44

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

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

1313
```sh
14-
npm install git+ssh://[email protected]:stainless-sdks/sent-node.git
14+
npm install @sent/node
1515
```
1616

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

2825
const client = new Sent();
2926

@@ -40,7 +37,7 @@ This library includes TypeScript definitions for all request params and response
4037

4138
<!-- prettier-ignore -->
4239
```ts
43-
import Sent from 'sent';
40+
import Sent from '@sent/node';
4441

4542
const client = new Sent();
4643

@@ -207,12 +204,12 @@ add the following import before your first import `from "Sent"`:
207204
```ts
208205
// Tell TypeScript and the package to use the global web fetch instead of node-fetch.
209206
// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
210-
import 'sent/shims/web';
211-
import Sent from 'sent';
207+
import '@sent/node/shims/web';
208+
import Sent from '@sent/node';
212209
```
213210

214-
To do the inverse, add `import "sent/shims/node"` (which does import polyfills).
215-
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/stainless-sdks/sent-node/tree/main/src/_shims#readme)).
211+
To do the inverse, add `import "@sent/node/shims/node"` (which does import polyfills).
212+
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/sentdm/sent-node/tree/main/src/_shims#readme)).
216213

217214
### Logging and middleware
218215

@@ -221,7 +218,7 @@ which can be used to inspect or alter the `Request` or `Response` before/after e
221218

222219
```ts
223220
import { fetch } from 'undici'; // as one example
224-
import Sent from 'sent';
221+
import Sent from '@sent/node';
225222

226223
const client = new Sent({
227224
fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
@@ -268,7 +265,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
268265

269266
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
270267

271-
We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/sent-node/issues) with questions, bugs, or suggestions.
268+
We are keen for your feedback; please open an [issue](https://www.github.com/sentdm/sent-node/issues) with questions, bugs, or suggestions.
272269

273270
## Requirements
274271

bin/check-release-environment

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
errors=()
4+
5+
if [ -z "${NPM_TOKEN}" ]; then
6+
errors+=("The SENT_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
7+
fi
8+
9+
lenErrors=${#errors[@]}
10+
11+
if [[ lenErrors -gt 0 ]]; then
12+
echo -e "Found the following errors in the release environment:\n"
13+
14+
for error in "${errors[@]}"; do
15+
echo -e "- $error\n"
16+
done
17+
18+
exit 1
19+
fi
20+
21+
echo "The environment is ready to push releases!"
22+

jest.config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const config: JestConfigWithTsJest = {
77
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
88
},
99
moduleNameMapper: {
10-
'^sent$': '<rootDir>/src/index.ts',
11-
'^sent/_shims/auto/(.*)$': '<rootDir>/src/_shims/auto/$1-node',
12-
'^sent/(.*)$': '<rootDir>/src/$1',
10+
'^@sent/node$': '<rootDir>/src/index.ts',
11+
'^@sent/node/_shims/auto/(.*)$': '<rootDir>/src/_shims/auto/$1-node',
12+
'^@sent/node/(.*)$': '<rootDir>/src/$1',
1313
},
1414
modulePathIgnorePatterns: [
1515
'<rootDir>/ecosystem-tests/',

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "sent",
3-
"version": "0.0.1-alpha.0",
2+
"name": "@sent/node",
3+
"version": "0.1.0-alpha.1",
44
"description": "The official TypeScript library for the Sent API",
55
"author": "Sent <[email protected]>",
66
"types": "dist/index.d.ts",
77
"main": "dist/index.js",
88
"type": "commonjs",
9-
"repository": "github:stainless-sdks/sent-node",
9+
"repository": "github:sentdm/sent-node",
1010
"license": "Apache-2.0",
1111
"packageManager": "[email protected]",
1212
"files": [
@@ -60,8 +60,8 @@
6060
"./shims/web.mjs"
6161
],
6262
"imports": {
63-
"sent": ".",
64-
"sent/*": "./src/*"
63+
"@sent/node": ".",
64+
"@sent/node/*": "./src/*"
6565
},
6666
"exports": {
6767
"./_shims/auto/*": {

release-please-config.json

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"packages": {
3+
".": {}
4+
},
5+
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
6+
"include-v-in-tag": true,
7+
"include-component-in-tag": false,
8+
"versioning": "prerelease",
9+
"prerelease": true,
10+
"bump-minor-pre-major": true,
11+
"bump-patch-for-minor-pre-major": false,
12+
"pull-request-header": "Automated Release PR",
13+
"pull-request-title-pattern": "release: ${version}",
14+
"changelog-sections": [
15+
{
16+
"type": "feat",
17+
"section": "Features"
18+
},
19+
{
20+
"type": "fix",
21+
"section": "Bug Fixes"
22+
},
23+
{
24+
"type": "perf",
25+
"section": "Performance Improvements"
26+
},
27+
{
28+
"type": "revert",
29+
"section": "Reverts"
30+
},
31+
{
32+
"type": "chore",
33+
"section": "Chores"
34+
},
35+
{
36+
"type": "docs",
37+
"section": "Documentation"
38+
},
39+
{
40+
"type": "style",
41+
"section": "Styles"
42+
},
43+
{
44+
"type": "refactor",
45+
"section": "Refactors"
46+
},
47+
{
48+
"type": "test",
49+
"section": "Tests",
50+
"hidden": true
51+
},
52+
{
53+
"type": "build",
54+
"section": "Build System"
55+
},
56+
{
57+
"type": "ci",
58+
"section": "Continuous Integration",
59+
"hidden": true
60+
}
61+
],
62+
"release-type": "node",
63+
"extra-files": [
64+
"src/version.ts",
65+
"README.md"
66+
]
67+
}

scripts/build

+3-3
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 `"sent/resources/foo"` works
11+
# This way importing from `"@sent/node/resources/foo"` works
1212
# even with `"moduleResolution": "node"`
1313

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

4848
# make sure that nothing crashes when we require the output CJS or
4949
# import the output ESM
50-
(cd dist && node -e 'require("sent")')
51-
(cd dist && node -e 'import("sent")' --input-type=module)
50+
(cd dist && node -e 'require("@sent/node")')
51+
(cd dist && node -e 'import("@sent/node")' --input-type=module)
5252

5353
if command -v deno &> /dev/null && [ -e ./scripts/build-deno ]
5454
then

scripts/utils/postprocess-files.cjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const fs = require('fs');
22
const path = require('path');
33
const { parse } = require('@typescript-eslint/parser');
44

5-
const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? 'sent/';
5+
const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? '@sent/node/';
66

77
const distDir =
88
process.env['DIST_PATH'] ?
@@ -142,7 +142,7 @@ async function postprocess() {
142142

143143
if (file.endsWith('.d.ts')) {
144144
// work around bad tsc behavior
145-
// if we have `import { type Readable } from 'sent/_shims/index'`,
145+
// if we have `import { type Readable } from '@sent/node/_shims/index'`,
146146
// tsc sometimes replaces `Readable` with `import("stream").Readable` inline
147147
// in the output .d.ts
148148
transformed = transformed.replace(/import\("stream"\).Readable/g, 'Readable');

0 commit comments

Comments
 (0)