Skip to content

Commit

Permalink
fix: schema-to-typescript.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed Feb 18, 2019
1 parent f32823c commit 75b7dbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"test": "node validate-schema.js",
"build": "npm run build:jsonld && npm run build:ts",
"build:jsonld": "node schema-to-jsonld.js",
"build:ts": "node schema-to-typescript.js",
"build:ts": "rimraf ts && node schema-to-typescript.js",
"clean": "rimraf jsonld ts"
},
"repository": {
Expand Down
7 changes: 3 additions & 4 deletions schema-to-typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const options = {
fs.mkdirp('ts')
for (let filename of fs.readdirSync('schema')) {
const src = path.join('schema', filename)
const dest = path.join('schema', filename)
console.log(`Generating "${dest}" from "${filename}"`)
const schema = fs.readJsonSync(src)
jstt.compileFromFile(schema, options).then(ts => fs.writeFileSync(dest, ts))
const dest = path.join('ts', filename.replace('.schema.json', '.ts'))
console.log(`Generating "${dest}" from "${src}"`)
jstt.compileFromFile(src, options).then(ts => fs.writeFileSync(dest, ts))
}

0 comments on commit 75b7dbe

Please sign in to comment.