Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

compile-schemas-to-typescript

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compile-schemas-to-typescript - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

.vscode/launch.json

15

build/index.js

@@ -26,7 +26,16 @@ "use strict";

}
// create output dir - skip eexist error
try {
yield fs.mkdir(path_1.default.resolve(output));
}
catch (err) {
if (err.code !== 'EEXIST')
throw err;
}
// get files from input dir
const files = yield fs.readdir(path_1.default.resolve(input));
for (const file of files) {
if (path_1.default.extname(file) === '.json') {
const ts = yield json_schema_to_typescript_1.compileFromFile(path_1.default.join(input, file));
yield fs.writeFile(fileOutputPath(file, output), ts);
if (path_1.default.extname(file) === '.json') { // for every `.json` file in the input
const ts = yield json_schema_to_typescript_1.compileFromFile(path_1.default.join(input, file)); // compile to ts
yield fs.writeFile(path_1.default.resolve(fileOutputPath(file, output)), ts); // write to output
}

@@ -33,0 +42,0 @@ }

3

package.json
{
"name": "compile-schemas-to-typescript",
"version": "0.1.0",
"version": "0.2.0",
"description": "Transform a directory of JSON Schems into TypeScript Interfaces",
"main": "build/index.js",
"types": "build/index.d.ts",
"bin": "build/cli.js",
"scripts": {

@@ -8,0 +9,0 @@ "compile": "tsc -p tsconfig.json",

@@ -5,2 +5,10 @@ # Compile Schemas to TypeScript

## CLI
This module works as an CLI. Install as a dependency and call `compile-schemas-to-typescript` from a npm script, or use `npx`
```bash
npx compile-schemas-to-typescript <schema-dir> <types-output-dir>
```
## API

@@ -33,2 +41,2 @@

Licensed under [MIT](./LICENSE).
Licensed under [MIT](./LICENSE).

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc