1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-10-30 22:33:11 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

check lockfile

This commit is contained in:
sunnylqm
2025-04-01 23:24:02 +08:00
parent fbdacfffd2
commit d351243ab7
5 changed files with 32 additions and 12 deletions

View File

@@ -1,11 +1,11 @@
import fs from 'node:fs';
import path from 'node:path';
// import path from 'node:path';
import { credentialFile, tempDir } from './constants';
export function addGitIgnore() {
const shouldIgnore = [credentialFile, tempDir];
const gitignorePath = path.join(process.cwd(), '.gitignore');
const gitignorePath = '.gitignore';
if (!fs.existsSync(gitignorePath)) {
return;
@@ -16,7 +16,7 @@ export function addGitIgnore() {
const gitignoreLines = gitignoreContent.split('\n');
for (const line of gitignoreLines) {
const index = shouldIgnore.indexOf(line);
const index = shouldIgnore.indexOf(line.trim());
if (index !== -1) {
shouldIgnore.splice(index, 1);
}

View File

@@ -0,0 +1,24 @@
import fs from 'node:fs';
import { t } from '../../lib/utils/i18n';
const lockFiles = [
'package-lock.json',
'yarn.lock',
'pnpm-lock.yaml',
'bun.lockb',
'bun.lock',
];
const existingLockFiles: string[] = [];
export function checkLockFiles() {
for (const file of lockFiles) {
if (fs.existsSync(file)) {
existingLockFiles.push(file);
}
}
if (existingLockFiles.length === 0) {
console.warn(t('lockFilesNotFound'));
} else if (existingLockFiles.length > 1) {
console.warn(t('multipleLockFilesFound'));
}
}

View File

@@ -1,7 +0,0 @@
const lockFiles = [
'package-lock.json',
'yarn.lock',
'pnpm-lock.yaml',
'bun.lockb',
'bun.lock',
];