forked from emberjs/data
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(private): scaffold packages for schema parser (emberjs#8955)
* feat(private): implement schema parser * dont build in ci
- Loading branch information
1 parent
222948b
commit 0304a36
Showing
17 changed files
with
243 additions
and
0 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 @@ | ||
/node_modules |
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,12 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (C) 2023 EmberData and WarpDrive contributors | ||
Copyright (C) 2017-2022 Ember.js contributors | ||
Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors. | ||
Portions Copyright (C) 2011 LivingSocial Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,120 @@ | ||
<p align="center"> | ||
<img | ||
class="project-logo" | ||
src="./NCC-1701-a-blue.svg#gh-light-mode-only" | ||
alt="WarpDrive" | ||
width="120px" | ||
title="WarpDrive" /> | ||
<img | ||
class="project-logo" | ||
src="./NCC-1701-a.svg#gh-dark-mode-only" | ||
alt="WarpDrive" | ||
width="120px" | ||
title="WarpDrive" /> | ||
</p> | ||
|
||
<h3 align="center">:electron: Declarative Schema Parser</h3> | ||
<p align="center">Build faster with better DX</p> | ||
|
||
<p align="center"> | ||
<img | ||
src="./parse-usage.png" | ||
alt="WarpDrive Schema" | ||
width="400px" | ||
title="WarpDrive Schema" /> | ||
</p> | ||
|
||
`@warp-drive/schema` allows you to easily use the typescript you already know as a statically analyzable schema language. | ||
|
||
Its like GraphQL, RPC, or Protobuf... but for anything! | ||
|
||
## Usage | ||
|
||
> ⚠️ Private | ||
This package may currently only be used within EmberData. A public version is coming soon 💜 | ||
|
||
#### 🔜 Soon | ||
|
||
Scaffold the schema for a `User` resource | ||
|
||
```no-highlight | ||
npx -p @warp-drive-schema resource user | ||
``` | ||
|
||
Parse Schemas | ||
|
||
```no-highlight | ||
npx -p @warp-drive/schema parse <path/to/schema.json> | ||
``` | ||
|
||
## How it works | ||
|
||
The parser expects a json config file. | ||
|
||
```ts | ||
{ | ||
"schemas": "./src/schemas", | ||
"dest": "./dist", | ||
} | ||
``` | ||
|
||
### ♥️ Credits | ||
|
||
<details> | ||
<summary>Brought to you with ♥️ love by <a href="https://emberjs.com" title="EmberJS">🐹 Ember</a></summary> | ||
|
||
<style type="text/css"> | ||
img.project-logo { | ||
padding: 0 5em 1em 5em; | ||
width: 100px; | ||
border-bottom: 2px solid #0969da; | ||
margin: 0 auto; | ||
display: block; | ||
} | ||
details > summary { | ||
font-size: 1.1rem; | ||
line-height: 1rem; | ||
margin-bottom: 1rem; | ||
} | ||
details { | ||
font-size: 1rem; | ||
} | ||
details > summary strong { | ||
display: inline-block; | ||
padding: .2rem 0; | ||
color: #000; | ||
border-bottom: 3px solid #0969da; | ||
} | ||
|
||
details > details { | ||
margin-left: 2rem; | ||
} | ||
details > details > summary { | ||
font-size: 1rem; | ||
line-height: 1rem; | ||
margin-bottom: 1rem; | ||
} | ||
details > details > summary strong { | ||
display: inline-block; | ||
padding: .2rem 0; | ||
color: #555; | ||
border-bottom: 2px solid #555; | ||
} | ||
details > details { | ||
font-size: .85rem; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
details > summary strong { | ||
color: #fff; | ||
} | ||
} | ||
@media (prefers-color-scheme: dark) { | ||
details > details > summary strong { | ||
color: #afaba0; | ||
border-bottom: 2px solid #afaba0; | ||
} | ||
} | ||
</style> | ||
</details> |
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,56 @@ | ||
{ | ||
"name": "@warp-drive/schema", | ||
"version": "5.5.0-alpha.11", | ||
"private": true, | ||
"description": "Parse Declarative Typescript into JSON Schemas", | ||
"keywords": [ | ||
"typescript", | ||
"schema", | ||
"parser", | ||
"GraphQL", | ||
"tRPC", | ||
"MSW", | ||
"EmberData", | ||
"Tanstack" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@github.com:emberjs/data.git", | ||
"directory": "packages/schema" | ||
}, | ||
"license": "MIT", | ||
"author": "Chris Thoburn <runspired@users.noreply.github.com>", | ||
"scripts": { | ||
"build:parse": "bun build src/parse.ts --compile --outfile parse", | ||
"build:scaffold": "bun build src/scaffold.ts --compile --outfile scaffold", | ||
"build": "pnpm run build:parse && pnpm run build:scaffold", | ||
"prepack": "pnpm build" | ||
}, | ||
"files": [ | ||
"README.md", | ||
"LICENSE.md", | ||
"NCC-1701-a.svg", | ||
"NCC-1701-a-blue.svg" | ||
], | ||
"bin": { | ||
"parse": "./parse", | ||
"resource": "./scaffold resource" | ||
}, | ||
"main": "src/index.ts", | ||
"peerDependencies": { | ||
"typescript": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"chalk": "^5.3.0" | ||
}, | ||
"devDependencies": { | ||
"bun-types": "1.0.4-canary.20231004T140131" | ||
}, | ||
"engines": { | ||
"node": ">= 18.*" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
}, | ||
"packageManager": "pnpm@8.8.0" | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
async function main() {} | ||
|
||
await main(); |
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 @@ | ||
async function main() {} | ||
|
||
await main(); |
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,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["ESNext"], | ||
"module": "esnext", | ||
"target": "esnext", | ||
"moduleResolution": "bundler", | ||
"moduleDetection": "force", | ||
"allowImportingTsExtensions": true, | ||
"strict": true, | ||
"downlevelIteration": true, | ||
"skipLibCheck": true, | ||
"allowSyntheticDefaultImports": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"allowJs": true, | ||
"noEmit": true | ||
} | ||
} |
Oops, something went wrong.