r/node 1d ago

Newbie asking for help...

So I built my first project with Astro, I run "pnpm install" then run and then build generated the dist folder. I would like to publish this sample static site to netlify via github...I did everything in my local laptop (Fedora 44) how can I push my dist folder to github now? Or should I follow other paths, idk pushing the entire project folder to github and not only the dist folder?. I know netlify support a local folder upload but I would like to understand how to use github in this process and so link netlify to github

thanks

9 Upvotes

12 comments sorted by

5

u/Fine-Comparison-2949 1d ago

What does the netlify build documentation say? What is your projects server framework?

1

u/nickname1917 1d ago

Netlify says to upload a folder or connect a github repo... I would like to follow the second one, but I built the app locally using node / pnpm / astro and I don't know now how to push my project to github (only the dist folder? the entire project folder?)

1

u/lil_lurch 1d ago

You publish the dist, it is only but a build artifact. Keep the source under version control.

3

u/azangru 1d ago

So I built my first project with Astro

Have you read their documentation on deployment?

2

u/UkrMalt 1d ago

Usually push the whole project (package.json, source, and config), not just dist. Let Netlify run the build from GitHub and set the publish directory to dist; keeping dist out of Git makes rebuilds reproducible.

4

u/gangeticmen 1d ago

you don't push dist or build fles to github basically.

in netlify there must be a build command so there do - npm run build

then netlify will built and serve it from dist.

also check if there are build dist something there and add /dist name there.

and if any issue ask chatGPT.

1

u/Single_Advice1111 1d ago

Get started with a .gitignore file for node_modules and the out/dist folder so you do not push that. Only push source files as others mention.

Once the source files are in GitHub, you set up the repository in netlify and it should build and deploy automatically every time you push.