slds-json-schema-renderer 1.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/LICENSE +21 -0
- package/README.md +118 -0
- package/bin/cli.js +35 -0
- package/lib/cli/generate.js +110 -0
- package/lib/cli/index.js +6 -0
- package/lib/frontend/bundle.mjs +1009 -0
- package/lib/frontend/bundle.umd.js +1 -0
- package/lib/frontend/style.css +1 -0
- package/lib/index.js +14 -0
- package/lib/templates/index.html +21 -0
- package/lib/utils/html-generator.js +160 -0
- package/lib/utils/schema-parser.js +266 -0
- package/package.json +90 -0
- package/src/templates/index.html +21 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Main entry point for the JSON Schema Documentation Generator
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var schemaParser = require('./utils/schema-parser');
|
|
8
|
+
var htmlGenerator = require('./utils/html-generator');
|
|
9
|
+
var cli = require('./cli');
|
|
10
|
+
module.exports = {
|
|
11
|
+
schemaParser: schemaParser,
|
|
12
|
+
htmlGenerator: htmlGenerator,
|
|
13
|
+
cli: cli
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>JSON Schema Documentation</title>
|
|
7
|
+
|
|
8
|
+
<!-- Stylesheet -->
|
|
9
|
+
<link rel="stylesheet" href="assets/style.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<!-- App will be rendered here -->
|
|
13
|
+
<div id="app"></div>
|
|
14
|
+
|
|
15
|
+
<!-- Vue 3 from CDN -->
|
|
16
|
+
<script src="assets/vue.js"></script>
|
|
17
|
+
|
|
18
|
+
<!-- App bundle -->
|
|
19
|
+
<script src="assets/bundle.umd.js"></script>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
5
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
6
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
7
|
+
var fs = require('fs-extra');
|
|
8
|
+
var path = require('path');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generate HTML documentation from parsed JSON schemas
|
|
12
|
+
* @param {Object} options - Generation options
|
|
13
|
+
* @param {Array} options.schemas - Array of parsed schemas
|
|
14
|
+
* @param {string} options.outputDir - Output directory
|
|
15
|
+
* @param {string} options.title - Documentation title
|
|
16
|
+
* @param {string} options.description - Documentation description
|
|
17
|
+
*/
|
|
18
|
+
function generate(_x) {
|
|
19
|
+
return _generate.apply(this, arguments);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Copy assets to the output directory
|
|
23
|
+
* @param {string} outputDir - Output directory
|
|
24
|
+
*/
|
|
25
|
+
function _generate() {
|
|
26
|
+
_generate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
27
|
+
var schemas, outputDir, title, description, templatePath, html, appData, scriptTag, outputPath;
|
|
28
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
schemas = options.schemas, outputDir = options.outputDir, title = options.title, description = options.description;
|
|
32
|
+
_context.prev = 1;
|
|
33
|
+
console.log('Preparing output directory...');
|
|
34
|
+
// Create the output directory if it doesn't exist
|
|
35
|
+
_context.next = 5;
|
|
36
|
+
return fs.ensureDir(outputDir);
|
|
37
|
+
case 5:
|
|
38
|
+
// Read the HTML template
|
|
39
|
+
templatePath = path.join(__dirname, '../templates/index.html');
|
|
40
|
+
_context.next = 8;
|
|
41
|
+
return fs.readFile(templatePath, 'utf8');
|
|
42
|
+
case 8:
|
|
43
|
+
html = _context.sent;
|
|
44
|
+
// Prepare the data for the Vue components
|
|
45
|
+
appData = {
|
|
46
|
+
title: title,
|
|
47
|
+
description: description,
|
|
48
|
+
schemas: schemas,
|
|
49
|
+
generatedAt: new Date().toISOString()
|
|
50
|
+
};
|
|
51
|
+
console.log('Creating HTML output...');
|
|
52
|
+
|
|
53
|
+
// Add the data to the window object so it can be used by Vue
|
|
54
|
+
scriptTag = "<script>\n window.__JSON_SCHEMA_DOCS_DATA__ = ".concat(JSON.stringify(appData), ";\n </script>"); // Insert the script tag before the closing body tag
|
|
55
|
+
html = html.replace('</body>', "".concat(scriptTag, "</body>"));
|
|
56
|
+
console.log('Writing HTML file...');
|
|
57
|
+
// Write the HTML to the output directory
|
|
58
|
+
outputPath = path.join(outputDir, 'index.html');
|
|
59
|
+
_context.next = 17;
|
|
60
|
+
return fs.writeFile(outputPath, html);
|
|
61
|
+
case 17:
|
|
62
|
+
_context.next = 19;
|
|
63
|
+
return copyAssets(outputDir);
|
|
64
|
+
case 19:
|
|
65
|
+
return _context.abrupt("return", {
|
|
66
|
+
outputPath: outputPath,
|
|
67
|
+
schemasProcessed: schemas.length
|
|
68
|
+
});
|
|
69
|
+
case 22:
|
|
70
|
+
_context.prev = 22;
|
|
71
|
+
_context.t0 = _context["catch"](1);
|
|
72
|
+
throw new Error("Failed to generate HTML: ".concat(_context.t0.message));
|
|
73
|
+
case 25:
|
|
74
|
+
case "end":
|
|
75
|
+
return _context.stop();
|
|
76
|
+
}
|
|
77
|
+
}, _callee, null, [[1, 22]]);
|
|
78
|
+
}));
|
|
79
|
+
return _generate.apply(this, arguments);
|
|
80
|
+
}
|
|
81
|
+
function copyAssets(_x2) {
|
|
82
|
+
return _copyAssets.apply(this, arguments);
|
|
83
|
+
}
|
|
84
|
+
function _copyAssets() {
|
|
85
|
+
_copyAssets = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(outputDir) {
|
|
86
|
+
var assetsDir, bundlePath, bundleTarget, vuePath, vueTarget;
|
|
87
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
88
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
_context2.prev = 0;
|
|
91
|
+
console.log('Copying assets...');
|
|
92
|
+
// Create assets directory
|
|
93
|
+
assetsDir = path.join(outputDir, 'assets');
|
|
94
|
+
_context2.next = 5;
|
|
95
|
+
return fs.ensureDir(assetsDir);
|
|
96
|
+
case 5:
|
|
97
|
+
_context2.prev = 5;
|
|
98
|
+
// Vite produces both ES modules and UMD files - we'll use the UMD version for broader compatibility
|
|
99
|
+
bundlePath = path.resolve(__dirname, '../../lib/frontend/');
|
|
100
|
+
bundleTarget = assetsDir;
|
|
101
|
+
_context2.next = 10;
|
|
102
|
+
return fs.pathExists(bundlePath);
|
|
103
|
+
case 10:
|
|
104
|
+
if (!_context2.sent) {
|
|
105
|
+
_context2.next = 24;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
_context2.next = 13;
|
|
109
|
+
return fs.copy(bundlePath, bundleTarget);
|
|
110
|
+
case 13:
|
|
111
|
+
console.log('Frontend bundle copied successfully');
|
|
112
|
+
|
|
113
|
+
// Copy Vue as well since we're externalizing it
|
|
114
|
+
vuePath = path.resolve(__dirname, '../../node_modules/vue/dist/vue.global.prod.js');
|
|
115
|
+
vueTarget = path.join(assetsDir, 'vue.js');
|
|
116
|
+
_context2.next = 18;
|
|
117
|
+
return fs.pathExists(vuePath);
|
|
118
|
+
case 18:
|
|
119
|
+
if (!_context2.sent) {
|
|
120
|
+
_context2.next = 22;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
_context2.next = 21;
|
|
124
|
+
return fs.copy(vuePath, vueTarget);
|
|
125
|
+
case 21:
|
|
126
|
+
console.log('Vue bundle copied successfully');
|
|
127
|
+
case 22:
|
|
128
|
+
_context2.next = 28;
|
|
129
|
+
break;
|
|
130
|
+
case 24:
|
|
131
|
+
console.warn('Warning: Frontend bundle not found at', bundlePath);
|
|
132
|
+
console.warn('Make sure you run "npm run build:frontend" first');
|
|
133
|
+
// Create a placeholder bundle
|
|
134
|
+
_context2.next = 28;
|
|
135
|
+
return fs.writeFile(bundleTarget, '// Placeholder bundle');
|
|
136
|
+
case 28:
|
|
137
|
+
_context2.next = 33;
|
|
138
|
+
break;
|
|
139
|
+
case 30:
|
|
140
|
+
_context2.prev = 30;
|
|
141
|
+
_context2.t0 = _context2["catch"](5);
|
|
142
|
+
console.warn("Warning: Could not copy frontend bundle: ".concat(_context2.t0.message));
|
|
143
|
+
case 33:
|
|
144
|
+
_context2.next = 38;
|
|
145
|
+
break;
|
|
146
|
+
case 35:
|
|
147
|
+
_context2.prev = 35;
|
|
148
|
+
_context2.t1 = _context2["catch"](0);
|
|
149
|
+
throw new Error("Failed to copy assets: ".concat(_context2.t1.message));
|
|
150
|
+
case 38:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context2.stop();
|
|
153
|
+
}
|
|
154
|
+
}, _callee2, null, [[0, 35], [5, 30]]);
|
|
155
|
+
}));
|
|
156
|
+
return _copyAssets.apply(this, arguments);
|
|
157
|
+
}
|
|
158
|
+
module.exports = {
|
|
159
|
+
generate: generate
|
|
160
|
+
};
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
5
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
9
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
10
|
+
var fs = require('fs-extra');
|
|
11
|
+
var path = require('path');
|
|
12
|
+
var $RefParser = require('json-schema-ref-parser');
|
|
13
|
+
var Ajv = require('ajv');
|
|
14
|
+
var glob = require('glob');
|
|
15
|
+
|
|
16
|
+
// Initialize AJV with options
|
|
17
|
+
var ajv = new Ajv({
|
|
18
|
+
allErrors: true,
|
|
19
|
+
verbose: true,
|
|
20
|
+
strict: false
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Parse a JSON schema file
|
|
25
|
+
* @param {string} filePath - Path to the JSON schema file
|
|
26
|
+
* @returns {Object} Parsed schema
|
|
27
|
+
*/
|
|
28
|
+
function parse(_x) {
|
|
29
|
+
return _parse.apply(this, arguments);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Process a schema to resolve references and add metadata
|
|
33
|
+
* @param {Object} schema - The JSON schema object
|
|
34
|
+
* @param {string} filePath - Path to the JSON schema file
|
|
35
|
+
* @returns {Object} Processed schema
|
|
36
|
+
*/
|
|
37
|
+
function _parse() {
|
|
38
|
+
_parse = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(filePath) {
|
|
39
|
+
var schemaContent, rawSchema, validate;
|
|
40
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
41
|
+
while (1) switch (_context.prev = _context.next) {
|
|
42
|
+
case 0:
|
|
43
|
+
_context.prev = 0;
|
|
44
|
+
_context.next = 3;
|
|
45
|
+
return fs.readFile(filePath, 'utf8');
|
|
46
|
+
case 3:
|
|
47
|
+
schemaContent = _context.sent;
|
|
48
|
+
_context.prev = 4;
|
|
49
|
+
rawSchema = JSON.parse(schemaContent);
|
|
50
|
+
_context.next = 11;
|
|
51
|
+
break;
|
|
52
|
+
case 8:
|
|
53
|
+
_context.prev = 8;
|
|
54
|
+
_context.t0 = _context["catch"](4);
|
|
55
|
+
throw new Error("Invalid JSON in file ".concat(filePath, ": ").concat(_context.t0.message));
|
|
56
|
+
case 11:
|
|
57
|
+
// Check if it's a valid JSON schema (should have a $schema property or type property)
|
|
58
|
+
if (!rawSchema.$schema && !rawSchema.type) {
|
|
59
|
+
console.warn("Warning: File ".concat(filePath, " may not be a JSON schema (missing $schema or type property)"));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Attempt to validate against JSON Schema draft-07
|
|
63
|
+
try {
|
|
64
|
+
validate = ajv.compile({
|
|
65
|
+
$schema: "http://json-schema.org/draft-07/schema#"
|
|
66
|
+
});
|
|
67
|
+
validate(rawSchema);
|
|
68
|
+
if (validate.errors) {
|
|
69
|
+
console.warn("Warning: Schema validation issues in ".concat(filePath, ":"));
|
|
70
|
+
validate.errors.forEach(function (err) {
|
|
71
|
+
console.warn(" - ".concat(err.instancePath, " ").concat(err.message));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
} catch (err) {
|
|
75
|
+
console.warn("Warning: Failed to validate schema ".concat(filePath, ": ").concat(err.message));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Process the schema to normalize and add metadata
|
|
79
|
+
_context.next = 15;
|
|
80
|
+
return processSchema(rawSchema, filePath);
|
|
81
|
+
case 15:
|
|
82
|
+
return _context.abrupt("return", _context.sent);
|
|
83
|
+
case 18:
|
|
84
|
+
_context.prev = 18;
|
|
85
|
+
_context.t1 = _context["catch"](0);
|
|
86
|
+
throw new Error("Failed to parse schema: ".concat(_context.t1.message));
|
|
87
|
+
case 21:
|
|
88
|
+
case "end":
|
|
89
|
+
return _context.stop();
|
|
90
|
+
}
|
|
91
|
+
}, _callee, null, [[0, 18], [4, 8]]);
|
|
92
|
+
}));
|
|
93
|
+
return _parse.apply(this, arguments);
|
|
94
|
+
}
|
|
95
|
+
function processSchema(_x2, _x3) {
|
|
96
|
+
return _processSchema.apply(this, arguments);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Parse multiple schema files from a directory
|
|
100
|
+
* @param {string} directoryPath - Path to the directory containing JSON schema files
|
|
101
|
+
* @param {Object} options - Parsing options
|
|
102
|
+
* @returns {Array} Array of parsed schemas
|
|
103
|
+
*/
|
|
104
|
+
function _processSchema() {
|
|
105
|
+
_processSchema = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(schema, filePath) {
|
|
106
|
+
var dereferencedSchema, stats;
|
|
107
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
108
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
109
|
+
case 0:
|
|
110
|
+
_context2.prev = 0;
|
|
111
|
+
_context2.next = 3;
|
|
112
|
+
return $RefParser.dereference(schema, {
|
|
113
|
+
resolve: {
|
|
114
|
+
file: true,
|
|
115
|
+
http: false
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
case 3:
|
|
119
|
+
dereferencedSchema = _context2.sent;
|
|
120
|
+
_context2.next = 6;
|
|
121
|
+
return fs.stat(filePath);
|
|
122
|
+
case 6:
|
|
123
|
+
stats = _context2.sent;
|
|
124
|
+
// Add metadata
|
|
125
|
+
dereferencedSchema._metadata = {
|
|
126
|
+
fileName: path.basename(filePath),
|
|
127
|
+
filePath: filePath,
|
|
128
|
+
fileSize: stats.size,
|
|
129
|
+
lastModified: stats.mtime,
|
|
130
|
+
processed: new Date().toISOString()
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// Extract additional useful metadata from the schema
|
|
134
|
+
if (dereferencedSchema.title) {
|
|
135
|
+
dereferencedSchema._metadata.title = dereferencedSchema.title;
|
|
136
|
+
}
|
|
137
|
+
if (dereferencedSchema.$id) {
|
|
138
|
+
dereferencedSchema._metadata.id = dereferencedSchema.$id;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Extract all schema types (if it's an array of types)
|
|
142
|
+
if (dereferencedSchema.type) {
|
|
143
|
+
if (Array.isArray(dereferencedSchema.type)) {
|
|
144
|
+
dereferencedSchema._metadata.types = dereferencedSchema.type;
|
|
145
|
+
} else {
|
|
146
|
+
dereferencedSchema._metadata.types = [dereferencedSchema.type];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Count properties
|
|
151
|
+
if (dereferencedSchema.properties) {
|
|
152
|
+
dereferencedSchema._metadata.propertyCount = Object.keys(dereferencedSchema.properties).length;
|
|
153
|
+
|
|
154
|
+
// Count required properties
|
|
155
|
+
if (Array.isArray(dereferencedSchema.required)) {
|
|
156
|
+
dereferencedSchema._metadata.requiredPropertyCount = dereferencedSchema.required.length;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return _context2.abrupt("return", dereferencedSchema);
|
|
160
|
+
case 15:
|
|
161
|
+
_context2.prev = 15;
|
|
162
|
+
_context2.t0 = _context2["catch"](0);
|
|
163
|
+
throw new Error("Failed to process schema: ".concat(_context2.t0.message));
|
|
164
|
+
case 18:
|
|
165
|
+
case "end":
|
|
166
|
+
return _context2.stop();
|
|
167
|
+
}
|
|
168
|
+
}, _callee2, null, [[0, 15]]);
|
|
169
|
+
}));
|
|
170
|
+
return _processSchema.apply(this, arguments);
|
|
171
|
+
}
|
|
172
|
+
function parseDirectory(_x4) {
|
|
173
|
+
return _parseDirectory.apply(this, arguments);
|
|
174
|
+
}
|
|
175
|
+
function _parseDirectory() {
|
|
176
|
+
_parseDirectory = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(directoryPath) {
|
|
177
|
+
var options,
|
|
178
|
+
_options$pattern,
|
|
179
|
+
pattern,
|
|
180
|
+
_options$verbose,
|
|
181
|
+
verbose,
|
|
182
|
+
schemaFiles,
|
|
183
|
+
schemas,
|
|
184
|
+
_iterator,
|
|
185
|
+
_step,
|
|
186
|
+
file,
|
|
187
|
+
schema,
|
|
188
|
+
_args3 = arguments;
|
|
189
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
190
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
191
|
+
case 0:
|
|
192
|
+
options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
193
|
+
_options$pattern = options.pattern, pattern = _options$pattern === void 0 ? '**/*.json' : _options$pattern, _options$verbose = options.verbose, verbose = _options$verbose === void 0 ? false : _options$verbose;
|
|
194
|
+
_context3.prev = 2;
|
|
195
|
+
// Find all JSON files in the directory
|
|
196
|
+
schemaFiles = glob.sync(path.join(directoryPath, pattern));
|
|
197
|
+
if (!(schemaFiles.length === 0)) {
|
|
198
|
+
_context3.next = 6;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
throw new Error("No JSON schema files found in ".concat(directoryPath));
|
|
202
|
+
case 6:
|
|
203
|
+
// Parse each schema file
|
|
204
|
+
schemas = [];
|
|
205
|
+
_iterator = _createForOfIteratorHelper(schemaFiles);
|
|
206
|
+
_context3.prev = 8;
|
|
207
|
+
_iterator.s();
|
|
208
|
+
case 10:
|
|
209
|
+
if ((_step = _iterator.n()).done) {
|
|
210
|
+
_context3.next = 25;
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
file = _step.value;
|
|
214
|
+
if (verbose) {
|
|
215
|
+
console.log("Parsing schema: ".concat(file));
|
|
216
|
+
}
|
|
217
|
+
_context3.prev = 13;
|
|
218
|
+
_context3.next = 16;
|
|
219
|
+
return parse(file);
|
|
220
|
+
case 16:
|
|
221
|
+
schema = _context3.sent;
|
|
222
|
+
schemas.push({
|
|
223
|
+
fileName: path.basename(file),
|
|
224
|
+
filePath: file,
|
|
225
|
+
schema: schema
|
|
226
|
+
});
|
|
227
|
+
_context3.next = 23;
|
|
228
|
+
break;
|
|
229
|
+
case 20:
|
|
230
|
+
_context3.prev = 20;
|
|
231
|
+
_context3.t0 = _context3["catch"](13);
|
|
232
|
+
if (verbose) {
|
|
233
|
+
console.error("Error parsing schema ".concat(file, ": ").concat(_context3.t0.message));
|
|
234
|
+
}
|
|
235
|
+
case 23:
|
|
236
|
+
_context3.next = 10;
|
|
237
|
+
break;
|
|
238
|
+
case 25:
|
|
239
|
+
_context3.next = 30;
|
|
240
|
+
break;
|
|
241
|
+
case 27:
|
|
242
|
+
_context3.prev = 27;
|
|
243
|
+
_context3.t1 = _context3["catch"](8);
|
|
244
|
+
_iterator.e(_context3.t1);
|
|
245
|
+
case 30:
|
|
246
|
+
_context3.prev = 30;
|
|
247
|
+
_iterator.f();
|
|
248
|
+
return _context3.finish(30);
|
|
249
|
+
case 33:
|
|
250
|
+
return _context3.abrupt("return", schemas);
|
|
251
|
+
case 36:
|
|
252
|
+
_context3.prev = 36;
|
|
253
|
+
_context3.t2 = _context3["catch"](2);
|
|
254
|
+
throw new Error("Failed to parse directory: ".concat(_context3.t2.message));
|
|
255
|
+
case 39:
|
|
256
|
+
case "end":
|
|
257
|
+
return _context3.stop();
|
|
258
|
+
}
|
|
259
|
+
}, _callee3, null, [[2, 36], [8, 27, 30, 33], [13, 20]]);
|
|
260
|
+
}));
|
|
261
|
+
return _parseDirectory.apply(this, arguments);
|
|
262
|
+
}
|
|
263
|
+
module.exports = {
|
|
264
|
+
parse: parse,
|
|
265
|
+
parseDirectory: parseDirectory
|
|
266
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slds-json-schema-renderer",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A CLI tool to generate documentation from JSON schema files",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"json-schema-docs": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"lib/",
|
|
12
|
+
"src/templates/",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"start": "node ./bin/cli.js",
|
|
18
|
+
"clean": "rimraf lib",
|
|
19
|
+
"build:cli": "babel src --out-dir lib --copy-files --ignore 'src/frontend/**'",
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build:frontend": "vite build",
|
|
22
|
+
"build": "npm run clean && npm run build:cli && npm run build:frontend",
|
|
23
|
+
"prepublishOnly": "npm run build",
|
|
24
|
+
"pages": "npm run build && npm run start -- generate -i ./test/ -o docs",
|
|
25
|
+
"semantic-release": "semantic-release"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"json-schema",
|
|
29
|
+
"documentation",
|
|
30
|
+
"cli",
|
|
31
|
+
"static-site-generator",
|
|
32
|
+
"vue",
|
|
33
|
+
"slds"
|
|
34
|
+
],
|
|
35
|
+
"author": "PhyberApex",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@salesforce-ux/design-system": "^2.17.5",
|
|
39
|
+
"ajv": "^8.12.0",
|
|
40
|
+
"chalk": "^4.1.2",
|
|
41
|
+
"commander": "^9.4.0",
|
|
42
|
+
"fs-extra": "^10.1.0",
|
|
43
|
+
"glob": "^8.0.3",
|
|
44
|
+
"json-schema-ref-parser": "^9.0.9",
|
|
45
|
+
"shx": "^0.4.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@babel/cli": "^7.15.7",
|
|
49
|
+
"@babel/core": "^7.15.5",
|
|
50
|
+
"@babel/preset-env": "^7.15.6",
|
|
51
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
52
|
+
"@semantic-release/git": "^10.0.1",
|
|
53
|
+
"@semantic-release/github": "^9.2.6",
|
|
54
|
+
"@semantic-release/npm": "^11.0.2",
|
|
55
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
56
|
+
"css-loader": "^6.3.0",
|
|
57
|
+
"jest": "^29.0.3",
|
|
58
|
+
"rimraf": "^3.0.2",
|
|
59
|
+
"semantic-release": "^23.0.2",
|
|
60
|
+
"style-loader": "^3.3.0",
|
|
61
|
+
"vite": "^4.3.9",
|
|
62
|
+
"vue": "^3.2.47"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=22"
|
|
66
|
+
},
|
|
67
|
+
"release": {
|
|
68
|
+
"branches": [
|
|
69
|
+
"main"
|
|
70
|
+
],
|
|
71
|
+
"plugins": [
|
|
72
|
+
"@semantic-release/commit-analyzer",
|
|
73
|
+
"@semantic-release/release-notes-generator",
|
|
74
|
+
"@semantic-release/changelog",
|
|
75
|
+
"@semantic-release/npm",
|
|
76
|
+
"@semantic-release/github",
|
|
77
|
+
[
|
|
78
|
+
"@semantic-release/git",
|
|
79
|
+
{
|
|
80
|
+
"assets": [
|
|
81
|
+
"package.json",
|
|
82
|
+
"package-lock.json",
|
|
83
|
+
"CHANGELOG.md"
|
|
84
|
+
],
|
|
85
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>JSON Schema Documentation</title>
|
|
7
|
+
|
|
8
|
+
<!-- Stylesheet -->
|
|
9
|
+
<link rel="stylesheet" href="assets/style.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<!-- App will be rendered here -->
|
|
13
|
+
<div id="app"></div>
|
|
14
|
+
|
|
15
|
+
<!-- Vue 3 from CDN -->
|
|
16
|
+
<script src="assets/vue.js"></script>
|
|
17
|
+
|
|
18
|
+
<!-- App bundle -->
|
|
19
|
+
<script src="assets/bundle.umd.js"></script>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|