Command option fixes, npm audit fix

This commit is contained in:
Juan Ferrer 2022-04-30 02:33:41 +02:00
parent 33acdd8a86
commit 0968ba1283
6 changed files with 92 additions and 55 deletions

View File

@ -164,7 +164,7 @@ $ myvc init
Incorporates database routine changes into workspace. Incorporates database routine changes into workspace.
```text ```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: 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. Applies versions and routine changes into database.
```text ```text
$ myvc push [<remote>] [-f|--force] [-c|--save-commit] [-s|save-sums] $ myvc push [<remote>] [-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 prevents from accidentally saving local commits into shared servers, causing
subsequent pushes from other clients to fail because they can't get that subsequent pushes from other clients to fail because they can't get that
commit from the git tree in order to get differences. 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. name mixing a color with a plant name.
```text ```text
$ myvc version [<name>] [-c|--no-clean] $ myvc version [<name>] [-o|--hold]
``` ```
## Local server commands ## Local server commands

View File

@ -11,7 +11,7 @@ class Pull {
force: 'Do it even if there are local changes', force: 'Do it even if there are local changes',
checkout: 'Move to same database commit before pull', checkout: 'Move to same database commit before pull',
updateAll: 'Update all routines', updateAll: 'Update all routines',
saveSums: 'Save SHA sums of all objects' sums: 'Save SHA sums of all objects'
}, },
operand: 'remote' operand: 'remote'
}; };
@ -23,13 +23,13 @@ class Pull {
force: 'f', force: 'f',
checkout: 'c', checkout: 'c',
updateAll: 'u', updateAll: 'u',
saveSums: 's' sums: 's'
}, },
boolean: [ boolean: [
'force', 'force',
'checkout', 'checkout',
'updateAll', 'updateAll',
'saveSums' 'sums'
] ]
}; };
} }
@ -117,7 +117,7 @@ class Pull {
for (const exporter of engine.exporters) for (const exporter of engine.exporters)
await exporter.export(exportDir, await exporter.export(exportDir,
schema, opts.update, opts.saveSums); schema, opts.update, opts.sums);
} }
await engine.refreshPullDate(); await engine.refreshPullDate();

View File

