Skip to content

Commit

Permalink
Merge pull request #59 from TechTeamer/beta
Browse files Browse the repository at this point in the history
FKITDEV-3818: feat(semver): setup semantic release
  • Loading branch information
robence authored Jun 19, 2024
2 parents 55c780d + d93a007 commit 44586bd
Show file tree
Hide file tree
Showing 49 changed files with 4,721 additions and 1,799 deletions.
11 changes: 7 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"extends": ["standard", "plugin:n/recommended"],
"extends": ["standard", "plugin:n/recommended", "plugin:@typescript-eslint/stylistic"],
"rules": {
"curly": ["error", "all"],
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
Expand All @@ -13,13 +13,16 @@
"no-process-exit": "off",
"n/shebang": "off",
"no-empty-function": "error",
"no-shadow": "warn"
"no-shadow": "warn",
"promise/param-names": "off"
},
"env": {
"commonjs": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 2020
}
"ecmaVersion": 2020,
"sourceType": "module"
},
"ignorePatterns": ["dist/", "*.d.ts"]
}
35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
branches:
- 'master'
- 'beta'

permissions:
contents: write
issues: write # Allow creating issues if needed
packages: write # If you are publishing packages
actions: read

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release@24
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules/
local_tests/
test/config/TestConfig.js
dist/

.npm
.eslintcache
Expand All @@ -13,3 +14,5 @@ yarn-error.log*

.nyc_output
test/coverage/

dist
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ addons:
language: node_js

node_js:
- 16
- 18
- 20
- 22

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.22
- export PATH="$HOME/.yarn/bin:$PATH"

git:
depth: false
Expand Down
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
# [7.0.0-beta.1](https://github.com/TechTeamer/mq/compare/6.4.0-beta.4...7.0.0-beta.1) (2024-06-07)


### Build System

