Skip to content

Commit

Permalink
Merge pull request #41 from AssemblyAI/E07417BDFEA3614F5967B1520F8B2F61
Browse files Browse the repository at this point in the history
Sync from internal repo (2024/03/18)
  • Loading branch information
Swimburger committed Mar 18, 2024
2 parents a29654e + dbf1f9a commit 5df9d9b
Show file tree
Hide file tree
Showing 9 changed files with 399 additions and 320 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/api-reference.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish API reference

on:
release:
types: [published]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build-and-publish:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
name: Build and publish to npmjs.com
runs-on: ubuntu-latest
steps:
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Checkout source code
uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
with:
version: 8.10.0
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile false
- name: Generate API reference
run: pnpm generate-reference
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "temp-docs"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
13 changes: 5 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install pnpm
run: npm install -g [email protected]
# doesn't work with Node 20
# - name: Install pnpm
# uses: pnpm/action-setup@v2
# with:
# version: 8.7.4
# run_install: false
uses: pnpm/action-setup@v3
with:
version: 8.10.0
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
Expand All @@ -37,7 +34,7 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile false
- name: Build code
run: npm run build
run: pnpm build
- run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
npm publish
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ jobs:
matrix:
node-version:
- "20"
# - "18"
# - "16"
- "18"
os:
- ubuntu-latest
# - macos-latest
Expand All @@ -28,13 +27,10 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install pnpm
run: npm install -g [email protected]
# doesn't work with Node 20
# - name: Install pnpm
# uses: pnpm/action-setup@v2
# with:
# version: 8.7.4
# run_install: false
uses: pnpm/action-setup@v3
with:
version: 8.10.0
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
Expand All @@ -49,6 +45,8 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile false
- name: Build code
run: npm run build
run: pnpm build
- name: Lint code
run: pnpm lint
- name: Run tests
run: npm test
run: pnpm test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ dist

# Ignore Jest directory
.jest

temp
temp-docs
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [4.3.3] - 2024-03-18

### Added

- GitHub action to generate API reference
- Generate API reference with Typedoc and host on GitHub Pages

### Changed

- Add `conformer-2` to `SpeechModel` type
- Change `language_code` field to accept any string
- Move from JSDoc to TSDoc
- Update `ws` to 8.13.0
- Update dev dependencies (no public facing changes)

## [4.3.2] - 2024-03-08

### Added
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "assemblyai",
"version": "4.3.2",
"version": "4.3.3",
"description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.",
"engines": {
"node": ">=18"
Expand Down Expand Up @@ -72,6 +72,7 @@
"test": "jest --config jest.config.js",
"format": "prettier '**/*' --write",
"generate-types": "tsx ./scripts/generate-types.ts && pnpm format",
"generate-reference": "typedoc",
"copybara:dry-run": "./copybara.sh dry_run --init-history",
"copybara:pr": "./copybara.sh sync_out --init-history"
},
Expand Down Expand Up @@ -125,6 +126,7 @@
"rollup": "^3.25.1",
"ts-jest": "^29.1.0",
"tslib": "^2.5.3",
"typedoc": "^0.25.12",
"typescript": "^5.2.2"
},
"dependencies": {
Expand Down
4 changes: 4 additions & 0 deletions scripts/generate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ async function generateTypes(apiSpecPath: string, outputPath: string) {
/( *\/\*\* *\n)((?:\s|\S)*)\n(\s*\* @description (?:.*))( *\*\/\n)/gm,
"$1$3$2$4"
)
.replaceAll(
/(?:\[(.*)\])(?:\(((?:http)(?:s)?(?::\/\/).*)\))/gm,
"{@link $2 | $1 }"
)
// remove description tag
.replaceAll("@description ", "")
// remove empty multiline comments
Expand Down
Loading

0 comments on commit 5df9d9b

Please sign in to comment.