diff --git a/.gitignore b/.gitignore index 763301f..9d31eda 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -dist/ -node_modules/ \ No newline at end of file +node_modules/ +swapi.openapi.yaml \ No newline at end of file diff --git a/README.md b/README.md index 462654f..d697ab5 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,43 @@ -## Notes +## About + +I created this project to learn about TypeSpec through first-hand usage. + +## Getting started + +Follow these steps to consume the generated Open API specification for SWAPI. + +1. Install this package as a dependency + + ```sh + npm install -D swapi-typespec + ``` + +2. Reference the generated Open API specification directly. + + ```sh + ./node_modules/swapi-typespec/swapi.openapi.yaml + ``` + +## Developing + +### Run scripts + +Use `npm run` to list all available scripts. The `release` script executes a +“release build.” The CI build uses this script. + +### Directory structure + +- [src](./src) contains the TypeSpec (`.tsp`) files + +### Notes - Using `@resource` adds _all_ REST operations. Thus, the spec files explicitly configure `list` and `read` operations because SWAPI only supports those. +--- + [swapi]: https://swapi.dev [typespec]: https://microsoft.github.io/typespec/ diff --git a/index.js b/index.js new file mode 100644 index 0000000..9253673 --- /dev/null +++ b/index.js @@ -0,0 +1,2 @@ +// Not a JS module +export {}; diff --git a/package-lock.json b/package-lock.json index aa5806a..9163e06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "swapi-typespec", - "version": "1.0.0-prerelease", + "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "swapi-typespec", - "version": "1.0.0-prerelease", + "version": "0.1.0", "devDependencies": { "@typespec/compiler": "~0.47.1", "@typespec/http": "~0.47.0", diff --git a/package.json b/package.json index 9d2af2f..604e210 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,34 @@ { "name": "swapi-typespec", + "version": "1.0.0-alpha.0", "description": "TypeSpec representation of SWAPI: The Star Wars API.", - "version": "1.0.0-prerelease", + "keywords": [ + "api", + "openapi", + "openapi3", + "star wars", + "swagger", + "swapi", + "typespec" + ], + "homepage": "https://github.com/connorjs/swapi-typespec#readme", + "bugs": { + "url": "https://github.com/connorjs/swapi-typespec/issues" + }, + "license": "MIT", + "author": { + "name": "Connor Sullivan", + "email": "dev.connorjs@gmail.com", + "url": "https://github.com/connorjs" + }, "type": "module", + "files": [ + "index.js", + "swapi.openapi.yaml" + ], + "exports": { + ".": "./index.js" + }, "scripts": { "build": "tsp compile src", "format": "prettier -l '**/*.{json,md,tsp,yaml,yml}'", diff --git a/tspconfig.yaml b/tspconfig.yaml index 9c56992..58fd59d 100644 --- a/tspconfig.yaml +++ b/tspconfig.yaml @@ -2,6 +2,6 @@ emit: - "@typespec/openapi3" options: "@typespec/openapi3": - emitter-output-dir: "{project-root}/dist" + emitter-output-dir: "{project-root}" # emit to the root for distribution omit-unreachable-types: true - output-file: "swapi.openapi.yaml" + output-file: "swapi.openapi.yaml" # matches `files` in `package.json` and is in `.gitignore`