Skip to content

Commit

Permalink
Move setup script, run as typescript with ts-node (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
zakpatterson committed Oct 20, 2021
1 parent 9bcefa2 commit 1463e85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"typescript": "^4.4.4"
},
"scripts": {
"start": "node ./notice.js && node ./setup.js && craco start",
"build": "node ./setup.js && craco build",
"test": "node ./setup.js && craco test",
"start": "node ./notice.js && ts-node ./scripts/setup.ts && craco start",
"build": "ts-node ./scripts/setup.ts && craco build",
"test": "ts-node ./scripts/setup.ts && craco test",
"eject": "craco eject",
"desktop-release": "ts-node ./scripts/setup.ts && tauri build",
"desktop": "node ./notice.js && ts-node ./scripts/setup.ts && tauri dev",
"test:report": "npm run test -- --coverage .",
"desktop-release": "node ./setup.js && tauri build",
"desktop": "node ./notice.js && node ./setup.js && tauri dev",
"tauri": "tauri",
"schema-generate": "node ./setup.js",
"lint": "eslint ./src --ext ts,js,tsx,jsx --max-warnings=0 && prettier -c .",
Expand Down
8 changes: 4 additions & 4 deletions setup.js → scripts/setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const tsj = require('ts-json-schema-generator')
const fs = require('fs')
import { createGenerator } from 'ts-json-schema-generator'
import fs from 'fs'

const config = {
path: 'src/redux/data.ts',
Expand All @@ -9,8 +9,8 @@ const config = {

const outputPath = 'src/redux/validation.json'

const schema = tsj.createGenerator(config).createSchema(config.type)
const schema = createGenerator(config).createSchema(config.type)
const schemaString = JSON.stringify(schema, null, 2)
fs.writeFile(outputPath, schemaString, (err) => {
fs.writeFile(outputPath, schemaString, (err): void => {
if (err) throw err
})

0 comments on commit 1463e85

Please sign in to comment.