diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 00000000..00dc207b --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,32 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to NPM in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/hyperspell/node-sdk/actions/workflows/publish-npm.yml +name: Publish NPM +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + 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 NPM + run: | + bash ./bin/publish-npm + env: + NPM_TOKEN: ${{ secrets.HYPERSPELL_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 00000000..293a7b16 --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,22 @@ +name: Release Doctor +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'hyperspell/node-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + NPM_TOKEN: ${{ secrets.HYPERSPELL_NPM_TOKEN || secrets.NPM_TOKEN }} + diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..d7a87356 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0-alpha.1" +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..34e3456c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,24 @@ +# Changelog + +## 0.1.0-alpha.1 (2025-01-22) + +Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/hyperspell/node-sdk/compare/v0.0.1-alpha.0...v0.1.0-alpha.1) + +### Features + +* **api:** api update ([7a2bd69](https://github.com/hyperspell/node-sdk/commit/7a2bd691ceb933053e41ace833524fa7eb03f0fe)) +* **api:** api update ([18e40aa](https://github.com/hyperspell/node-sdk/commit/18e40aa3424efad169f6bb6f84b5e8a4c3b63780)) +* **api:** api update ([e9a6314](https://github.com/hyperspell/node-sdk/commit/e9a631469f5daf849bce2a0d4b3c18580a6ce208)) +* **api:** api update ([f304147](https://github.com/hyperspell/node-sdk/commit/f3041475263292a22094818a67808ce6bc18498f)) +* **api:** api update ([d493a36](https://github.com/hyperspell/node-sdk/commit/d493a36acac1df96fc4d4f0d2e7ed355b812531a)) + + +### Chores + +* configure new SDK language ([6b1ea1e](https://github.com/hyperspell/node-sdk/commit/6b1ea1ee164cf9bad4273005a5ef22096c1a290c)) +* go live ([#1](https://github.com/hyperspell/node-sdk/issues/1)) ([88cabb4](https://github.com/hyperspell/node-sdk/commit/88cabb40b7540aabd038ae209f129e05d0917a4e)) +* **internal:** codegen related update ([96a6428](https://github.com/hyperspell/node-sdk/commit/96a642805334376da1691482c8de710cb30d8e54)) +* **internal:** codegen related update ([0f48c3c](https://github.com/hyperspell/node-sdk/commit/0f48c3c73e7a5f5bd2f5a21b58d5e42c369b5a7a)) +* **internal:** codegen related update ([7136be0](https://github.com/hyperspell/node-sdk/commit/7136be08b13c920d0255e19aa65135245fbb8ba6)) +* **internal:** codegen related update ([b4aec87](https://github.com/hyperspell/node-sdk/commit/b4aec87aec69128a7a2ff13a1f19a4104d0960f8)) +* update SDK settings ([#3](https://github.com/hyperspell/node-sdk/issues/3)) ([99ef2f5](https://github.com/hyperspell/node-sdk/commit/99ef2f5de368ba55fa92f6678e44b94035f8bc9c)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6693e8d4..4108c69b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,15 +42,15 @@ If you’d like to use the repository from source, you can either install from g To install via git: ```sh -$ npm install git+ssh://git@github.com:stainless-sdks/hyperspell-node.git +$ npm install git+ssh://git@github.com:hyperspell/node-sdk.git ``` Alternatively, to link a local copy of the repo: ```sh # Clone -$ git clone https://www.github.com/stainless-sdks/hyperspell-node -$ cd hyperspell-node +$ git clone https://www.github.com/hyperspell/node-sdk +$ cd node-sdk # With yarn $ yarn link @@ -91,3 +91,17 @@ To format and fix all lint issues automatically: ```sh $ yarn fix ``` + +## Publishing and releases + +Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If +the changes aren't made through the automated pipeline, you may want to make releases manually. + +### Publish with a GitHub workflow + +You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/hyperspell/node-sdk/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up. + +### Publish manually + +If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on +the environment. diff --git a/README.md b/README.md index 2d69454d..064d0cd5 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,9 @@ It is generated with [Stainless](https://www.stainlessapi.com/). ## Installation ```sh -npm install git+ssh://git@github.com:stainless-sdks/hyperspell-node.git +npm install hyperspell ``` -> [!NOTE] -> Once this package is [published to npm](https://app.stainlessapi.com/docs/guides/publish), this will become: `npm install hyperspell` - ## Usage The full API of this library can be found in [api.md](api.md). @@ -213,7 +210,7 @@ import Hyperspell from 'hyperspell'; ``` To do the inverse, add `import "hyperspell/shims/node"` (which does import polyfills). -This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/stainless-sdks/hyperspell-node/tree/main/src/_shims#readme)). +This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/hyperspell/node-sdk/tree/main/src/_shims#readme)). ### Logging and middleware @@ -272,7 +269,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. -We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/hyperspell-node/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/hyperspell/node-sdk/issues) with questions, bugs, or suggestions. ## Requirements diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 00000000..9ee7bb7d --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${NPM_TOKEN}" ]; then + errors+=("The HYPERSPELL_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" + diff --git a/package.json b/package.json index 7798b687..b8a01a2f 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "hyperspell", - "version": "0.0.1-alpha.0", + "version": "0.1.0-alpha.1", "description": "The official TypeScript library for the Hyperspell API", "author": "Hyperspell ", "types": "dist/index.d.ts", "main": "dist/index.js", "type": "commonjs", - "repository": "github:stainless-sdks/hyperspell-node", + "repository": "github:hyperspell/node-sdk", "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..624ed99e --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,67 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "node", + "extra-files": [ + "src/version.ts", + "README.md" + ] +} diff --git a/src/_shims/index-deno.ts b/src/_shims/index-deno.ts index 6069010d..c6cae80a 100644 --- a/src/_shims/index-deno.ts +++ b/src/_shims/index-deno.ts @@ -79,7 +79,7 @@ export function getDefaultAgent(url: string) { } export function fileFromPath() { throw new Error( - 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/stainless-sdks/hyperspell-node#file-uploads', + 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/hyperspell/node-sdk#file-uploads', ); } diff --git a/src/_shims/web-runtime.ts b/src/_shims/web-runtime.ts index b3ae393f..e4631b0a 100644 --- a/src/_shims/web-runtime.ts +++ b/src/_shims/web-runtime.ts @@ -95,7 +95,7 @@ export function getRuntime({ manuallyImported }: { manuallyImported?: boolean } getDefaultAgent: (url: string) => undefined, fileFromPath: () => { throw new Error( - 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/stainless-sdks/hyperspell-node#file-uploads', + 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/hyperspell/node-sdk#file-uploads', ); }, isFsReadStream: (value: any) => false, diff --git a/src/version.ts b/src/version.ts index 55a1a527..b0bfd9e7 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.0.1-alpha.0'; +export const VERSION = '0.1.0-alpha.1'; // x-release-please-version