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

Publish generator and client to npm #240

Merged
merged 37 commits into from
May 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8838e5b
move generator and client into directories in packages/
david-crespo May 1, 2024
aafdfda
move package.json into generator package dir
david-crespo May 1, 2024
573f19e
rework gen.sh so it can be run from anywhere, take gen script out of …
david-crespo May 1, 2024
75d2002
add tsup, rename openapi-gen to openapi-gen-ts
david-crespo May 1, 2024
bcd9598
put config in package.json
david-crespo May 1, 2024
e0bf5ca
move stuff into src dir
david-crespo May 1, 2024
383a9b0
try to make CI work
david-crespo May 1, 2024
e04ea7c
put tsconfig where it belongs, whoops
david-crespo May 1, 2024
c4d22a3
put some stuff in package.json like we're really gonna publish
david-crespo May 1, 2024
c586506
maybe make CI linting work
david-crespo May 1, 2024
a10aa79
try to fix update spec action
david-crespo May 1, 2024
fe4393f
Autogenerate config update
github-actions[bot] May 1, 2024
4f34215
try crunchbang
david-crespo May 1, 2024
1c30222
fix exports and main
david-crespo May 1, 2024
8048a0f
0.1.1
david-crespo May 1, 2024
66948ce
Autogenerate config update
github-actions[bot] May 1, 2024
dc54f18
0.1.2
david-crespo May 1, 2024
6355756
0.1.3
david-crespo May 1, 2024
25af23e
remove publish command
david-crespo May 1, 2024
d1d92c4
fix bin name, 0.1.4
david-crespo May 1, 2024
35cb68a
switch bin to cjs
david-crespo May 1, 2024
fea1189
npm pkg fix
david-crespo May 1, 2024
e793eff
use tsup-node! yes!
david-crespo May 1, 2024
757d008
try different approach to static files
david-crespo May 1, 2024
1fcb6a0
add tsup and package.json for @oxide/api, move src into src/
david-crespo May 2, 2024
8386d58
try adding /validate sub export with zod
david-crespo May 2, 2024
07b8ee7
give each package its own readme
david-crespo May 3, 2024
e50d4fd
bump package versions
david-crespo May 3, 2024
d7daf4c
fix links in generator readme and bump version
david-crespo May 3, 2024
115ce66
Autogenerate config update
github-actions[bot] May 3, 2024
ef959da
add barebones readme to @oxide/api
david-crespo May 3, 2024
038643e
remove stray TBD from readme
david-crespo May 3, 2024
0ecd8aa
Update README.md
david-crespo May 4, 2024
91bbb7e
move packages up a dir, kill packages directory
david-crespo May 4, 2024
6076098
update readme with versioning scheme
david-crespo May 6, 2024
92c9369
put msw, zod, and type test behind --features flag in CLI
david-crespo May 6, 2024
6991f43
fail earlier if dest dir does not exist, fix tools/gen.sh
david-crespo May 6, 2024
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
Prev Previous commit
Next Next commit
add barebones readme to @oxide/api
david-crespo committed May 3, 2024
commit ef959dad2c22f3f5032199ef576a8d09323b4031
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ The generator is built specifically for use with specs generated by
[Dropshot](https://github.com/oxidecomputer/dropshot). It has not been tested on
any other specs and is unlikely to handle them well.

## Repo guide

|Package| Description|
|---|---|
| [`@oxide/openapi-gen-ts`](./packages/openapi-gen-ts) | TypeScript OpenAPI client generator |
59 changes: 58 additions & 1 deletion packages/api/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
# @oxide/api, the Oxide TypeScript SDK
# Oxide TypeScript SDK

TBD

## Usage

### Installation

```
npm install @oxide/api
```

### Get API token

The easiest way to get a device token is to use the CLI.

```
oxide auth login --host https://my-oxide-rack.com
```

Then print the token:

```
oxide auth status --show-token
```

In the following example it's passed to the script through the `OXIDE_TOKEN`
environment variable on the assumption that you don't want to hard-code a token
into a script, but this can of course be done however you want. `OXIDE_TOKEN` is
not a special variable for the TypeScript SDK (it is for the CLI).

### Example

```ts
import { Api } from "@oxide/api"

const api = new Api({
host: "https://my-oxide-rack.com",
token: process.env.OXIDE_TOKEN,
})

const result = await api.methods.projectList({})

if (result.type === "success") {
console.log(result.data.items.map((p) => p.name))
} else if (result.type === "error") {
console.log(result.data.errorCode)
console.log(result.data.message)
} else { // result.type === client_error
console.log(result.error)
}
```

## Other stuff in the package

Most likely nobody but us wants this, and we should take it out of the npm package.

### Mock Service Worker API skeleton

### Zod validators
4 changes: 2 additions & 2 deletions packages/api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oxide/api",
"version": "0.1.0-alpha.2",
"version": "0.1.0-alpha.3",
"description": "TypeScript client for the Oxide API",
"engines": {
"node": ">=18"