Skip to content

Commit

Permalink
build(dependencies): remove unused dependencies
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Removes the JSON schema validation feature entirely
  • Loading branch information
trieloff committed Dec 11, 2019
1 parent cfefa92 commit dbc9192
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 65 deletions.
29 changes: 0 additions & 29 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const nodepath = require('path');

const fs = require('fs');
const readdirp = require('readdirp');
const Ajv = require('ajv');
const logger = require('@adobe/helix-log');
const {
iter, pipe, filter, map, obj,
Expand All @@ -32,11 +31,6 @@ const { info, error, debug } = logger;
// const Schema = require('./lib/schema');
// const readSchemaFile = require('./lib/readSchemaFile');

// init JSON Schema validator
const ajv = new Ajv({
allErrors: true, messages: true, schemaId: 'auto', logger,
});

// parse/process command line arguments
const { argv } = yargs
.usage('Generate Markdown documentation from JSON Schema.\n\nUsage: $0')
Expand Down Expand Up @@ -69,13 +63,6 @@ const { argv } = yargs
obj,
))

.alias('s', 'metaSchema')
.describe('s', 'Custom meta schema path to validate schemas')
.coerce('s', (s) => {
// eslint-disable-next-line import/no-dynamic-require, global-require
ajv.addMetaSchema(require(nodepath.resolve(s)));
})

.alias('x', 'schema-out')
.describe('x', 'output JSON Schema files including description and validated examples in the specified folder, or suppress with -')
.default('x', nodepath.resolve(nodepath.join('.', 'out')))
Expand All @@ -89,20 +76,6 @@ const { argv } = yargs
.describe('n', 'Do not generate a README.md file in the output directory')
.default('n', false)

.describe('v', 'JSON Schema Draft version to use. Supported: 04, 06, 07 (default)')
.alias('v', 'draft')
.default('v', '07')
.coerce('v', (v) => {
if (v === '06' || v === 6) {
info('enabling draft-06 support');
// eslint-disable-next-line global-require
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json'));
} else if (v === '04' || v === 4) {
// eslint-disable-next-line global-require
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
}
})

.describe('link-*', 'Add this file as a link the explain the * attribute, e.g. --link-abstract=abstract.md')

.alias('i', 'i18n')
Expand Down Expand Up @@ -162,8 +135,6 @@ readdirp.promise(schemaPath, { root: schemaPath, fileFilter: `*.${schemaExtensio
map(schema => schema.fullPath),
// eslint-disable-next-line import/no-dynamic-require, global-require
map(path => schemaloader(require(path), path)),
// validate
// validate(ajv, logger),
// find contained schemas
traverse,

Expand Down
45 changes: 14 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,21 @@
},
"dependencies": {
"@adobe/helix-log": "^2.0.0",
"ajv": "^6.10.2",
"ejs": "^2.6.2",
"es2015-i18n-tag": "^1.6.1",
"ferrum": "^1.4.1",
"fs-extra": "^8.1.0",
"github-slugger": "^1.2.1",
"js-yaml": "^3.13.1",
"json-pointer": "^0.6.0",
"mdast-builder": "^1.1.1",
"mdast-util-to-string": "^1.0.7",
"mkdirp": "^0.5.1",
"mocha": "^6.2.2",
"readdirp": "^3.1.1",
"readdirp": "^3.3.0",
"remark-parse": "^7.0.2",
"remark-stringify": "^7.0.4",
"unified": "^8.4.2",
"unist-builder": "^2.0.2",
"unist-util-inspect": "^5.0.0",
"valid-url": "1.0.9",
"yargs": "^15.0.2"
},
"devDependencies": {
Expand Down

0 comments on commit dbc9192

Please sign in to comment.