gradle react-native的推荐.gitignore [duplicate]

l0oc07j2  于 2023-11-18  发布在  React
关注(0)|答案(3)|浏览(191)

此问题在此处已有答案

What folders should be git ignored in React Native project?(6个答案)
去年关闭。
我正在尝试react native和eject艾德到一个完整的构建环境中,遗憾的是,弹出脚本没有创建一个合理的.gitignore文件。
不知道很多关于应用程序开发,我想知道什么目录我可以.gitignore在这里?
我猜

  • android/build
  • android/app/build
  • android/.gradle/

这些都是好的,或者有任何更多的目录,我应该.gitignore

hfyxw5xn

hfyxw5xn1#

下面是react-native init命令附带的.gitignore文件。你可以在这里找到完整的文件。

# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
node_modules/
package-lock.json # include if you are using npm - don't use both yarn and npm
npm-debug.log
yarn-error.log
yarn.lock # include if you are using yarn - don't use both npm and yarn

# BUCK
buck-out/
\.buckd/
*.keystore

# Fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use Fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

# Bundle artifact
*.jsbundle

字符串

uhry853o

uhry853o2#

这就是我正在使用的。
内容应该保存在.gitignore后,iOS和Android环境一样(签名,配置文件)初始化,
然后需要使用git rm -f -cached(文件路径)删除自动生成的文件(index.android.bundle,main.jsbundle),然后提交,然后创建一个新的。
这是因为自动生成的文件不需要提交。

node_modules/**/*
.expo/*
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
package-lock.json
# macOS
.DS_Store
ios/
ios/*
ios/main.jsbundle
ios/**/*
android/
android/*
android/**/*

.vs/
*.log

# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore

# Bundle artifacts
*.jsbundle

# CocoaPods
/ios/Pods/

# Expo
.expo/
web-build/

字符串

41zrol4v

41zrol4v3#

这是react-native项目https://github.com/facebook/react-native/blob/master/.gitignore的.gitignore的更新版本
添加包管理器锁文件是可选的。您可以通过在下面的代码末尾添加package-lock.json(npm)或yarn.lock(yarn)来添加它们。

# Xcode
!**/*.xcodeproj
!**/*.pbxproj
!**/*.xcworkspacedata
!**/*.xcsettings
!**/*.xcscheme
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Gradle
/build/
/RNTester/android/app/build/
/RNTester/android/app/gradle/
/RNTester/android/app/gradlew
/RNTester/android/app/gradlew.bat
/ReactAndroid/build/

# Buck
.buckd
buck-out
/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/
/ReactAndroid/src/main/jni/prebuilt/lib/x86/
/ReactAndroid/src/main/gen

# Watchman
.watchmanconfig

# Android
.idea
.gradle
local.properties
*.iml
/android/

# Node
node_modules
*.log
.nvm
/bots/node_modules/
package-lock.json

# OS X
.DS_Store

# Test generated files
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
*.js.meta

/coverage
/third-party

# Root dir shouldn't have Xcode project
/*.xcodeproj

# ReactCommon subdir shouldn't have Xcode project
/ReactCommon/**/*.xcodeproj
RNTester/build

# Libs that shouldn't have Xcode project
/Libraries/FBLazyVector/**/*.xcodeproj
/Libraries/FBReactNativeSpec/**/*.xcodeproj
/Libraries/RCTRequired/**/*.xcodeproj
/React/CoreModules/**/*.xcodeproj
/packages/react-native-codegen/**/*.xcodeproj

# CocoaPods
/template/ios/Pods/
/template/ios/Podfile.lock
/RNTester/Gemfile.lock

# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
RNTester/Pods/*
!RNTester/Pods/__offline_mirrors

# react-native-codegen
/ReactCommon/fabric/components/rncore/
/schema-rncore.json

字符串

相关问题