diff --git a/lib/tasks/verify-origami-json.js b/lib/tasks/verify-origami-json.js index 635cc344..4fa5fde1 100644 --- a/lib/tasks/verify-origami-json.js +++ b/lib/tasks/verify-origami-json.js @@ -26,8 +26,8 @@ function origamiJson(config) { if (origamiJson.origamiType !== 'imageset' && origamiJson.origamiType !== 'module' && origamiJson.origamiType !== 'service') { result.push('The origamiType property needs to be set to either "imageset", "module" or "service"'); } - if (origamiJson.origamiVersion !== 1) { - result.push('The origamiVersion property needs to be set to 1'); + if (origamiJson.origamiVersion !== 2) { + result.push('The origamiVersion property needs to be set to 2, this version of Origami Build tools only supports v2 of the Origami component specification.'); } if (!origamiJson.support) { result.push('The support property must be an email or url to an issue tracker for this module'); diff --git a/test/integration/demo/fixtures/multiple-demos/origami.json b/test/integration/demo/fixtures/multiple-demos/origami.json index ae2e855b..aac4d875 100644 --- a/test/integration/demo/fixtures/multiple-demos/origami.json +++ b/test/integration/demo/fixtures/multiple-demos/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": ["master"], "support": "https://github.com/Financial-Times/o-multiple-demos/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/js-bower-dependency/origami.json b/test/integration/verify/fixtures/js-bower-dependency/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/js-bower-dependency/origami.json +++ b/test/integration/verify/fixtures/js-bower-dependency/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/js-custom-eslint/origami.json b/test/integration/verify/fixtures/js-custom-eslint/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/js-custom-eslint/origami.json +++ b/test/integration/verify/fixtures/js-custom-eslint/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/js-es5/origami.json b/test/integration/verify/fixtures/js-es5/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/js-es5/origami.json +++ b/test/integration/verify/fixtures/js-es5/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/js-es6/origami.json b/test/integration/verify/fixtures/js-es6/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/js-es6/origami.json +++ b/test/integration/verify/fixtures/js-es6/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/js-es7/origami.json b/test/integration/verify/fixtures/js-es7/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/js-es7/origami.json +++ b/test/integration/verify/fixtures/js-es7/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/js-invalid/origami.json b/test/integration/verify/fixtures/js-invalid/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/js-invalid/origami.json +++ b/test/integration/verify/fixtures/js-invalid/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/js-npm-dependency/origami.json b/test/integration/verify/fixtures/js-npm-dependency/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/js-npm-dependency/origami.json +++ b/test/integration/verify/fixtures/js-npm-dependency/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/no-js-or-sass/origami.json b/test/integration/verify/fixtures/no-js-or-sass/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/no-js-or-sass/origami.json +++ b/test/integration/verify/fixtures/no-js-or-sass/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/no-readme/origami.json b/test/integration/verify/fixtures/no-readme/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/no-readme/origami.json +++ b/test/integration/verify/fixtures/no-readme/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/readme-custom-remarkrc/origami.json b/test/integration/verify/fixtures/readme-custom-remarkrc/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/readme-custom-remarkrc/origami.json +++ b/test/integration/verify/fixtures/readme-custom-remarkrc/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/readme-invalid-name/origami.json b/test/integration/verify/fixtures/readme-invalid-name/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/readme-invalid-name/origami.json +++ b/test/integration/verify/fixtures/readme-invalid-name/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/readme-invalid/origami.json b/test/integration/verify/fixtures/readme-invalid/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/readme-invalid/origami.json +++ b/test/integration/verify/fixtures/readme-invalid/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/readme-valid-lowercase/origami.json b/test/integration/verify/fixtures/readme-valid-lowercase/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/readme-valid-lowercase/origami.json +++ b/test/integration/verify/fixtures/readme-valid-lowercase/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/readme-valid-uppercase/origami.json b/test/integration/verify/fixtures/readme-valid-uppercase/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/readme-valid-uppercase/origami.json +++ b/test/integration/verify/fixtures/readme-valid-uppercase/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/sass-bower-dependency/origami.json b/test/integration/verify/fixtures/sass-bower-dependency/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/sass-bower-dependency/origami.json +++ b/test/integration/verify/fixtures/sass-bower-dependency/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/sass-custom-config/origami.json b/test/integration/verify/fixtures/sass-custom-config/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/sass-custom-config/origami.json +++ b/test/integration/verify/fixtures/sass-custom-config/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/sass-invalid/origami.json b/test/integration/verify/fixtures/sass-invalid/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/sass-invalid/origami.json +++ b/test/integration/verify/fixtures/sass-invalid/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/sass-npm-dependency/origami.json b/test/integration/verify/fixtures/sass-npm-dependency/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/sass-npm-dependency/origami.json +++ b/test/integration/verify/fixtures/sass-npm-dependency/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/integration/verify/fixtures/sass/origami.json b/test/integration/verify/fixtures/sass/origami.json index 4e3c7dad..b055ad2f 100644 --- a/test/integration/verify/fixtures/sass/origami.json +++ b/test/integration/verify/fixtures/sass/origami.json @@ -3,7 +3,7 @@ "keywords": [], "origamiType": "module", "origamiCategory": "components", - "origamiVersion": 1, + "origamiVersion": 2, "brands": [], "support": "https://github.com/Financial-Times/o-example/issues", "supportContact": { diff --git a/test/unit/fixtures/o-test/origami.json b/test/unit/fixtures/o-test/origami.json index f656ae19..e38d6f54 100644 --- a/test/unit/fixtures/o-test/origami.json +++ b/test/unit/fixtures/o-test/origami.json @@ -1,7 +1,7 @@ { "description": "Test module", "origamiType": "module", - "origamiVersion": 1, + "origamiVersion": 2, "support": "origami.support@ft.com", "supportStatus": "active", "demosDefaults": { diff --git a/test/unit/tasks/verify-origami-json.test.js b/test/unit/tasks/verify-origami-json.test.js index f2432383..668f3033 100644 --- a/test/unit/tasks/verify-origami-json.test.js +++ b/test/unit/tasks/verify-origami-json.test.js @@ -104,7 +104,7 @@ describe('verify-origami-json', function () { 'Failed linting:\n\n' + 'A non-empty description property is required\n' + 'The origamiType property needs to be set to either "imageset", "module" or "service"\n' + - 'The origamiVersion property needs to be set to 1\n' + + 'The origamiVersion property needs to be set to 2, this version of Origami Build tools only supports v2 of the Origami component specification.\n' + 'The support property must be an email or url to an issue tracker for this module\n' + 'The supportStatus property must be set to either "active", "maintained", "deprecated", "dead" or "experimental"\n\n' + 'The origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/' @@ -121,7 +121,7 @@ describe('verify-origami-json', function () { proclaim.calledOnce(console.log); proclaim.calledWithExactly( console.log, - `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AA non-empty description property is required%0AThe origamiType property needs to be set to either "imageset", "module" or "service"%0AThe origamiVersion property needs to be set to 1%0AThe support property must be an email or url to an issue tracker for this module%0AThe supportStatus property must be set to either "active", "maintained", "deprecated", "dead" or "experimental"%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` + `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AA non-empty description property is required%0AThe origamiType property needs to be set to either "imageset", "module" or "service"%0AThe origamiVersion property needs to be set to 2, this version of Origami Build tools only supports v2 of the Origami component specification.%0AThe support property must be an email or url to an issue tracker for this module%0AThe supportStatus property must be set to either "active", "maintained", "deprecated", "dead" or "experimental"%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` ); } }); @@ -184,7 +184,7 @@ describe('verify-origami-json', function () { proclaim.calledOnce(console.log); proclaim.calledWithExactly( console.log, - `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AA non-empty description property is required%0AThe origamiType property needs to be set to either "imageset", "module" or "service"%0AThe origamiVersion property needs to be set to 1%0AThe support property must be an email or url to an issue tracker for this module%0AThe supportStatus property must be set to either "active", "maintained", "deprecated", "dead" or "experimental"%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` + `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AA non-empty description property is required%0AThe origamiType property needs to be set to either "imageset", "module" or "service"%0AThe origamiVersion property needs to be set to 2, this version of Origami Build tools only supports v2 of the Origami component specification.%0AThe support property must be an email or url to an issue tracker for this module%0AThe supportStatus property must be set to either "active", "maintained", "deprecated", "dead" or "experimental"%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` ); }); }); @@ -268,20 +268,20 @@ describe('verify-origami-json', function () { proclaim.equal( verifiedOrigamiJson.message, 'Failed linting:\n\n' + - 'The origamiVersion property needs to be set to 1\n\n' + + 'The origamiVersion property needs to be set to 2, this version of Origami Build tools only supports v2 of the Origami component specification.\n\n' + 'The origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/' ); proclaim.calledOnce(console.log); proclaim.calledWithExactly( console.log, - `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AThe origamiVersion property needs to be set to 1%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` + `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AThe origamiVersion property needs to be set to 2, this version of Origami Build tools only supports v2 of the Origami component specification.%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` ); }); }); - it('should fail if origamiVersion property is not 1', function () { + it('should fail if origamiVersion property is not 2', function () { const origamiJSON = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'origami.json'), 'utf-8')); - origamiJSON.origamiVersion = 2; + origamiJSON.origamiVersion = 1; fs.writeFileSync('origami.json', JSON.stringify(origamiJSON), 'utf8'); return verifyOrigamiJson().task() @@ -289,20 +289,20 @@ describe('verify-origami-json', function () { proclaim.equal( verifiedOrigamiJson.message, 'Failed linting:\n\n' + - 'The origamiVersion property needs to be set to 1\n\n' + + 'The origamiVersion property needs to be set to 2, this version of Origami Build tools only supports v2 of the Origami component specification.\n\n' + 'The origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/' ); proclaim.calledOnce(console.log); proclaim.calledWithExactly( console.log, - `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AThe origamiVersion property needs to be set to 1%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` + `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AThe origamiVersion property needs to be set to 2, this version of Origami Build tools only supports v2 of the Origami component specification.%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` ); }); }); - it('should pass if origamiVersion property is 1', async function () { + it('should pass if origamiVersion property is 2', async function () { const origamiJSON = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'origami.json'), 'utf-8')); - origamiJSON.origamiVersion = 1; + origamiJSON.origamiVersion = 2; fs.writeFileSync('origami.json', JSON.stringify(origamiJSON), 'utf8'); await verifyOrigamiJson().task(); @@ -352,7 +352,7 @@ describe('verify-origami-json', function () { proclaim.calledOnce(console.log); proclaim.calledWithExactly( console.log, - `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AA non-empty description property is required%0AThe origamiType property needs to be set to either "imageset", "module" or "service"%0AThe origamiVersion property needs to be set to 1%0AThe support property must be an email or url to an issue tracker for this module%0AThe supportStatus property must be set to either "active", "maintained", "deprecated", "dead" or "experimental"%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` + `::error file=origami.json,line=1,col=1::Failed linting:%0A%0AA non-empty description property is required%0AThe origamiType property needs to be set to either "imageset", "module" or "service"%0AThe origamiVersion property needs to be set to 2, this version of Origami Build tools only supports v2 of the Origami component specification.%0AThe support property must be an email or url to an issue tracker for this module%0AThe supportStatus property must be set to either "active", "maintained", "deprecated", "dead" or "experimental"%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/` ); }); }); @@ -490,11 +490,15 @@ describe('verify-origami-json', function () { }); describe('demo title', function() { - const origamiJSON = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'origami.json'), 'utf-8')); - origamiJSON.origamiType = 'module'; const expectedError = 'Failed linting:\n\n' + 'All demos require a title property which is non-empty and of type "string".\n\n' + 'The origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/'; + let origamiJSON = {}; + + beforeEach(() => { + origamiJSON = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'origami.json'), 'utf-8')); + origamiJSON.origamiType = 'module'; + }); it('should fail when a demo does not have a title property', function () { origamiJSON.demos = [{