Skip to content

Commit

Permalink
chore: some minor post cleanup (#26)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
neoncitylights authored Dec 16, 2023
1 parent 04b8586 commit fbb6295
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A monorepo of pure-TypeScript type packages.

## License

This library is licensed under the MIT license ([`LICENSE-MIT`](../../LICENSE) or <http://opensource.org/licenses/MIT>).
This library is licensed under the MIT license ([`LICENSE-MIT`](./LICENSE) or <http://opensource.org/licenses/MIT>).

### Contribution

Expand Down
8 changes: 6 additions & 2 deletions packages/typed-css-utils/README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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.
1 change: 1 addition & 0 deletions packages/typed-css-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
74 changes: 74 additions & 0 deletions packages/typed-http/README.md
Original file line number Diff line number Diff line change
@@ -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`: <a href="#HttpHeader">#</a> headers.**HttpHeader**[source](./src/httpHeaders.ts)
- `T`: <a href="#HttpRequetHeader">#</a> headers.**HttpRequestHeader**[source](./src/httpHeaders.ts)
- `T`: <a href="#HttpResponseHeader">#</a> headers.**HttpResponseHeader**[source](./src/httpHeaders.ts)
- `T`: <a href="#ForbiddenHttpRequestHeader">#</a> headers.**ForbiddenHttpRequestHeader**[source](./src/httpHeaders.ts)
- `T`: <a href="#ForbiddenHttpResponseHeader">#</a> headers.**ForbiddenHttpResponseHeader**[source](./src/httpHeaders.ts)
- `T`: <a href="#HttpMethod">#</a> methods.**HttpMethod**[source](./src/httpMethods.ts)
- `T`: <a href="#HttpStatusCode">#</a> statusCodes.**HttpStatusCode**[source](./src/httpStatusCodes.ts)
- `T`: <a href="#HttpInfoStatusCode">#</a> statusCodes.**HttpInfoStatusCode**[source](./src/httpStatusCodes.ts)
- `T`: <a href="#HttpSuccessStatusCode">#</a> statusCodes.**HttpSuccessStatusCode**[source](./src/httpStatusCodes.ts)
- `T`: <a href="#HttpRedirectStatusCode">#</a> statusCodes.**HttpRedirectStatusCode**[source](./src/httpStatusCodes.ts)
- `T`: <a href="#HttpClientErrorStatusCode">#</a> statusCodes.**HttpClientErrorStatusCode**[source](./src/httpStatusCodes.ts)
- `T`: <a href="#HttpServerErrorStatusCode">#</a> 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.
4 changes: 1 addition & 3 deletions packages/typed-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -34,9 +35,6 @@
"src/httpStatusCodes.ts",
"src/*.d.ts"
],
"directories": {
"test": "tests"
},
"scripts": {
"generateHttpTypes": "ts-node ./build/generateHttpTypes.ts",
"build": "npm run generateHttpTypes",
Expand Down

0 comments on commit fbb6295

Please sign in to comment.