From 66a177343ccca33d7114bf43ddc09b9b7530c6da Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Tue, 1 May 2018 09:00:09 +0100 Subject: [PATCH] Add engines stanza to generated business network package.json (#3932) Also add _composer_ and _composer-network_ keywords. Signed-off-by: Mark S. Lewis --- .../businessnetwork/templates/package.json | 7 +++++++ .../test/business-network.js | 20 +++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/generator-hyperledger-composer/generators/businessnetwork/templates/package.json b/packages/generator-hyperledger-composer/generators/businessnetwork/templates/package.json index 14826c9ce2..7468a0d557 100644 --- a/packages/generator-hyperledger-composer/generators/businessnetwork/templates/package.json +++ b/packages/generator-hyperledger-composer/generators/businessnetwork/templates/package.json @@ -1,4 +1,7 @@ { + "engines": { + "composer": "<%= composerversion %>" + }, "name": "<%= appname %>", "version": "0.0.1", "description": "<%= appdescription %>", @@ -8,6 +11,10 @@ "lint": "eslint .", "test": "nyc mocha -t 0 test/*.js && cucumber-js" }, + "keywords": [ + "composer", + "composer-network" + ], "author": "<%= appauthor %>", "email": "<%= appemail %>", "license": "<%= applicense %>", diff --git a/packages/generator-hyperledger-composer/test/business-network.js b/packages/generator-hyperledger-composer/test/business-network.js index 07b8316950..a561960abc 100644 --- a/packages/generator-hyperledger-composer/test/business-network.js +++ b/packages/generator-hyperledger-composer/test/business-network.js @@ -132,26 +132,20 @@ describe('hyperledger-composer:businessnetwork', function () { assert(fs.existsSync(packageFile), 'No package.json file detected in test run'); let myPackage = require(packageFile); - assert(myPackage.name === passedBusNetName, 'incorrect name in package file'); - assert(myPackage.author === passedAuthor, 'incorrect author in package file'); - assert(myPackage.email === passedEmail, 'incorrect email in package file'); - assert(myPackage.license === passedLic, 'incorrect license in package file'); + assert.strictEqual(myPackage.name, passedBusNetName, 'incorrect name in package file'); + assert.strictEqual(myPackage.author, passedAuthor, 'incorrect author in package file'); + assert.strictEqual(myPackage.email, passedEmail, 'incorrect email in package file'); + assert.strictEqual(myPackage.license, passedLic, 'incorrect license in package file'); assert.strictEqual(myPackage.dependencies, undefined, 'there should be no production dependencies in package file'); - assert.deepStrictEqual(myPackage.devDependencies, { - chai: 'latest', - 'chai-as-promised': 'latest', + assert.objectContent(myPackage.devDependencies, { 'composer-admin': `^${version}`, 'composer-cli': `^${version}`, 'composer-client': `^${version}`, 'composer-common': `^${version}`, 'composer-connector-embedded': `^${version}`, 'composer-cucumber-steps': `^${version}`, - cucumber: '^2.2.0', - eslint: 'latest', - mkdirp: 'latest', - mocha: 'latest', - nyc: 'latest' - }, 'incorrect development dependencies in package file'); + }); + assert.objectContent(myPackage.engines, { composer: `^${version}`}); }); });