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

Not working with .env files #41

Open
devWaleed opened this issue Sep 5, 2022 · 3 comments
Open

Not working with .env files #41

devWaleed opened this issue Sep 5, 2022 · 3 comments

Comments

@devWaleed
Copy link

devWaleed commented Sep 5, 2022

I am using version "cpy-cli": "^4.2.0",

I am trying to copy ".env.qa" contents to ".env" file in the same directory structure but its not working as intended. Instead of writing the contents, it creates a "/.env/.env.qa" directory & file.

I have tried the --dot and --flat flags but that doesn't solve the problem.

cpy .env.qa .env --dot --flat

I wanted to copy my environment variables from .env.qa or .env.production to .env file so it can be used with .dotenv package.

@sindresorhus
Copy link
Owner

Duplicate of #29

@sindresorhus sindresorhus marked this as a duplicate of #29 Sep 5, 2022
@joeBidenBalls
Copy link

joeBidenBalls commented Nov 10, 2022

This is weird. It works without even using the --dot option if I type it directly in console: cpy '.env' build

But in the package.json scripts it will never work no matter where I put the --dot option.

"scripts": {
    "build": "cpy --dot '.env' build"
  },

Sadly because of this the package becomes useless to me

@joeBidenBalls
Copy link

joeBidenBalls commented Nov 18, 2022

Doesn't work at all in package.json. am I doing something wrong? Works on cli normally and with NPX:

Running at the root of the project. Works:

cpy 'build/data/clientes.json' 'build/data/transmissao.json' 'data' --flat 
npx cpy 'build/data/clientes.json' 'build/data/transmissao.json' 'data' --flat

does not work:

"scripts": {
    "sync": "cpy 'build/data/clientes.json' 'build/data/transmissao.json' 'data' --flat"
  },

I'm not even using 'build/data/*.json' as a possible solution to this, but still won't work.

> npm run sync                                                                  

> npx cpy 'build/data/clientes.json' 'build/data/transmissao.json' 'data' --flat
> cpy 'build/data/clientes.json' 'build/data/transmissao.json' 'data' --flat

Cannot copy `'build/data/clientes.json'`: the file doesn't exist

The files exist in the specified structure, I'm not sure what is wrong with package.json scripts?

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

No branches or pull requests

3 participants