From 0968ba12836e1b6e0b9d9319b7099d5879cbd671 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Sat, 30 Apr 2022 02:33:41 +0200 Subject: [PATCH] Command option fixes, npm audit fix --- README.md | 8 ++-- myvc-pull.js | 8 ++-- myvc-push.js | 20 ++++----- myvc-version.js | 8 ++-- package-lock.json | 101 +++++++++++++++++++++++++++++++--------------- package.json | 2 +- 6 files changed, 92 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 61b3499..f60746d 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ $ myvc init Incorporates database routine changes into workspace. ```text -$ myvc pull [remote] [-f|--force] [-c|--checkout] [-u|--update] [-s|save-sums] +$ myvc pull [remote] [-f|--force] [-c|--checkout] [-u|--update] [-s|--sums] ``` When *--checkout* option is provided, it does the following before export: @@ -177,10 +177,10 @@ When *--checkout* option is provided, it does the following before export: Applies versions and routine changes into database. ```text -$ myvc push [] [-f|--force] [-c|--save-commit] [-s|save-sums] +$ myvc push [] [-f|--force] [-c|--commit] [-s|--sums] ``` -Commit is saved into database only if *--save-commit* option is provided, it +Commit is saved into database only if *--commit* option is provided, it prevents from accidentally saving local commits into shared servers, causing subsequent pushes from other clients to fail because they can't get that commit from the git tree in order to get differences. @@ -191,7 +191,7 @@ Creates a new version folder, when name is not specified it generates a random name mixing a color with a plant name. ```text -$ myvc version [] [-c|--no-clean] +$ myvc version [] [-o|--hold] ``` ## Local server commands diff --git a/myvc-pull.js b/myvc-pull.js index 9d556b2..e5d7804 100755 --- a/myvc-pull.js +++ b/myvc-pull.js @@ -11,7 +11,7 @@ class Pull { force: 'Do it even if there are local changes', checkout: 'Move to same database commit before pull', updateAll: 'Update all routines', - saveSums: 'Save SHA sums of all objects' + sums: 'Save SHA sums of all objects' }, operand: 'remote' }; @@ -23,13 +23,13 @@ class Pull { force: 'f', checkout: 'c', updateAll: 'u', - saveSums: 's' + sums: 's' }, boolean: [ 'force', 'checkout', 'updateAll', - 'saveSums' + 'sums' ] }; } @@ -117,7 +117,7 @@ class Pull { for (const exporter of engine.exporters) await exporter.export(exportDir, - schema, opts.update, opts.saveSums); + schema, opts.update, opts.sums); } await engine.refreshPullDate(); diff --git a/myvc-push.js b/myvc-push.js index 6b8a718..5b4cb2b 100644 --- a/myvc-push.js +++ b/myvc-push.js @@ -13,8 +13,8 @@ class Push { description: 'Apply changes into database', params: { force: 'Answer yes to all questions', - saveCommit: 'Wether to save the commit SHA into database', - saveSums: 'Save SHA sums of pushed objects' + commit: 'Wether to save the commit SHA into database', + sums: 'Save SHA sums of pushed objects' }, operand: 'remote' }; @@ -24,13 +24,13 @@ class Push { return { alias: { force: 'f', - saveCommit: 'c', - saveSums: 's' + commit: 'c', + sums: 's' }, boolean: [ 'force', - 'saveCommit', - 'saveSums' + 'commit', + 'sums' ] }; } @@ -39,8 +39,8 @@ class Push { const conn = await myvc.dbConnect(); this.conn = conn; - if (opts.saveCommit == null && opts.remote == 'local') - opts.saveCommit = true; + if (opts.commit == null && opts.remote == 'local') + opts.commit = true; // Obtain exclusive lock @@ -346,7 +346,7 @@ class Push { ); } - if (opts.saveSums || oldSum) + if (opts.sums || oldSum) await engine.fetchShaSum(type, schema, name); } else { const escapedName = @@ -377,7 +377,7 @@ class Push { } else console.log(` -> No routines changed.`); - if (gitExists && opts.saveCommit) { + if (gitExists && opts.commit) { const repo = await nodegit.Repository.open(this.opts.workspace); const head = await repo.getHeadCommit(); diff --git a/myvc-version.js b/myvc-version.js index f150c98..c1e38d0 100644 --- a/myvc-version.js +++ b/myvc-version.js @@ -11,7 +11,7 @@ class Version { description: 'Creates a new version', params: { name: 'Name for the new version', - noClean: 'Do not clean old versions' + hold: 'Do not clean old versions' }, operand: 'name' }; @@ -21,13 +21,13 @@ class Version { return { alias: { name: 'n', - noClean: 'c' + hold: 'o' }, string: [ 'name' ], boolean: [ - 'noClean' + 'hold' ], default: { remote: 'production' @@ -143,7 +143,7 @@ class Version { // Remove old versions - if (opts.maxOldVersions && !opts.noClean + if (opts.maxOldVersions && !opts.hold && oldVersions.length > opts.maxOldVersions) { oldVersions.splice(-opts.maxOldVersions); diff --git a/package-lock.json b/package-lock.json index c8488d7..d6ab963 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "myvc", - "version": "1.3.4", + "version": "1.4.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "myvc", - "version": "1.3.4", + "version": "1.4.1", "license": "GPL-3.0", "dependencies": { "@sqltools/formatter": "^1.2.3", @@ -167,9 +167,9 @@ } }, "node_modules/async": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==" }, "node_modules/asynckit": { "version": "0.4.0", @@ -460,11 +460,11 @@ } }, "node_modules/ejs": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.6.tgz", - "integrity": "sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", + "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", "dependencies": { - "jake": "^10.6.1" + "jake": "^10.8.5" }, "bin": { "ejs": "bin/cli.js" @@ -505,11 +505,30 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "node_modules/filelist": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz", - "integrity": "sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz", + "integrity": "sha512-LwjCsruLWQULGYKy7TX0OPtrL9kLpojOFKc5VCTxdFTV7w5zbsgqVKfnkKG7Qgjtq50gKfO56hJv88OfcGb70Q==", "dependencies": { - "minimatch": "^3.0.4" + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" } }, "node_modules/forever-agent": { @@ -794,11 +813,11 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "node_modules/jake": { - "version": "10.8.4", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.4.tgz", - "integrity": "sha512-MtWeTkl1qGsWUtbl/Jsca/8xSoK3x0UmS82sNbjqxxG/de/M/3b1DntdjHgPMC50enlTNwXOCRqPXLLt5cCfZA==", + "version": "10.8.5", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", + "integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==", "dependencies": { - "async": "0.9.x", + "async": "^3.2.3", "chalk": "^4.0.2", "filelist": "^1.0.1", "minimatch": "^3.0.4" @@ -1930,9 +1949,9 @@ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" }, "async": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==" }, "asynckit": { "version": "0.4.0", @@ -2171,11 +2190,11 @@ } }, "ejs": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.6.tgz", - "integrity": "sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", + "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", "requires": { - "jake": "^10.6.1" + "jake": "^10.8.5" } }, "end-of-stream": { @@ -2207,11 +2226,29 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "filelist": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz", - "integrity": "sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz", + "integrity": "sha512-LwjCsruLWQULGYKy7TX0OPtrL9kLpojOFKc5VCTxdFTV7w5zbsgqVKfnkKG7Qgjtq50gKfO56hJv88OfcGb70Q==", "requires": { - "minimatch": "^3.0.4" + "minimatch": "^5.0.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "forever-agent": { @@ -2449,11 +2486,11 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "jake": { - "version": "10.8.4", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.4.tgz", - "integrity": "sha512-MtWeTkl1qGsWUtbl/Jsca/8xSoK3x0UmS82sNbjqxxG/de/M/3b1DntdjHgPMC50enlTNwXOCRqPXLLt5cCfZA==", + "version": "10.8.5", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", + "integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==", "requires": { - "async": "0.9.x", + "async": "^3.2.3", "chalk": "^4.0.2", "filelist": "^1.0.1", "minimatch": "^3.0.4" diff --git a/package.json b/package.json index 605390a..9a83684 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "myvc", - "version": "1.4.0", + "version": "1.4.1", "author": "Verdnatura Levante SL", "description": "MySQL Version Control", "license": "GPL-3.0",