Skip to content

Commit

Permalink
release: 0.24.0 (#440)
Browse files Browse the repository at this point in the history
* The main change in this release is our first attempt at publishing on JSR.

---------

Co-authored-by: stainless-bot <dev@stainlessapi.com>
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
  • Loading branch information
stainless-app[bot] and stainless-bot authored Nov 21, 2024
1 parent 3a9460e commit 12f5712
Show file tree
Hide file tree
Showing 49 changed files with 689 additions and 361 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/publish-jsr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to JSR in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/val-town/sdk/actions/workflows/publish-jsr.yml
name: Publish JSR
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
run: |
yarn install
- name: Publish to JSR
run: |
bash ./bin/publish-jsr
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ yarn-error.log
codegen.log
Brewfile.lock.json
dist
/deno
dist-deno
/*.tgz
.idea/

2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.23.0"
".": "0.24.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 26
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/val-town%2Fval-town-e71c730055783b96c5f9858d3c80eb88a8355c1d1fb770e9f2745fe63a16a4be.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/val-town%2Fval-town-56a412f0f88fc96d4ccb7d3ae75cb619581c413531caae445a85fa2279fba829.yml
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Changelog

## 0.24.0 (2024-11-21)

Full Changelog: [v0.23.0...v0.24.0](https://github.com/val-town/sdk/compare/v0.23.0...v0.24.0)

### Features

* **api:** api update ([#446](https://github.com/val-town/sdk/issues/446)) ([1625820](https://github.com/val-town/sdk/commit/1625820a3596a65f673c42a99883885bbc34f594))
* **api:** api update ([#447](https://github.com/val-town/sdk/issues/447)) ([2514141](https://github.com/val-town/sdk/commit/251414115ece2b975d147084159cf7e275723bb9))
* **api:** api update ([#448](https://github.com/val-town/sdk/issues/448)) ([e7b26f4](https://github.com/val-town/sdk/commit/e7b26f4f55dc0c1e1e202a6accfd4e790f6edb76))
* **api:** api update ([#449](https://github.com/val-town/sdk/issues/449)) ([ed0ef16](https://github.com/val-town/sdk/commit/ed0ef16921548c741b83cb19f78cfe7e74e1c796))
* **api:** api update ([#450](https://github.com/val-town/sdk/issues/450)) ([ecbef3b](https://github.com/val-town/sdk/commit/ecbef3ba1d9895440f3c0ba42ce098c7d33ee8be))
* **api:** api update ([#451](https://github.com/val-town/sdk/issues/451)) ([f65b028](https://github.com/val-town/sdk/commit/f65b028499cfec450ae7aa285bfae30639a5d1be))
* **api:** api update ([#453](https://github.com/val-town/sdk/issues/453)) ([225c943](https://github.com/val-town/sdk/commit/225c94397f49dfbc95bc8d75f66e11336e1ae4d0))
* **api:** api update ([#454](https://github.com/val-town/sdk/issues/454)) ([7a16e67](https://github.com/val-town/sdk/commit/7a16e6703a99bc956bfd68d1814c4b355b0f52b8))
* **api:** api update ([#458](https://github.com/val-town/sdk/issues/458)) ([ebd88f3](https://github.com/val-town/sdk/commit/ebd88f3e15903f5cf24ea176560a3869138bfbda))
* **api:** api update ([#459](https://github.com/val-town/sdk/issues/459)) ([e5172d3](https://github.com/val-town/sdk/commit/e5172d3681593fbbd28bca0a3edd99c14c487870))
* **api:** api update ([#464](https://github.com/val-town/sdk/issues/464)) ([df9279b](https://github.com/val-town/sdk/commit/df9279be5cd98f3e76ae71766c5ad28a310be614))


### Chores

* rebuild project due to codegen change ([#452](https://github.com/val-town/sdk/issues/452)) ([a1f8f0b](https://github.com/val-town/sdk/commit/a1f8f0bfdb31b447b6a90c4a2f66346c75b98b53))
* rebuild project due to codegen change ([#455](https://github.com/val-town/sdk/issues/455)) ([c02656e](https://github.com/val-town/sdk/commit/c02656e98f53654905a00f3383b4b432d96fd294))
* rebuild project due to codegen change ([#456](https://github.com/val-town/sdk/issues/456)) ([a743193](https://github.com/val-town/sdk/commit/a743193a021aaf7020ac3bdfc680ba8ee3898d80))
* rebuild project due to codegen change ([#457](https://github.com/val-town/sdk/issues/457)) ([636d468](https://github.com/val-town/sdk/commit/636d4680bfeec90fb7d1a788e97bbff39344f42b))
* rebuild project due to codegen change ([#461](https://github.com/val-town/sdk/issues/461)) ([67a58bb](https://github.com/val-town/sdk/commit/67a58bbb9c2ea54deec2bdb1fdbe32331cbbe013))
* remove redundant word in comment ([#463](https://github.com/val-town/sdk/issues/463)) ([cc848fb](https://github.com/val-town/sdk/commit/cc848fbe88c9fe3d5bc43d613842d82f05a8fcbb))


### Documentation

* remove suggestion to use `npm` call out ([#462](https://github.com/val-town/sdk/issues/462)) ([2cb0b87](https://github.com/val-town/sdk/commit/2cb0b87486ffa6c53c629da75e6e5546758e034a))

## 0.23.0 (2024-09-16)

Full Changelog: [v0.22.0...v0.23.0](https://github.com/val-town/sdk/compare/v0.22.0...v0.23.0)
Expand Down
46 changes: 23 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Other package managers may work but are not officially supported for development

To set up the repository, run:

```bash
yarn
yarn build
```sh
$ yarn
$ yarn build
```

This will install all the required dependencies and build output files to `dist/`.
Expand All @@ -22,7 +22,7 @@ modify the contents of the `src/lib/` and `examples/` directories.

All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.

```bash
```ts
// add an example to examples/<your-example>.ts

#!/usr/bin/env -S npm run tsn -T
Expand All @@ -41,38 +41,38 @@ If you’d like to use the repository from source, you can either install from g

To install via git:

```bash
npm install git+ssh://git@github.com:val-town/sdk.git
```sh
$ npm install git+ssh://git@github.com:val-town/sdk.git
```

Alternatively, to link a local copy of the repo:

```bash
```sh
# Clone
git clone https://www.github.com/val-town/sdk
cd sdk
$ git clone https://www.github.com/val-town/sdk
$ cd sdk

# With yarn
yarn link
cd ../my-package
yarn link @valtown/sdk
$ yarn link
$ cd ../my-package
$ yarn link @valtown/sdk

# With pnpm
pnpm link --global
cd ../my-package
pnpm link -—global @valtown/sdk
$ pnpm link --global
$ cd ../my-package
$ pnpm link -—global @valtown/sdk
```

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
npx prism mock path/to/your/openapi.yml
```sh
$ npx prism mock path/to/your/openapi.yml
```

```bash
yarn run test
```sh
$ yarn run test
```

## Linting and formatting
Expand All @@ -82,14 +82,14 @@ This repository uses [prettier](https://www.npmjs.com/package/prettier) and

To lint:

```bash
yarn lint
```sh
$ yarn lint
```

To format and fix all lint issues automatically:

```bash
yarn fix
```sh
$ yarn fix
```

## Publishing and releases
Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Val Town Node API Library

[![NPM version](https://img.shields.io/npm/v/@valtown/sdk.svg)](https://npmjs.org/package/@valtown/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@valtown/sdk)
[![NPM version](https://img.shields.io/npm/v/@valtown/sdk.svg)](https://npmjs.org/package/@valtown/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@valtown/sdk) [![JSR Version](https://jsr.io/badges/@valtown/sdk)](https://jsr.io/@valtown/sdk)

This library provides convenient access to the Val Town REST API from server-side TypeScript or JavaScript.

Expand All @@ -14,6 +14,21 @@ It is generated with [Stainless](https://www.stainlessapi.com/).
npm install @valtown/sdk
```

### Installation from JSR

```sh
deno add jsr:@valtown/sdk
npx jsr add @valtown/sdk
```

These commands will make the module importable from the `@valtown/sdk` scope:

You can also [import directly from JSR](https://jsr.io/docs/using-packages#importing-with-jsr-specifiers) without an install step if you're using the Deno JavaScript runtime:

```ts
import ValTown from 'jsr:@valtown/sdk';
```

## Usage

The full API of this library can be found in [api.md](api.md).
Expand Down Expand Up @@ -275,6 +290,19 @@ TypeScript >= 4.5 is supported.

The following runtimes are supported:

- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher.
- Bun 1.0 or later.
- Cloudflare Workers.
- Vercel Edge Runtime.
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
- Nitro v2.6 or greater.

Note that React Native is not supported at this time.

If you are interested in other runtime environments, please open or upvote an issue on GitHub.

## Contributing

See [the contributing documentation](./CONTRIBUTING.md).
11 changes: 11 additions & 0 deletions bin/publish-jsr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -eux

# Build the project
yarn build

# Navigate to the dist directory
cd dist-deno

npx jsr publish ${JSR_TOKEN:+"--token=$JSR_TOKEN"}
10 changes: 10 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@valtown/sdk",
"version": "0.24.0",
"exports": "./index.ts",
"publish": {
"exclude": [
"!."
]
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@valtown/sdk",
"version": "0.23.0",
"version": "0.24.0",
"description": "The official TypeScript library for the Val Town API",
"author": "Val Town <support@val.town>",
"types": "dist/index.d.ts",
Expand All @@ -10,7 +10,7 @@
"license": "MIT",
"packageManager": "yarn@1.22.22",
"files": [
"*"
"**/*"
],
"private": false,
"scripts": {
Expand Down Expand Up @@ -41,10 +41,10 @@
"eslint": "^8.49.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
"iconv-lite": "^0.6.3",
"jest": "^29.4.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"ts-morph": "^19.0.0",
"ts-node": "^10.5.0",
"tsc-multi": "^1.1.0",
"tsconfig-paths": "^4.0.0",
Expand Down
7 changes: 6 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
"release-type": "node",
"extra-files": [
"src/version.ts",
"README.md"
"README.md",
{
"type": "json",
"path": "jsr.json",
"jsonpath": "$.version"
}
]
}
4 changes: 2 additions & 2 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ npm exec tsc-multi
# copy over handwritten .js/.mjs/.d.ts files
cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims
cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto
# we need to add exports = module.exports = Val Town Node to index.js;
# we need to add exports = module.exports = ValTown to index.js;
# No way to get that from index.ts because it would cause compile errors
# when building .mjs
node scripts/utils/fix-index-exports.cjs
Expand All @@ -50,7 +50,7 @@ node scripts/utils/postprocess-files.cjs
(cd dist && node -e 'require("@valtown/sdk")')
(cd dist && node -e 'import("@valtown/sdk")' --input-type=module)

