Skip to content

Commit

Permalink
chore: provide playground example
Browse files Browse the repository at this point in the history
  • Loading branch information
noook committed Jul 7, 2023
1 parent ef11d2f commit a45f065
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 378 deletions.
10 changes: 9 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"extends": "@antfu"
"extends": "@antfu",
"overrides": [
{
"files": ["playground/**/*.ts"],
"rules": {
"no-console": "off"
}
}
]
}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"ofetch": "^1.1.1",
"start": "^5.1.0"
"ofetch": "^1.1.1"
},
"devDependencies": {
"@antfu/eslint-config": "^0.39.5",
Expand Down
22 changes: 11 additions & 11 deletions playground/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { config } from 'dotenv'
import { SpotifyClient } from '@noook/spotify-client'
import { ResourceType, SpotifyClient } from '@noook/spotify-client'

Check failure on line 1 in playground/index.ts

View workflow job for this annotation

GitHub Actions / typecheck

Cannot find module '@noook/spotify-client' or its corresponding type declarations.

config({
path: '.env.local',
})

async function init() {
const client = new SpotifyClient().setAccessToken(process.env.SPOTIFY_TOKEN!)
console.clear()
const client = new SpotifyClient().setAccessToken(import.meta.env.SPOTIFY_TOKEN!)

// Test your functions here
}
// Test your functions here
const searchResult = await client.search.search(
[ResourceType.Track],
'Uh uh',
)

init()
await client.player.startPlayback(undefined, {
uris: [searchResult.tracks.items[0].uri],
})
13 changes: 3 additions & 10 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,15 @@
"version": "0.0.0",
"private": true,
"scripts": {
"start": "ts-node .",
"dev": "nodemon . -e ts,json --exec 'npm run start'",
"build": "run-p build-only",
"preview": "vite preview --port 4173",
"build-only": "vite build"
"start": "vite-node -w index.ts"
},
"dependencies": {
"@noook/spotify-client": "workspace:*",
"dotenv": "^16.3.1",
"why": "^0.6.2"
"vite-node": "^0.33.0",
"vitest": "^0.32.2"
},
"devDependencies": {
"@types/node": "^18.14.1",
"nodemon": "^2.0.22",
"npm-run-all": "^4.1.5",
"ts-node": "^10.9.1",
"typescript": "5.1.3",
"vite": "^4.3.9"
}
Expand Down
26 changes: 5 additions & 21 deletions playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
{
"include": [
"env.d.ts",
"./**/*"
],
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"moduleResolution": "node",
"baseUrl": ".",
"lib": ["DOM", "esnext"],
"paths": {
"@/*": [
"./*"
],
"@noook/spotify-client": [
"../index.ts"
]
}
"lib": ["esnext", "dom"]
},
"ts-node": {
"esm": true,
"experimentalSpecifierResolution": "node"
}
"exclude": ["**/dist/**"],
// module resolution: bundler
"include": ["**/*.ts", "**/*.d.ts"]
}
6 changes: 6 additions & 0 deletions playground/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite'

export default defineConfig({
envPrefix: ['SPOTIFY'],
})
Loading

0 comments on commit a45f065

Please sign in to comment.