kayvee 3.17.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -202
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/kayvee.d.ts +12 -0
- package/dist/kayvee.d.ts.map +1 -0
- package/dist/kayvee.js +50 -0
- package/dist/logger/logger.d.ts +49 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +237 -0
- package/dist/middleware.d.ts +23 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +196 -0
- package/dist/package.json +89 -0
- package/dist/router/index.d.ts +23 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +184 -0
- package/package.json +64 -24
- package/.circleci/config.yml +0 -25
- package/.eslintrc.yml +0 -44
- package/.nvmrc +0 -1
- package/.prettierrc.json +0 -1
- package/Makefile +0 -56
- package/benchmarks/data/.keep +0 -1
- package/benchmarks/data/corpus-basic.json +0 -22
- package/benchmarks/data/corpus-pathological.json +0 -22
- package/benchmarks/data/corpus-realistic.json +0 -22
- package/benchmarks/data/kvconfig-basic.yml +0 -7
- package/benchmarks/data/kvconfig-pathological.yml +0 -222
- package/benchmarks/data/kvconfig-realistic.yml +0 -39
- package/benchmarks/routing.js +0 -116
- package/build/lib/kayvee.js +0 -67
- package/build/lib/logger/helpers.js +0 -0
- package/build/lib/logger/logger.js +0 -221
- package/build/lib/middleware.js +0 -302
- package/build/lib/router/index.js +0 -198
- package/build/package.json +0 -49
- package/build/test/context_logger.js +0 -77
- package/build/test/kayvee.js +0 -36
- package/build/test/logger_test.js +0 -334
- package/build/test/middleware.js +0 -557
- package/build/test/router.js +0 -311
- package/index.js +0 -7
- package/lib/kayvee.ts +0 -73
- package/lib/logger/helpers.ts +0 -0
- package/lib/logger/logger.ts +0 -296
- package/lib/middleware.ts +0 -317
- package/lib/router/index.ts +0 -234
- package/lib/router/schema_definitions.json +0 -158
- package/test/context_logger.ts +0 -76
- package/test/kayvee.ts +0 -50
- package/test/kvconfig.yml +0 -14
- package/test/logger_test.ts +0 -378
- package/test/middleware.ts +0 -632
- package/test/router.ts +0 -558
- package/test/static/empty.css +0 -0
- package/test/static/js/empty.js +0 -0
- package/test/tests.json +0 -100
- package/tsconfig.json +0 -10
- package/tslint.json +0 -134
- /package/{build/lib → dist}/router/schema_definitions.json +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Router = exports.Rule = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const jsonschema_1 = require("jsonschema");
|
|
9
|
+
const js_yaml_1 = require("js-yaml");
|
|
10
|
+
// JSON imports with "with { type: 'json' }" work in both native ESM (Node 24) and
|
|
11
|
+
// TypeScript/ts-node CJS (compiled to require()). This avoids import.meta.url which
|
|
12
|
+
// prevents Node 24 from bypassing ts-node's CJS hook via loadESMFromCJS.
|
|
13
|
+
// @ts-ignore TS1343 - import attributes are supported in TS 5.3+
|
|
14
|
+
const schema_definitions_json_1 = __importDefault(require("./schema_definitions.json"));
|
|
15
|
+
// @ts-ignore TS1343
|
|
16
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
17
|
+
const kvVersion = package_json_1.default.version;
|
|
18
|
+
const teamName = process.env._TEAM_OWNER || "UNSET";
|
|
19
|
+
const reEnvvarTokens = new RegExp("\\$\\{(.+?)\\}", "g");
|
|
20
|
+
const reFieldTokens = new RegExp("%\\{(.+?)\\}", "g");
|
|
21
|
+
// For performance reason this code is intentionally redundant and not-inlined.
|
|
22
|
+
// Removing redundancy and inlining this function somehow makes performance worst.
|
|
23
|
+
function substituteEnvVars(obj, subber) {
|
|
24
|
+
const rtn = {};
|
|
25
|
+
const replacer = (s) => s.replace(reEnvvarTokens, (__, p1) => subber(p1) ?? "");
|
|
26
|
+
for (const key in obj) {
|
|
27
|
+
const val = obj[key];
|
|
28
|
+
if (Array.isArray(val)) {
|
|
29
|
+
const updatedVals = Array(val.length);
|
|
30
|
+
for (let i = 0; i < val.length; i++) {
|
|
31
|
+
updatedVals[i] = replacer(val[i]);
|
|
32
|
+
}
|
|
33
|
+
rtn[key] = updatedVals;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
rtn[key] = replacer(val);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return rtn;
|
|
40
|
+
}
|
|
41
|
+
function deepKey(obj, key) {
|
|
42
|
+
const path = key.split(".");
|
|
43
|
+
let idx = 0;
|
|
44
|
+
let val = obj;
|
|
45
|
+
do {
|
|
46
|
+
val = val[path[idx++]];
|
|
47
|
+
} while (val && idx < path.length);
|
|
48
|
+
return val;
|
|
49
|
+
}
|
|
50
|
+
function fieldMatches(obj, field, values) {
|
|
51
|
+
const val = obj[field] || deepKey(obj, field);
|
|
52
|
+
if (val == null || val === "") {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (values[0] === "*") {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
for (let i = 0; i < values.length; i++) {
|
|
59
|
+
if (values[i] === val) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
class Rule {
|
|
66
|
+
name;
|
|
67
|
+
matchers;
|
|
68
|
+
output;
|
|
69
|
+
constructor(name, matchers, output) {
|
|
70
|
+
this.name = name;
|
|
71
|
+
this.matchers = matchers;
|
|
72
|
+
const envMissing = [];
|
|
73
|
+
this.output = substituteEnvVars(output, (k) => {
|
|
74
|
+
const val = process.env[k];
|
|
75
|
+
if (val == null) {
|
|
76
|
+
envMissing.push(k);
|
|
77
|
+
}
|
|
78
|
+
return val;
|
|
79
|
+
});
|
|
80
|
+
if (envMissing.length > 0) {
|
|
81
|
+
throw new Error(`Missing env var(s): ${envMissing.join(", ")}`);
|
|
82
|
+
}
|
|
83
|
+
Object.keys(matchers).forEach((field) => {
|
|
84
|
+
const fieldVals = matchers[field];
|
|
85
|
+
if (fieldVals.indexOf("*") !== -1 && fieldVals.length > 1) {
|
|
86
|
+
throw new Error(`Invalid matcher values in ${name}.${field}.\n` +
|
|
87
|
+
"Wildcard matcher can't co-exist with other matchers.");
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (this.output.type === "alerts" || this.output.type === "metrics") {
|
|
91
|
+
this.output.value_field = this.output.value_field || "value";
|
|
92
|
+
}
|
|
93
|
+
this.output.rule = this.name;
|
|
94
|
+
}
|
|
95
|
+
matches(msg) {
|
|
96
|
+
for (const field in this.matchers) {
|
|
97
|
+
if (!fieldMatches(msg, field, this.matchers[field])) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
outputFor(msg) {
|
|
104
|
+
const rtn = {};
|
|
105
|
+
const subst = (__, k) => msg[k] || deepKey(msg, k) || "KEY_NOT_FOUND";
|
|
106
|
+
const replacer = (s) => s.replace(reFieldTokens, subst);
|
|
107
|
+
for (const key in this.output) {
|
|
108
|
+
const val = this.output[key];
|
|
109
|
+
if (Array.isArray(val)) {
|
|
110
|
+
const updatedVals = Array(val.length);
|
|
111
|
+
for (let i = 0; i < val.length; i++) {
|
|
112
|
+
updatedVals[i] = replacer(val[i]);
|
|
113
|
+
}
|
|
114
|
+
rtn[key] = updatedVals;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
rtn[key] = replacer(val);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return rtn;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.Rule = Rule;
|
|
124
|
+
function validateKVConfig(config) {
|
|
125
|
+
const validator = new jsonschema_1.Validator();
|
|
126
|
+
const results = validator.validate(config, schema_definitions_json_1.default);
|
|
127
|
+
return {
|
|
128
|
+
valid: results.valid,
|
|
129
|
+
errors: results.errors.map((err) => err.stack ?? ""),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function parseConfig(fileString) {
|
|
133
|
+
let config;
|
|
134
|
+
try {
|
|
135
|
+
config = (0, js_yaml_1.load)(fileString);
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
return { valid: false, rules: [], errors: [e] };
|
|
139
|
+
}
|
|
140
|
+
const validateRes = validateKVConfig(config);
|
|
141
|
+
if (!validateRes.valid) {
|
|
142
|
+
return Object.assign(validateRes, { rules: [] });
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const rules = Object.entries(config.routes).map(([name, elem]) => new Rule(name, elem.matchers, elem.output));
|
|
146
|
+
return { valid: true, rules, errors: [] };
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
return { valid: false, rules: [], errors: [e] };
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
class Router {
|
|
153
|
+
rules;
|
|
154
|
+
constructor(rules) {
|
|
155
|
+
this.rules = rules || [];
|
|
156
|
+
}
|
|
157
|
+
loadConfig(filename) {
|
|
158
|
+
const data = node_fs_1.default.readFileSync(filename, "utf8");
|
|
159
|
+
this._loadConfigString(data);
|
|
160
|
+
}
|
|
161
|
+
_loadConfigString(configStr) {
|
|
162
|
+
const parsedRules = parseConfig(configStr);
|
|
163
|
+
if (!parsedRules.valid) {
|
|
164
|
+
throw new Error(String(parsedRules.errors));
|
|
165
|
+
}
|
|
166
|
+
this.rules = parsedRules.rules;
|
|
167
|
+
}
|
|
168
|
+
route(msg) {
|
|
169
|
+
const outputs = [];
|
|
170
|
+
for (let i = 0; i < this.rules.length; i++) {
|
|
171
|
+
const rule = this.rules[i];
|
|
172
|
+
if (rule.matches(msg)) {
|
|
173
|
+
outputs.push(rule.outputFor(msg));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
team: teamName,
|
|
178
|
+
kv_version: kvVersion,
|
|
179
|
+
kv_language: "js",
|
|
180
|
+
routes: outputs,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.Router = Router;
|
package/package.json
CHANGED
|
@@ -1,42 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kayvee",
|
|
3
3
|
"description": "Write data to key=val pairs, for human and machine readability",
|
|
4
|
-
"version": "
|
|
5
|
-
"main": "index.js",
|
|
4
|
+
"version": "4.0.0",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./dist/index.js",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./logger": {
|
|
14
|
+
"require": "./dist/logger/logger.js",
|
|
15
|
+
"import": "./dist/logger/logger.js",
|
|
16
|
+
"types": "./dist/logger/logger.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./middleware": {
|
|
19
|
+
"require": "./dist/middleware.js",
|
|
20
|
+
"import": "./dist/middleware.js",
|
|
21
|
+
"types": "./dist/middleware.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./router": {
|
|
24
|
+
"require": "./dist/router/index.js",
|
|
25
|
+
"import": "./dist/router/index.js",
|
|
26
|
+
"types": "./dist/router/index.d.ts"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"typesVersions": {
|
|
30
|
+
"*": {
|
|
31
|
+
"logger": ["dist/logger/logger.d.ts"],
|
|
32
|
+
"middleware": ["dist/middleware.d.ts"],
|
|
33
|
+
"router": ["dist/router/index.d.ts"]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist/**/*",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
6
41
|
"repository": {
|
|
7
42
|
"type": "git",
|
|
8
43
|
"url": "git://github.com/Clever/kayvee-js"
|
|
9
44
|
},
|
|
10
45
|
"dependencies": {
|
|
11
|
-
"js-yaml": "^
|
|
12
|
-
"jsonschema": "^1.
|
|
13
|
-
"morgan": "^1.
|
|
14
|
-
"qs": "^6.
|
|
15
|
-
"split": "^1.0.0",
|
|
16
|
-
"underscore": "^1.8.3"
|
|
46
|
+
"js-yaml": "^4.1.0",
|
|
47
|
+
"jsonschema": "^1.5.0",
|
|
48
|
+
"morgan": "^1.10.0",
|
|
49
|
+
"qs": "^6.13.0"
|
|
17
50
|
},
|
|
18
51
|
"devDependencies": {
|
|
19
52
|
"@clever/prettier-config": "1.0.0",
|
|
20
|
-
"@types/
|
|
21
|
-
"@types/
|
|
22
|
-
"
|
|
53
|
+
"@types/express": "^4.17.23",
|
|
54
|
+
"@types/js-yaml": "^4.0.9",
|
|
55
|
+
"@types/jsonschema": "^1.1.1",
|
|
56
|
+
"@types/mocha": "^10.0.6",
|
|
57
|
+
"@types/morgan": "^1.9.10",
|
|
58
|
+
"@types/node": "^20.11.0",
|
|
59
|
+
"@types/qs": "^6.9.11",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
61
|
+
"@typescript-eslint/parser": "^6.19.0",
|
|
23
62
|
"benchmark": "^2.1.1",
|
|
24
|
-
"eslint": "^
|
|
25
|
-
"eslint-config-airbnb": "^
|
|
26
|
-
"eslint-
|
|
27
|
-
"eslint-
|
|
28
|
-
"express": "^4.
|
|
29
|
-
"mocha": "^
|
|
30
|
-
"prettier": "2.
|
|
31
|
-
"sinon": "^
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"typescript": "^
|
|
63
|
+
"eslint": "^8.56.0",
|
|
64
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
65
|
+
"eslint-config-prettier": "^9.1.0",
|
|
66
|
+
"eslint-formatter-summary": "^1.1.0",
|
|
67
|
+
"express": "^4.18.2",
|
|
68
|
+
"mocha": "^10.2.0",
|
|
69
|
+
"prettier": "^3.2.5",
|
|
70
|
+
"sinon": "^17.0.1",
|
|
71
|
+
"split": "^1.0.0",
|
|
72
|
+
"supertest": "^6.3.4",
|
|
73
|
+
"ts-node": "^10.9.2",
|
|
74
|
+
"typescript": "^5.3.0",
|
|
75
|
+
"underscore": "^1.8.3"
|
|
36
76
|
},
|
|
37
77
|
"scripts": {
|
|
38
78
|
"test": "make -Br test",
|
|
39
|
-
"
|
|
79
|
+
"prepublishOnly": "make build"
|
|
40
80
|
},
|
|
41
81
|
"author": "Clever <tech-notify@clever.com>",
|
|
42
82
|
"license": "BSD-2-Clause",
|
package/.circleci/config.yml
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
jobs:
|
|
3
|
-
build:
|
|
4
|
-
working_directory: ~/Clever/kayvee-js
|
|
5
|
-
docker:
|
|
6
|
-
- image: circleci/node:12-stretch
|
|
7
|
-
environment:
|
|
8
|
-
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
|
9
|
-
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
|
10
|
-
steps:
|
|
11
|
-
- run:
|
|
12
|
-
command: cd $HOME && git clone --depth 1 -v https://github.com/Clever/ci-scripts.git && cd ci-scripts && git show --oneline -s
|
|
13
|
-
name: Clone ci-scripts
|
|
14
|
-
- checkout
|
|
15
|
-
- setup_remote_docker
|
|
16
|
-
- run:
|
|
17
|
-
command: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
|
|
18
|
-
name: Set up CircleCI artifacts directories
|
|
19
|
-
- run:
|
|
20
|
-
command: npm install
|
|
21
|
-
name: npm install
|
|
22
|
-
- run: make build
|
|
23
|
-
- run: npm test
|
|
24
|
-
- run: make benchmarks
|
|
25
|
-
- run: if [ "${CIRCLE_BRANCH}" == "master" ]; then $HOME/ci-scripts/circleci/npm-publish $NPM_TOKEN .; fi;
|
package/.eslintrc.yml
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
extends: "airbnb"
|
|
2
|
-
env:
|
|
3
|
-
mocha: true
|
|
4
|
-
parser: "babel-eslint"
|
|
5
|
-
parserOptions:
|
|
6
|
-
ecmaVersion: 6
|
|
7
|
-
rules:
|
|
8
|
-
# no hard limit on line length
|
|
9
|
-
max-len: 0
|
|
10
|
-
|
|
11
|
-
# we allow use of console...for now
|
|
12
|
-
no-console: 0
|
|
13
|
-
|
|
14
|
-
# we currently use snake case in most places, however, we'd like to switch to camelCase eventually since it's more common in the JS community
|
|
15
|
-
camelcase: 0
|
|
16
|
-
|
|
17
|
-
# vars are necessary for server-side requires right now
|
|
18
|
-
no-var: 0
|
|
19
|
-
vars-on-top: 0
|
|
20
|
-
|
|
21
|
-
# multi spaces only allowed for aligning variable/import declarations
|
|
22
|
-
no-multi-spaces:
|
|
23
|
-
- 2
|
|
24
|
-
- exceptions:
|
|
25
|
-
VariableDeclarator: true
|
|
26
|
-
ImportDeclaration: true
|
|
27
|
-
|
|
28
|
-
# we currently use null in many places, so allow == for null checks
|
|
29
|
-
eqeqeq:
|
|
30
|
-
- 2
|
|
31
|
-
- "smart"
|
|
32
|
-
|
|
33
|
-
quotes: [2, "double", "avoid-escape"]
|
|
34
|
-
new-cap:
|
|
35
|
-
- 2
|
|
36
|
-
- newIsCapExceptions: ["kayvee.logger"]
|
|
37
|
-
no-param-reassign:
|
|
38
|
-
- 2
|
|
39
|
-
- props: false
|
|
40
|
-
key-spacing:
|
|
41
|
-
- 2
|
|
42
|
-
- mode: "minimum"
|
|
43
|
-
|
|
44
|
-
guard-for-in: 0
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
12
|
package/.prettierrc.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"@clever/prettier-config"
|
package/Makefile
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
.PHONY: test build format format-all format-check lint
|
|
2
|
-
TESTS=$(shell cd test && ls *.ts | sed s/\.ts$$//)
|
|
3
|
-
TS_FILES := $(shell find . -name "*.ts" -not -path "./node_modules/*")
|
|
4
|
-
FORMATTED_FILES := $(TS_FILES) # Add other file types as you see fit, e.g. JSON files, config files
|
|
5
|
-
MODIFIED_FORMATTED_FILES := $(shell git diff --name-only master $(FORMATTED_FILES))
|
|
6
|
-
|
|
7
|
-
PRETTIER := ./node_modules/.bin/prettier
|
|
8
|
-
|
|
9
|
-
build: clean
|
|
10
|
-
./node_modules/.bin/tsc --outDir build
|
|
11
|
-
cp ./lib/router/schema_definitions.json ./build/lib/router/
|
|
12
|
-
cp ./package.json ./build/
|
|
13
|
-
|
|
14
|
-
test: lint test/tests.json $(TESTS)
|
|
15
|
-
|
|
16
|
-
$(TESTS):
|
|
17
|
-
_DEPLOY_ENV=testing _EXECUTION_NAME=abc DEBUG=us:progress NODE_ENV=test \
|
|
18
|
-
node_modules/mocha/bin/mocha --require ts-node/register --timeout 60000 test/$@.ts
|
|
19
|
-
|
|
20
|
-
benchmarks: build benchmark-data
|
|
21
|
-
node benchmarks/routing.js
|
|
22
|
-
|
|
23
|
-
clean:
|
|
24
|
-
rm -rf build
|
|
25
|
-
|
|
26
|
-
clean-data:
|
|
27
|
-
rm ./benchmarks/data/*.json ./benchmarks/data/*.yml
|
|
28
|
-
|
|
29
|
-
benchmark-data:
|
|
30
|
-
@# Only download if the files don't exist
|
|
31
|
-
@[ -f ./benchmarks/data/corpus-basic.json ] || curl https://raw.githubusercontent.com/Clever/kayvee/master/data/corpus-basic.json > ./benchmarks/data/corpus-basic.json
|
|
32
|
-
@[ -f ./benchmarks/data/corpus-pathological.json ] || curl https://raw.githubusercontent.com/Clever/kayvee/master/data/corpus-pathological.json > ./benchmarks/data/corpus-pathological.json
|
|
33
|
-
@[ -f ./benchmarks/data/corpus-realistic.json ] || curl https://raw.githubusercontent.com/Clever/kayvee/master/data/corpus-realistic.json > ./benchmarks/data/corpus-realistic.json
|
|
34
|
-
@[ -f ./benchmarks/data/kvconfig-basic.yml ] || curl https://raw.githubusercontent.com/Clever/kayvee/master/data/kvconfig-basic.yml > ./benchmarks/data/kvconfig-basic.yml
|
|
35
|
-
@[ -f ./benchmarks/data/kvconfig-pathological.yml ] || curl https://raw.githubusercontent.com/Clever/kayvee/master/data/kvconfig-pathological.yml > ./benchmarks/data/kvconfig-pathological.yml
|
|
36
|
-
@[ -f ./benchmarks/data/kvconfig-realistic.yml ] || curl https://raw.githubusercontent.com/Clever/kayvee/master/data/kvconfig-realistic.yml > ./benchmarks/data/kvconfig-realistic.yml
|
|
37
|
-
|
|
38
|
-
format:
|
|
39
|
-
@echo "Formatting modified files..."
|
|
40
|
-
@$(PRETTIER) --write $(MODIFIED_FORMATTED_FILES)
|
|
41
|
-
|
|
42
|
-
format-all:
|
|
43
|
-
@echo "Formatting all files..."
|
|
44
|
-
@$(PRETTIER) --write $(FORMATTED_FILES)
|
|
45
|
-
|
|
46
|
-
format-check:
|
|
47
|
-
@echo "Running format check..."
|
|
48
|
-
@$(PRETTIER) --list-different $(FORMATTED_FILES) || \
|
|
49
|
-
(echo -e "❌ \033[0;31m Prettier found discrepancies in the above files. Run 'make format' to fix.\033[0m" && false)
|
|
50
|
-
|
|
51
|
-
lint: format-check
|
|
52
|
-
./node_modules/.bin/tslint $(TS_FILES)
|
|
53
|
-
./node_modules/.bin/eslint $(TS_FILES)
|
|
54
|
-
|
|
55
|
-
test/tests.json:
|
|
56
|
-
wget https://raw.githubusercontent.com/Clever/kayvee/master/tests.json -O test/tests.json
|
package/benchmarks/data/.keep
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{ "title": "time" },
|
|
3
|
-
{ "title": "person" },
|
|
4
|
-
{ "title": "year" },
|
|
5
|
-
{ "title": "way" },
|
|
6
|
-
{ "title": "day" },
|
|
7
|
-
{ "title": "thing" },
|
|
8
|
-
{ "title": "man" },
|
|
9
|
-
{ "title": "world" },
|
|
10
|
-
{ "title": "life" },
|
|
11
|
-
{ "title": "hand" },
|
|
12
|
-
{ "title": "part" },
|
|
13
|
-
{ "title": "child" },
|
|
14
|
-
{ "title": "eye" },
|
|
15
|
-
{ "title": "woman" },
|
|
16
|
-
{ "title": "place" },
|
|
17
|
-
{ "title": "work" },
|
|
18
|
-
{ "title": "week" },
|
|
19
|
-
{ "title": "case" },
|
|
20
|
-
{ "title": "point" },
|
|
21
|
-
{ "title": "government" }
|
|
22
|
-
]
|