-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8876c2
commit 68c127a
Showing
68 changed files
with
5,531 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"lerna": "6", | ||
"conventionalCommits": true, | ||
"npmClient": "yarn", | ||
"npmClientArgs": [ | ||
"--no-lockfile" | ||
], | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "independent", | ||
"registry": "https://registry.npmjs.org", | ||
"command": { | ||
"create": { | ||
"homepage": "https://github.com/pyramation/schema-typescript-workspace", | ||
"license": "SEE LICENSE IN LICENSE", | ||
"access": "restricted" | ||
}, | ||
"publish": { | ||
"allowBranch": "main", | ||
"message": "chore(release): publish" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# @schema-typescript/cli | ||
|
||
<p align="center"> | ||
<img src="https://user-images.githubusercontent.com/545047/188804067-28e67e5e-0214-4449-ab04-2e0c564a6885.svg" width="80"><br /> | ||
schema-typescript CLI | ||
</p> | ||
|
||
## install | ||
|
||
```sh | ||
npm install @schema-typescript/cli | ||
``` | ||
## Table of contents | ||
|
||
- [@schema-typescript/cli](#@schema-typescript/cli) | ||
- [Install](#install) | ||
- [Table of contents](#table-of-contents) | ||
- [Developing](#developing) | ||
- [Credits](#credits) | ||
|
||
## Developing | ||
|
||
When first cloning the repo: | ||
|
||
``` | ||
yarn | ||
yarn build | ||
``` | ||
|
||
## Related | ||
|
||
Checkout these related projects: | ||
|
||
* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | ||
* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ||
* [chain-registry](https://github.com/cosmology-tech/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | ||
* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | ||
* [create-cosmos-app](https://github.com/cosmology-tech/create-cosmos-app) Set up a modern Cosmos app by running one command. | ||
* [interchain-ui](https://github.com/cosmology-tech/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | ||
* [starship](https://github.com/cosmology-tech/starship) Unified Testing and Development for the Interchain. | ||
|
||
## Credits | ||
|
||
π Built by Cosmology βΒ if you like our tools, please consider delegating to [our validator βοΈ](https://cosmology.zone/validator) | ||
|
||
|
||
## Disclaimer | ||
|
||
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED βAS ISβ, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. | ||
|
||
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
transform: { | ||
"^.+\\.tsx?$": [ | ||
"ts-jest", | ||
{ | ||
babelConfig: false, | ||
tsconfig: "tsconfig.json", | ||
}, | ||
], | ||
}, | ||
transformIgnorePatterns: [`/node_modules/*`], | ||
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], | ||
modulePathIgnorePatterns: ["dist/*"] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "@schema-typescript/cli", | ||
"version": "0.0.1", | ||
"author": "Dan Lynch <pyramation@gmail.com>", | ||
"description": "schema-typescript CLI", | ||
"main": "index.js", | ||
"module": "esm/index.js", | ||
"types": "index.d.ts", | ||
"homepage": "https://github.com/pyramation/schema-typescript", | ||
"license": "SEE LICENSE IN LICENSE", | ||
"publishConfig": { | ||
"access": "public", | ||
"directory": "dist" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pyramation/schema-typescript" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/pyramation/schema-typescript/issues" | ||
}, | ||
"scripts": { | ||
"copy": "copyfiles -f ../../LICENSE README.md package.json dist", | ||
"clean": "del dist/**", | ||
"prepare": "npm run build", | ||
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy", | ||
"test": "jest", | ||
"test:watch": "jest --watch" | ||
}, | ||
"keywords": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default () => { | ||
|
||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"rootDir": "src/" | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# schema-typescript | ||
|
||
<p align="center" width="100%"> | ||
<a href="https://github.com/pyramation/schema-typescript/actions/workflows/run-tests.yaml"> | ||
<img height="20" src="https://github.com/pyramation/schema-typescript/actions/workflows/run-tests.yaml/badge.svg" /> | ||
</a> | ||
<a href="https://github.com/pyramation/schema-typescript/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a> | ||
</p> | ||
|
||
Welcome to _schema-typescript_! This project provides robust tools for handling JSON schemas and converting them to TypeScript interfaces with ease and efficiency. | ||
|
||
## Features | ||
|
||
- **π§ JSON Schema to TypeScript**: Convert JSON schemas into TypeScript interfaces automatically. | ||
|
||
- **π¦ Modular**: Designed to be reusable with minimal dependencies. | ||
|
||
- **π Supports `$ref` and `$defs`**: Fully supports JSON Schema references, allowing you to define complex schemas modularly. | ||
|
||
- **π Multiple Entities Handling**: Handles arrays of defined types, such as multiple dogs or cats, seamlessly in your schemas. | ||
|
||
## Getting Started π | ||
|
||
To get started with _schema-typescript_, simply run: | ||
|
||
```bash | ||
npm install schema-typescript | ||
``` | ||
|
||
## Usage π | ||
|
||
Here's a quick example to show you how to convert a JSON schema into TypeScript interfaces: | ||
|
||
```javascript | ||
import { generateTypeScript } from 'schema-typescript'; | ||
|
||
const schema = { | ||
"$id": "https://example.com/person.schema.json", | ||
"$schema": "https://json-schema.org/draft-07/schema#", | ||
"title": "Person", | ||
"type": "object", | ||
"properties": { | ||
"firstName": { "type": "string" }, | ||
"pets": { | ||
"type": "array", | ||
"items": { "$ref": "#/$defs/pet" } | ||
} | ||
}, | ||
"required": ["firstName", "pets"], | ||
"$defs": { | ||
"pet": { | ||
"type": "object", | ||
"properties": { | ||
"name": { "type": "string" }, | ||
"type": { "type": "string" } | ||
}, | ||
"required": ["name", "type"] | ||
} | ||
} | ||
}; | ||
|
||
console.log(generateTypeScript(schema)); | ||
// OUTPUT: | ||
interface Pet { | ||
name: string; | ||
type: string; | ||
} | ||
interface Person { | ||
firstName: string; | ||
pets: Pet[]; | ||
} | ||
``` | ||
|
||
## Contributing π€ | ||
|
||
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. | ||
|
||
## Need Help? | ||
|
||
`schema-typescript` might not work perfectly for all JSON schemas yet. We value your feedback and contributions to make it better. If you encounter any issues or have suggestions for improvements, please [let us know](https://github.com/pyramation/schema-typescript/issues). | ||
|
||
## License π | ||
|
||
Distributed under the MIT License. See \`LICENSE\` for more information. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.