@ -13,8 +13,8 @@ class Push {
description: 'Apply changes into database', description: 'Apply changes into database',
params: { params: {
force: 'Answer yes to all questions', force: 'Answer yes to all questions',
saveCommit: 'Wether to save the commit SHA into database', commit: 'Wether to save the commit SHA into database',
saveSums: 'Save SHA sums of pushed objects' sums: 'Save SHA sums of pushed objects'
}, },
operand: 'remote' operand: 'remote'
}; };
@ -24,13 +24,13 @@ class Push {
return { return {
alias: { alias: {
force: 'f', force: 'f',
saveCommit: 'c', commit: 'c',
saveSums: 's' sums: 's'
}, },
boolean: [ boolean: [
'force', 'force',
'saveCommit', 'commit',
'saveSums' 'sums'
] ]
}; };
} }
@ -39,8 +39,8 @@ class Push {
const conn = await myvc.dbConnect(); const conn = await myvc.dbConnect();
this.conn = conn; this.conn = conn;
if (opts.saveCommit == null && opts.remote == 'local') if (opts.commit == null && opts.remote == 'local')
opts.saveCommit = true; opts.commit = true;
// Obtain exclusive lock // Obtain exclusive lock
@ -346,7 +346,7 @@ class Push {
); );
} }
if (opts.saveSums || oldSum) if (opts.sums || oldSum)
await engine.fetchShaSum(type, schema, name); await engine.fetchShaSum(type, schema, name);
} else { } else {
const escapedName = const escapedName =
@ -377,7 +377,7 @@ class Push {
} else } else
console.log(` -> No routines changed.`); console.log(` -> No routines changed.`);
if (gitExists && opts.saveCommit) { if (gitExists && opts.commit) {
const repo = await nodegit.Repository.open(this.opts.workspace); const repo = await nodegit.Repository.open(this.opts.workspace);
const head = await repo.getHeadCommit(); const head = await repo.getHeadCommit();

View File

@ -11,7 +11,7 @@ class Version {
description: 'Creates a new version', description: 'Creates a new version',
params: { params: {
name: 'Name for the new version', name: 'Name for the new version',
noClean: 'Do not clean old versions' hold: 'Do not clean old versions'
}, },
operand: 'name' operand: 'name'
}; };
@ -21,13 +21,13 @@ class Version {
return { return {
alias: { alias: {
name: 'n', name: 'n',
noClean: 'c' hold: 'o'
}, },
string: [ string: [
'name' 'name'
], ],
boolean: [ boolean: [
'noClean' 'hold'
], ],
default: { default: {
remote: 'production' remote: 'production'
@ -143,7 +143,7 @@ class Version {
// Remove old versions // Remove old versions
if (opts.maxOldVersions && !opts.noClean if (opts.maxOldVersions && !opts.hold
&& oldVersions.length > opts.maxOldVersions) { && oldVersions.length > opts.maxOldVersions) {
oldVersions.splice(-opts.maxOldVersions); oldVersions.splice(-opts.maxOldVersions);

101
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "myvc", "name": "myvc",
"version": "1.3.4", "version": "1.4.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "myvc", "name": "myvc",
"version": "1.3.4", "version": "1.4.1",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@sqltools/formatter": "^1.2.3", "@sqltools/formatter": "^1.2.3",
@ -167,9 +167,9 @@
} }
}, },
"node_modules/async": { "node_modules/async": {
"version": "0.9.2", "version": "3.2.3",
"resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
"integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
}, },
"node_modules/asynckit": { "node_modules/asynckit": {
"version": "0.4.0", "version": "0.4.0",
@ -460,11 +460,11 @@
} }
}, },
"node_modules/ejs": { "node_modules/ejs": {
"version": "3.1.6", "version": "3.1.7",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.6.tgz", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz",
"integrity": "sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==", "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==",
"dependencies": { "dependencies": {
"jake": "^10.6.1" "jake": "^10.8.5"
}, },
"bin": { "bin": {
"ejs": "bin/cli.js" "ejs": "bin/cli.js"
@ -505,11 +505,30 @@
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
}, },
"node_modules/filelist": { "node_modules/filelist": {
"version": "1.0.2", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz",
"integrity": "sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ==", "integrity": "sha512-LwjCsruLWQULGYKy7TX0OPtrL9kLpojOFKc5VCTxdFTV7w5zbsgqVKfnkKG7Qgjtq50gKfO56hJv88OfcGb70Q==",
"dependencies": { "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": { "node_modules/forever-agent": {
@ -794,11 +813,11 @@
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
}, },
"node_modules/jake": { "node_modules/jake": {
"version": "10.8.4", "version": "10.8.5",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.4.tgz", "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz",
"integrity": "sha512-MtWeTkl1qGsWUtbl/Jsca/8xSoK3x0UmS82sNbjqxxG/de/M/3b1DntdjHgPMC50enlTNwXOCRqPXLLt5cCfZA==", "integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==",
"dependencies": { "dependencies": {
"async": "0.9.x", "async": "^3.2.3",
"chalk": "^4.0.2", "chalk": "^4.0.2",
"filelist": "^1.0.1", "filelist": "^1.0.1",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"
@ -1930,9 +1949,9 @@
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
}, },
"async": { "async": {
"version": "0.9.2", "version": "3.2.3",
"resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
"integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g=="
}, },
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
@ -2171,11 +2190,11 @@
} }
}, },
"ejs": { "ejs": {
"version": "3.1.6", "version": "3.1.7",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.6.tgz", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz",
"integrity": "sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==", "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==",
"requires": { "requires": {
"jake": "^10.6.1" "jake": "^10.8.5"
} }
}, },
"end-of-stream": { "end-of-stream": {
@ -2207,11 +2226,29 @@
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
}, },
"filelist": { "filelist": {
"version": "1.0.2", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz",
"integrity": "sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ==", "integrity": "sha512-LwjCsruLWQULGYKy7TX0OPtrL9kLpojOFKc5VCTxdFTV7w5zbsgqVKfnkKG7Qgjtq50gKfO56hJv88OfcGb70Q==",
"requires": { "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": { "forever-agent": {
@ -2449,11 +2486,11 @@
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
}, },
"jake": { "jake": {
"version": "10.8.4", "version": "10.8.5",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.4.tgz", "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz",
"integrity": "sha512-MtWeTkl1qGsWUtbl/Jsca/8xSoK3x0UmS82sNbjqxxG/de/M/3b1DntdjHgPMC50enlTNwXOCRqPXLLt5cCfZA==", "integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==",
"requires": { "requires": {
"async": "0.9.x", "async": "^3.2.3",
"chalk": "^4.0.2", "chalk": "^4.0.2",
"filelist": "^1.0.1", "filelist": "^1.0.1",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"

View File

@ -1,6 +1,6 @@
{ {
"name": "myvc", "name": "myvc",
"version": "1.4.0", "version": "1.4.1",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "MySQL Version Control", "description": "MySQL Version Control",
"license": "GPL-3.0", "license": "GPL-3.0",