Skip to content

Commit

Permalink
feat(private): schema CLI (#8957)
Browse files Browse the repository at this point in the history
* feat(private): schema scaffolder

* more progress

* pdates to parser

* things

* more parsing

* chore, begin work on json compile

* progress on compilation

* stash
  • Loading branch information
runspired authored Apr 24, 2024
1 parent 0640eca commit a5528b1
Show file tree
Hide file tree
Showing 20 changed files with 1,393 additions and 236 deletions.
8 changes: 2 additions & 6 deletions packages/schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@

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 💜
---

## Installation

Expand All @@ -53,7 +49,7 @@ pnpm install @warp-drive/schema
Scaffold the schema for a `User` resource

```no-highlight
npx -p @warp-drive-schema resource user
npx -p @warp-drive/schema resource user
```

Parse Schemas
Expand Down
20 changes: 10 additions & 10 deletions packages/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
"scripts": {
"build:parse": "bun build src/parse.ts --compile --outfile parse",
"build:scaffold": "bun build src/scaffold.ts --compile --outfile scaffold",
"build": "bun run build:parse && bun run build:scaffold",
"prepack": "bun run _build",
"_syncPnpm": "bun run sync-dependencies-meta-injected"
"_build": "bun run build:parse && bun run build:scaffold",
"prepack": "bun run _build"
},
"files": [
"README.md",
Expand All @@ -38,15 +37,16 @@
"resource": "./scaffold resource"
},
"main": "src/index.ts",
"peerDependencies": {
"typescript": "^5.4.5"
},
"dependencies": {
"chalk": "^5.3.0"
},
"peerDependencies": {},
"dependencies": {},
"devDependencies": {
"bun-types": "1.1.3",
"pnpm-sync-dependencies-meta-injected": "0.0.10"
"chalk": "^5.3.0",
"@babel/parser": "^7.24.4",
"@babel/traverse": "^7.24.1",
"@types/babel__parser": "^7.1.1",
"@types/babel__traverse": "^7.20.5",
"typescript": "^5.4.5"
},
"engines": {
"node": ">= 18.20.2"
Expand Down
Binary file modified packages/schema/parse
Binary file not shown.
Binary file modified packages/schema/scaffold
Binary file not shown.
13 changes: 12 additions & 1 deletion packages/schema/src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
async function main() {}
import { getSchemaConfig } from './parser/steps/get-config';
import { gatherSchemaFiles } from './parser/steps/gather-schema-files';
import { compileJSONSchemas } from './parser/compile/json';

async function main() {
const config = await getSchemaConfig();

const modules = await gatherSchemaFiles(config);
const compiledJson = await compileJSONSchemas(modules);

console.log(compiledJson);
}

await main();
Loading

0 comments on commit a5528b1

Please sign in to comment.