Skip to content

Commit

Permalink
Make TS types easier to consume (#197)
Browse files Browse the repository at this point in the history
They were split in a separate file for the generated types, this caused issues with paths without filename extension, so merging them together simplifies usage.

The trick here was to generate .ts files instead of .d.ts from the API specs!
  • Loading branch information
osmestad authored Sep 18, 2024
1 parent 6dd2141 commit 14390a4
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 16 deletions.
6 changes: 6 additions & 0 deletions packages/catalogue/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.2] - 2024-09-18

### Changed

- Make TS types easier to use with different `tsconfig` settings (was assuming `CommonJS`)

## [0.3.1] - 2024-09-17

### Changed
Expand Down
8 changes: 4 additions & 4 deletions packages/catalogue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tidal-music/catalogue",
"version": "0.3.1",
"version": "0.3.2",
"type": "module",
"files": [
"dist"
Expand All @@ -17,16 +17,16 @@
"import": "./dist/index.js"
},
"scripts": {
"prepare": "vite build && cp src/catalogueAPI.d.ts dist/",
"build": "vite build && cp src/catalogueAPI.d.ts dist/",
"prepare": "vite build",
"build": "vite build",
"build:dev": "vite build -m development",
"clean": "rm -rf coverage dist .eslintcache",
"dev": "vite --debug --cors -c=./vite.config.ts",
"lint": "eslint . --cache --cache-strategy content",
"lint:ci": "eslint . --quiet",
"lint:fix": "pnpm run lint --fix",
"preview": "vite preview",
"generateTypes": "openapi-typescript https://developer.tidal.com/apiref/api-specifications/api-public-catalogue-jsonapi/tidal-catalog-v2-openapi-3.0.json --output ./src/catalogueAPI.d.ts && echo \"/* eslint-disable */\n$(cat ./src/catalogueAPI.d.ts)\" > ./src/catalogueAPI.d.ts",
"generateTypes": "openapi-typescript https://developer.tidal.com/apiref/api-specifications/api-public-catalogue-jsonapi/tidal-catalog-v2-openapi-3.0.json --output ./src/catalogueAPI.ts && echo \"/* eslint-disable */\n$(cat ./src/catalogueAPI.ts)\" > ./src/catalogueAPI.ts",
"test": "vitest",
"test:coverage": "pnpm run test --coverage",
"test:ui": "pnpm run test:coverage --ui",
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions packages/playlist/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.2] - 2024-09-18

### Changed

- Make TS types easier to use with different `tsconfig` settings (was assuming `CommonJS`)

## [0.1.1] - 2024-09-17

### Changed
Expand Down
8 changes: 4 additions & 4 deletions packages/playlist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tidal-music/playlist",
"version": "0.1.1",
"version": "0.1.2",
"type": "module",
"files": [
"dist"
Expand All @@ -17,16 +17,16 @@
"import": "./dist/index.js"
},
"scripts": {
"prepare": "vite build && cp src/playlistAPI.d.ts dist/",
"build": "vite build && cp src/playlistAPI.d.ts dist/",
"prepare": "vite build",
"build": "vite build",
"build:dev": "vite build -m development",
"clean": "rm -rf coverage dist .eslintcache",
"dev": "vite --debug --cors -c=./vite.config.ts",
"lint": "eslint . --cache --cache-strategy content",
"lint:ci": "eslint . --quiet",
"lint:fix": "pnpm run lint --fix",
"preview": "vite preview",
"generateTypes": "openapi-typescript https://developer.tidal.com/apiref/api-specifications/api-public-user-content/tidal-user-content-openapi-3.0.json --output ./src/playlistAPI.d.ts && echo \"/* eslint-disable */\n$(cat ./src/playlistAPI.d.ts)\" > ./src/playlistAPI.d.ts",
"generateTypes": "openapi-typescript https://developer.tidal.com/apiref/api-specifications/api-public-user-content/tidal-user-content-openapi-3.0.json --output ./src/playlistAPI.ts && echo \"/* eslint-disable */\n$(cat ./src/playlistAPI.ts)\" > ./src/playlistAPI.ts",
"test": "vitest",
"test:coverage": "pnpm run test --coverage",
"test:ui": "pnpm run test:coverage --ui",
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions packages/search/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.2] - 2024-09-18