* **deps:** bump minimum node to v20 ([1585212](https://github.com/TechTeamer/mq/commit/1585212b77805852f3d3e5381f3098d766e023cb))


### BREAKING CHANGES

* **deps:** drop support for node <20.8.1

# [6.4.0-beta.4](https://github.com/TechTeamer/mq/compare/6.4.0-beta.3...6.4.0-beta.4) (2024-06-07)


### Bug Fixes

* remove commitlint upgrade semantic release ([#63](https://github.com/TechTeamer/mq/issues/63)) ([4fbd888](https://github.com/TechTeamer/mq/commit/4fbd8888d50e5d3dc3bee8012411cd87760abf70))

# [6.4.0-beta.3](https://github.com/TechTeamer/mq/compare/6.4.0-beta.2...6.4.0-beta.3) (2024-06-05)


### Features

* module migration to beta FKITDEV-3756 ([#61](https://github.com/TechTeamer/mq/issues/61)) ([885cea8](https://github.com/TechTeamer/mq/commit/885cea857b26b71504a3ff17d9fa91cff1409745))

# [6.4.0-beta.2](https://github.com/TechTeamer/mq/compare/6.4.0-beta.1...6.4.0-beta.2) (2024-05-28)


### Bug Fixes

* set changelog path ([486dd3c](https://github.com/TechTeamer/mq/commit/486dd3c643e37a65cdfeb897b9c9473af0334697))

6.3.2
- fix the reconnecting
- updated dependencies
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ A RabbitMQ wrapper for node
yarn add @techteamer/mq
```

## Build

```
yarn run build
```

## Tests

To run tests you need to rename `test/config/TestConfig.js.config` to `TestConfig.js` and provide valid configurations.
Expand All @@ -22,3 +28,9 @@ Then run:
```
yarn test
```

## Publish

**Before publish always run the build process!** This will create the `dist` folder, which will be needed in the published package.


11 changes: 11 additions & 0 deletions fixup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cat >dist/cjs/package.json <<!EOF
{
"type": "commonjs"
}
!EOF

cat >dist/mjs/package.json <<!EOF
{
"type": "module"
}
!EOF
62 changes: 32 additions & 30 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
const QueueClient = require('./src/QueueClient')
const QueueConfig = require('./src/QueueConfig')
const QueueConnection = require('./src/QueueConnection')
const ConnectionPool = require('./src/ConnectionPool')
const QueueMessage = require('./src/QueueMessage')
const ProtoQueueMessage = require('./src/ProtoQueueMessage')
const QueueServer = require('./src/QueueServer')
const QueueManager = require('./src/QueueManager')
const RPCClient = require('./src/RPCClient')
const RPCError = require('./src/RPCError')
const RPCServer = require('./src/RPCServer')
const Publisher = require('./src/Publisher')
const Subscriber = require('./src/Subscriber')
const GatheringClient = require('./src/GatheringClient')
const GatheringServer = require('./src/GatheringServer')
import QueueClient from './src/QueueClient.js'
import QueueConfig from './src/QueueConfig.js'
import QueueConnection from './src/QueueConnection.js'
import ConnectionPool from './src/ConnectionPool.js'
import QueueMessage from './src/QueueMessage.js'
import ProtoQueueMessage from './src/ProtoQueueMessage.js'
import QueueServer from './src/QueueServer.js'
import QueueManager from './src/QueueManager.js'
import RPCClient from './src/RPCClient.js'
import RPCError from './src/RPCError.js'
import RPCServer from './src/RPCServer.js'
import Publisher from './src/Publisher.js'
import Subscriber from './src/Subscriber.js'
import GatheringClient from './src/GatheringClient.js'
import GatheringServer from './src/GatheringServer.js'

module.exports.QueueClient = QueueClient
module.exports.QueueConfig = QueueConfig
module.exports.QueueConnection = QueueConnection
module.exports.ConnectionPool = ConnectionPool
module.exports.QueueMessage = QueueMessage
module.exports.ProtoQueueMessage = ProtoQueueMessage
module.exports.QueueServer = QueueServer
module.exports.QueueManager = QueueManager
module.exports.RPCClient = RPCClient
module.exports.RPCError = RPCError
module.exports.RPCServer = RPCServer
module.exports.Publisher = Publisher
module.exports.Subscriber = Subscriber
module.exports.GatheringClient = GatheringClient
module.exports.GatheringServer = GatheringServer
export {
QueueClient,
QueueConfig,
QueueConnection,
ConnectionPool,
QueueMessage,
ProtoQueueMessage,
QueueServer,
QueueManager,
RPCClient,
RPCError,
RPCServer,
Publisher,
Subscriber,
GatheringClient,
GatheringServer
}
41 changes: 32 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"name": "@techteamer/mq",
"version": "6.3.2",
"version": "7.0.0-beta.1",
"description": "A RabbitMQ wrapper for node",
"main": "index.js",
"main": "dist/cjs/index.js",
"module": "dist/mjs/index.js",
"exports": {
".": {
"import": "./dist/mjs/index.js",
"require": "./dist/cjs/index.js"
}
},
"author": "TechTeamer",
"contributors": [
"Gábor Tóth <gabor@techteamer.com>",
Expand All @@ -14,32 +21,48 @@
"url": "https://github.com/TechTeamer/mq"
},
"engines": {
"node": ">=16"
"node": ">=20.8.1"
},
"scripts": {
"build": "rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && ./fixup.sh",
"lint": "eslint .",
"unit": "mocha --exit",
"test": "eslint . && nyc mocha --temp-directory=./test/coverage/ --exit && nyc report --reporter=text-lcov --report-dir=./test/coverage/ --reporter=lcovonly | coveralls"
"unit": "vitest run",
"test": "eslint . && c8 --temp-directory=./test/coverage/tmp vitest run && c8 report --reporter=text-lcov --report-dir=./test/coverage/ --reporter=lcovonly | coveralls"
},
"type": "module",
"dependencies": {
"@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/github": "^10.0.3",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^14.0.0",
"amqplib": "^0.10.3",
"uuid": "^9.0.0"
},
"devDependencies": {
"chai": "^4.3.7",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"c8": "^9.1.0",
"coveralls": "^3.1.1",
"eslint": "^8.38.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-standard": "^5.0.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"protobufjs": "^7.2.3",
"seed-random": "^2.2.0"
"seed-random": "^2.2.0",
"semantic-release": "^24.0.0",
"typescript": "^5.4.5",
"typescript-eslint": "^7.8.0",
"vitest": "^1.6.0"
},
"peerDependencies": {
"protobufjs": "^7.2.3"
},
"publishConfig": {
"access": "public"
},
"resolutions": {
"wrap-ansi": "^7.0.0"
}
}
27 changes: 27 additions & 0 deletions release.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @type {import('semantic-release').GlobalConfig}
*/
export default {
branches: ['master', { name: 'beta', prerelease: true }],
// eslint-disable-next-line no-template-curly-in-string
tagFormat: '${version}',
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogFile: 'CHANGELOG.md'
}
],
'@semantic-release/npm',
[
'@semantic-release/github',
{
assets: ['dist/**']
}
],
'@semantic-release/git'
],
preset: 'angular'
}
6 changes: 3 additions & 3 deletions src/ConnectionPool.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const QueueManager = require('./QueueManager')
const QueueConfig = require('./QueueConfig')
import QueueManager from './QueueManager.js'
import QueueConfig from './QueueConfig.js'

/**
* @class ConnectionPool
Expand Down Expand Up @@ -117,4 +117,4 @@ class ConnectionPool {
}
}

module.exports = ConnectionPool
export default ConnectionPool
6 changes: 3 additions & 3 deletions src/GatheringClient.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { v4: uuid } = require('uuid')
const QueueMessage = require('./QueueMessage')
import { v4 as uuid } from 'uuid'
import QueueMessage from './QueueMessage.js'

class GatheringClient {
/**
Expand Down Expand Up @@ -271,4 +271,4 @@ class GatheringClient {
}
}

module.exports = GatheringClient
export default GatheringClient
6 changes: 3 additions & 3 deletions src/GatheringServer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const QueueMessage = require('./QueueMessage')
const QueueResponse = require('./QueueResponse')
import QueueMessage from './QueueMessage.js'
import QueueResponse from './QueueResponse.js'

class GatheringServer {
/**
Expand Down Expand Up @@ -287,4 +287,4 @@ class GatheringServer {
}
}

module.exports = GatheringServer
export default GatheringServer
4 changes: 2 additions & 2 deletions src/ProtoQueueMessage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const QueueMessage = require('./QueueMessage')
import QueueMessage from './QueueMessage.js'

class ProtoQueueMessage extends QueueMessage {
serialize () {
Expand Down Expand Up @@ -37,4 +37,4 @@ class ProtoQueueMessage extends QueueMessage {
}
}

module.exports = ProtoQueueMessage
export default ProtoQueueMessage
4 changes: 2 additions & 2 deletions src/Publisher.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const QueueMessage = require('./QueueMessage')
import QueueMessage from './QueueMessage.js'

class Publisher {
/**
Expand Down Expand Up @@ -109,4 +109,4 @@ class Publisher {
}
}

module.exports = Publisher
export default Publisher
Loading

0 comments on commit 44586bd

Please sign in to comment.