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

Allow running Node with env vars #52

Open
vjpr opened this issue Apr 11, 2022 · 0 comments
Open

Allow running Node with env vars #52

vjpr opened this issue Apr 11, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@vjpr
Copy link

vjpr commented Apr 11, 2022

I find I have to pass a lot of flags via NODE_OPTIONS to get ESM and other experimental features to work.

This Node package allows you to pass env vars to Node: https://github.com/toddbluhm/env-cmd

But it adds 300ms to startup time - toddbluhm/env-cmd#349

I would love to use dum instead.

a. Support running a cross-platform script (.sh / .ps1 / .bat)

Essentially just doing the following (maybe reading location of script files from package.json or another env var):

I would be sharing script files from <package>/node_modules/my-scripts/scripts/(run-win.ps1|run-nix.sh).

https://stackoverflow.com/a/68934424/130910

{
    "scripts": {
        "build": "( Write-Output 'Powershell' && ./tools/build-ps.ps1 ) || 
                  ( CALL ./tools/build-cmd.bat ) || 
                  ( bash -c 'uname -a | grep -q -i Linux' && bash -c ./tools/build-linux.sh ) ||
                  ( bash -c 'uname -a | grep -q -i Darwin' && bash -c ./tools/build-mac.sh )"
        }
}

b. Support .env, etc.

This is lower priority for me. Replicates the functionality of https://www.npmjs.com/package/env-cmd

@egoist egoist added the enhancement New feature or request label Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants