Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't commit built files in the repo

See original GitHub issue

Files like assets/scripts/dist/choices.js (and company) are needed to be rebuilt every time. This should not be the case.


  • Add files in package.json to whitelist all the files needed, but do NOT include assets/scripts/dist/ in it.

  • Add a scripts.prepublish in package.json to run npm run js:build (and whatever else is needed)

  • Add assets/scripts/dist/ to .gitignore

  • Remove the files using git rm -rf --cached assets/scripts/dist

What it does

The files will not be in the Git repository anymore.

They are, however, uploaded to npm. Just run npm publish and it will build the files and upload them to the registry.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

ojensen5115commented, May 16, 2017

If the dist files are removed from the repo, what would be the best way for those who aren’t using node to get the built files?

rstacruzcommented, May 26, 2017

…by the way, I’m asking this because it’d be much easier for us who would occasionally maintain forks of Choices. We can’t always easily contribute our fixes back, because PR’s here should not have the dist files rebuilt.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What not to commit - Dart programming language
The rules. Don't commit the following files and directories created by pub: .dart_tool/ build/ pubspec.lock # Except for application packages.
Read more >
Ignoring files - GitHub Docs
You can create a .gitignore file in your repository's root directory to tell Git which files and directories to ignore when you make...
Read more >
Ignore files in your Git repo - Azure - Microsoft Learn
Learn how to exclude files from Git version control by using gitignore and exclude files, the git update-index command, and repo management.
Read more >
How can I ignore a file that has already been committed to a ...
Git can only ignore files that are untracked - files that haven't been committed to the repository, yet. That's why, when you create...
Read more >
.gitignore file - ignoring files in Git | Atlassian Git Tutorial
Ignored files are usually build artifacts and machine generated files that can be derived from your repository source or should otherwise not be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found