UNPKG

@nx/react-native

Version:

The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: -Integration with libraries such as Jest, Detox, and Storybook. -Scaffolding for creating buildable libraries th

24 lines (23 loc) 978 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addGitIgnoreEntry = addGitIgnoreEntry; const devkit_1 = require("@nx/devkit"); const ignore_1 = require("ignore"); const gitignore_entries_1 = require("./gitignore-entries"); function addGitIgnoreEntry(host) { if (!host.exists('.gitignore')) { devkit_1.logger.warn(`Couldn't find .gitignore file to update`); return; } let content = host.read('.gitignore', 'utf-8').trimEnd(); const ig = (0, ignore_1.default)(); ig.add(host.read('.gitignore', 'utf-8')); if (!ig.ignores('apps/example/ios/Pods/Folly')) { content = `${content}\n${gitignore_entries_1.gitIgnoreEntriesForReactNative}\n`; } // also ignore nested node_modules folders due to symlink for React Native if (!ig.ignores('apps/example/node_modules')) { content = `${content}\n## Nested node_modules\n\nnode_modules/\n`; } host.write('.gitignore', content); }