Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ this will make a new version and on version tag, the main ci workflow will push
## HowTo release using `gh`

Install and create automatically a draft release version using [gh client](https://cli.github.com/)
- the version tag must exists
- the version tag must exist

Example to create v2.2.9
```bash
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ jobs:
cache: 'pnpm'

- name: Install dependencies
# - run: npm ci # need package.json.lock
run: |
echo ::group::Install dependencies
echo "install"
pnpm install
echo "show outdated (if any)"
pnpm outdated --depth=3 || echo "::notice title=OneLineReport::ℹ️ you must think about update your dependencies :)"
pnpm outdated --depth=3 || echo "::warning::🕸️ you must think about update your dependencies :)"
echo ::endgroup::

- name: pnpm audit
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ jobs:
cache: 'pnpm'

- name: Install dependencies
# npx force-resolutions : in case of Permission denied: run it locally to fix package-lock.json
run: |
echo ::group::Install dependencies
echo "install"
pnpm install
echo "show outdated (if any)"
pnpm outdated --depth=3 || echo "::warning::🕸️ you must think about update your dependencies :)"
echo ::endgroup::
pnpm outdated --depth=3 || echo "::notice title=OneLineReport::ℹ️ you must think about update your dependencies :)"

- name: Setup mongo tools # add mongosh and mongodump/mongorestore
Expand Down
20 changes: 10 additions & 10 deletions lib/MTCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class MTCommand {
}

logOutput(result) {
if (result.stdout) { console.info('stdout:', result.stdout); }
if (result.stderr) { console.error('stderr:', result.stderr); }
if (result?.stdout) { console.info('stdout:', result.stdout); }
if (result?.stderr) { console.error('stderr:', result.stderr); }
}

logSuccess(success) {
Expand All @@ -41,11 +41,11 @@ class MTCommand {

logError(err) {
// DEBUG // console.error(JSON.stringify(err));
if (err && err.status) {
if (err?.status) {
console.error(`Error ${err.status} ${JSON.stringify(err.error, null, 4)}`);
} else if (err && err.message) {
} else if (err?.message) {
console.error(`Error ${err.message}`);
} else if (err && err.text) {
} else if (err?.text) {
console.error(`Error ${err.text}`);
} else {
console.error(`Error ${JSON.stringify(err, null, 4)}`);
Expand All @@ -65,18 +65,18 @@ class MTCommand {
if (action === 'list') {
this.mt.list(new MTOptions()).then((listResult) => {
console.log(JSON.stringify(listResult, null, 4));
}).catch(error => cmd.logError(error.message));
}).catch(error => cmd.logError(error));
return;
}
if (action === 'dumpz') {
this.mt.mongodump(new MTOptions({
"encrypt":true
}))
.then(cmd.logSuccess.bind(cmd)).catch(error => cmd.logError(error.message));
.then(cmd.logSuccess.bind(cmd)).catch(error => cmd.logError(error));
return;
}
if (action === 'dump') {
this.mt.mongodump(new MTOptions({})).then(cmd.logSuccess.bind(cmd)).catch(error => cmd.logError(error.message));
this.mt.mongodump(new MTOptions({})).then(cmd.logSuccess.bind(cmd)).catch(error => cmd.logError(error));
return;
}
// restore action do need an extra argument: the file to restore
Expand All @@ -91,11 +91,11 @@ class MTCommand {
dropBeforeRestore: false,
deleteDumpAfterRestore: false
}))
.then(cmd.logSuccess.bind(cmd)).catch(error => cmd.logError(error.message));
.then(cmd.logSuccess.bind(cmd)).catch(error => cmd.logError(error));
return;
}
if (action === 'rotation') {
this.mt.rotation(new MTOptions()).then(cmd.logSuccess.bind(cmd)).catch(error => cmd.logError(error.message));
this.mt.rotation(new MTOptions()).then(cmd.logSuccess.bind(cmd)).catch(error => cmd.logError(error));
}
}

Expand Down
Loading