if command -v deno &> /dev/null && [ -e ./scripts/build-deno ]
if [ -e ./scripts/build-deno ]
then
./scripts/build-deno
fi
19 changes: 19 additions & 0 deletions scripts/build-deno
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -exuo pipefail

cd "$(dirname "$0")/.."

rm -rf dist-deno; mkdir dist-deno
cp -rp src/* jsr.json dist-deno

rm dist-deno/_shims/auto/*-node.ts
for dir in dist-deno/_shims dist-deno/_shims/auto; do
rm "${dir}"/*.{d.ts,js,mjs}
for file in "${dir}"/*-deno.ts; do
mv -- "$file" "${file%-deno.ts}.ts"
done
done
for file in README.md LICENSE CHANGELOG.md; do
if [ -e "${file}" ]; then cp "${file}" dist-deno; fi
done
2 changes: 1 addition & 1 deletion src/_shims/node-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as fd from 'formdata-node';
export { type Agent } from 'node:http';
export { type Readable } from 'node:stream';
export { type ReadStream as FsReadStream } from 'node:fs';
export { ReadableStream } from 'web-streams-polyfill';
export { ReadableStream } from 'node:stream/web';

export const fetch: typeof nf.default;

Expand Down
Loading

0 comments on commit 12f5712

Please sign in to comment.