mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-16 09:41:38 +08:00
check lockfiles
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-update-cli",
|
"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.",
|
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
@@ -6,7 +6,7 @@ export default {
|
|||||||
lockNotFound:
|
lockNotFound:
|
||||||
'No lock file detected, which may cause inconsistent dependencies and hot-updating issues.',
|
'No lock file detected, which may cause inconsistent dependencies and hot-updating issues.',
|
||||||
multipleLocksFound:
|
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: `
|
lockBestPractice: `
|
||||||
Best practices for lock files:
|
Best practices for lock files:
|
||||||
1. All members of the development team should use the same package manager to maintain a single lock file.
|
1. All members of the development team should use the same package manager to maintain a single lock file.
|
||||||
|
@@ -12,7 +12,7 @@ export default {
|
|||||||
这样可以最大限度避免因依赖关系不一致而导致的热更异常,也降低供应链攻击等安全隐患。
|
这样可以最大限度避免因依赖关系不一致而导致的热更异常,也降低供应链攻击等安全隐患。
|
||||||
`,
|
`,
|
||||||
multipleLocksFound:
|
multipleLocksFound:
|
||||||
'检测到多种不同格式的锁文件({lockFiles}),这可能导致依赖关系不一致而使热更异常。',
|
'检测到多种不同格式的锁文件({{lockFiles}}),这可能导致依赖关系不一致而使热更异常。',
|
||||||
loginExpired: '登录信息已过期,请使用 `pushy login` 命令重新登录',
|
loginExpired: '登录信息已过期,请使用 `pushy login` 命令重新登录',
|
||||||
fileSizeExceeded:
|
fileSizeExceeded:
|
||||||
'此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{pricingPageUrl}}',
|
'此文件大小 {{fileSize}} , 超出当前额度 {{maxSize}} 。您可以考虑升级付费业务以提升此额度。详情请访问: {{pricingPageUrl}}',
|
||||||
|
@@ -23,6 +23,7 @@ export function addGitIgnore() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shouldIgnore.length > 0) {
|
if (shouldIgnore.length > 0) {
|
||||||
|
gitignoreLines.push('# react-native-update');
|
||||||
for (const line of shouldIgnore) {
|
for (const line of shouldIgnore) {
|
||||||
gitignoreLines.push(line);
|
gitignoreLines.push(line);
|
||||||
console.log(`Added ${line} to .gitignore`);
|
console.log(`Added ${line} to .gitignore`);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { t } from '../../lib/utils/i18n';
|
import { t } from './i18n';
|
||||||
|
|
||||||
const lockFiles = [
|
const lockFiles = [
|
||||||
'package-lock.json',
|
'package-lock.json',
|
||||||
@@ -16,9 +16,14 @@ export function checkLockFiles() {
|
|||||||
existingLockFiles.push(file);
|
existingLockFiles.push(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (existingLockFiles.length === 0) {
|
if (existingLockFiles.length === 1) {
|
||||||
console.warn(t('lockFilesNotFound'));
|
return;
|
||||||
} else if (existingLockFiles.length > 1) {
|
|
||||||
console.warn(t('multipleLockFilesFound'));
|
|
||||||
}
|
}
|
||||||
|
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