From 337aeea1522317097310043a0d6c3f31265d83b4 Mon Sep 17 00:00:00 2001 From: Tejas Bubane Date: Thu, 13 Jun 2019 22:59:45 +0530 Subject: [PATCH 1/2] Skip package.json version when comparing checksums --- scripts/checksum | 10 +++++++++- scripts/helpers.js | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/checksum b/scripts/checksum index bd32357bcf..521d6875af 100755 --- a/scripts/checksum +++ b/scripts/checksum @@ -15,10 +15,16 @@ const crypto = require('crypto'); const sha = str => crypto.createHash('md5').update(str).digest("hex"); +// Helper function to check single assignment function checksum(filename, assignment, rootChecksum) { if(!assignment) { return; } - const assignmentConfig = shell.cat(['exercises', assignment, filename].join('/')).toString(); + let assignmentConfig = shell.cat(['exercises', assignment, filename].join('/')).toString(); + if(filename === 'package.json') { + const json = JSON.parse(assignmentConfig); + delete json['version']; + assignmentConfig = JSON.stringify(json, null, 2) + '\n'; + } const assignmentChecksum = sha(assignmentConfig); if(assignmentChecksum !== rootChecksum) { @@ -27,6 +33,8 @@ function checksum(filename, assignment, rootChecksum) { } } +// Check all assignments by default +// or single if ASSIGNMENT is given function checkSumAll(filename, rootFileName = filename) { shell.echo('\nChecking integrity of ' + filename + '...'); diff --git a/scripts/helpers.js b/scripts/helpers.js index 87244dc3f9..5769edb7f7 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -46,6 +46,7 @@ function createExercisePackageJson() { const packageFile = shell.cat('package.json').toString(); const packageJson = JSON.parse(packageFile); + delete packageJson['version']; SKIP_PACKAGES_FOR_CHECKSUM.forEach(package => delete packageJson['devDependencies'][package]); const shellStr = new shell.ShellString(JSON.stringify(packageJson, null, 2) + '\n'); From 609b0f164a9f52530e19207a6c3af7e63220d2e3 Mon Sep 17 00:00:00 2001 From: Tejas Bubane Date: Thu, 13 Jun 2019 23:00:27 +0530 Subject: [PATCH 2/2] Sync `hello-world` exercise with canonical data v1.1.0 --- exercises/hello-world/hello-world.spec.js | 2 +- exercises/hello-world/package.json | 2 +- package.json | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/exercises/hello-world/hello-world.spec.js b/exercises/hello-world/hello-world.spec.js index cbafe12e41..cd0b7ec1c0 100644 --- a/exercises/hello-world/hello-world.spec.js +++ b/exercises/hello-world/hello-world.spec.js @@ -1,7 +1,7 @@ import { hello } from './hello-world'; describe('Hello World', () => { - test('says hello', () => { + test('Say Hi!', () => { expect(hello()).toEqual('Hello, World!'); }); }); diff --git a/exercises/hello-world/package.json b/exercises/hello-world/package.json index 4c825b290f..09f9280019 100644 --- a/exercises/hello-world/package.json +++ b/exercises/hello-world/package.json @@ -1,6 +1,6 @@ { "name": "exercism-javascript", - "version": "0.0.0", + "version": "1.1.0", "description": "Exercism exercises in Javascript.", "author": "Katrina Owen", "private": true, diff --git a/package.json b/package.json index 7e1c79100f..da70c70721 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "exercism-javascript", - "version": "0.0.0", "description": "Exercism exercises in Javascript.", "author": "Katrina Owen", "private": true,