Skip to content

Commit

Permalink
dep(punycode.js), reduced indirection, spread operator (#35)
Browse files Browse the repository at this point in the history
* punycode.js: also update package.json

* remove unused indirection, use es6 ... to reduce boilerplate

* lint: turn off prefer-const warnings

* update GHA workflows

* pr fix: call open_database in register

* revert eslint rule
  • Loading branch information
msimerson authored Apr 19, 2024
1 parent 30374bd commit 0e9e3f1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
package-name: ${{env.NPM_MODULE_NAME}}
pull-request-title-pattern: 'chore${scope}: release ${version} [skip-ci]'
# The logic below handles the npm publication:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
test:
strategy:
matrix:
node: [16.x, 18.x, 20.x]
node: [16, 18, 20]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm install
Expand Down
20 changes: 4 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ exports.register = function () {
plugin.logdebug('Initializing Wild Duck plugin.');
plugin.load_wildduck_ini();

plugin.register_hook('init_master', 'init_wildduck_shared');
plugin.register_hook('init_child', 'init_wildduck_shared');
plugin.register_hook('init_master', 'open_database');
plugin.register_hook('init_child', 'open_database');

plugin.resolver = async (name, rr) => await dns.promises.resolve(name, rr);
};
Expand All @@ -64,7 +64,7 @@ exports.load_wildduck_ini = function () {
);
};

exports.open_database = function (server, next) {
exports.open_database = function (next, server) {
const plugin = this;

plugin.srsRewriter = new SRS({
Expand Down Expand Up @@ -129,13 +129,7 @@ exports.open_database = function (server, next) {
plugin.db.messageHandler.loggelf = message => plugin.loggelf(message);
plugin.db.userHandler.loggelf = message => plugin.loggelf(message);

plugin.maildrop = new Maildropper({
db,
enabled: plugin.cfg.sender.enabled,
zone: plugin.cfg.sender.zone,
collection: plugin.cfg.sender.collection,
gfs: plugin.cfg.sender.gfs
});
plugin.maildrop = new Maildropper({ db, ...plugin.cfg.sender });

plugin.filterHandler = new FilterHandler({
db,
Expand Down Expand Up @@ -194,12 +188,6 @@ exports.normalize_address = function (address) {
return tools.normalizeAddress(address.address());
};

exports.init_wildduck_shared = function (next, server) {
const plugin = this;

plugin.open_database(server, next);
};

exports.increment_forward_counters = async function (connection) {
const plugin = this;
const txn = connection.transaction;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"mailauth": "4.6.5",
"mongodb": "4.17.0",
"nodemailer": "6.9.13",
"punycode": "2.3.1",
"punycode.js": "2.3.1",
"srs.js": "0.1.0",
"wildduck": "1.42.5"
}
Expand Down

0 comments on commit 0e9e3f1

Please sign in to comment.