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

Add typescript to dependencies and change npx tsc to tsc #466

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

philipostli
Copy link

@philipostli philipostli commented Oct 14, 2024

Problem occurs using homey-cli in github actions or other environments without typescript installed.
The cli runs the deprecated tsc package instead of the bundled version in typescript.
See issue in athombv/github-action-homey-app-validate

I think this raises the required node version from 16 to 18 ?
Not sure how to test my proposal.

Edit:
Easy test with homey app validate without any local node modules installed and no Typesript globally. (Only homey cli globally)

@philipostli
Copy link
Author

Managed to recreate the error, whilst installing dependencies fixes the error. I think the proposal shall work.

Test without dependencies: https://github.com/philipostli/com.uyunilighting/actions/runs/11330747376
Added dependencies before validating: https://github.com/philipostli/com.uyunilighting/actions/runs/11329382164

@OlivierZal
Copy link
Contributor

OlivierZal commented Nov 2, 2024

@philipostli, I'm not sure it's a good practice since you override the typescript version the developer is using.

There's no notion of deprecated tsc / typescript, just the version the developer wants to work with.

Then the typescript version needs to be taken from the developer app's package.json.

@philipostli
Copy link
Author

Thank you. That is a good point. I thought running tsc in the latest typescript would take into account the version in the package/folder it is ran in. But since it is not installed, it will use the version in the cli-package, which is not smart I agree. However, since npm ci was removed from the validation package, and we should not depend on having to install dependencies to run the validation tool. I think we should do something about the command anyway.

The npx tsc expect typescript to be installed either in the cli tool or the folder we run the tool in, or it will download the latest version from node package registry. The tsc script online is not working anymore.. It is failing in all of my typescript projects on Github actions, where it is supposed to run. I think also the cli-tool should be able to run even though the package is not installed. And if typescript is installed globally and the package is not installed, then the command will potentially run with the wrong typescript version. This is another concern. Perhaps we should check that the package is installed before running homey app validate? One can do npm list --depth=0 first. If it throws error then a package is missing. But it does not solve the validation tool problem.

So you think we should change homey cli or the github validate-action, or both?

@OlivierZal
Copy link
Contributor

Maybe a question for @WeeJeWel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants