Skip to content

Commit 117dd5e

Browse files
Coroliov Olegruscon
Coroliov Oleg
authored andcommittedJan 4, 2022
feat: upgrade deps
- support nodejs@>=14 (drop support v12) - support nestjs@>=7
1 parent 1692098 commit 117dd5e

14 files changed

+182
-101
lines changed
 

‎.github/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* @goparrot/core-team
2+
.github/workflows @goparrot/github-workflow-experts

‎.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Thanks for creating a Pull Request! Before you submit, please make sure
33
you've done the following:
44
5-
- I read the contributing document at https://github.com/goparrot/geocoder/blob/master/CONTRIBUTING.md#contributing
5+
- I read the contributing document at https://github.com/goparrot/nestjs-pubsub-event-bus/blob/master/CONTRIBUTING.md#contributing
66
-->
77

88
<!--

‎.github/workflows/ci.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: ci
22

33
on:
44
push:
@@ -28,7 +28,7 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
node-version: [12, 14, 16]
31+
node-version: [14, 16]
3232

3333
env:
3434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -51,6 +51,9 @@ jobs:
5151
- name: Type check
5252
run: npm run typecheck
5353

54+
- name: Dry run of publishing
55+
run: npm run publish:dev:dry
56+
5457
- name: Lint code
5558
run: npm run lint
5659

@@ -59,6 +62,6 @@ jobs:
5962

6063
- name: Run Coveralls
6164
uses: coverallsapp/github-action@master
62-
if: startsWith(matrix.node-version, '14.')
65+
if: startsWith(matrix.node-version, '16.')
6366
with:
6467
github-token: ${{ secrets.GITHUB_TOKEN }}

‎.npmrc

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
save-exact=true
1+
save-exact=false
22
scripts-prepend-node-path=true
33
package-lock=false
4+
optional=false
5+
audit=false
6+
fund=false
7+
update-notifier=false
8+
strict-peer-deps=true
9+
legacy-peer-deps=false

‎.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v14
1+
v16

‎bin/npm-dev-version.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ void (async (): Promise<void> => {
1717
const packageJsonPath = `${packageJsonDir}/package.json`;
1818
const packageJson = JSON.parse(readFileSync(packageJsonPath).toString());
1919
const { version } = packageJson;
20-
const branchName: string = getCurrentGitBranch();
2120

22-
const ticketNumber: string | undefined = /^(feature|feat|hotfix|fix)\/(\d+)/gim.exec(branchName)?.[0]?.split('/').pop();
23-
const semVer: SemVer = new SemVer(version);
21+
if (!version) {
22+
throw new Error(`Can't find package.json version`);
23+
}
24+
25+
const branchName = getCurrentGitBranch();
26+
const ticketNumber = /^(feature|feat|hotfix|fix)\/(\d+)/gim.exec(branchName)?.[0]?.split('/').pop();
27+
const semVer = new SemVer(version);
2428

2529
console.log('Input data', { packageJsonPath, branchName, ticketNumber, version: semVer.format() });
2630

@@ -38,4 +42,6 @@ void (async (): Promise<void> => {
3842

3943
packageJson.version = semVer.format();
4044
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 4) + EOL);
41-
})();
45+
})().catch(() => {
46+
process.exit(1);
47+
});

‎bin/prepublish.js

-13
This file was deleted.

‎bin/prepublish.ts

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import fs from 'fs';
2+
import { EOL } from 'os';
3+
import path from 'path';
4+
import parseArgs from 'minimist';
5+
6+
function run(): void {
7+
const {
8+
from = '.',
9+
to = './dist',
10+
main = './cjs/index.js',
11+
module = './esm/index.js',
12+
typings = './types/index.d.ts',
13+
} = parseArgs<{ from: string; to: string; main: string; module: string; typings: string }>(process.argv.slice(2));
14+
console.log({ from, to, main, module, typings });
15+
16+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
17+
const {
18+
scripts,
19+
devDependencies,
20+
husky,
21+
files,
22+
'lint-staged': lintStaged,
23+
directories,
24+
config,
25+
...packageJson
26+
} = JSON.parse(fs.readFileSync(path.join(process.cwd(), `./${from}/package.json`)).toString());
27+
delete packageJson.engines.npm;
28+
29+
packageJson.main = main;
30+
packageJson.module = module;
31+
packageJson.typings = typings;
32+
packageJson.sideEffects = false;
33+
34+
fs.writeFileSync(`${to}/package.json`, JSON.stringify(packageJson, null, 4) + EOL);
35+
36+
const copyFiles = ['README.md'];
37+
for (const file of copyFiles) {
38+
const fromPath = `${from}/${file}`;
39+
if (!fs.existsSync(fromPath)) {
40+
console.warn(`WARN: File "${fromPath}" doesn't exist`);
41+
continue;
42+
}
43+
44+
fs.copyFileSync(fromPath, `${to}/${file}`);
45+
}
46+
}
47+
48+
run();

‎package.json

+70-68
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,48 @@
22
"name": "@goparrot/pubsub-event-bus",
33
"description": "NestJS EventBus extension for RabbitMQ PubSub",
44
"version": "2.0.2",
5-
"main": "src/index.js",
5+
"author": "GoParrot",
6+
"keywords": [
7+
"NestJS",
8+
"PubSub",
9+
"EventBus",
10+
"CqrsModule"
11+
],
12+
"license": "MIT",
13+
"homepage": "https://github.com/goparrot/nestjs-pubsub-event-bus#readme",
14+
"bugs": {
15+
"url": "https://github.com/goparrot/nestjs-pubsub-event-bus/issues"
16+
},
17+
"repository": {
18+
"type": "git",
19+
"url": "git+ssh://git@github.com/goparrot/nestjs-pubsub-event-bus.git"
20+
},
21+
"engines": {
22+
"node": ">=14",
23+
"npm": "^8"
24+
},
25+
"directories": {
26+
"bin": "./bin",
27+
"lib": "./src",
28+
"test": "./test"
29+
},
30+
"lint-staged": {
31+
"*.{ts,tsx,js,json}": [
32+
"npm run format:base"
33+
],
34+
"*.md": [
35+
"npm run prettier:base"
36+
]
37+
},
38+
"config": {
39+
"commitizen": {
40+
"path": "cz-conventional-changelog"
41+
}
42+
},
643
"scripts": {
744
"commit": "git-cz",
845
"prepare": "husky install",
9-
"pre-commit": "npm run format:staged && tsc --project tsconfig.json && npm run build:dist && npm run lint",
46+
"pre-commit": "git add . && run-p format:staged typecheck && run-p publish:dev:dry lint coverage",
1047
"prettier": "npm run prettier:base -- '**/**.+(md)'",
1148
"prettier:base": "prettier --ignore-path .eslintignore --write",
1249
"format": "npm run prettier && npm run lint -- --fix",
@@ -18,11 +55,13 @@
1855
"typecheck": "tsc -p tsconfig.json --noEmit",
1956
"test": "jest",
2057
"coverage": "jest --collect-coverage",
21-
"build:dist": "rimraf dist && tsc --project tsconfig.compile.json && node bin/prepublish.js",
22-
"check:tsc": "rimraf dist/* && tsc --project tsconfig.json && rimraf dist",
58+
"build:dist": "rimraf dist/* && run-p build:dist:cjs build:dist:esm build:dist:types",
59+
"build:dist:cjs": "tsc --project tsconfig.build-cjs.json",
60+
"build:dist:esm": "tsc --project tsconfig.build-esm.json",
61+
"build:dist:types": "tsc -b tsconfig.build-types.json",
2362
"prepublishOnly": "echo \"use 'npm run publish'\" && exit 1",
2463
"version:prerelease": "ts-node -T bin/npm-dev-version.ts",
25-
"publish": "npm run build:dist && node bin/prepublish.js && npm publish dist",
64+
"publish": "npm run build:dist && ts-node -T bin/prepublish.ts && npm publish ./dist",
2665
"publish:dev": "npm run version:prerelease && npm run publish --tag dev",
2766
"publish:dev:dry": "npm run publish --tag dev --dry-run",
2867
"preversion": "npm run pre-commit",
@@ -32,83 +71,46 @@
3271
"release:dry": "npm run publish:dev:dry && standard-version --dry-run",
3372
"github-release": "conventional-github-releaser -p angular"
3473
},
35-
"author": "",
36-
"license": "MIT",
37-
"repository": {
38-
"type": "git",
39-
"url": "git+ssh://git@github.com/goparrot/nestjs-pubsub-event-bus.git"
40-
},
41-
"keywords": [
42-
"NestJS",
43-
"PubSub",
44-
"EventBus",
45-
"CqrsModule"
46-
],
47-
"directories": {
48-
"bin": "./bin",
49-
"lib": "./src",
50-
"test": "./test"
51-
},
52-
"engines": {
53-
"node": "^12.10 | ^14.10 | ^16.13"
54-
},
55-
"lint-staged": {
56-
"*.{ts,tsx,js,json}": [
57-
"npm run format:base"
58-
],
59-
"*.{md}": [
60-
"npm run prettier:base"
61-
]
62-
},
63-
"config": {
64-
"commitizen": {
65-
"path": "cz-conventional-changelog"
66-
}
74+
"peerDependencies": {
75+
"@nestjs/common": "^7.0.0 || ^8.0.0",
76+
"@nestjs/core": "^7.0.0 || ^8.0.0",
77+
"@nestjs/cqrs": "^7.0.0 || ^8.0.0",
78+
"amqp-connection-manager": "^3.2.0",
79+
"amqplib": ">=0.5",
80+
"reflect-metadata": ">=0.1.13"
6781
},
68-
"bugs": {
69-
"url": "https://github.com/goparrot/nestjs-pubsub-event-bus/issues"
82+
"dependencies": {
83+
"lodash": "^4.17.21",
84+
"tslib": "^2.3.1"
7085
},
71-
"homepage": "https://github.com/goparrot/nestjs-pubsub-event-bus#readme",
7286
"devDependencies": {
73-
"@commitlint/cli": "^13.1.0",
74-
"@commitlint/config-conventional": "^13.1.0",
75-
"@goparrot/eslint-config": "^1.0.1",
76-
"@nestjs/common": "^7.6.18",
77-
"@nestjs/core": "^7.6.18",
78-
"@nestjs/cqrs": "^7.0.1",
87+
"@commitlint/cli": "^16.0.1",
88+
"@commitlint/config-conventional": "^16.0.0",
89+
"@goparrot/eslint-config": "^1.0.3",
90+
"@nestjs/common": "^8.2.4",
91+
"@nestjs/core": "^8.2.4",
92+
"@nestjs/cqrs": "^8.0.1",
7993
"@types/amqplib": "0.8.2",
80-
"@types/jest": "^27.0.1",
81-
"@types/lodash": "^4.14.173",
94+
"@types/jest": "^27.4.0",
95+
"@types/lodash": "^4.14.178",
8296
"@types/minimist": "^1.2.2",
8397
"@types/semver": "^7.3.8",
84-
"amqp-connection-manager": "^3.6.0",
98+
"amqp-connection-manager": "^3.8.1",
8599
"amqplib": "^0.8.0",
86-
"class-transformer": "0.3.1",
87100
"commitizen": "^4.2.4",
88-
"conventional-changelog-cli": "^2.1.1",
101+
"conventional-changelog-cli": "^2.2.2",
89102
"cz-conventional-changelog": "^3.3.0",
90103
"husky": "^7.0.2",
91-
"jest": "^27.2.0",
92-
"lint-staged": "^11.1.2",
93-
"lodash": "^4.17.21",
104+
"jest": "^27.4.5",
105+
"lint-staged": "^12.1.5",
94106
"minimist": "^1.2.5",
107+
"npm-run-all": "^4.1.5",
95108
"reflect-metadata": "^0.1.13",
96109
"rimraf": "^3.0.2",
97-
"rxjs": "^6.6.7",
98110
"semver": "^7.3.5",
99111
"standard-version": "^9.3.1",
100-
"ts-jest": "^27.0.5",
112+
"ts-jest": "^27.1.2",
101113
"ts-node": "^10.2.1",
102-
"typescript": "^4.4.3"
103-
},
104-
"peerDependencies": {
105-
"@nestjs/common": ">=7.*",
106-
"@nestjs/core": ">=7.*",
107-
"@nestjs/cqrs": ">=7.*",
108-
"amqp-connection-manager": ">=3.2",
109-
"amqplib": ">=0.5",
110-
"reflect-metadata": ">=0.1",
111-
"lodash": ">=4.17.21"
112-
},
113-
"dependencies": {}
114+
"typescript": "^4.5.4"
115+
}
114116
}

‎tsconfig.build-cjs.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.build.json",
3+
"compilerOptions": {
4+
"target": "ES2018",
5+
"lib": ["ES2018"],
6+
"module": "commonjs",
7+
"outDir": "dist/cjs"
8+
}
9+
}

‎tsconfig.build-esm.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.build.json",
3+
"compilerOptions": {
4+
"module": "esnext",
5+
"outDir": "dist/esm"
6+
}
7+
}

‎tsconfig.build-types.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.build.json",
3+
"compilerOptions": {
4+
"outDir": "dist/types",
5+
"removeComments": false,
6+
"declaration": true,
7+
"emitDeclarationOnly": true
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"declaration": true,
4+
"outDir": "dist",
55
"incremental": false,
6-
"removeComments": false
6+
"declaration": false
77
},
8-
"include": ["src"]
8+
"include": ["./src/**/*"]
99
}

‎tsconfig.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{
22
"compilerOptions": {
33
"module": "commonjs",
4-
"esModuleInterop": true,
5-
"target": "es2018",
4+
"target": "ES2021",
5+
"lib": ["ES2021"],
6+
"baseUrl": "src",
7+
"outDir": "dist",
68
"strict": true,
9+
"esModuleInterop": true,
710
"strictPropertyInitialization": false,
11+
"useUnknownInCatchVariables": false,
812
"noUnusedLocals": true,
913
"noUnusedParameters": true,
1014
"noFallthroughCasesInSwitch": true,
@@ -20,9 +24,7 @@
2024
"noLib": false,
2125
"allowSyntheticDefaultImports": true,
2226
"strictNullChecks": true,
23-
"outDir": "dist",
24-
"baseUrl": "src",
25-
"lib": ["es2018"]
26-
},
27-
"include": ["src", "test"]
27+
"incremental": true,
28+
"importHelpers": true
29+
}
2830
}

0 commit comments

Comments
 (0)