Recommended .gitignore for react-native

前端 未结 2 1310
我寻月下人不归
我寻月下人不归 2021-02-02 06:13

I\'m trying out react native and ejected into a full build environment. Sadly, the eject-script did not create a sensible .gitignore file.

Not

2条回答
  •  别那么骄傲
    2021-02-02 07:19

    This is the newer version of .gitignore for react-native projects https://github.com/facebook/react-native/blob/master/.gitignore

    Adding package manager lock file is optional. You can add them by adding package-lock.json for npm or yarn.lock for yarn, at the end of the below code.

    # 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
    

提交回复
热议问题