React 项目中的 .gitignore 中应该包含哪些文件或文件夹?
Which files or folders should be in .gitignore in React project?
我正在制作一个 React 项目,并在笔记本电脑和 Windows 10 台式机上使用 Linux mint。我想知道,我应该将哪些文件或文件夹保留在 .gitignore 中,这样我就不必在每次切换计算机时都清理缓存和安装 npm。
你可以在 react gitignore 中添加以下文件
.idea/
.vscode/
node_modules/
build
.DS_Store
*.tgz
my-app*
template/src/__tests__/__snapshots__/
lerna-debug.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/.changelog
.npm/
yarn.lock
如果您使用 create react app,则包含一个用于 React 项目的良好 .gitignore。你肯定想在 gitignore 中保留node_modules。
有关详细信息,请参阅 How to configure .gitignore file。
依赖项
/node_modules
/.pnp
.pnp.js
package-lock.json
测试
/coverage
产量
/build
其他
npm-debug.log*
何必呢?只需将您的浏览器指向 gitignore.io 和 select 您正在使用的所有工具和技术。您将自动生成一个 .gitignore
文件。
node_modules 应该总是放在 gitignore 和日志文件中(如果有的话)。休息由你决定。没有这样的标准
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Distribution directories
dist/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
我能找到的最接近 'official' .gitignore
的是在 Facebook git 存储库下维护的开源 .gitignore
- https://github.com/facebook/react/blob/main/.gitignore
我正在制作一个 React 项目,并在笔记本电脑和 Windows 10 台式机上使用 Linux mint。我想知道,我应该将哪些文件或文件夹保留在 .gitignore 中,这样我就不必在每次切换计算机时都清理缓存和安装 npm。
你可以在 react gitignore 中添加以下文件
.idea/
.vscode/
node_modules/
build
.DS_Store
*.tgz
my-app*
template/src/__tests__/__snapshots__/
lerna-debug.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/.changelog
.npm/
yarn.lock
如果您使用 create react app,则包含一个用于 React 项目的良好 .gitignore。你肯定想在 gitignore 中保留node_modules。
有关详细信息,请参阅 How to configure .gitignore file。
依赖项
/node_modules
/.pnp
.pnp.js
package-lock.json
测试
/coverage
产量
/build
其他
npm-debug.log*
何必呢?只需将您的浏览器指向 gitignore.io 和 select 您正在使用的所有工具和技术。您将自动生成一个 .gitignore
文件。
node_modules 应该总是放在 gitignore 和日志文件中(如果有的话)。休息由你决定。没有这样的标准
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Distribution directories
dist/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
我能找到的最接近 'official' .gitignore
的是在 Facebook git 存储库下维护的开源 .gitignore
- https://github.com/facebook/react/blob/main/.gitignore