zcf 2.12.5 → 2.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,7 +15,7 @@ import semver from 'semver';
|
|
|
15
15
|
import { exec } from 'tinyexec';
|
|
16
16
|
import { rm, mkdir, copyFile as copyFile$1 } from 'node:fs/promises';
|
|
17
17
|
|
|
18
|
-
const version = "2.12.
|
|
18
|
+
const version = "2.12.6";
|
|
19
19
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
20
20
|
|
|
21
21
|
const i18n = i18next.createInstance();
|
|
@@ -61,13 +61,27 @@ async function initI18n(language = "zh-CN") {
|
|
|
61
61
|
backend: {
|
|
62
62
|
loadPath: (() => {
|
|
63
63
|
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
64
|
+
const packageRoot = (() => {
|
|
65
|
+
let dir = currentDir;
|
|
66
|
+
while (dir !== dirname(dir)) {
|
|
67
|
+
if (existsSync(join(dir, "package.json"))) {
|
|
68
|
+
return dir;
|
|
69
|
+
}
|
|
70
|
+
dir = dirname(dir);
|
|
71
|
+
}
|
|
72
|
+
return currentDir;
|
|
73
|
+
})();
|
|
64
74
|
const possibleBasePaths = [
|
|
65
75
|
join(currentDir, "locales"),
|
|
66
76
|
// Development: src/i18n/locales
|
|
77
|
+
join(packageRoot, "dist/i18n/locales"),
|
|
78
|
+
// NPM package: /node_modules/zcf/dist/i18n/locales
|
|
67
79
|
join(process.cwd(), "dist/i18n/locales"),
|
|
68
|
-
// Production: dist/i18n/locales
|
|
69
|
-
join(currentDir, "../../../dist/i18n/locales")
|
|
80
|
+
// Production build: ./dist/i18n/locales
|
|
81
|
+
join(currentDir, "../../../dist/i18n/locales"),
|
|
70
82
|
// Fallback for deep chunk paths
|
|
83
|
+
join(currentDir, "../../i18n/locales")
|
|
84
|
+
// Alternative chunk structure
|
|
71
85
|
];
|
|
72
86
|
for (const basePath of possibleBasePaths) {
|
|
73
87
|
const testFile = join(basePath, "zh-CN/common.json");
|
package/package.json
CHANGED