From 3af3b8ac73602112bec854afe9319d09f48e3373 Mon Sep 17 00:00:00 2001 From: Luong Vu Date: Mon, 26 Feb 2018 11:14:45 +0700 Subject: [PATCH 1/2] fix_compile_error_and_merge_object_deep --- lib/command.ts | 5 +++-- package.json | 9 +++++---- plugins/document.require-by/index.ts | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/command.ts b/lib/command.ts index 4fa866b8..c3658366 100644 --- a/lib/command.ts +++ b/lib/command.ts @@ -2,6 +2,7 @@ import * as path from 'path'; import * as fs from 'fs'; import * as glob from 'glob'; import { render } from 'mustache'; +import * as deepmerge from 'deepmerge'; import { Output, Plugin, getFilenameOf, createData } from './utility'; import { readFile, writeFile, createBuildDirectory, resolve, removeBuildDirectory } from './utility/fs'; import { @@ -194,11 +195,11 @@ export class GraphQLDocumentor extends Command { packageJSON = {}; } - packageJSON.graphdoc = Object.assign(packageJSON.graphdoc || {}, input.flags); + packageJSON.graphdoc = deepmerge(packageJSON.graphdoc || {}, input.flags); if (packageJSON.graphdoc.data) { const data = packageJSON.graphdoc.data; - packageJSON.graphdoc = Object.assign(data, packageJSON.graphdoc); + packageJSON.graphdoc = deepmerge(data, packageJSON.graphdoc); } if (packageJSON.graphdoc.plugins.length === 0) diff --git a/package.json b/package.json index 6e605cce..e0bec5d6 100644 --- a/package.json +++ b/package.json @@ -44,9 +44,9 @@ "@types/marked": "0.0.27", "@types/mocha": "^2.2.32", "@types/mustache": "^0.8.28", - "@types/node": "^6.0.32", - "@types/request": "^0.0.40", - "@types/striptags": "^0.0.5", + "@types/node": "^9.4.6", + "@types/request": "^2.47.0", + "@types/striptags": "^3.1.1", "chai": "^3.5.0", "handlebars": "^4.0.10", "jest": "^18.1.0", @@ -56,6 +56,7 @@ "dependencies": { "@2fd/command": "^1.1.2", "bluebird": "^3.5.0", + "deepmerge": "^2.0.1", "fs-extra": "^0.30.0", "glob": "^7.1.0", "graphql": "^0.7.0", @@ -63,7 +64,7 @@ "mustache": "^2.2.1", "request": "^2.79.0", "slug": "^0.9.1", - "striptags": "^3.0.1", + "striptags": "^3.1.1", "word-wrap": "^1.2.1" }, "graphdoc": { diff --git a/plugins/document.require-by/index.ts b/plugins/document.require-by/index.ts index 18df0dad..be9d1ca6 100644 --- a/plugins/document.require-by/index.ts +++ b/plugins/document.require-by/index.ts @@ -18,7 +18,7 @@ import { } from '../../lib/interface'; // Fix signature -const stript: typeof striptags.default = striptags as any; +const stript: typeof striptags = striptags as any; export default class RequireByPlugin extends Plugin implements PluginInterface { From 82339b744fe083f7c0afc49ee471686f9f20c495 Mon Sep 17 00:00:00 2001 From: Luong Vu Date: Mon, 26 Feb 2018 14:45:24 +0700 Subject: [PATCH 2/2] reverse_merge_order_to_override_flags --- lib/command.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/command.ts b/lib/command.ts index c3658366..463eae3d 100644 --- a/lib/command.ts +++ b/lib/command.ts @@ -195,7 +195,7 @@ export class GraphQLDocumentor extends Command { packageJSON = {}; } - packageJSON.graphdoc = deepmerge(packageJSON.graphdoc || {}, input.flags); + packageJSON.graphdoc = deepmerge(input.flags, packageJSON.graphdoc || {}); if (packageJSON.graphdoc.data) { const data = packageJSON.graphdoc.data;