From d638e92af4cc9b734fbf0ca053148ec7f124c122 Mon Sep 17 00:00:00 2001 From: Joel Chu Date: Sun, 21 Jul 2019 17:10:41 +0800 Subject: [PATCH 1/2] update the contract cli without the contractWithDesc option this is moved to the Koa middleware instead --- packages/contract-cli/lib/options.js | 2 +- packages/contract-cli/lib/public-contract/index.js | 11 ++++++----- packages/contract-cli/package.json | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/contract-cli/lib/options.js b/packages/contract-cli/lib/options.js index 0d757acf..9b231623 100644 --- a/packages/contract-cli/lib/options.js +++ b/packages/contract-cli/lib/options.js @@ -53,7 +53,7 @@ const defaultOptions = { resolverDir: createConfig(resolve(join(BASE_DIR, DEFAULT_RESOLVER_DIR)) , STRING_TYPE, {[ALIAS_KEY]: 'inDir'}), contractDir: createConfig(resolve(join(BASE_DIR, DEFAULT_CONTRACT_DIR)), STRING_TYPE, {[ALIAS_KEY]: 'outDir'}), // show or hide the description field in the public contract - contractWithDesc: createConfig(false, [BOOLEAN_TYPE]), + // contractWithDesc: createConfig(false, [BOOLEAN_TYPE]), @1.7.6 move to Koa // remove the old one and always create a new one - useful during development alwaysNew: createConfig(false, [BOOLEAN_TYPE]), // where to put the public method diff --git a/packages/contract-cli/lib/public-contract/index.js b/packages/contract-cli/lib/public-contract/index.js index a5d25c31..0eb6e281 100644 --- a/packages/contract-cli/lib/public-contract/index.js +++ b/packages/contract-cli/lib/public-contract/index.js @@ -15,16 +15,17 @@ const cleanForPublic = (json, config) => { enableAuth, loginHandlerName, logoutHandlerName, - validatorHandlerName, - contractWithDesc + validatorHandlerName } = config; for (let type in json) { for (let fn in json[type]) { delete json[type][fn].file; // @1.7.4 remove the description to reduce the size of the contract - if (!contractWithDesc) { - delete json[type][fn].description; - } + // @ 1.7.6 this function move to the Koa instead + // because we want to keep the data in the file only remove it when serving up + // if (!contractWithDesc) { + // delete json[type][fn].description; + // } } } // also if there is a validator field then delete it diff --git a/packages/contract-cli/package.json b/packages/contract-cli/package.json index 3fb09a91..4b75673f 100755 --- a/packages/contract-cli/package.json +++ b/packages/contract-cli/package.json @@ -1,6 +1,6 @@ { "name": "jsonql-contract", - "version": "1.7.5", + "version": "1.7.6", "description": "An command line tool to generate the contract.json for jsonql", "main": "index.js", "files": [ -- Gitee From 9b47445886b46eff1dea2360143cd85bddccdf99 Mon Sep 17 00:00:00 2001 From: Joel Chu Date: Sun, 21 Jul 2019 17:14:03 +0800 Subject: [PATCH 2/2] Fix test and ready to publish to 1.7.6 --- packages/contract-cli/tests/generator.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/contract-cli/tests/generator.test.js b/packages/contract-cli/tests/generator.test.js index 5e029d4e..d3b73926 100755 --- a/packages/contract-cli/tests/generator.test.js +++ b/packages/contract-cli/tests/generator.test.js @@ -78,7 +78,8 @@ test.serial('Should able to create a public-contract.json', async t => { // check if there is a description field in each t.falsy(json.query.anyoneCanGetThis.description, 'should not have a description in the public query') - t.falsy(json.query.privateFn.description, 'should not have a description in the private query') + // @1.7.6 the description field is kept in the file + // t.falsy(json.query.privateFn.description, 'should not have a description in the private query') }) test.serial('It should able to parse ES6 style resolvers automatically', async t => { -- Gitee