caprover-cli icon indicating copy to clipboard operation
caprover-cli copied to clipboard

Title: Issue with Constant.ts file not reflecting environment variable override in built Constants.js

Open kmikodev opened this issue 1 year ago • 1 comments

I've encountered an inconsistency when using the latest version of the CapRover library. Upon installation, the Constant.ts file within the utils directory contains the following line:

const ADMIN_DOMAIN = process.env.CAPROVER_ADMIN_DOMAIN_OVERRIDE || 'captain';

However, after installation, when inspecting the Constants.js file in the built/utils directory, the line appears as:

const ADMIN_DOMAIN = 'captain';

I've cloned the master branch and executed the compilation command, which seems to produce the correct output. Additionally, I've published a new version (caprover-fix) on npm for further testing.

This inconsistency appears to result in the environment variable override not being reflected in the built Constants.js file. Could you please investigate this issue? Let me know if you need any further information or assistance in resolving this matter. Thank you!

kmikodev avatar Mar 12 '24 22:03 kmikodev

Feel free to open the pull request to fix if you have the fix for this.

githubsaturn avatar Mar 14 '24 04:03 githubsaturn

@githubsaturn FYI there doesn't seem to be a PR-able "fix" for this. It looks more like an issue with your GitHub Action workflows or something. The built files don't match the source files in 2.3.0.

wildyaboku avatar Jul 03 '24 00:07 wildyaboku

there doesn't seem to be a PR-able "fix" for this

I'm not sure what this means. If it's not PR-able fix, then what fix should be implemented. Even Github Action workflows are part of the source code here: https://github.com/caprover/caprover-cli/blob/master/.github/workflows/build_push_docker_release.yml

So anything should be possible.

githubsaturn avatar Jul 03 '24 01:07 githubsaturn

Hi @githubsaturn, I looked more into the workflows. I don't see where the npm publish command is in this repo.

In short:

  • The dockerfile in the repository builds the code correctly
  • The build script in the package.json builds the code correctly

And yet, the source code published to NPM does not match what is built in either case.

Did you run npm publish manually on your end? Are you certain that it was using freshly built files? Because it really doesn't look that way.

Apologies for my former brevity.

wildyaboku avatar Jul 03 '24 01:07 wildyaboku

Ah that makes sense!

githubsaturn avatar Jul 03 '24 01:07 githubsaturn

I completely missed that the actions on github are for the Docker images. https://hub.docker.com/r/caprover/cli-caprover

githubsaturn avatar Jul 03 '24 01:07 githubsaturn

Just published 2.3.1 - can you please confirm if it's fixed?

githubsaturn avatar Jul 03 '24 01:07 githubsaturn

Yes, I can confirm it is working now, and the source code of the built file matches what is expected.

Thank you @githubsaturn!

wildyaboku avatar Jul 03 '24 01:07 wildyaboku

Thanks! I should definitely add npm publish to GitHub action!

githubsaturn avatar Jul 03 '24 01:07 githubsaturn