From a559140b72126e1c43a62bde8021944d47330c9a Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Sat, 15 Mar 2025 19:03:19 +0800 Subject: [PATCH] fix number format --- src/locales/en.ts | 14 +++++++++++++- src/locales/zh.ts | 11 +++++++++++ src/utils/git.ts | 4 ++-- src/utils/lock-checker.ts | 17 ----------------- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/locales/en.ts b/src/locales/en.ts index 51bf19d..a1022f7 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -1,5 +1,17 @@ export default { updateNotifier: 'Run `{updateCommand}` to update the CLI to get continuous improvements in features, performance, and security.', - loginFirst: 'Not logged in.\nPlease run `cresc login` in the project directory to login.', + loginFirst: + 'Not logged in.\nPlease run `cresc login` in the project directory to login.', + 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.', + 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. +2. Add the lock file to version control (but do not commit multiple lock files of different formats). +3. Pay attention to changes in the lock file during code review. +This can reduce the risk of inconsistent dependencies and supply chain attacks. +`, }; diff --git a/src/locales/zh.ts b/src/locales/zh.ts index d80026c..69187da 100644 --- a/src/locales/zh.ts +++ b/src/locales/zh.ts @@ -2,4 +2,15 @@ export default { updateNotifier: '建议运行 `{updateCommand}` 来更新命令行工具以获得功能、性能和安全性的持续改进', loginFirst: '尚未登录。\n请在项目目录中运行`pushy login`命令来登录', + lockNotFound: + '没有检测到任何 lock 文件,这可能导致依赖关系不一致而使热更异常。', + lockBestPractice: ` +关于 lock 文件的最佳实践: +1. 开发团队中的所有成员应该使用相同的包管理器,维护同一份 lock 文件。 +2. 将 lock 文件添加到版本控制中(但不要同时提交多种不同格式的 lock 文件)。 +3. 代码审核时应关注 lock 文件的变化。 +这样可以最大限度避免因依赖关系不一致而导致的热更异常,也降低供应链攻击等安全隐患。 +`, + multipleLocksFound: + '检测到多种不同格式的锁文件({lockFiles}),这可能导致依赖关系不一致而使热更异常。', }; diff --git a/src/utils/git.ts b/src/utils/git.ts index 2efc694..365b4b0 100644 --- a/src/utils/git.ts +++ b/src/utils/git.ts @@ -6,7 +6,7 @@ export interface CommitInfo { hash: string; message: string; author: string; - date: number; + date: string; origin: string; } @@ -40,7 +40,7 @@ export async function getCommitInfo(): Promise { hash: oid, message: commit.message, author: commit.author.name || commit.committer.name, - date: commit.committer.timestamp, + date: String(commit.committer.timestamp), origin: origin.url, }; } catch (error) { diff --git a/src/utils/lock-checker.ts b/src/utils/lock-checker.ts index 6fdb2c3..593c702 100644 --- a/src/utils/lock-checker.ts +++ b/src/utils/lock-checker.ts @@ -5,20 +5,3 @@ const lockFiles = [ 'bun.lockb', 'bun.lock', ]; - -const lockNotFound = ` -没有检测到任何 lock 文件,这可能导致依赖关系不一致而使热更异常。 -`; - -const multipleLocksFound = ` -检测到多个锁文件(),这可能导致依赖关系不一致而使热更异常。 -`; - - -const lockBestPractice = ` -关于 lock 文件的最佳实践: -1. 开发团队中的所有成员应该使用相同的包管理器,维护同一份 lock 文件。 -2. 将 lock 文件添加到版本控制中(但不要同时提交多种不同格式的 lock 文件)。 -3. 代码审核时应关注 lock 文件的变化。 -这样可以最大限度避免因依赖关系不一致而导致的热更异常,也降低供应链攻击等安全隐患。 -`;