### Changed

- Make TS types easier to use with different `tsconfig` settings (was assuming `CommonJS`)

## [0.3.1] - 2024-09-17

### Changed
Expand Down
8 changes: 4 additions & 4 deletions packages/search/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tidal-music/search",
"version": "0.3.1",
"version": "0.3.2",
"type": "module",
"files": [
"dist"
Expand All @@ -17,16 +17,16 @@
"import": "./dist/index.js"
},
"scripts": {
"prepare": "vite build && cp src/searchAPI.d.ts dist/",
"build": "vite build && cp src/searchAPI.d.ts dist/",
"prepare": "vite build",
"build": "vite build",
"build:dev": "vite build -m development",
"clean": "rm -rf coverage dist .eslintcache",
"dev": "vite --debug --cors -c=./vite.config.ts",
"lint": "eslint . --cache --cache-strategy content",
"lint:ci": "eslint . --quiet",
"lint:fix": "pnpm run lint --fix",
"preview": "vite preview",
"generateTypes": "openapi-typescript https://developer.tidal.com/apiref/api-specifications/api-public-search-jsonapi/tidal-search-v2-openapi-3.0.json --output ./src/searchAPI.d.ts && echo \"/* eslint-disable */\n$(cat ./src/searchAPI.d.ts)\" > ./src/searchAPI.d.ts",
"generateTypes": "openapi-typescript https://developer.tidal.com/apiref/api-specifications/api-public-search-jsonapi/tidal-search-v2-openapi-3.0.json --output ./src/searchAPI.ts && echo \"/* eslint-disable */\n$(cat ./src/searchAPI.ts)\" > ./src/searchAPI.ts",
"test": "vitest",
"test:coverage": "pnpm run test --coverage",
"test:ui": "pnpm run test:coverage --ui",
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions packages/user/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.2] - 2024-09-18

### Changed

- Make TS types easier to use with different `tsconfig` settings (was assuming `CommonJS`)

## [0.1.1] - 2024-09-17

### Changed
Expand Down
8 changes: 4 additions & 4 deletions packages/user/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tidal-music/user",
"version": "0.1.1",
"version": "0.1.2",
"type": "module",
"files": [
"dist"
Expand All @@ -17,16 +17,16 @@
"import": "./dist/index.js"
},
"scripts": {
"prepare": "vite build && cp src/userAPI.d.ts dist/",
"build": "vite build && cp src/userAPI.d.ts dist/",
"prepare": "vite build",
"build": "vite build",
"build:dev": "vite build -m development",
"clean": "rm -rf coverage dist .eslintcache",
"dev": "vite --debug --cors -c=./vite.config.ts",
"lint": "eslint . --cache --cache-strategy content",
"lint:ci": "eslint . --quiet",
"lint:fix": "pnpm run lint --fix",
"preview": "vite preview",
"generateTypes": "openapi-typescript https://developer.tidal.com/apiref/api-specifications/api-public-user-jsonapi/tidal-user-v2-openapi-3.0.json --output ./src/userAPI.d.ts && echo \"/* eslint-disable */\n$(cat ./src/userAPI.d.ts)\" > ./src/userAPI.d.ts",
"generateTypes": "openapi-typescript https://developer.tidal.com/apiref/api-specifications/api-public-user-jsonapi/tidal-user-v2-openapi-3.0.json --output ./src/userAPI.ts && echo \"/* eslint-disable */\n$(cat ./src/userAPI.ts)\" > ./src/userAPI.ts",
"test": "vitest",
"test:coverage": "pnpm run test --coverage",
"test:ui": "pnpm run test:coverage --ui",
Expand Down
File renamed without changes.

0 comments on commit 14390a4

Please sign in to comment.