1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 01:41:37 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

check lockfiles

This commit is contained in:
sunnylqm
2025-04-02 08:27:05 +08:00
parent d351243ab7
commit d281d72737
5 changed files with 14 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update-cli",
"version": "1.42.2",
"version": "1.43.0",
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
"main": "index.js",
"bin": {

View File

@@ -6,7 +6,7 @@ export default {
lockNotFound:
'No lock file detected, which may cause inconsistent dependencies and hot-updating issues.',
multipleLocksFound:
'Multiple lock files detected ({lockFiles}), which may cause inconsistent dependencies and hot-updating issues.',
'Multiple lock files detected ({{lockFiles}}), which may cause inconsistent dependencies and hot-updating issues.',
lockBestPractice: `
Best practices for lock files:
1. All members of the development team should use the same package manager to maintain a single lock file.

View File

@@ -12,7 +12,7 @@ export default {
这样可以最大限度避免因依赖关系不一致而导致的热更异常,也降低供应链攻击等安全隐患。
`,
multipleLocksFound:
'检测到多种不同格式的锁文件({lockFiles}),这可能导致依赖关系不一致而使热更异常。',
'检测到多种不同格式的锁文件({{lockFiles}}),这可能导致依赖关系不一致而使热更异常。',
loginExpired: '登录信息已过期,请使用 `pushy login` 命令重新登录',
fileSizeExceeded:
'此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{pricingPageUrl}}',

View File

@@ -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`);

View File

@@ -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(', ') }),
);
}