slds-json-schema-renderer 1.0.3 → 1.1.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/bin/cli.js +11 -10
- package/lib/cli/generate.js +5 -4
- package/lib/frontend/bundle.css +1 -1
- package/lib/frontend/bundle.umd.cjs +1 -1
- package/lib/index.js +3 -3
- package/lib/utils/html-generator.js +4 -4
- package/lib/utils/schema-parser.js +72 -54
- package/package.json +33 -35
package/bin/cli.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { readFileSync } from 'node:fs'
|
|
4
|
+
import process from 'node:process'
|
|
5
|
+
import { program } from 'commander'
|
|
6
|
+
import * as cli from '../lib/cli/index.js'
|
|
6
7
|
|
|
7
8
|
// Read package.json
|
|
8
|
-
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url)))
|
|
9
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url)))
|
|
9
10
|
|
|
10
|
-
program.version(pkg.version).description('JSON Schema Documentation Generator CLI')
|
|
11
|
+
program.version(pkg.version).description('JSON Schema Documentation Generator CLI')
|
|
11
12
|
|
|
12
13
|
// Add the generate command
|
|
13
14
|
program
|
|
@@ -18,19 +19,19 @@ program
|
|
|
18
19
|
.option('-t, --title <title>', 'Documentation title', 'JSON Schema Documentation')
|
|
19
20
|
.option('-d, --description <description>', 'Documentation description', '')
|
|
20
21
|
.option('-v, --verbose', 'Enable verbose output', false)
|
|
21
|
-
.action(cli.generate)
|
|
22
|
+
.action(cli.generate)
|
|
22
23
|
|
|
23
24
|
// Add the init command for future implementation
|
|
24
25
|
program
|
|
25
26
|
.command('init')
|
|
26
27
|
.description('Initialize a new documentation project')
|
|
27
28
|
.action(() => {
|
|
28
|
-
console.log('Initialize command not yet implemented')
|
|
29
|
-
})
|
|
29
|
+
console.log('Initialize command not yet implemented')
|
|
30
|
+
})
|
|
30
31
|
|
|
31
|
-
program.parse(process.argv)
|
|
32
|
+
program.parse(process.argv)
|
|
32
33
|
|
|
33
34
|
// If no arguments, display help
|
|
34
35
|
if (!process.argv.slice(2).length) {
|
|
35
|
-
program.outputHelp()
|
|
36
|
+
program.outputHelp()
|
|
36
37
|
}
|
package/lib/cli/generate.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import process from 'node:process';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
-
import
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
5
|
import * as htmlGenerator from '../utils/html-generator.js';
|
|
6
|
+
import * as schemaParser from '../utils/schema-parser.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Generate documentation from JSON schema files
|
|
9
|
-
* @param {
|
|
10
|
+
* @param {object} options - Command options
|
|
10
11
|
*/
|
|
11
12
|
async function generate(options) {
|
|
12
13
|
const {
|