@stencila/configa
Advanced tools
Comparing version 0.4.7 to 0.4.8
@@ -0,1 +1,11 @@ | ||
## [0.4.8](https://github.com/stencila/configa/compare/v0.4.7...v0.4.8) (2020-05-22) | ||
### Bug Fixes | ||
* **dependencies:** update dependency @stencila/logga to ^2.2.0 ([36d4286](https://github.com/stencila/configa/commit/36d4286a987a77fe4be10ace15e8bc9c5fc5e519)) | ||
* **dependencies:** update dependency ajv to ^6.12.2 ([339c987](https://github.com/stencila/configa/commit/339c987b2df9963cc2406f2cb630749617caac9f)) | ||
* **dependencies:** update dependency chalk to v4 ([e94a46a](https://github.com/stencila/configa/commit/e94a46ae504ed60d383523d3ff609393b2cb271f)) | ||
* **dependencies:** update dependency typedoc to ^0.17.7 ([ecadb33](https://github.com/stencila/configa/commit/ecadb33f797ad146ba1d628b5e54a81eb5126666)) | ||
## [0.4.7](https://github.com/stencila/configa/compare/v0.4.6...v0.4.7) (2020-03-23) | ||
@@ -2,0 +12,0 @@ |
@@ -9,2 +9,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.log = void 0; | ||
const logga_1 = require("@stencila/logga"); | ||
@@ -11,0 +12,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Config = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * Configa ${version} |
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"description": "Configa 0.4.6", | ||
"description": "Configa 0.4.7", | ||
"$comment": "", | ||
@@ -6,0 +6,0 @@ "properties": { |
@@ -21,2 +21,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dependentRequired = exports.required = exports.minProperties = exports.maxProperties = exports.minContains = exports.maxContains = exports.contains = exports.uniqueItems = exports.minItems = exports.maxItems = exports.pattern = exports.minLength = exports.maxLength = exports.exclusiveMinimum = exports.minimum = exports.exclusiveMaximum = exports.maximum = exports.multipleOf = exports.enumeration = void 0; | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
@@ -23,0 +24,0 @@ // These validation decorators are purely declarative and used in static analysis |
@@ -12,2 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.updateReadme = exports.insertMdIntoFile = exports.insertMd = exports.generateMdDetails = exports.generateMdTable = exports.generateMdUsage = void 0; | ||
const fs_1 = __importDefault(require("fs")); | ||
@@ -39,4 +40,4 @@ const common_1 = require("./common"); | ||
let detailsCount = 0; | ||
const rows = options.map(option => { | ||
const { name, description, details, types, validators, defaultValue } = option; | ||
const rows = options.map((option) => { | ||
const { name, description, details, types, validators, defaultValue, } = option; | ||
const descriptionCell = (description + | ||
@@ -62,3 +63,3 @@ (addDetails && details !== undefined | ||
// Generate dashes row | ||
const dashes = widths.map(width => '-'.repeat(width)); | ||
const dashes = widths.map((width) => '-'.repeat(width)); | ||
// Generate table | ||
@@ -88,3 +89,3 @@ const table = [header, dashes].concat(rows).reduce((md, row) => { | ||
options | ||
.map(option => { | ||
.map((option) => { | ||
const { details, name } = option; | ||
@@ -95,3 +96,3 @@ return details !== undefined | ||
}) | ||
.filter(md => md.length > 0) | ||
.filter((md) => md.length > 0) | ||
.join('\n') + | ||
@@ -138,5 +139,5 @@ '\n'); | ||
USAGE: generateMdUsage(appName), | ||
TABLE: generateMdTable(options) | ||
TABLE: generateMdTable(options), | ||
}); | ||
} | ||
exports.updateReadme = updateReadme; |
@@ -8,7 +8,19 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
@@ -20,2 +32,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseDecorator = exports.parseConfig = void 0; | ||
const typedoc = __importStar(require("typedoc")); | ||
@@ -35,3 +48,3 @@ const json5_1 = __importDefault(require("json5")); | ||
esModuleInterop: true, | ||
experimentalDecorators: true | ||
experimentalDecorators: true, | ||
}); | ||
@@ -42,7 +55,7 @@ const files = app.convert([filePath]); | ||
// Get the declaration object for the file | ||
const file = files.children.filter(decl => decl.originalName === filePath)[0]; | ||
const file = files.children.filter((decl) => decl.originalName === filePath)[0]; | ||
if (file.children === undefined) | ||
return; | ||
// Get the first class defined in the file | ||
const clas = Object.values(file.children).filter(decl => decl.kindString === 'Class')[0]; | ||
const clas = Object.values(file.children).filter((decl) => decl.kindString === 'Class')[0]; | ||
if (clas.children === undefined) | ||
@@ -63,3 +76,3 @@ return; | ||
const options = props.map((prop) => { | ||
const { name, comment, type: typeObj, defaultValue: defaultString, decorators = [] } = prop; | ||
const { name, comment, type: typeObj, defaultValue: defaultString, decorators = [], } = prop; | ||
const id = `${parent}.${name}`; | ||
@@ -104,3 +117,3 @@ let description; | ||
types.includes(type) ? types : [...types, type], | ||
value === undefined ? values : [...values, value] | ||
value === undefined ? values : [...values, value], | ||
]; | ||
@@ -130,9 +143,9 @@ }, [[], []]); | ||
types, | ||
defaultValue | ||
defaultValue, | ||
}; | ||
let validators = decorators.map(decorator => exports.parseDecorator(option, decorator)); | ||
let validators = decorators.map((decorator) => exports.parseDecorator(option, decorator)); | ||
if (enumeration.length > 0) { | ||
validators = [ | ||
...validators, | ||
{ keyword: 'enumeration', value: enumeration } | ||
{ keyword: 'enumeration', value: enumeration }, | ||
]; | ||
@@ -147,3 +160,3 @@ } | ||
details, | ||
options | ||
options, | ||
}; | ||
@@ -200,3 +213,3 @@ } | ||
case 'minContains': | ||
if (!types.some(type => type.includes('[]'))) | ||
if (!types.some((type) => type.includes('[]'))) | ||
logWrongType(); | ||
@@ -233,4 +246,4 @@ break; | ||
keyword, | ||
value | ||
value, | ||
}; | ||
}; |
@@ -9,2 +9,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateJsonSample = void 0; | ||
/** | ||
@@ -19,3 +20,3 @@ * Generate a sample configuration in JSON with description comments | ||
${options | ||
.map(option => { | ||
.map((option) => { | ||
const { description, name, types, defaultValue = null } = option; | ||
@@ -22,0 +23,0 @@ const desc = description.replace('\n', '\n // '); |
@@ -12,2 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateDefault = exports.updateJsonSchema = exports.generateJsonSchema = exports.generateJsonSchemaDefinition = exports.typeToJsonSchema = exports.validatorsForType = exports.validatorToJsonSchema = void 0; | ||
const ajv_1 = __importDefault(require("ajv")); | ||
@@ -44,3 +45,3 @@ const fs_1 = __importDefault(require("fs")); | ||
'minimum', | ||
'exclusiveMinimum' | ||
'exclusiveMinimum', | ||
], | ||
@@ -54,5 +55,5 @@ string: ['pattern', 'maxLength', 'minLength'], | ||
'maxContains', | ||
'minContains' | ||
'minContains', | ||
], | ||
object: ['maxProperties', 'minProperties', 'required', 'dependentRequired'] | ||
object: ['maxProperties', 'minProperties', 'required', 'dependentRequired'], | ||
}; | ||
@@ -90,3 +91,3 @@ const keywords = keywordsMap[type]; | ||
items: itemSchema, | ||
...exports.validatorsForType(validators, 'array') | ||
...exports.validatorsForType(validators, 'array'), | ||
}; | ||
@@ -119,4 +120,4 @@ } | ||
const properties = options.reduce((properties, option) => { | ||
const { name, description, details, types, validators = [], defaultValue } = option; | ||
const subschemas = types.map(type => exports.typeToJsonSchema(type, validators)); | ||
const { name, description, details, types, validators = [], defaultValue, } = option; | ||
const subschemas = types.map((type) => exports.typeToJsonSchema(type, validators)); | ||
const property = { | ||
@@ -126,3 +127,3 @@ description, | ||
...(subschemas.length === 1 ? subschemas[0] : { anyOf: subschemas }), | ||
...(defaultValue === undefined ? {} : { default: defaultValue }) | ||
...(defaultValue === undefined ? {} : { default: defaultValue }), | ||
}; | ||
@@ -138,3 +139,3 @@ return property !== undefined | ||
$comment, | ||
properties | ||
properties, | ||
}; | ||
@@ -168,3 +169,3 @@ }; | ||
details: '', | ||
options: [option] | ||
options: [option], | ||
}); | ||
@@ -183,5 +184,5 @@ let validate; | ||
common_1.log.error(`Option has default value that is not valid against its validators: ${id}: ${errors | ||
.map(error => error.message) | ||
.map((error) => error.message) | ||
.join(', ')}`); | ||
} | ||
}; |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./develop-md")); | ||
__export(require("./develop-parse")); | ||
__export(require("./develop-samples")); | ||
__export(require("./develop-schema")); | ||
__exportStar(require("./develop-md"), exports); | ||
__exportStar(require("./develop-parse"), exports); | ||
__exportStar(require("./develop-samples"), exports); | ||
__exportStar(require("./develop-schema"), exports); |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./define")); | ||
__export(require("./develop")); | ||
__export(require("./run")); | ||
__exportStar(require("./define"), exports); | ||
__exportStar(require("./develop"), exports); | ||
__exportStar(require("./run"), exports); |
@@ -12,2 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateOptions = exports.coerceOptions = exports.collectConfig = void 0; | ||
const rc_1 = __importDefault(require("rc")); | ||
@@ -23,3 +24,3 @@ const ajv_1 = __importDefault(require("ajv")); | ||
// Generate all error messages | ||
allErrors: true | ||
allErrors: true, | ||
}); | ||
@@ -26,0 +27,0 @@ /** |
@@ -12,2 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.helpForOption = exports.helpListOptions = exports.helpUsage = void 0; | ||
const json5_1 = __importDefault(require("json5")); | ||
@@ -37,4 +38,4 @@ const chalk_1 = __importDefault(require("chalk")); | ||
typeName = anyOf | ||
.map(item => (typeof item !== 'boolean' ? item.type : '')) | ||
.filter(type => typeof type === 'string') | ||
.map((item) => (typeof item !== 'boolean' ? item.type : '')) | ||
.filter((type) => typeof type === 'string') | ||
.join(' | '); | ||
@@ -41,0 +42,0 @@ } |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./run-help")); | ||
__export(require("./run-collect")); | ||
__exportStar(require("./run-help"), exports); | ||
__exportStar(require("./run-collect"), exports); |
{ | ||
"name": "@stencila/configa", | ||
"version": "0.4.7", | ||
"version": "0.4.8", | ||
"description": "Application configuration: DRY, flexible and type-safe", | ||
@@ -39,21 +39,21 @@ "bin": "dist/cli.js", | ||
"devDependencies": { | ||
"@stencila/dev-config": "1.4.22", | ||
"@types/jest": "25.1.4", | ||
"@stencila/dev-config": "1.4.36", | ||
"@types/jest": "25.2.2", | ||
"@types/json5": "0.0.30", | ||
"@types/rc": "1.1.0", | ||
"jest": "25.1.0", | ||
"jest": "26.0.1", | ||
"jest-file-snapshot": "0.3.8", | ||
"json-schema": "0.2.5", | ||
"ts-jest": "25.2.1", | ||
"ts-node": "8.8.1", | ||
"typescript": "3.8.3" | ||
"ts-jest": "26.0.0", | ||
"ts-node": "8.10.1", | ||
"typescript": "3.9.2" | ||
}, | ||
"dependencies": { | ||
"@stencila/logga": "^2.1.0", | ||
"ajv": "^6.12.0", | ||
"chalk": "^3.0.0", | ||
"@stencila/logga": "^2.2.0", | ||
"ajv": "^6.12.2", | ||
"chalk": "^4.0.0", | ||
"globby": "^11.0.0", | ||
"json5": "^2.1.2", | ||
"rc": "^1.2.8", | ||
"typedoc": "^0.17.3" | ||
"typedoc": "^0.17.7" | ||
}, | ||
@@ -60,0 +60,0 @@ "commitlint": { |
82083
1646
+ Addedchalk@4.1.2(transitive)
- Removedchalk@3.0.0(transitive)
Updated@stencila/logga@^2.2.0
Updatedajv@^6.12.2
Updatedchalk@^4.0.0
Updatedtypedoc@^0.17.7