|
1 | | -# Palette SDK TypeScript |
| 1 | +<p align="center"> |
| 2 | + <img alt="svu Logo" src="https://becker.software/svu.png" height="300" /> |
| 3 | + <p align="center">semantic version utility</p> |
| 4 | +</p> |
2 | 5 |
|
3 | | -A TypeScript SDK for the Spectro Cloud Palette API. This package provides a comprehensive set of functions to manage Kubernetes clusters, applications, and cloud resources through the Palette API. |
| 6 | +<hr> |
4 | 7 |
|
5 | | -> [!WARNING] |
6 | | -> This is an experimental SDK and subject to change. |
| 8 | +<p align="center"> |
| 9 | +<a href="https://github.com/caarlos0/svu/releases/latest"><img src="https://img.shields.io/github/release/caarlos0/svu.svg?style=for-the-badge" alt="Release"></a> |
| 10 | +<a href="/LICENSE.md"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=for-the-badge" alt="Software License"></a> |
| 11 | +<a href="https://github.com/caarlos0/svu/actions?workflow=build"><img src="https://img.shields.io/github/actions/workflow/status/caarlos0/svu/build.yml?style=for-the-badge&branch=main" alt="Build status"></a> |
| 12 | +<a href="http://godoc.org/github.com/caarlos0/svu/v3"><img src="https://img.shields.io/badge/godoc-reference-blue.svg?style=for-the-badge" alt="Go Doc"></a> |
| 13 | +<a href="https://goreportcard.com/report/github.com/caarlos0/svu/v3"><img src="https://goreportcard.com/badge/github.com/caarlos0/svu/v3?style=for-the-badge" alt="GoReportCard"></a> |
| 14 | +<a href="https://conventionalcommits.org"><img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=for-the-badge" alt="Conventional Commits"></a> |
| 15 | +</p> |
7 | 16 |
|
8 | | -## Features |
9 | 17 |
|
10 | | -- **Complete API Coverage**: All Palette API endpoints are supported |
11 | | -- **Comprehensive TypeScript Support**: Full type definitions for all API requests and responses. |
12 | | -- **No Type Casting Required**: Clean, typed API calls without `any` casting |
13 | | -- **Fetch-based**: Built on the modern Fetch API |
14 | | -- **Tree-shakable**: Import only the functions you need |
| 18 | +semantic version utility (svu) is a small helper for release scripts and workflows. |
15 | 19 |
|
16 | | -## Installation |
| 20 | +It provides utility commands and functions to increase specific portions of the version. |
| 21 | +It can also figure the next version out automatically by looking through the git history. |
17 | 22 |
|
18 | | -```bash |
19 | | -npm install palette-sdk-typescript |
20 | | -``` |
| 23 | +> [!TIP] |
| 24 | +> Read [the spec][Semver] for more information. |
21 | 25 |
|
22 | | -> [!IMPORTANT] |
23 | | -> This package is published as TypeScript source code. You'll need TypeScript in your project to use it. If you're using JavaScript, you may need to configure your build tools to handle TypeScript files. |
| 26 | +## usage |
24 | 27 |
|
25 | | -- Node.js 22 or higher |
26 | | -- TypeScript 5.5 or higher |
27 | | -- A Palette API key and project UID |
| 28 | +Check `svu --help` for the list of sub-commands and flags. |
28 | 29 |
|
29 | | -## Getting Started |
| 30 | +### `next`, `n` |
30 | 31 |
|
31 | | -### Authentication |
| 32 | +This is probably the command you'll use the most. |
32 | 33 |
|
33 | | -To use the Palette API, you need an API key. Check the [Create API Key](https://docs.spectrocloud.com/user-management/authentication/api-key/create-api-key/) guide for more information. |
| 34 | +It checks your `git log`, and automatically increases and returns the new |
| 35 | +version based on this table: |
34 | 36 |
|
35 | | -Set the API key as an environment variable: |
| 37 | +| Commit message | Tag increase | |
| 38 | +| -------------------------------------------------------------------------------------- | ------------ | |
| 39 | +| `chore: foo` | Nothing | |
| 40 | +| `fix: fixed something` | Patch | |
| 41 | +| `feat: added new button to do X` | Minor | |
| 42 | +| `fix: fixed thing xyz`<br><br>`BREAKING CHANGE: this will break users because of blah` | Major | |
| 43 | +| `fix!: fixed something` | Major | |
| 44 | +| `feat!: added blah` | Major | |
36 | 45 |
|
37 | | -```bash |
38 | | -export PALETTE_API_KEY="your-api-key-here" |
39 | | -export PROJECT_UID="your-project-uid-here" |
| 46 | +> [!TIP] |
| 47 | +> You can create an alias to create tags automatically: |
| 48 | +> |
| 49 | +> ```bash |
| 50 | +> alias gtn='git tag $(svu next)' |
| 51 | +> ``` |
| 52 | +
|
| 53 | +## configuration |
| 54 | +
|
| 55 | +Every flag option can also be set in a `.svu.yml` in the current |
| 56 | +directory/repository root folder, for example: |
| 57 | +
|
| 58 | +```yaml |
| 59 | +tag.prefix: "" |
| 60 | +always: true |
| 61 | +v0: true |
40 | 62 | ``` |
41 | 63 |
|
42 | | -### Usage |
43 | | - |
44 | | -Import the specific API functions and types you need. |
45 | | - |
46 | | -```typescript |
47 | | -import { |
48 | | - spectroClustersMetadataGet, |
49 | | - setPaletteBaseUrl, |
50 | | - getPaletteBaseUrl, |
51 | | - type SpectroClustersMetadata, |
52 | | -} from "palette-sdk-typescript"; |
53 | | - |
54 | | -// Configure authentication |
55 | | -const config = { |
56 | | - headers: { |
57 | | - ApiKey: process.env.PALETTE_API_KEY, |
58 | | - "Content-Type": "application/json", |
59 | | - ProjectUID: process.env.PROJECT_UID, // Optional, for project-scoped requests |
60 | | - }, |
61 | | - // Configure custom base URL (optional) |
62 | | - // By default, the SDK uses https://api.spectrocloud.com |
63 | | - baseUrl: "https://your-palette-host.com", |
64 | | -}; |
65 | | - |
66 | | -// Get all clusters |
67 | | -const response: SpectroClustersMetadata = await spectroClustersMetadataGet( |
68 | | - {}, // no filter params provided in this example |
69 | | - config |
70 | | -); |
71 | | - |
72 | | -if (response.items && response.items.length > 0) { |
73 | | - console.log("First cluster metadata:", response.items[0]); |
74 | | -} |
| 64 | +Names are the same as the flags themselves. |
| 65 | + |
| 66 | +## install |
| 67 | + |
| 68 | +[](https://repology.org/project/svu/versions) |
| 69 | + |
| 70 | +<details> |
| 71 | + <summary>macOS</summary> |
| 72 | + |
| 73 | +```bash |
| 74 | +brew install caarlos0/tap/svu |
75 | 75 | ``` |
76 | 76 |
|
77 | | -If a project UID is not specified, then the Palette API will use the tenant scope. Keep this in mind when using the SDK. There may be some cases where you want to use the tenant scope. |
| 77 | +</details> |
78 | 78 |
|
79 | | -### Base URL Configuration |
| 79 | +<details> |
| 80 | + <summary>linux/apt</summary> |
80 | 81 |
|
81 | | -By default, the PaletteSDK targets `https://api.spectrocloud.com`. If you have a different Palette instance, such as a self-hosted Palette instance, you can configure the base URL. |
| 82 | +```bash |
| 83 | +echo 'deb [trusted=yes] https://apt.fury.io/caarlos0/ /' | sudo tee /etc/apt/sources.list.d/caarlos0.list |
| 84 | +sudo apt update |
| 85 | +sudo apt install svu |
| 86 | +``` |
| 87 | + |
| 88 | +</details> |
82 | 89 |
|
83 | | -```typescript |
84 | | -const config = { |
85 | | - headers: { |
86 | | - ApiKey: process.env.PALETTE_API_KEY, |
87 | | - "Content-Type": "application/json", |
88 | | - ProjectUID: process.env.PROJECT_UID, |
89 | | - }, |
90 | | - // Set custom base URL |
91 | | - baseUrl: "https://your-palette-host.com", |
92 | | -}; |
| 90 | +<details> |
| 91 | + <summary>linux/yum</summary> |
93 | 92 |
|
94 | | -const response: SpectroClustersMetadata = await spectroClustersMetadataGet( |
95 | | - {}, |
96 | | - config |
97 | | -); |
| 93 | +```bash |
| 94 | +echo '[caarlos0] |
| 95 | +name=caarlos0 |
| 96 | +baseurl=https://yum.fury.io/caarlos0/ |
| 97 | +enabled=1 |
| 98 | +gpgcheck=0' | sudo tee /etc/yum.repos.d/caarlos0.repo |
| 99 | +sudo yum install svu |
98 | 100 | ``` |
99 | 101 |
|
100 | | -The SDK will now use your custom URL(`https://your-palette-host.com`) for all API calls. |
| 102 | +</details> |
| 103 | + |
| 104 | +<details> |
| 105 | + <summary>docker</summary> |
101 | 106 |
|
102 | | -## Contributing |
| 107 | +```bash |
| 108 | +docker run --rm -v $PWD:/tmp --workdir /tmp ghcr.io/caarlos0/svu --help |
| 109 | +``` |
| 110 | + |
| 111 | +</details> |
103 | 112 |
|
104 | | -This SDK is generated from the Palette OpenAPI specification. To contribute: |
| 113 | +<details> |
| 114 | + <summary><code>go install</code></summary> |
105 | 115 |
|
106 | | -1. Fork the repository |
107 | | -2. Make your changes |
108 | | -3. Run tests: `npm test` |
109 | | -4. Submit a pull request |
| 116 | +```bash |
| 117 | +go install github.com/caarlos0/svu/v3@latest |
| 118 | +``` |
110 | 119 |
|
111 | | -### Requirements |
| 120 | +</details> |
112 | 121 |
|
113 | | -- Node.js 22 or higher |
114 | | -- Python 3.10 or higher |
115 | | -- Make |
116 | | -- [Copywrite](https://github.com/hashicorp/copywrite) |
117 | | -- Docker |
| 122 | +<details> |
| 123 | + <summary>manually</summary> |
118 | 124 |
|
119 | | -## License |
| 125 | +Or download one from the [releases tab](https://github.com/caarlos0/svu/releases) and install manually. |
120 | 126 |
|
121 | | -This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details. |
| 127 | +</details> |
122 | 128 |
|
123 | | -## Support |
| 129 | +## stargazers over time |
124 | 130 |
|
125 | | -For issues and questions: |
| 131 | +[](https://starchart.cc/caarlos0/svu) |
126 | 132 |
|
127 | | -- **SDK Issues**: Open an issue on GitHub. |
128 | | -- **API Documentation**: Visit the [Palette API Documentation](https://docs.spectrocloud.com/api/) |
129 | | -- **Palette Support**: Contact Spectro Cloud support |
| 133 | +[Semver]: https://semver.org |
130 | 134 |
|
131 | | -## Related Projects |
| 135 | +--- |
132 | 136 |
|
133 | | -- [Palette Terraform Provider](https://github.com/spectrocloud/terraform-provider-spectrocloud) |
134 | | -- [Palette CLI](https://github.com/spectrocloud/palette-cli) |
135 | | -- [Palette Go SDK](https://github.com/spectrocloud/palette-sdk-go) |
| 137 | +Logo art and concept by [@carinebecker](https://github.com/carinebecker). |
0 commit comments