From fbb6295efb137b29ab9efc2343ecbdf8336cd44e Mon Sep 17 00:00:00 2001 From: Samantha Date: Sat, 16 Dec 2023 01:05:45 -0600 Subject: [PATCH] chore: some minor post cleanup (#26) - package.json: remove directories key, only used for commonJS - package.json: add homepage key for exact path - add back README.md for typed-http - minor markdown style/formatting changes --- README.md | 2 +- packages/typed-css-utils/README.md | 8 ++- packages/typed-css-utils/package.json | 1 + packages/typed-http/README.md | 74 +++++++++++++++++++++++++++ packages/typed-http/package.json | 4 +- 5 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 packages/typed-http/README.md diff --git a/README.md b/README.md index aee1d26..7647c87 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ A monorepo of pure-TypeScript type packages. ## License -This library is licensed under the MIT license ([`LICENSE-MIT`](../../LICENSE) or ). +This library is licensed under the MIT license ([`LICENSE-MIT`](./LICENSE) or ). ### Contribution diff --git a/packages/typed-css-utils/README.md b/packages/typed-css-utils/README.md index fc96f96..8cfca18 100644 --- a/packages/typed-css-utils/README.md +++ b/packages/typed-css-utils/README.md @@ -1,7 +1,7 @@ -# Typed CSS utilities +# neoncitylights/typed-css-utils [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT) -[![NPM package](https://img.shields.io/npm/v/@neoncitylights/typed-css-utils)](https://www.npmjs.com/package/@neoncitylights/typed-css-utils) +[![NPM package](https://img.shields.io/npm/v/@neoncitylights/typed-css-utils?style=flat-square)](https://www.npmjs.com/package/@neoncitylights/typed-css-utils) This library provides a set of utilities extending the `csstype` package to help you write typed CSS in TypeScript. @@ -54,3 +54,7 @@ const supportsFlex: boolean = cssSupports('display', 'flex'); ## License This library is licensed under the [MIT License](./LICENSE). + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions. diff --git a/packages/typed-css-utils/package.json b/packages/typed-css-utils/package.json index 8ee89e0..807ce9b 100644 --- a/packages/typed-css-utils/package.json +++ b/packages/typed-css-utils/package.json @@ -11,6 +11,7 @@ "css", "typescript" ], + "homepage": "https://github.com/neoncitylights/types/tree/main/packages/typed-css-utils", "bugs": "https://github.com/neoncitylights/types/issues", "repository": { "type": "git", diff --git a/packages/typed-http/README.md b/packages/typed-http/README.md new file mode 100644 index 0000000..bf3c677 --- /dev/null +++ b/packages/typed-http/README.md @@ -0,0 +1,74 @@ +# @neoncitylights/typed-http + +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT) +[![npm (scoped)](https://img.shields.io/npm/v/@neoncitylights/typed-http?style=flat-square)](https://www.npmjs.com/package/@neoncitylights/typed-http) + +A pure TypeScript package that provides strongly typed HTTP headers, methods, and status codes. Supports the Fetch API, `XmlHttpRequest`, and the Node.js HTTP module with zero-runtime overhead. + +This package uses an open-source JSON dataset by [WebConcepts](https://webconcepts.info/JSON-concepts) with slight modifications, available under [`concepts.json`](./build/concepts.json). The script to auto-generate the TypeScript files is available under [`generateHttpTypes.ts`](./build/generateHttpTypes.ts). The generated files are: + + - [`httpHeaders.ts`](./src/httpHeaders.ts): 248 HTTP header types + - [`httpMethods.ts`](./src/httpMethods.ts): 40 HTTP method types + - [`httpStatusCodes.ts`](./src/httpStatusCodes.ts): 63 HTTP status code types + +## Install + +``` +npm install @neoncitylights/typed-http +``` + +## Documentation + +[Auto-generated API documentation is available.](https://neoncitylights.github.io/typed-http/) + +### API Reference +> +> **Note**: Specific HTTP headers, methods, and status codes are omitted from the API documentation for brevity. The full list of types is available in the source code. + + - `T`: # headers.**HttpHeader** • [source](./src/httpHeaders.ts) + - `T`: # headers.**HttpRequestHeader** • [source](./src/httpHeaders.ts) + - `T`: # headers.**HttpResponseHeader** • [source](./src/httpHeaders.ts) + - `T`: # headers.**ForbiddenHttpRequestHeader** • [source](./src/httpHeaders.ts) + - `T`: # headers.**ForbiddenHttpResponseHeader** • [source](./src/httpHeaders.ts) + - `T`: # methods.**HttpMethod** • [source](./src/httpMethods.ts) + - `T`: # statusCodes.**HttpStatusCode** • [source](./src/httpStatusCodes.ts) + - `T`: # statusCodes.**HttpInfoStatusCode** • [source](./src/httpStatusCodes.ts) + - `T`: # statusCodes.**HttpSuccessStatusCode** • [source](./src/httpStatusCodes.ts) + - `T`: # statusCodes.**HttpRedirectStatusCode** • [source](./src/httpStatusCodes.ts) + - `T`: # statusCodes.**HttpClientErrorStatusCode** • [source](./src/httpStatusCodes.ts) + - `T`: # statusCodes.**HttpServerErrorStatusCode** • [source](./src/httpStatusCodes.ts) + +## Usage + +### Type the Fetch API + +```ts +import '@neoncitylights/typed-http/fetch'; + +let request = await fetch(); +``` + +### Type `XmlHttpRequest` + +```ts +import '@neoncitylights/typed-http/xhr'; + +const xhr = new XMLHttpRequest(); +xhr.addEventListener('load', (e) => console.log(xhr.responseText)); +xhr.open('GET', 'https://www.google.com'); +xhr.send(); +``` + +### Type the Node.js HTTP module + +```ts +import '@neoncitylights/typed-http/node'; +``` + +## License + +This library is licensed under the MIT license ([`LICENSE-MIT`](./LICENSE) or http://opensource.org/licenses/MIT). + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions. diff --git a/packages/typed-http/package.json b/packages/typed-http/package.json index d85d41d..8cc05ad 100644 --- a/packages/typed-http/package.json +++ b/packages/typed-http/package.json @@ -16,6 +16,7 @@ "xmlHttpRequest", "node" ], + "homepage": "https://github.com/neoncitylights/types/tree/main/packages/typed-http", "bugs": "https://github.com/neoncitylights/types/issues", "repository": { "type": "git", @@ -34,9 +35,6 @@ "src/httpStatusCodes.ts", "src/*.d.ts" ], - "directories": { - "test": "tests" - }, "scripts": { "generateHttpTypes": "ts-node ./build/generateHttpTypes.ts", "build": "npm run generateHttpTypes",