herbsjs / herbs-cli

Herbs CLI
https://herbsjs.org/
MIT License
29 stars 30 forks source link

Herbs generated project must born with gitignore file event not initializing a new git repository #186

Closed gustavobigardi closed 1 year ago

gustavobigardi commented 1 year ago

I was thinking the herbs-cli could create a gitignore file inside the root folder of the project, excluding the usual node files like node_modules to be commited.

UPDATE: There is already a generator for the gitignore file, but it only creates the file if a new git repository is initialized. I believe that the file should be created even if a new git repo is not initialized.

herbs new ...

A .gitignore file will exist in the root folder of the project.

The initial content of the file could be (just a suggestion):

### Node ###
# Logs
logs
*.log

# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
dalssoft commented 1 year ago

sounds great. can we use the a standard .gitignore like https://github.com/github/gitignore/blob/main/Node.gitignore ?

gustavobigardi commented 1 year ago

sounds great. can we use the a standard .gitignore like https://github.com/github/gitignore/blob/main/Node.gitignore ?

Sure! The CLI could download it, in order to keep the project generation using always the up to date file provided by Github.

dalssoft commented 1 year ago

Sure! The CLI could download it, in order to keep the project generation using always the up to date file provided by Github.

Or just copy/paste it. I'm fine with it.

gustavobigardi commented 1 year ago

I was checking the git generator, the gitignore file is already in the templates, but is only created if you select yes as the answer to initialize a git repository. If I'm working with a monorepo approach, it will never generate a gitignore file to the project, since I'm not initializing a git repository again.