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

Enable TypeScript #8074

Merged
merged 10 commits into from
Jul 21, 2021
Merged

Enable TypeScript #8074

merged 10 commits into from
Jul 21, 2021

Conversation

Koenkk
Copy link
Owner

@Koenkk Koenkk commented Jul 19, 2021

This PR enables TypeScript support for the Zigbee2MQTT code base.

Related:

@Koenkk Koenkk requested a review from nurikk July 19, 2021 14:52
@Koenkk Koenkk changed the base branch from master to dev July 19, 2021 14:52
@nurikk
Copy link
Collaborator

nurikk commented Jul 20, 2021

Looks got to me. But I have few concerns

  1. For the folks who're using z2m from bare git repo (git clone, npm ci, npm run start) how this flow will work?
  2. For the folks who're using npm install --force --production -g Koenkk/zigbee2mqtt#dev how this flow will work?

minor: we can truely say that ts is implemented after we convert at least one js file to ts (since it will require a whole bunch of deps like @types/node)

@Koenkk
Copy link
Owner Author

Koenkk commented Jul 20, 2021

For the folks who're using z2m from bare git repo (git clone, npm ci, npm run start) how this flow will work?

They need to run npm run build now between npm ci and npm start. Check is done here: https://github.com/Koenkk/zigbee2mqtt/pull/8074/files#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R40 . Docs are also updated with this https://github.com/Koenkk/zigbee2mqtt.io/pull/831/files

For the folks who're using npm install --force --production -g Koenkk/zigbee2mqtt#dev how this flow will work?

I'm not aware of this installation option and this is also not officially supported. Those should install the npm package instead.

e can truely say that ts is implemented after we convert at least one js file to ts (since it will require a whole bunch of deps like @types/node)

This is already done here: https://github.com/Koenkk/zigbee2mqtt/pull/8074/files#diff-38317fef586533d730d87de8397da2c496a456ac6efa6e33ba846bd8755a0b4a

@Koenkk
Copy link
Owner Author

Koenkk commented Jul 20, 2021

Just updated index.js to automatically build on start when needed so Koenkk/zigbee2mqtt.io#831 is not needed anymore.

  • dist folder contains a file dist/.hash
  • when this .hash file does not exists index.js will automatically build z2m on npm start
  • when you do a git pull the hash changes, if the current hash mismatches with the one in .hash a rebuild is done
  • on environments were z2m is not in a git repo (e.g. docker) a rebuild is never done

@Koenkk Koenkk requested a review from nurikk July 20, 2021 18:03
@Koenkk Koenkk merged commit 7b65dc6 into dev Jul 21, 2021
@Koenkk Koenkk deleted the feature/typescript branch July 21, 2021 17:35
@ghost ghost mentioned this pull request Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants