MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / ensureGitignore

Function ensureGitignore

packages/vite/helpers/init.ts:61–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59}
60
61function ensureGitignore() {
62 const root = getProjectRootPath();
63 const gitignorePath = path.join(root, '.gitignore');
64 let contents = '';
65 if (fs.existsSync(gitignorePath)) {
66 contents = fs.readFileSync(gitignorePath, 'utf8');
67 }
68 if (!contents.split(/\r?\n/).includes('.ns-vite-build')) {
69 if (contents.length && !contents.endsWith('\n')) {
70 contents += '\n';
71 }
72 contents += '.ns-vite-build\n';
73 fs.writeFileSync(gitignorePath, contents, 'utf8');
74 }
75}
76
77function resolveFlavor(): string {
78 const flavor = determineProjectFlavor();

Callers 1

runInitFunction · 0.85

Calls 3

joinMethod · 0.80
includesMethod · 0.80
getProjectRootPathFunction · 0.70

Tested by

no test coverage detected