graphql-markdown
Advanced tools
Comparing version 3.2.0 to 4.0.0-0
{ | ||
"name": "graphql-markdown", | ||
"version": "3.2.0", | ||
"version": "4.0.0-0", | ||
"description": "Generate documentation for your GraphQL schema in Markdown", | ||
@@ -11,3 +11,3 @@ "main": "src/index.js", | ||
"engines": { | ||
"node": ">=4.0.0" | ||
"node": ">=8.10.0" | ||
}, | ||
@@ -20,7 +20,6 @@ "files": [ | ||
"coverage": "nyc report --reporter=text-lcov | coveralls", | ||
"format": "npm run format:prettier && npm run format:standard", | ||
"format:prettier": "prettier --write --no-semi --single-quote **/*.js", | ||
"format:standard": "npm run lint:fix", | ||
"lint": "standard --verbose | snazzy", | ||
"lint:fix": "standard --verbose --fix | snazzy", | ||
"format": "npm run lint:fix || true", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"precommit": "lint-staged", | ||
"test": "npm run lint && npm run test:coverage", | ||
@@ -31,22 +30,31 @@ "test:coverage": "nyc ava", | ||
}, | ||
"pre-commit": [ | ||
"format", | ||
"lint" | ||
], | ||
"lint-staged": { | ||
"*.js": [ | ||
"eslint --fix", | ||
"git add" | ||
] | ||
}, | ||
"dependencies": { | ||
"deep-diff": "^0.3.8", | ||
"graphql": "^0.11.7", | ||
"deep-diff": "^1.0.1", | ||
"graphql": "^0.13.2", | ||
"minimist": "^1.2.0", | ||
"node-fetch": "^1.7.1", | ||
"node-fetch": "^2.2.0", | ||
"resolve-from": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.23.0", | ||
"coveralls": "^3.0.0", | ||
"nyc": "^11.2.1", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "^1.7.4", | ||
"snazzy": "^7.0.0", | ||
"standard": "^10.0.2" | ||
"ava": "^0.25.0", | ||
"coveralls": "^3.0.2", | ||
"eslint": "^5.3.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.13.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-prettier": "^2.6.2", | ||
"eslint-plugin-promise": "^3.8.0", | ||
"eslint-plugin-standard": "^3.1.0", | ||
"husky": "^0.14.3", | ||
"lint-staged": "^7.2.0", | ||
"nyc": "^12.0.2", | ||
"prettier": "^1.14.0" | ||
} | ||
} |
'use strict' | ||
const diff = require('deep-diff') | ||
function toNamedObject (arr, modifier = obj => obj) { | ||
function toNamedObject(arr, modifier = obj => obj) { | ||
if (!arr) { | ||
@@ -14,3 +14,3 @@ return {} | ||
function toNamedArray (obj, modifier = obj => obj) { | ||
function toNamedArray(obj, modifier = obj => obj) { | ||
if (!obj) { | ||
@@ -24,3 +24,3 @@ return [] | ||
function toDiffableSchema (schema) { | ||
function toDiffableSchema(schema) { | ||
const types = toNamedObject(schema.__schema.types, type => { | ||
@@ -50,3 +50,3 @@ if (type.fields) { | ||
function fromDiffableSchema (schema) { | ||
function fromDiffableSchema(schema) { | ||
const types = toNamedArray(schema.__schema.types, type => { | ||
@@ -76,3 +76,3 @@ if (type.fields) { | ||
function diffSchema (oldSchema, newSchema, options) { | ||
function diffSchema(oldSchema, newSchema, options) { | ||
const oldDiffableSchema = toDiffableSchema(oldSchema) | ||
@@ -79,0 +79,0 @@ const newDiffableSchema = toDiffableSchema(newSchema) |
@@ -10,4 +10,4 @@ #!/usr/bin/env node | ||
function safeExit (code) { | ||
process.on('exit', function () { | ||
function safeExit(code) { | ||
process.on('exit', function() { | ||
process.exit(code) | ||
@@ -17,3 +17,3 @@ }) | ||
function printHelp () { | ||
function printHelp() { | ||
const name = require('../package.json').name | ||
@@ -20,0 +20,0 @@ console.log(` |
@@ -9,3 +9,3 @@ 'use strict' | ||
function readFile (filename) { | ||
function readFile(filename) { | ||
return new Promise((resolve, reject) => { | ||
@@ -20,3 +20,3 @@ fs.readFile( | ||
function schemaToJSON (schema, options) { | ||
function schemaToJSON(schema, options) { | ||
options = options || {} | ||
@@ -29,3 +29,3 @@ const graphql = options.graphql || DEFAULT_GRAPHQL | ||
function fetchSchemaJSON (url, options) { | ||
function fetchSchemaJSON(url, options) { | ||
options = options || {} | ||
@@ -45,3 +45,3 @@ const graphql = options.graphql || DEFAULT_GRAPHQL | ||
function parseSchemaGraphQL (filename, options) { | ||
function parseSchemaGraphQL(filename, options) { | ||
options = options || {} | ||
@@ -52,3 +52,3 @@ const graphql = options.graphql || DEFAULT_GRAPHQL | ||
function requireSchema (schemaPath) { | ||
function requireSchema(schemaPath) { | ||
const schemaModule = resolveFrom('.', schemaPath) | ||
@@ -91,3 +91,3 @@ if (!schemaModule) { | ||
function loadSchemaJSON (schemaPath) { | ||
function loadSchemaJSON(schemaPath) { | ||
if (schemaPath.indexOf('://') >= 0) { | ||
@@ -94,0 +94,0 @@ return fetchSchemaJSON(schemaPath) |
'use strict' | ||
function sortBy (arr, property) { | ||
function sortBy(arr, property) { | ||
arr.sort((a, b) => { | ||
@@ -12,3 +12,3 @@ const aValue = a[property] | ||
function renderType (type, options) { | ||
function renderType(type, options) { | ||
if (type.kind === 'NON_NULL') { | ||
@@ -24,3 +24,3 @@ return renderType(type.ofType, options) + '!' | ||
function renderObject (type, options) { | ||
function renderObject(type, options) { | ||
options = options || {} | ||
@@ -51,5 +51,5 @@ const skipTitle = options.skipTitle === true | ||
printer( | ||
`<td colspan="2" valign="top"><strong>${field.name}</strong>${field.isDeprecated | ||
? ' ⚠️' | ||
: ''}</td>` | ||
`<td colspan="2" valign="top"><strong>${field.name}</strong>${ | ||
field.isDeprecated ? ' ⚠️' : '' | ||
}</td>` | ||
) | ||
@@ -95,3 +95,3 @@ printer(`<td valign="top">${renderType(field.type, { getTypeURL })}</td>`) | ||
function renderSchema (schema, options) { | ||
function renderSchema(schema, options) { | ||
options = options || {} | ||
@@ -179,5 +179,5 @@ const title = options.title || 'Schema Types' | ||
printer( | ||
`\n${'#'.repeat(headingLevel + 1)} Query ${query.name === 'Query' | ||
? '' | ||
: '(' + query.name + ')'}` | ||
`\n${'#'.repeat(headingLevel + 1)} Query ${ | ||
query.name === 'Query' ? '' : '(' + query.name + ')' | ||
}` | ||
) | ||
@@ -210,5 +210,5 @@ renderObject(query, { skipTitle: true, headingLevel, printer, getTypeURL }) | ||
printer( | ||
`<td valign="top"><strong>${value.name}</strong>${value.isDeprecated | ||
? ' ⚠️' | ||
: ''}</td>` | ||
`<td valign="top"><strong>${value.name}</strong>${ | ||
value.isDeprecated ? ' ⚠️' : '' | ||
}</td>` | ||
) | ||
@@ -215,0 +215,0 @@ if (value.description || value.isDeprecated) { |
const fs = require('fs') | ||
const renderSchema = require('./renderSchema') | ||
function updateMarkdown (doc, newContent, options = {}) { | ||
function updateMarkdown(doc, newContent, options = {}) { | ||
const includeMarkers = options.includeMarkers !== false | ||
@@ -26,3 +26,3 @@ const startMarker = options.startMarker || '<!-- START graphql-markdown -->' | ||
function updateSchema (path, schema, options) { | ||
function updateSchema(path, schema, options) { | ||
return new Promise((resolve, reject) => { | ||
@@ -29,0 +29,0 @@ fs.readFile(path, 'utf8', (err, doc) => { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197475
14
2
+ Addeddeep-diff@1.0.2(transitive)
+ Addedgraphql@0.13.2(transitive)
+ Addediterall@1.3.0(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removeddeep-diff@0.3.8(transitive)
- Removedencoding@0.1.13(transitive)
- Removedgraphql@0.11.7(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removediterall@1.1.3(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedsafer-buffer@2.1.2(transitive)
Updateddeep-diff@^1.0.1
Updatedgraphql@^0.13.2
Updatednode-fetch@^2.2.0