Skip to content

Commit

Permalink
docs: fix deno.land import (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Nov 4, 2023
1 parent f9a3014 commit e5415a2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ yarn add openai

You can import in Deno via:

<!-- x-release-please-start-version -->

```ts
import OpenAI from 'https://raw.githubusercontent.com/openai/openai-node/v4.15.0-deno/mod.ts';
import OpenAI from 'https://deno.land/x/openai';
```

<!-- x-release-please-end -->

## Usage

The full API of this library can be found in [api.md file](https://github.com/openai/openai-node/blob/master/api.md). The code below shows how to get started using the chat completions API.
Expand Down
19 changes: 15 additions & 4 deletions scripts/git-publish-deno.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -exuo pipefail

# This script pushes the contents of the `deno`` directory to the `deno` branch,
# and creates a `vx.x.x-deno` tag, so that Deno users can
Expand All @@ -10,6 +11,7 @@
# - Set the following environment variables when running this script:
# - DENO_PUSH_REMOTE_URL - the remote url of the separate GitHub repo
# - DENO_PUSH_BRANCH - the branch you want to push to in that repo (probably `main`)
# - DENO_MAIN_BRANCH - the branch you want as the main branch in that repo (probably `main`, sometimes `master`)
# - DENO_PUSH_VERSION - defaults to version in package.json
# - DENO_PUSH_RELEASE_TAG - defaults to v$DENO_PUSH_VERSION-deno

Expand All @@ -18,8 +20,6 @@ die () {
exit 1
}

set -exuo pipefail

# Allow caller to set the following environment variables, but provide defaults
# if unset
# : "${FOO:=bar}" sets FOO=bar unless it's set and non-empty
Expand All @@ -28,8 +28,15 @@ set -exuo pipefail

: "${DENO_PUSH_VERSION:=$(node -p 'require("./package.json").version')}"
: "${DENO_PUSH_BRANCH:=deno}"
: "${DENO_MAIN_BRANCH:=main}"
: "${DENO_PUSH_REMOTE_URL:=$(git remote get-url origin)}"
: "${DENO_PUSH_RELEASE_TAG:="v$DENO_PUSH_VERSION-deno"}"
: "${DENO_GIT_USER_NAME:="Stainless Bot"}"
: "${DENO_GIT_USER_NAME:="bot@stainlessapi.com"}"
if [[ $DENO_PUSH_BRANCH = "deno" ]]; then
: "${DENO_PUSH_RELEASE_TAG:="v$DENO_PUSH_VERSION-deno"}"
else
: "${DENO_PUSH_RELEASE_TAG:="v$DENO_PUSH_VERSION"}"
fi

if [ ! -e deno ]; then ./build; fi

Expand All @@ -41,7 +48,7 @@ if [ ! -e deno ]; then ./build; fi

cd deno
rm -rf .git
git init
git init -b "$DENO_MAIN_BRANCH"
git remote add origin "$DENO_PUSH_REMOTE_URL"
if git fetch origin "$DENO_PUSH_RELEASE_TAG"; then
die "Tag $DENO_PUSH_RELEASE_TAG already exists"
Expand All @@ -56,6 +63,10 @@ else
# the branch doesn't exist on the remote yet
git checkout -b "$DENO_PUSH_BRANCH"
fi

git config user.email "$DENO_GIT_USER_EMAIL"
git config user.name "$DENO_GIT_USER_NAME"

git add .
git commit -m "chore(deno): release $DENO_PUSH_VERSION"
git tag -a "$DENO_PUSH_RELEASE_TAG" -m "release $DENO_PUSH_VERSION"
Expand Down

0 comments on commit e5415a2

Please sign in to comment.