Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install and use tsup to build library #7

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI
on:
push:
branches:
- "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 20.x
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm run lint && pnpm run build
29 changes: 0 additions & 29 deletions .github/workflows/npm-publish.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish
on:
workflow_run:
workflows: [CI]
branches: [main]
types: [completed]

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 20.x
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> This is a fork of the [official library](https://github.com/spotify/spotify-web-api-ts-sdk) released by Spotify. I needed to publish my fork to npm so I include a fix in my own application since there has not been an offical release in several months. This project has now diverged from upstream and I plan to maintain this library.

This is a JavaScript/TypeScript SDK for the [Spotify Web API](https://developer.spotify.com/web-api/) and currently **does not** include any of the Web Playback SDK functionality.
This is a JavaScript/TypeScript SDK for the [Spotify Web API](https://developer.spotify.com/web-api/) and currently **does not** include any of the Web Playback SDK functionality. I recommend installing `@types/spotify-web-playback-sdk` if you are working with the Playback SDK.

## Requirements

Expand Down Expand Up @@ -43,4 +43,4 @@ To run the embedded example app, you will need to add the following environment
- `VITE_SPOTIFY_CLIENT_ID`=the same value as set in INTEGRATION_TESTS_SPOTIFY_CLIENT_ID
- `VITE_REDIRECT_TARGET`=http://localhost:3000

For the example app to work, this .env file needs to be in the specific example directory within the `/examples`` folder.
For the example app to work, this .env file needs to be in the specific example directory within the `/examples` folder.
28 changes: 10 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
{
"name": "@fostertheweb/spotify-web-sdk",
"version": "1.2.1",
"description": "A typescript SDK for the Spotify Web API",
"main": "dist/cjs/index.js",
"module": "dist/mjs/index.js",
"types": "dist/mjs/index.d.ts",
"description": "A TypeScript SDK for the Spotify Web API",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"start": "npx vite serve",
"test": "vitest run",
"ci": "npm run build",
"build": "npm run build:cjs && npm run build:mjs",
"build:mjs": "tsc --project tsconfig.mjs.json && cp res/package.mjs.json dist/mjs/package.json",
"build:cjs": "tsc --project tsconfig.cjs.json && cp res/package.cjs.json dist/cjs/package.json",
"build:win": "npm run build:cjs-win && npm run build:mjs-win",
"build:mjs-win": "tsc --project tsconfig.mjs.json && xcopy .\\res\\package.mjs.json .\\dist\\mjs\\package.json /-I /Y",
"build:cjs-win": "tsc --project tsconfig.cjs.json && xcopy .\\res\\package.cjs.json .\\dist\\cjs\\package.json /-I /Y"
},
"exports": {
"import": "./dist/mjs/index.js",
"require": "./dist/cjs/index.js"
"build": "tsup src/index.ts --format cjs,esm --dts",
"release": "pnpm run build && changeset publish",
"lint": "tsc"
},
"repository": {
"type": "git",
"url": "https://github.com/fostertheweb/spotify-web-api-ts-sdk"
"url": "https://github.com/fostertheweb/spotify-web-sdk"
},
"author": "Spotify",
"license": "Apache",
Expand All @@ -33,6 +23,8 @@
"dotenv": "^16.3.1",
"jsdom": "^22.1.0",
"playwright": "^1.35.1",
"tsup": "^8.0.1",
"typedoc": "^0.25.4",
"typescript": "^5.1.6",
"uuid": "^9.0.0",
"vite": "^4.3.9",
Expand Down
Loading