Connect Custom Card UI to GitHub

Hi! I’m working on migrate my custom cards in GitHub.

But when I connect to my HubSpot deploying falls with this error

Directory /app/.vite has multiple validation errors. 
Directory .vite contains an invalid character: "vite". Remove it and try again.

So I’ve changed .gitignore file to avoid this kind of files and then I got this error

Directory /app/app.functions/node_modules/.bin has multiple validation errors.

Directory .bin contains an invalid character: "bin". Remove it and try again.

Which files and folders I’ve not to push in my GitHub?

Thanks

Have you looked at the boiler plate CMS theme from Hubspot? I usually just copy their .gitignore file as a starting point and then add my own stuff:

node_modules folder usually isn’t repo’d and you can see it’s ignored in the hubspot boilerplate theme.

Thanks @MichaelMa I’ll try

This is for a custom UI Extension -- it doesn’t use the CMS, it uses projects or github. The project is quite different, but I guess you could start wiht that .gitignore

I’ve done using .gitignore files taken from boilerplate but now error is

Directory /app/app.functions/node_modules/.bin has multiple validation errors.

Directory .bin contains an invalid character: "bin". Remove it and try again.
# HubSpot problematic directories
.vite/
**/.*/
**/*.tmp
dist/
.temp/
tmp/

# Specificatamente problematici per HubSpot
**/node_modules/.bin/
**/node_modules/.cache/

Maybe I’ve resolved by adding also these

Use this -- you should be ignoring all your node module folders…

Here how I’ve resolved for future purposes

What to Exclude from Git (and HubSpot)

In most Node or front-end projects, a number of folders and files shouldn’t be pushed to your HubSpot portal. They can still be in your GitHub repository if you want to track them, but they generally must be ignored or excluded from upload to HubSpot:

  1. Build and Development Artifacts
    • The “.vite” folder or any local cache folders created by your build tools
    • “dist”, “build” or any other production output directories
  2. node_modules and Third-Party Files
    • “node_modules” typically contains thousands of dependencies that HubSpot doesn’t need
    • “.bin” within node_modules is automatically generated, so it causes validation conflicts
  3. Configuration, Environment, and Local Files
    • .env or .env.* files containing environment variables
    • Local cache or lock files (like package-lock.json or yarn.lock) — it’s optional to keep them in GitHub for versioning, but they’re not needed on HubSpot’s side

How to Implement These Exclusions

  1. In your project’s .gitignore file, ensure you list the directories and files you do not want stored in the repository or sent to HubSpot. For example:

.gitignore# Ignore build outputsdist/build/.vite/# Ignore dependenciesnode_modules/node_modules/.bin/# Ignore environment files.env.env.*

  1. If you’re using the HubSpot CLI, you can also define a .hsignore file to prevent these directories from uploading to your HubSpot account.

I’m going to ignore the fact that you answered your own question with chat gpt and didn’t take the time to fix the code block so that it displays properly, but I’m going to address the issues I have with the response as a whole, regardless of who wrote it. So let me explain one major item that I think others would benefit from in the community when they are looking for a HubSpot UI Extension project .gitignore file in the future
The reason this issue can happen is because of the ways these projects are set up -- there could be two sets of node_modules folders in your repo (example: one for loading axios into your serverless functions, and then one for loading the UI Extensions into your extensions. See code block below.

# this covers the root folder
node_modules/

# this covers any node_modules folder in your repo
**/node_modules/

That could have been an issue some have seen.
Now, the code block you answered with is below, formatted so that the community can benefit from being able to read it… Now my issue with this answer -- having node_modules/.bin/ is unnecessary because on the line before this, you already have ignored the node_modules/ folder, which ignores all of the contents inside that folder and all other folders. We don’t build out individual lines for each node package to our .gitignore -- that would take forever to do that manually with the amount of modules that are depenedent upon other modules.

# Ignore build outputs
dist/
build/
.vite/

# Ignore dependencies
node_modules/
node_modules/.bin/

# Ignore environment files
.env
.env.*

I tried to think about why you would need the second line, and I just can’t determine the need. If someone had added a file in the node_modules/.bin/ file to the repo, adding this to the .gitignore wouldn’t untrack it, that would have to be done through other means to untrack the file.
So, because I’ve already gone to this length to attempt to set the record straight, I’ll also not use a commonly used .gitignore file that is out there -- instead I’ve gone through a bunch of my projects I’ve done and have included this. First we’ll get into a small variance that you had mentioned, the .hsignore file, then my overly verbose .gitignore file I spent the past half day on.
HubSpot automatically ignores these files in the .hsignore when you are using the hs upload

hubspot.config.yml/hubspot.config.yaml
node_modules - dependencies
.* - hidden files/folders
*.log - NPM error log
*.swp - Swap file for Vim state
Icon\\r - Mac OS custom Finder icon
__MACOSX - Mac resource fork
~ Linux Backup file
Thumbs.db - Windows image file cache
ehthumbs.db - Windows folder config file
Desktop.ini - Windows custom folder attribute information
@eaDir - Windows Synology diskstation "hidden" folder where the server stores thumbnails.

If you have your project using github to deploy/build, then you should likely set these up as well in the project .gitignore file!
So here is the .gitignore, I also have a link here to it as a gist on github
I will also include it in a code block below. I have added the comments into the file so I can talk about the who what and why of what is going on here so that people have a better understanding of the actual reason for these.

# depending on how you set up your project, having the ** here will make sure
# to cover your entire project
**/node_modules/

# HubSpot config file
**/hubspot.config.yml
**/hubspot.config.yaml

# this is a file that keeps the packages in your project in sync
# if you want to make sure everyone is using the same version of packages it is a
# good idea to commit these files and not ignore them. It is also helpful when
# you are working with newer developers -- this makes it so anyone sharing this
# repo will be in sync with all packages, prevents issues with different package
# versions that could have different syntax, bugs, deprecations, etc.
**/package-lock.json

# env variables as you may use these, I have the !.env.example after the .env files
# so that you can create a .env.example file and commit it to the repo
# this allows you to share what your teams .env vars should be set up like
.env
.env.*
!.env.example

# build and log stuff, depending on what you do, you may not need the log stuff
target/
dist/
.vite/
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# operating system files that can get created in folders 
.DS_Store
Icon?
__MACOSX/
Thumbs.db
ehthumbs.db
Desktop.ini
@eaDir/
*~
*.swp

# for hidden files I don't like to ignore all of them wiht a *.
# If you aren't sharing setup with others, then you can just uncomment them
# if you want to share them in your repo
# then we have teh ! which allows you to override a previous rule

# vscode/cursor or any other branched forked editor
# the first two lines ignores all the vscode / code editor stuff
# the lines under that are allowing specific files to be shared in the repo
# *.code-workspace
# .vscode/* 
# !.vscode/settings.json
# !.vscode/tasks.json
# !.vscode/launch.json
# !.vscode/extensions.json

# cache files for linters and formatters that are commonly used
.eslintcache
.prettiercache
.stylelintcache
.history/

# as a last tidbit to add here -- If you are using webpack to extend your project
# so you can use other dependeices that HubSpot does not allow you should see:
# https://docs.google.com/document/d/e/2PACX-1vRGX60V2wQ2Co9X1NO73hkLObcQdNWp2i49XE-pY_DRS6UjZnv4UuODz4nsI_g1gUIXFC1MhN4AFsnZ/pub
# https://github.com/HubSpot/cms-webpack-serverless-boilerplate?tab=readme-ov-file
# **/dist/
# /coverage/
# config.json
# /.pnp
# .pnp.js
# /build/
# /public/
# /out/
# *.bundle.js
# *.bundle.js.map

Chat Gpt and other AI solutions are far from understanding everything about HubSpot development. They get the answer wrong all the time. There isn’t a massive amount of places that it can find these answers, and a lot of times it makes mistakes. I make a lot of mistakes to -- but I also think copy and pasting an answer from chat gpt should be noted “I used chat gpt to get this”