RocketChat / Rocket.Chat.Apps-cli

The CLI for interacting with Rocket.Chat Apps
MIT License
46 stars 27 forks source link

[NEW] Proxy support #120

Closed mrsimpson closed 2 years ago

mrsimpson commented 2 years ago

What

Fixes #118

How it's done

node-fetch which is used for interacting with rocket.chat from the CLI does not natively support proxies. This PR adds a library which parses common env variables and - based on them - configures an agent which is injected to fetch.

I added the library and typings.

Edit: While the automated tests failed for some reason I could not trace, the manual testing of the tool including deployment via a proxy worked out fine.

Remark: While tsc could compile the apps-cli without any issues, oclif-dev which is triggered in prepack ~does not seem to consider the tsconfig.~ uses the rocket.Chat Apps compiler. This tool is not node@8 compatible. I selected version 8 as it's stated in the package.json. It may be a good idea to bump this to 14.

mrsimpson commented 2 years ago

Thanks, I was looking for this, I had it failing at types/module_name earlier 🙈 But that a . made the trick... Why was tsc executed separately successful, but not the apps-compiler?

d-gubert commented 2 years ago

Why was tsc executed separately successful, but not the apps-compiler?

@mrsimpson that's because the tests with mocha run with ts-node instead of simply compiling with tsc, and the ts-node package does not use the files, include or exclude properties from tsconfig.json, by default - instead, it starts with the script file and resolves dependencies based on imports and references. Then, if it needs to follow custom type declaration files, they need to be in the same format they would be in node_modules since the source code will hardly ever have direct references to the .d.ts file.

Kinda confusing if you ask me, but it makes sense if you think about the performance side of things I guess 🤷