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

schema-watcher

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

schema-watcher - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

5

args.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var argparse_1 = require("argparse");
var path_1 = require("path");
var parser = new argparse_1.ArgumentParser({

@@ -26,4 +27,4 @@ version: "0.0.1",

exports.args = parser.parseArgs();
// args.file = resolve(join(process.cwd(), args.file));
// args.schema = resolve(join(process.cwd(), args.schema));
exports.args.file = path_1.resolve(path_1.join(process.cwd(), exports.args.file));
exports.args.schema = path_1.resolve(path_1.join(process.cwd(), exports.args.schema));
exports.default = exports.args;

1

args.ts

@@ -40,3 +40,2 @@ import { ArgumentParser } from "argparse";

export const args: Args = parser.parseArgs();
args.file = resolve(join(process.cwd(), args.file));

@@ -43,0 +42,0 @@ args.schema = resolve(join(process.cwd(), args.schema));

@@ -14,20 +14,5 @@ "use strict";

var js_yaml_1 = __importDefault(require("js-yaml"));
console.clear();
console.dir(args_1.default);
var AJV = new ajv_1.default({ allErrors: true });
chokidar_1.default.watch(args_1.default.file).on("change", validate_file);
chokidar_1.default.watch(args_1.default.schema).on("change", validate_file);
var _ic = 0;
var colors = [
"green",
"yellow",
"blue",
"magenta",
"cyan",
"white"
];
function next_color() {
_ic = (_ic + 1) % colors.length;
return colors[_ic];
}
validate_file();

@@ -39,2 +24,5 @@ function validate_file() {

console.log(chalk_1.default.inverse("Schema file") + ": " + args_1.default.schema);
if (args_1.default.query) {
console.log(chalk_1.default.inverse("Schema path") + ": " + args_1.default.query);
}
console.log(chalk_1.default.bgBlue.black("Last run at " + new Date().toLocaleString()));

@@ -59,3 +47,4 @@ try {

if (err) {
console.log(chalk_1.default.bgRed.black(err.message.replace("jasonthorpe", "user")));
console.log(chalk_1.default.bgRed.black(err.message));
console.log(err.stack);
return;

@@ -69,3 +58,4 @@ }

if (err) {
console.log(chalk_1.default.bgRed.black(err.message.replace("jasonthorpe", "user")));
console.log(chalk_1.default.bgRed.black(err.message));
console.log(err.stack);
return;

@@ -103,3 +93,3 @@ }

AJV.errors.map(function (e) {
return console.log(chalk_1.default.bgBlue(e.dataPath) + ": " + chalk_1.default.inverse(e.message.replace("jasonthorpe", "user")));
return console.log(chalk_1.default.bgBlue(e.dataPath) + ": " + chalk_1.default.inverse(e.message));
});

@@ -114,3 +104,3 @@ return;

console.log(chalk_1.default.bgRed.black("Invalid schema"));
console.log("Error:", err.message.replace("jasonthorpe", "user"));
console.log("Error:", err.message);
if (args_1.default.query && !args_1.default.d) {

@@ -121,3 +111,3 @@ console.log(chalk_1.default.bgGreen.black("This may occure when using json references in combinatoin with the query parameter. Try setting the '-d' flag and re-starting"));

AJV.errors.map(function (e) {
return console.log(chalk_1.default.bgBlue(e.dataPath) + ": " + chalk_1.default.inverse(e.message.replace("jasonthorpe", "user")));
return console.log(chalk_1.default.bgBlue(e.dataPath) + ": " + chalk_1.default.inverse(e.message));
});

@@ -130,3 +120,3 @@ return;

AJV.errors.map(function (e) {
return console.log("'" + chalk_1.default.bgBlue(e.dataPath) + "': " + chalk_1.default.inverse(e.message.replace("jasonthorpe", "user")));
return console.log("'" + chalk_1.default.bgBlue(e.dataPath) + "': " + chalk_1.default.inverse(e.message));
});

@@ -138,7 +128,3 @@ }

}
process.once("SIGINT", function (code) {
process.exit();
});
process.once("SIGTERM", function (code) {
process.exit();
});
process.once("SIGINT", function () { return process.exit(); });
process.once("SIGTERM", function () { return process.exit(); });

@@ -10,5 +10,2 @@ import args from "./args";

console.clear();
console.dir(args);
const AJV = new Ajv({ allErrors: true });

@@ -19,17 +16,2 @@

let _ic = 0;
const colors: string[] = [
"green",
"yellow",
"blue",
"magenta",
"cyan",
"white"
];
function next_color(): string {
_ic = (_ic + 1) % colors.length;
return colors[_ic];
}
validate_file();

@@ -42,2 +24,5 @@

console.log(`${chalk.inverse("Schema file")}: ${args.schema}`);
if (args.query) {
console.log(`${chalk.inverse("Schema path")}: ${args.query}`);
}
console.log(

@@ -155,7 +140,3 @@ chalk.bgBlue.black(`Last run at ${new Date().toLocaleString()}`)

process.once("SIGINT", function(code) {
process.exit();
});
process.once("SIGTERM", function(code) {
process.exit();
});
process.once("SIGINT", () => process.exit());
process.once("SIGTERM", () => process.exit());
{
"name": "schema-watcher",
"version": "1.0.0",
"version": "1.0.1",
"description": "File Watcher + Schema Validator",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,3 +6,3 @@ # schema-watcher (swatch)

![swatch demo](demo.gif)
![swatch demo](https://github.com/jdthorpe/schema-watcher/raw/master/demo.gif)

@@ -9,0 +9,0 @@ ## Installation

@@ -0,0 +0,0 @@ {

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