DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

Anyone else NEVER create a Node.js project at Git root?

Usually, my Git structure is like

_data/
_media/
.git/
packages/
.gitignore
Enter fullscreen mode Exit fullscreen mode

Then,

cd packages
yarn create nuxt-app nuxt
cd nuxt && rm -rf .git
Enter fullscreen mode Exit fullscreen mode

This usually cause problems with VSCode and Vetur (Vue language server for VSCode), and sometimes also ESLint / Prettier language server, unless I

code packages/nuxt
Enter fullscreen mode Exit fullscreen mode

Also, Node.js isn't necessarily the only kind of project I have.

My approach makes it easily to migrate project scaffolding, I think, like deleting and creating a new one. Usually you cannot do this with project scaffolder.

git checkout new-branch
git rm -rf -e .env **/*
yarn create nuxt-app .  # Do not create a new folder
Enter fullscreen mode Exit fullscreen mode

This also causes problems with hosting services that have or rely on Git integration.

  • Netlify and Vercel prefers Git integration; not locally built then upload.
  • Heroku relies on either Git integration or Docker.

Now, where do I put netlify.toml?

# Choice 1
netlify.toml
# Choice 2
packages/nuxt/netlify.toml
# Choice 3 - Both
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
mzaini30 profile image
Zen

I set my Node JS package.json as root project

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

"Think different" - Steve Jobs