From d4fcf4bad307d10226e5c44058c6b465b16892fa Mon Sep 17 00:00:00 2001 From: wxzhang Date: Wed, 29 Mar 2023 17:35:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(utils):=20=E6=B7=BB=E5=8A=A0`string.protot?= =?UTF-8?q?ype.replaceall`=20shim=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=9C=A8?= =?UTF-8?q?=E4=BD=8E=E7=89=88=E6=9C=ACnodejs=E4=B8=8A=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/apps/app/index.js | 2 +- packages/utils/index.js | 3 +++ packages/utils/package.json | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/apps/app/index.js b/packages/apps/app/index.js index 16fa34a..586255f 100644 --- a/packages/apps/app/index.js +++ b/packages/apps/app/index.js @@ -1,4 +1,4 @@ - +const { t } = require("./languages") t("a") t("b") t("c") diff --git a/packages/utils/index.js b/packages/utils/index.js index ffd6c93..4a2dcfc 100644 --- a/packages/utils/index.js +++ b/packages/utils/index.js @@ -2,6 +2,9 @@ const path = require("path") const shelljs = require("shelljs") const fs = require("fs-extra") const semver = require('semver') +const replaceAll = require("string.prototype.replaceall") +// 由于replaceAll()方法在nodejs 15版本才支持,所以这里做兼容处理 +replaceAll.shim() /** * diff --git a/packages/utils/package.json b/packages/utils/package.json index 96b5788..8d8e0f3 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -12,7 +12,8 @@ "dependencies": { "fs-extra": "^10.0.1", "semver": "^7.3.7", - "shelljs": "^0.8.5" + "shelljs": "^0.8.5", + "string.prototype.replaceall": "^1.0.7" }, "lastPublish": "2023-02-13T11:13:34+08:00" } \ No newline at end of file