Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-markdown

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-markdown - npm Package Compare versions

Comparing version 3.2.0 to 4.0.0-0

50

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc