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

chore!: convert project to typescript #1641

Merged
merged 33 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1f99e49
chore!: convert project to typescript
robertsLando Jul 19, 2023
12d39a7
fix: add some types
robertsLando Jul 19, 2023
33451be
fix: other thypes
robertsLando Jul 19, 2023
05753e0
fix: end up lib refactor
robertsLando Jul 20, 2023
d851565
fix: build errors
robertsLando Jul 20, 2023
3961cdf
fix: add client events typed
robertsLando Jul 20, 2023
7b25f64
fix: abstract tests
robertsLando Jul 20, 2023
efa1587
fix: convert tests
robertsLando Jul 20, 2023
85faf2c
fix: some types
robertsLando Jul 20, 2023
7ce4259
fix: build
robertsLando Jul 20, 2023
2d1a028
fix: lint extensions
robertsLando Jul 20, 2023
5bc8309
fix: subscribe
robertsLando Jul 20, 2023
1b2fefb
fix: subscribe
robertsLando Jul 20, 2023
e7cd5ac
fix: unsubscribe
robertsLando Jul 20, 2023
35d94ef
fix: debug
robertsLando Jul 20, 2023
4efe6f5
fix: publish errors
robertsLando Jul 20, 2023
9ed7a5c
fix: reconnect
robertsLando Jul 20, 2023
0e29d75
fix: store tests
robertsLando Jul 20, 2023
dd94a7a
fix: secure client
robertsLando Jul 20, 2023
3fae70e
fix: add missing secure options
robertsLando Jul 20, 2023
94a00f2
fix: remove typescript tests from gh
robertsLando Jul 20, 2023
8422efa
chore: fix .mocharc
robertsLando Jul 20, 2023
9f0569c
fix: package.json exports
robertsLando Jul 20, 2023
960caab
fix: types versions
robertsLando Jul 20, 2023
1c56921
fix: write methods overload
robertsLando Jul 21, 2023
143de76
fix: camel case
robertsLando Jul 21, 2023
69e8556
fix: remove some useless tsconfig options
robertsLando Jul 21, 2023
7beb49a
fix: add `src` dir to npm to make abstract test accessible
robertsLando Jul 21, 2023
7b68504
refactor: remove unused imports
robertsLando Jul 21, 2023
40ee0bf
fix: add IStore interface
robertsLando Jul 21, 2023
5cf9232
docs: fix readme changelog
robertsLando Jul 21, 2023
2f8888e
refactor: add comments and reorder methods
robertsLando Jul 21, 2023
0f55a3b
fix: use `mqtt.js` as entrypoint also for browser
robertsLando Jul 21, 2023
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
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/examples/
/doc/
/dist/
/test/typescript/
/build/

*.js
24 changes: 21 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint/eslint-plugin'],
env: {
browser: true,
commonjs: true,
es2021: true,
node: true,
mocha: true,
},
extends: ['airbnb-base', 'plugin:prettier/recommended'],
extends: [
'airbnb-base',
'airbnb-typescript/base',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended'
],
parserOptions: {
ecmaVersion: 'latest',
project: 'tsconfig.json',
sourceType: 'module',
tsconfigRootDir: __dirname
},
rules: {
'global-require': 'off',
Expand All @@ -29,5 +38,14 @@ module.exports = {
'no-continue': 'off',
'prefer-destructuring': 'off',
'no-use-before-define': 'off',
},
// Typescript rules
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/no-use-before-define': 'off',
}
}
8 changes: 1 addition & 7 deletions .github/workflows/mqttjs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,12 @@ jobs:
CI: true
DEBUG: "${{ runner.debug == '1' && 'mqttjs:*' || '' }}"

- name: Test Typescript
run: npm run test:typescript
env:
CI: true
DEBUG: "${{ runner.debug == '1' && 'mqttjs:*' || '' }}"

- name: Test Browser
if: matrix.node-version == '20.x'
# only run on latest node version, no reason to run on all
timeout-minutes: 2
run: |
npm run browser-build
npm run build:browser
npm run unit-test:browser


Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ test/typescript/*.map
.vscode/
.npmrc

/build/

10 changes: 10 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// --check-leaks
// --timeout 10000
// --exit

module.exports = {
checkLeaks: true,
exit: true,
timeout: 10000,
};

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ There is work being done on the next generation of MQTT.js (vNext). We invite th

## Important notes for existing users

**v5.0.0** (**BETA** 06/2023) removes support for all end of life node versions (v12 and v14), and now supports node v18 and v20.
**v5.0.0** (**BETA** 06/2023)

- Removes support for all end of life node versions (v12 and v14), and now supports node v18 and v20.
- Completely rewritten in Typescript 🚀.
- When creating `MqttClient` instance `new` is now required

**v4.0.0** (Released 04/2020) removes support for all end of life node versions, and now supports node v12 and v14. It also adds improvements to
debug logging, along with some feature additions.
Expand Down Expand Up @@ -389,7 +393,7 @@ The arguments are:
- `customHandleAcks`: MQTT 5 feature of custom handling puback and pubrec packets. Its callback:

```js
customHandleAcks: function(topic, message, packet, done) {/*some logic wit colling done(error, reasonCode)*/}
customHandleAcks: function(topic, message, packet, done) {/*some logic with calling done(error, reasonCode)*/}
```

- `autoUseTopicAlias`: enabling automatic Topic Alias using functionality
Expand Down
159 changes: 0 additions & 159 deletions bin/pub.js

This file was deleted.

Loading
Loading