diff --git a/package-lock.json b/package-lock.json index c13e8bd..d019840 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wiki-to-git", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wiki-to-git", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "dependencies": { "node-fetch": "3.x" @@ -547,9 +547,9 @@ } }, "node_modules/eslint": { - "version": "8.44.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.44.0.tgz", - "integrity": "sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A==", + "version": "8.45.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.45.0.tgz", + "integrity": "sha512-pd8KSxiQpdYRfYa9Wufvdoct3ZPQQuVuU5O6scNgMuOMYuxvH0IGaYK0wUFjo4UYYQQCUndlXiMbnxopwvvTiw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -577,7 +577,6 @@ "globals": "^13.19.0", "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", @@ -589,7 +588,6 @@ "natural-compare": "^1.4.0", "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "bin": { @@ -603,9 +601,9 @@ } }, "node_modules/eslint-scope": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", - "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.1.tgz", + "integrity": "sha512-CvefSOsDdaYYvxChovdrPo/ZGt8d5lrJWleAc1diXRKhHGiTYEI26cvo8Kle/wGnsizoCJjK73FMg1/IkIwiNA==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", @@ -631,9 +629,9 @@ } }, "node_modules/espree": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.0.tgz", - "integrity": "sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "dependencies": { "acorn": "^8.9.0", diff --git a/package.json b/package.json index d9ed9f3..8e27429 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wiki-to-git", - "version": "1.0.0", + "version": "1.0.1", "description": "Node.js tool that helps to download Mediwiki page history and push it to a Git repository.", "type": "module", "main": "src/main.js", diff --git a/src/GitOps.js b/src/GitOps.js index a311257..09e90ba 100644 --- a/src/GitOps.js +++ b/src/GitOps.js @@ -76,10 +76,22 @@ export default class GitOps { args.push(this.pDate(history)); let env = {}; env.GIT_COMMITTER_DATE = history.dt.toString().trim(); - const result = await this.execFile('git', args, this.dir, env); - if (!result) { - throw 'Unable to commit changes!'; + + let result; + try { + result = await this.execFile('git', args, this.dir, env); + if (!result) { + throw 'Unable to commit changes!'; + } + } catch (error) { + if (error.code === 1 && error.stdout.search(/nothing to commit/) >= 0) { + console.log('\n\nskipping empty commit:\n', history); + } else { + this.execInfo(error.stdout, error.stderr); + throw(error); + } } + return result; } @@ -120,7 +132,7 @@ export default class GitOps { } /** @private Report exec problems. */ - async execInfo(stdout, stderr) { + execInfo(stdout, stderr) { if (stdout && stdout.length) { console.log(stdout); }