Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ts refactoring - wip #100

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
13 changes: 0 additions & 13 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "makeomatic"
"extends": "makeomatic/typescript"
}
9 changes: 6 additions & 3 deletions .mdeprc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"node": "12.14.1",
"node": "14.11.0",
"auto_compose": true,
"services": [
"rabbitmq"
Expand All @@ -19,9 +19,12 @@
}
},
"rabbitmq": {
"ports": ["15672:15672"]
"ports": [
"5672:5672",
"15672:15672"
]
}
},
"tests": "./test/*.js",
"tests": "./test/**/*",
"rebuild": ["microtime"]
}
5 changes: 3 additions & 2 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"bail": true,
"bail": false,
"timeout": 60000,
"report": "spec"
"report": "spec",
"require": "ts-node/register"
}
2 changes: 1 addition & 1 deletion .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"src/**/*.spec.js"
],
"require": [
"@babel/register"
"ts-node/register"
],
"sourceMap": false,
"instrument": false,
Expand Down
14 changes: 8 additions & 6 deletions bench/roundtrip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const Promise = require('bluebird');
const Benchmark = require('benchmark');
const fmt = require('util').format;
const AMQPTransport = require('../lib');
Expand Down Expand Up @@ -39,12 +38,13 @@ const opts = {
const publisher = new AMQPTransport(configuration);
let messagesSent = 0;

Promise.join(
Promise.all([
AMQPTransport.connect(opts, listener),
publisher.connect()
)
.spread((consumer) => {
])
.then(([consumer]) => {
const suite = new Benchmark.Suite('RabbitMQ');

suite.add('Round-trip', {
defer: true,
fn: function test(deferred) {
Expand All @@ -57,11 +57,13 @@ Promise.join(
},
})
.on('complete', function suiteCompleted() {
const { stats } = this.filter('fastest')[0];
const { times } = this.filter('fastest')[0];
const { stats } = this.filter('successful')[0];
const { times } = this.filter('successful')[0];
process.stdout.write(fmt('Messages sent: %s\n', messagesSent));
process.stdout.write(fmt('Mean is %s ms ~ %s %\n', stats.mean * 1000, stats.rme));
process.stdout.write(fmt('Total time is %s s %s s\n', times.elapsed, times.period));
process.stdout.write(fmt('Std. dev %s\n', stats.deviation))

consumer.close();
publisher.close();
})
Expand Down
40 changes: 25 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
"version": "0.0.0-development",
"main": "./lib/amqp.js",
"scripts": {
"compile": "babel -d ./lib ./src",
"lint": "eslint ./src",
"lint": "eslint ./src --ext .ts,.js",
"test": "yarn lint && yarn test:e2e",
"test:e2e": "mdep test run",
"prepublishOnly": "yarn compile",
"bench": "yarn compile && node ./bench/roundtrip.js",
"semantic-release": "semantic-release"
"bench": "yarn build && node ./bench/roundtrip.js",
"prepublishOnly": "yarn build",
"semantic-release": "semantic-release",
"clean": "yarn build:clean",
"build:lib": "tsc --build tsconfig.build.json",
"build:clean": "rimraf ./lib",
"build": "yarn build:clean && yarn build:lib"
},
"engines": {
"node": ">= 10.15.0",
Expand All @@ -27,12 +30,13 @@
},
"homepage": "https://github.com/microfleet/transport-amqp#readme",
"devDependencies": {
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.2",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-transform-strict-mode": "^7.10.1",
"@babel/register": "^7.10.1",
"@makeomatic/deploy": "^10.2.1",
"@types/common-errors": "^1.0.1",
"@types/lodash": "^4.14.161",
"@types/mocha": "^8.0.3",
"@types/node": "^14.11.2",
"@types/object-hash": "^1.3.3",
"@types/pino": "^6.3.1",
"babel-plugin-istanbul": "^6.0.0",
"benchmark": "^2.1.4",
"chai": "^4.2.0",
Expand All @@ -48,29 +52,35 @@
"microtime": "^3.0.0",
"mocha": "^8.0.1",
"nyc": "^15.1.0",
"sinon": "^9.0.2"
"rimraf": "^3.0.2",
"sinon": "^9.0.2",
"ts-node": "^9.0.0",
"typescript": "^4.1.0-beta"
},
"peerDependencies": {
"common-errors": "~1.x.x",
"stdout-stream": "~1.x.x"
},
"dependencies": {
"@hapi/joi": "^17.1.1",
"@microfleet/amqp-coffee": "^1.3.1",
"bluebird": "^3.7.2",
"@sindresorhus/is": "^3.1.2",
"common-errors": "^1.0.5",
"debug": "^4.1.1",
"delay": "^4.4.0",
"eventemitter3": "^4.0.4",
"flatstr": "^1.0.12",
"hashlru": "^2.3.0",
"hyperid": "^2.0.5",
"is": "^3.3.0",
"json-stringify-safe": "^5.0.1",
"joi": "^17.2.1",
"lodash": "^4.17.15",
"object-hash": "^2.0.3",
"opentracing": "^0.14.4",
"p-timeout": "^3.2.0",
"pino": "^6.3.2",
"safe-stable-stringify": "^1.1.1",
"sonic-boom": "^1.0.1",
"uuid": "^8.1.0"
"zod": "^2.0.0-beta.8"
},
"files": [
"lib/",
Expand Down
Loading