mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-10-30 22:33:11 +08:00
check lockfiles
This commit is contained in:
@@ -23,6 +23,7 @@ export function addGitIgnore() {
|
||||
}
|
||||
|
||||
if (shouldIgnore.length > 0) {
|
||||
gitignoreLines.push('# react-native-update');
|
||||
for (const line of shouldIgnore) {
|
||||
gitignoreLines.push(line);
|
||||
console.log(`Added ${line} to .gitignore`);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import fs from 'node:fs';
|
||||
import { t } from '../../lib/utils/i18n';
|
||||
import { t } from './i18n';
|
||||
|
||||
const lockFiles = [
|
||||
'package-lock.json',
|
||||
@@ -16,9 +16,14 @@ export function checkLockFiles() {
|
||||
existingLockFiles.push(file);
|
||||
}
|
||||
}
|
||||
if (existingLockFiles.length === 0) {
|
||||
console.warn(t('lockFilesNotFound'));
|
||||
} else if (existingLockFiles.length > 1) {
|
||||
console.warn(t('multipleLockFilesFound'));
|
||||
if (existingLockFiles.length === 1) {
|
||||
return;
|
||||
}
|
||||
console.warn(t('lockBestPractice'));
|
||||
if (existingLockFiles.length === 0) {
|
||||
throw new Error(t('lockNotFound'));
|
||||
}
|
||||
throw new Error(
|
||||
t('multipleLocksFound', { lockFiles: existingLockFiles.join(', ') }),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user