@fubar-it-co/tmdb-client 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +157 -72
- package/dist/client/@tanstack/react-query.gen.d.ts +35859 -0
- package/dist/client/@tanstack/react-query.gen.d.ts.map +1 -0
- package/dist/client/@tanstack/react-query.gen.js +4003 -0
- package/dist/client/@tanstack/react-query.gen.js.map +1 -0
- package/dist/client/client/client.gen.d.ts +3 -0
- package/dist/client/client/client.gen.d.ts.map +1 -0
- package/dist/client/client/client.gen.js +236 -0
- package/dist/client/client/client.gen.js.map +1 -0
- package/dist/client/client/index.d.ts +9 -0
- package/dist/client/client/index.d.ts.map +1 -0
- package/dist/client/client/index.js +8 -0
- package/dist/client/client/index.js.map +1 -0
- package/dist/client/client/types.gen.d.ts +118 -0
- package/dist/client/client/types.gen.d.ts.map +1 -0
- package/dist/client/client/types.gen.js +4 -0
- package/dist/client/client/types.gen.js.map +1 -0
- package/dist/client/client/utils.gen.d.ts +34 -0
- package/dist/client/client/utils.gen.d.ts.map +1 -0
- package/dist/client/client/utils.gen.js +230 -0
- package/dist/client/client/utils.gen.js.map +1 -0
- package/{src/client/client.gen.ts → dist/client/client.gen.d.ts} +3 -9
- package/dist/client/client.gen.d.ts.map +1 -0
- package/dist/client/client.gen.js +6 -0
- package/dist/client/client.gen.js.map +1 -0
- package/dist/client/core/auth.gen.d.ts +19 -0
- package/dist/client/core/auth.gen.d.ts.map +1 -0
- package/dist/client/core/auth.gen.js +16 -0
- package/dist/client/core/auth.gen.js.map +1 -0
- package/dist/client/core/bodySerializer.gen.d.ts +26 -0
- package/dist/client/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/client/core/bodySerializer.gen.js +59 -0
- package/dist/client/core/bodySerializer.gen.js.map +1 -0
- package/dist/client/core/params.gen.d.ts +44 -0
- package/dist/client/core/params.gen.d.ts.map +1 -0
- package/dist/client/core/params.gen.js +102 -0
- package/dist/client/core/params.gen.js.map +1 -0
- package/dist/client/core/pathSerializer.gen.d.ts +34 -0
- package/dist/client/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/client/core/pathSerializer.gen.js +108 -0
- package/dist/client/core/pathSerializer.gen.js.map +1 -0
- package/dist/client/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/client/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/client/core/queryKeySerializer.gen.js +94 -0
- package/dist/client/core/queryKeySerializer.gen.js.map +1 -0
- package/dist/client/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/client/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/client/core/serverSentEvents.gen.js +135 -0
- package/dist/client/core/serverSentEvents.gen.js.map +1 -0
- package/dist/client/core/types.gen.d.ts +79 -0
- package/dist/client/core/types.gen.d.ts.map +1 -0
- package/dist/client/core/types.gen.js +4 -0
- package/dist/client/core/types.gen.js.map +1 -0
- package/dist/client/core/utils.gen.d.ts +20 -0
- package/dist/client/core/utils.gen.d.ts.map +1 -0
- package/dist/client/core/utils.gen.js +89 -0
- package/dist/client/core/utils.gen.js.map +1 -0
- package/{src/client/index.ts → dist/client/index.d.ts} +2 -4
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +5 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/sdk.gen.d.ts +882 -0
- package/dist/client/sdk.gen.d.ts.map +1 -0
- package/dist/client/sdk.gen.js +1514 -0
- package/dist/client/sdk.gen.js.map +1 -0
- package/{src/client/types.gen.ts → dist/client/types.gen.d.ts} +8 -462
- package/dist/client/types.gen.d.ts.map +1 -0
- package/dist/client/types.gen.js +4 -0
- package/dist/client/types.gen.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/{src/index.ts → dist/index.js} +2 -5
- package/dist/index.js.map +1 -0
- package/{src/tmdb-config.ts → dist/tmdb-config.d.ts} +3 -25
- package/dist/tmdb-config.d.ts.map +1 -0
- package/dist/tmdb-config.js +31 -0
- package/dist/tmdb-config.js.map +1 -0
- package/{src/types/errors.ts → dist/types/errors.d.ts} +7 -6
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +2 -0
- package/dist/types/errors.js.map +1 -0
- package/package.json +21 -15
- package/.eslintignore +0 -1
- package/eslint.config.js +0 -15
- package/openapi-ts.config.ts +0 -43
- package/publish-local.sh +0 -86
- package/publish.sh +0 -114
- package/scripts/add-ts-nocheck.js +0 -85
- package/src/client/@tanstack/react-query.gen.ts +0 -4398
- package/src/client/client/client.gen.ts +0 -289
- package/src/client/client/index.ts +0 -26
- package/src/client/client/types.gen.ts +0 -214
- package/src/client/client/utils.gen.ts +0 -317
- package/src/client/core/auth.gen.ts +0 -42
- package/src/client/core/bodySerializer.gen.ts +0 -85
- package/src/client/core/params.gen.ts +0 -170
- package/src/client/core/pathSerializer.gen.ts +0 -172
- package/src/client/core/queryKeySerializer.gen.ts +0 -118
- package/src/client/core/serverSentEvents.gen.ts +0 -244
- package/src/client/core/types.gen.ts +0 -105
- package/src/client/core/utils.gen.ts +0 -141
- package/src/client/sdk.gen.ts +0 -1682
- package/src/vite-env.d.ts +0 -9
- package/tsconfig.build.json +0 -12
- package/tsconfig.json +0 -17
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* @fileoverview TMDB API client runtime configuration.
|
|
5
3
|
*
|
|
@@ -11,14 +9,7 @@
|
|
|
11
9
|
*
|
|
12
10
|
* @see https://heyapi.dev/openapi-ts/clients/fetch#runtime-api
|
|
13
11
|
*/
|
|
14
|
-
import type { Config } from './client/client/types.gen'
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* TMDB API Bearer token from environment variables.
|
|
18
|
-
* Must be set in `.env.local` at the monorepo root.
|
|
19
|
-
*/
|
|
20
|
-
const TMDB_API_TOKEN = import.meta.env.VITE_TMDB_API_TOKEN
|
|
21
|
-
|
|
12
|
+
import type { Config } from './client/client/types.gen';
|
|
22
13
|
/**
|
|
23
14
|
* Creates the client configuration for TMDB API requests.
|
|
24
15
|
*
|
|
@@ -30,18 +21,5 @@ const TMDB_API_TOKEN = import.meta.env.VITE_TMDB_API_TOKEN
|
|
|
30
21
|
* @param config - The default configuration from heyAPI
|
|
31
22
|
* @returns The merged configuration with TMDB-specific settings
|
|
32
23
|
*/
|
|
33
|
-
export const createClientConfig
|
|
34
|
-
|
|
35
|
-
config.headers && !Array.isArray(config.headers)
|
|
36
|
-
? (config.headers as Record<string, string>)
|
|
37
|
-
: {}
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
...config,
|
|
41
|
-
baseUrl: 'https://api.themoviedb.org',
|
|
42
|
-
headers: {
|
|
43
|
-
...existingHeaders,
|
|
44
|
-
Authorization: `Bearer ${TMDB_API_TOKEN}`,
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
}
|
|
24
|
+
export declare const createClientConfig: <T extends Config>(config: T) => T;
|
|
25
|
+
//# sourceMappingURL=tmdb-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmdb-config.d.ts","sourceRoot":"","sources":["../src/tmdb-config.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAQvD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,UAAU,CAAC,KAAG,CAchE,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
/**
|
|
3
|
+
* TMDB API Bearer token from environment variables.
|
|
4
|
+
* Must be set in `.env.local` at the monorepo root.
|
|
5
|
+
*/
|
|
6
|
+
const TMDB_API_TOKEN = import.meta.env.VITE_TMDB_API_TOKEN;
|
|
7
|
+
/**
|
|
8
|
+
* Creates the client configuration for TMDB API requests.
|
|
9
|
+
*
|
|
10
|
+
* This function is called by the generated `client.gen.ts` before
|
|
11
|
+
* initializing the client instance. It sets:
|
|
12
|
+
* - `baseUrl`: The TMDB API base URL
|
|
13
|
+
* - `Authorization`: Bearer token for authentication
|
|
14
|
+
*
|
|
15
|
+
* @param config - The default configuration from heyAPI
|
|
16
|
+
* @returns The merged configuration with TMDB-specific settings
|
|
17
|
+
*/
|
|
18
|
+
export const createClientConfig = (config) => {
|
|
19
|
+
const existingHeaders = config.headers && !Array.isArray(config.headers)
|
|
20
|
+
? config.headers
|
|
21
|
+
: {};
|
|
22
|
+
return {
|
|
23
|
+
...config,
|
|
24
|
+
baseUrl: 'https://api.themoviedb.org',
|
|
25
|
+
headers: {
|
|
26
|
+
...existingHeaders,
|
|
27
|
+
Authorization: `Bearer ${TMDB_API_TOKEN}`,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=tmdb-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmdb-config.js","sourceRoot":"","sources":["../src/tmdb-config.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAerC;;;GAGG;AACH,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAA;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAmB,MAAS,EAAK,EAAE;IACnE,MAAM,eAAe,GACnB,MAAM,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QAC9C,CAAC,CAAE,MAAM,CAAC,OAAkC;QAC5C,CAAC,CAAC,EAAE,CAAA;IAER,OAAO;QACL,GAAG,MAAM;QACT,OAAO,EAAE,4BAA4B;QACrC,OAAO,EAAE;YACP,GAAG,eAAe;YAClB,aAAa,EAAE,UAAU,cAAc,EAAE;SAC1C;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -23,10 +23,11 @@
|
|
|
23
23
|
* }
|
|
24
24
|
*/
|
|
25
25
|
export interface TMDBError {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
/** Always false for error responses */
|
|
27
|
+
success: false;
|
|
28
|
+
/** TMDB internal status code (e.g., 7 for invalid API key, 34 for not found) */
|
|
29
|
+
status_code: number;
|
|
30
|
+
/** Human-readable error message */
|
|
31
|
+
status_message: string;
|
|
32
32
|
}
|
|
33
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,SAAS;IACxB,uCAAuC;IACvC,OAAO,EAAE,KAAK,CAAA;IACd,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAA;IACnB,mCAAmC;IACnC,cAAc,EAAE,MAAM,CAAA;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fubar-it-co/tmdb-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "TMDB API client generated with heyAPI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,8 +15,26 @@
|
|
|
15
15
|
"types": "./dist/client/index.d.ts"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
+
"files": [
|
|
19
|
+
"CHANGELOG.md",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"README.md",
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
18
24
|
"publishConfig": {
|
|
19
|
-
"access": "
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@tanstack/react-query": "5.74.4"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"conventional-changelog": "7.2.0",
|
|
32
|
+
"@eslint/js": "9.21.0",
|
|
33
|
+
"@hey-api/openapi-ts": "^0.92.3",
|
|
34
|
+
"eslint": "^9.0.0",
|
|
35
|
+
"typescript": "5.7.2",
|
|
36
|
+
"typescript-eslint": "8.24.1",
|
|
37
|
+
"vite": "6.3.4"
|
|
20
38
|
},
|
|
21
39
|
"scripts": {
|
|
22
40
|
"clean": "rm -rf dist",
|
|
@@ -30,17 +48,5 @@
|
|
|
30
48
|
"release:patch": "pnpm build && ./publish.sh patch",
|
|
31
49
|
"release:minor": "pnpm build && ./publish.sh minor",
|
|
32
50
|
"release:major": "pnpm build && ./publish.sh major"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@tanstack/react-query": "catalog:"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"conventional-changelog": "catalog:",
|
|
39
|
-
"@eslint/js": "catalog:",
|
|
40
|
-
"@hey-api/openapi-ts": "^0.92.3",
|
|
41
|
-
"eslint": "^9.0.0",
|
|
42
|
-
"typescript": "catalog:",
|
|
43
|
-
"typescript-eslint": "catalog:",
|
|
44
|
-
"vite": "catalog:"
|
|
45
51
|
}
|
|
46
|
-
}
|
|
52
|
+
}
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
src/client
|
package/eslint.config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview ESLint configuration for http-client package.
|
|
3
|
-
*
|
|
4
|
-
* Generated client files in src/client/ are ignored via .eslintignore.
|
|
5
|
-
*/
|
|
6
|
-
import js from '@eslint/js'
|
|
7
|
-
import tseslint from 'typescript-eslint'
|
|
8
|
-
|
|
9
|
-
export default tseslint.config(
|
|
10
|
-
js.configs.recommended,
|
|
11
|
-
...tseslint.configs.recommended,
|
|
12
|
-
{
|
|
13
|
-
ignores: ['src/client/**'],
|
|
14
|
-
}
|
|
15
|
-
)
|
package/openapi-ts.config.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview heyAPI OpenAPI-to-TypeScript configuration.
|
|
3
|
-
*
|
|
4
|
-
* This configuration file tells heyAPI how to generate the TMDB API client.
|
|
5
|
-
*
|
|
6
|
-
* ## Generated files (in `./src/client/`):
|
|
7
|
-
* - `types.gen.ts` - TypeScript interfaces for all API types
|
|
8
|
-
* - `sdk.gen.ts` - SDK functions for each API endpoint
|
|
9
|
-
* - `client.gen.ts` - HTTP client instance
|
|
10
|
-
* - `tanstack-query.gen.ts` - TanStack Query options and hooks
|
|
11
|
-
*
|
|
12
|
-
* ## Plugins used:
|
|
13
|
-
* - `@hey-api/typescript` - Generates TypeScript types from OpenAPI schemas
|
|
14
|
-
* - `@hey-api/sdk` - Generates SDK functions (e.g., `moviePopularList()`)
|
|
15
|
-
* - `@hey-api/client-fetch` - Fetch API-based HTTP client
|
|
16
|
-
* - `@tanstack/react-query` - TanStack Query integration
|
|
17
|
-
*
|
|
18
|
-
* ## Usage:
|
|
19
|
-
* Run `pnpm generate` to regenerate the client after OpenAPI spec changes.
|
|
20
|
-
*
|
|
21
|
-
* @see https://heyapi.dev/openapi-ts/configuration
|
|
22
|
-
*/
|
|
23
|
-
import { defineConfig } from '@hey-api/openapi-ts'
|
|
24
|
-
|
|
25
|
-
export default defineConfig({
|
|
26
|
-
input: 'https://developer.themoviedb.org/openapi/tmdb-api.json',
|
|
27
|
-
output: {
|
|
28
|
-
path: './src/client',
|
|
29
|
-
},
|
|
30
|
-
plugins: [
|
|
31
|
-
'@hey-api/typescript',
|
|
32
|
-
'@hey-api/sdk',
|
|
33
|
-
{
|
|
34
|
-
name: '@hey-api/client-fetch',
|
|
35
|
-
runtimeConfigPath: '../tmdb-config.ts',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: '@tanstack/react-query',
|
|
39
|
-
queryOptions: true,
|
|
40
|
-
mutationOptions: true,
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
})
|
package/publish-local.sh
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Set default version type to patch if not provided
|
|
4
|
-
VERSION_TYPE="${1:-patch}"
|
|
5
|
-
|
|
6
|
-
# Validate version type argument
|
|
7
|
-
if [[ ! "$VERSION_TYPE" =~ ^(patch|minor|major)$ ]]; then
|
|
8
|
-
echo -e "\033[0;31mError: Invalid version type. Must be one of: patch, minor, major\033[0m"
|
|
9
|
-
exit 1
|
|
10
|
-
fi
|
|
11
|
-
|
|
12
|
-
RED='\033[0;31m'
|
|
13
|
-
GREEN='\033[0;32m'
|
|
14
|
-
YELLOW='\033[1;33m'
|
|
15
|
-
NC='\033[0m'
|
|
16
|
-
|
|
17
|
-
log() {
|
|
18
|
-
echo -e "${2:-$GREEN}$1${NC}"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
check_status() {
|
|
22
|
-
if [ $? -eq 0 ]; then
|
|
23
|
-
log "✓ $1 completed successfully"
|
|
24
|
-
else
|
|
25
|
-
log "✗ $1 failed" "$RED"
|
|
26
|
-
exit 1
|
|
27
|
-
fi
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
log "Checking if Verdaccio is running..." "$YELLOW"
|
|
31
|
-
curl -s http://localhost:4873 > /dev/null
|
|
32
|
-
if [ $? -ne 0 ]; then
|
|
33
|
-
log "Verdaccio is not running on localhost:4873" "$RED"
|
|
34
|
-
exit 1
|
|
35
|
-
fi
|
|
36
|
-
check_status "Verdaccio connection"
|
|
37
|
-
|
|
38
|
-
# Go to package directory first
|
|
39
|
-
cd "$(dirname "$0")" || exit 1
|
|
40
|
-
|
|
41
|
-
# Load token from .env
|
|
42
|
-
if [ -f ../../.env ]; then
|
|
43
|
-
export $(cat ../../.env | grep -v '^#' | xargs)
|
|
44
|
-
else
|
|
45
|
-
log ".env has not been found"
|
|
46
|
-
fi
|
|
47
|
-
|
|
48
|
-
if [ -z "$VERDACCIO_TOKEN" ]; then
|
|
49
|
-
log "VERDACCIO_TOKEN not set in .env" "$RED"
|
|
50
|
-
exit 1
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
# Create .npmrc with token
|
|
54
|
-
log "Configuring npm authentication..." "$YELLOW"
|
|
55
|
-
cat > .npmrc << EOL
|
|
56
|
-
//localhost:4873/:_authToken="$VERDACCIO_TOKEN"
|
|
57
|
-
registry=http://localhost:4873/
|
|
58
|
-
EOL
|
|
59
|
-
check_status "NPM authentication"
|
|
60
|
-
|
|
61
|
-
log "Building package..." "$YELLOW"
|
|
62
|
-
pnpm build
|
|
63
|
-
check_status "Build"
|
|
64
|
-
|
|
65
|
-
#log "Creating new version..." "$YELLOW"
|
|
66
|
-
#pnpm version "$VERSION_TYPE"
|
|
67
|
-
#check_status "Version bump"
|
|
68
|
-
|
|
69
|
-
log "Publishing to Verdaccio..." "$YELLOW"
|
|
70
|
-
npm publish --userconfig .npmrc
|
|
71
|
-
check_status "Publish"
|
|
72
|
-
|
|
73
|
-
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
74
|
-
|
|
75
|
-
log "Creating git tag..." "$YELLOW"
|
|
76
|
-
git tag -a "http-client-v${CURRENT_VERSION}" -m "http-client Version ${CURRENT_VERSION}" || true
|
|
77
|
-
check_status "Tag creation"
|
|
78
|
-
|
|
79
|
-
#log "Creating git tag..." "$YELLOW"
|
|
80
|
-
#git tag -a "http-client-v${CURRENT_VERSION}" -m "http-client Version ${CURRENT_VERSION}" || true
|
|
81
|
-
#check_status "Tag creation"
|
|
82
|
-
|
|
83
|
-
log "🎉 Package published! Version: ${CURRENT_VERSION}" "$GREEN"
|
|
84
|
-
|
|
85
|
-
# Cleanup
|
|
86
|
-
rm -f .npmrc
|
package/publish.sh
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Make the script executable in MacOS: chmod +x publish.sh
|
|
4
|
-
|
|
5
|
-
# You have to be logged in to npm before running this script.
|
|
6
|
-
# You have to have NPM_TOKEN in your .env file
|
|
7
|
-
|
|
8
|
-
# Colors for output
|
|
9
|
-
RED='\033[0;31m'
|
|
10
|
-
GREEN='\033[0;32m'
|
|
11
|
-
YELLOW='\033[1;33m'
|
|
12
|
-
NC='\033[0m' # No Color
|
|
13
|
-
|
|
14
|
-
# Set default version type to patch if not provided
|
|
15
|
-
VERSION_TYPE="${1:-patch}"
|
|
16
|
-
|
|
17
|
-
# Validate version type argument
|
|
18
|
-
if [[ ! "$VERSION_TYPE" =~ ^(patch|minor|major)$ ]]; then
|
|
19
|
-
echo -e "\033[0;31mError: Invalid version type. Must be one of: patch, minor, major\033[0m"
|
|
20
|
-
exit 1
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
# Function to log messages
|
|
24
|
-
log() {
|
|
25
|
-
echo -e "${2:-$GREEN}$1${NC}"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
# Function to check if command was successful
|
|
29
|
-
check_status() {
|
|
30
|
-
if [ $? -eq 0 ]; then
|
|
31
|
-
log "✓ $1 completed successfully"
|
|
32
|
-
else
|
|
33
|
-
log "✗ $1 failed" "$RED"
|
|
34
|
-
exit 1
|
|
35
|
-
fi
|
|
36
|
-
}
|
|
37
|
-
# Load environment variables from .env file (root of monorepo)
|
|
38
|
-
if [ -f ../../.env ]; then
|
|
39
|
-
log "Loading environment variables from .env file..." "$YELLOW"
|
|
40
|
-
export $(cat ../../.env | grep -v '^#' | xargs)
|
|
41
|
-
else
|
|
42
|
-
log ".env file not found at root. Please create one" "$RED"
|
|
43
|
-
exit 1
|
|
44
|
-
fi
|
|
45
|
-
|
|
46
|
-
# Check for NPM_TOKEN
|
|
47
|
-
if [ -z "$NPM_TOKEN" ]; then
|
|
48
|
-
log "NPM_TOKEN is not set in .env file" "$RED"
|
|
49
|
-
log "Please add your NPM_TOKEN to the .env file" "$YELLOW"
|
|
50
|
-
exit 1
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
# Check git tags configuration
|
|
54
|
-
log "Configuring git..." "$YELLOW"
|
|
55
|
-
git config --local version.commitTag true
|
|
56
|
-
git config --local tag.gpgSign false
|
|
57
|
-
git config --local version.tagName "v%s"
|
|
58
|
-
check_status "Git configuration"
|
|
59
|
-
|
|
60
|
-
# Create or update .npmrc file with the token
|
|
61
|
-
log "Configuring npm authentication..." "$YELLOW"
|
|
62
|
-
cat > .npmrc << EOL
|
|
63
|
-
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
|
64
|
-
registry=https://registry.npmjs.org/
|
|
65
|
-
@fubar-it-co:registry=https://registry.npmjs.org/
|
|
66
|
-
always-auth=true
|
|
67
|
-
|
|
68
|
-
# pnpm specific settings
|
|
69
|
-
strict-peer-dependencies=false
|
|
70
|
-
auto-install-peers=true
|
|
71
|
-
resolution-mode=highest
|
|
72
|
-
public-hoist-pattern[]=@storybook/*
|
|
73
|
-
EOL
|
|
74
|
-
check_status "NPM authentication configuration"
|
|
75
|
-
|
|
76
|
-
# Build
|
|
77
|
-
log "Building package..." "$YELLOW"
|
|
78
|
-
pnpm build
|
|
79
|
-
check_status "Build"
|
|
80
|
-
|
|
81
|
-
log "Creating new version..." "$YELLOW"
|
|
82
|
-
pnpm version "$VERSION_TYPE"
|
|
83
|
-
check_status "Version bump"
|
|
84
|
-
|
|
85
|
-
# Generate changelog
|
|
86
|
-
log "Generating changelog..." "$YELLOW"
|
|
87
|
-
pnpm exec conventional-changelog -p angular -r 0 > CHANGELOG.md
|
|
88
|
-
check_status "Changelog generation"
|
|
89
|
-
|
|
90
|
-
# Add changelog to git
|
|
91
|
-
git add CHANGELOG.md
|
|
92
|
-
git commit -m "docs(http-client): update changelog for version bump" --no-verify
|
|
93
|
-
check_status "Changelog commit"
|
|
94
|
-
|
|
95
|
-
log "Publishing package..." "$YELLOW"
|
|
96
|
-
npm publish --userconfig .npmrc --no-git-checks
|
|
97
|
-
check_status "Publish"
|
|
98
|
-
|
|
99
|
-
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
100
|
-
log "Ensuring tag http-client-v${CURRENT_VERSION} exists..." "$YELLOW"
|
|
101
|
-
git tag -a "http-client-v${CURRENT_VERSION}" -m "http-client Version ${CURRENT_VERSION}" || true
|
|
102
|
-
check_status "Tag creation"
|
|
103
|
-
|
|
104
|
-
log "Pushing new version to repository..." "$YELLOW"
|
|
105
|
-
git push origin main && git push origin --tags
|
|
106
|
-
check_status "Git push"
|
|
107
|
-
|
|
108
|
-
# Clean up - remove .npmrc file and unset environment variables
|
|
109
|
-
log "Cleaning up..." "$YELLOW"
|
|
110
|
-
rm -f .npmrc
|
|
111
|
-
unset NPM_TOKEN
|
|
112
|
-
check_status "Cleanup"
|
|
113
|
-
|
|
114
|
-
log "🎉 Package published successfully!" "$GREEN"
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Post-generation script to add @ts-nocheck to generated files
|
|
3
|
-
* and ensure TanStack Query exports are included.
|
|
4
|
-
*
|
|
5
|
-
* This script runs after heyAPI generates the client files.
|
|
6
|
-
* It adds `// @ts-nocheck` to the top of generated .ts files to prevent
|
|
7
|
-
* TypeScript errors from the generated code (e.g., duplicate Content-Type headers).
|
|
8
|
-
*
|
|
9
|
-
* Usage: Called automatically by `pnpm generate`
|
|
10
|
-
*/
|
|
11
|
-
import { readdir, readFile, writeFile, stat } from 'node:fs/promises'
|
|
12
|
-
import { join } from 'node:path'
|
|
13
|
-
import { fileURLToPath } from 'node:url'
|
|
14
|
-
|
|
15
|
-
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
|
16
|
-
const clientDir = join(__dirname, '..', 'src', 'client')
|
|
17
|
-
|
|
18
|
-
async function processDirectory(dir, relativePath = '') {
|
|
19
|
-
const entries = await readdir(dir, { withFileTypes: true })
|
|
20
|
-
|
|
21
|
-
for (const entry of entries) {
|
|
22
|
-
const fullPath = join(dir, entry.name)
|
|
23
|
-
|
|
24
|
-
if (entry.isDirectory()) {
|
|
25
|
-
await processDirectory(fullPath, join(relativePath, entry.name))
|
|
26
|
-
} else if (entry.name.endsWith('.ts')) {
|
|
27
|
-
const content = await readFile(fullPath, 'utf-8')
|
|
28
|
-
|
|
29
|
-
// Skip if already has @ts-nocheck
|
|
30
|
-
if (content.includes('// @ts-nocheck')) {
|
|
31
|
-
continue
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Add @ts-nocheck after the auto-generated comment
|
|
35
|
-
let newContent = content.replace(
|
|
36
|
-
'// This file is auto-generated by @hey-api/openapi-ts',
|
|
37
|
-
'// This file is auto-generated by @hey-api/openapi-ts\n// @ts-nocheck'
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
// Fix imports from .ts to .js for compiled files
|
|
41
|
-
newContent = newContent.replace(/from ['"]([^'"]+)\.ts['"]/g, "from '$1.js'")
|
|
42
|
-
|
|
43
|
-
await writeFile(fullPath, newContent, 'utf-8')
|
|
44
|
-
console.log(`Added @ts-nocheck to ${join(relativePath, entry.name)}`)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function addTanStackQueryExport() {
|
|
50
|
-
const indexPath = join(clientDir, 'index.ts')
|
|
51
|
-
const tanstackDir = join(clientDir, '@tanstack')
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
await stat(tanstackDir)
|
|
55
|
-
} catch {
|
|
56
|
-
console.log('No @tanstack directory found, skipping export addition')
|
|
57
|
-
return
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const content = await readFile(indexPath, 'utf-8')
|
|
61
|
-
|
|
62
|
-
// Check if already exported
|
|
63
|
-
if (content.includes('@tanstack/react-query.gen')) {
|
|
64
|
-
console.log('TanStack Query already exported')
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Add export for TanStack Query
|
|
69
|
-
const newContent = content + "export * from './@tanstack/react-query.gen'\n"
|
|
70
|
-
await writeFile(indexPath, newContent, 'utf-8')
|
|
71
|
-
console.log('Added TanStack Query export to index.ts')
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async function main() {
|
|
75
|
-
try {
|
|
76
|
-
await processDirectory(clientDir)
|
|
77
|
-
await addTanStackQueryExport()
|
|
78
|
-
console.log('Done!')
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error('Error in post-generation script:', error)
|
|
81
|
-
process.exit(1)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
main()
|