@ttoss/i18n-cli 0.7.6 → 0.7.7
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.
- package/dist/index.js +7 -22
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
|
28
28
|
|
|
29
29
|
// src/index.ts
|
|
30
30
|
var fs = __toESM(require("fs"));
|
|
31
|
-
var
|
|
31
|
+
var import_fast_glob = __toESM(require("fast-glob"));
|
|
32
32
|
var path = __toESM(require("path"));
|
|
33
33
|
var import_cli_lib = require("@formatjs/cli-lib");
|
|
34
34
|
var import_minimist = __toESM(require("minimist"));
|
|
@@ -55,25 +55,7 @@ var getTtossExtractedTranslations = async () => {
|
|
|
55
55
|
for (const dependency of ttossDependencies) {
|
|
56
56
|
try {
|
|
57
57
|
const dependencyPathFromCwd = path.join(process.cwd(), "node_modules", dependency);
|
|
58
|
-
const
|
|
59
|
-
const requirePath = (() => {
|
|
60
|
-
if (checkIfDependencyIsSymlink) {
|
|
61
|
-
return path.join(dependencyPathFromCwd,
|
|
62
|
-
/**
|
|
63
|
-
* We need to go up one level because the symlink is pointing to
|
|
64
|
-
* the folder that lists dependencies, not the actual dependency.
|
|
65
|
-
* For example, `dependencyPathFromCwd` is
|
|
66
|
-
* /ttoss/terezinha-farm/app/node_modules/@ttoss/react-auth and
|
|
67
|
-
* `checkIfDependencyIsSymlink` is ../../../../packages/react-auth.
|
|
68
|
-
* If we don't go up one level, we will get:
|
|
69
|
-
* /ttoss/terezinha-farm/packages/react-auth/i18n/lang/en.json
|
|
70
|
-
* instead of:
|
|
71
|
-
* /ttoss/packages/react-auth/i18n/lang/en.json
|
|
72
|
-
*/
|
|
73
|
-
"..", checkIfDependencyIsSymlink, EXTRACT_FILE);
|
|
74
|
-
}
|
|
75
|
-
return path.join(dependency, EXTRACT_FILE);
|
|
76
|
-
})();
|
|
58
|
+
const requirePath = path.join(dependencyPathFromCwd, EXTRACT_FILE);
|
|
77
59
|
const extractedTranslations = require(requirePath);
|
|
78
60
|
const extractedTranslationsWithModule = Object.keys(extractedTranslations).reduce((acc, key) => {
|
|
79
61
|
return {
|
|
@@ -94,7 +76,7 @@ var getTtossExtractedTranslations = async () => {
|
|
|
94
76
|
(async () => {
|
|
95
77
|
const pattern = argv.pattern || "src/**/*.{ts,tsx}";
|
|
96
78
|
const ignore = argv.ignore || ["src/**/*.test.{ts,tsx}", "src/**/*.d.ts"];
|
|
97
|
-
const extractedDataAsString = await (0, import_cli_lib.extract)(
|
|
79
|
+
const extractedDataAsString = await (0, import_cli_lib.extract)(import_fast_glob.default.sync(pattern, {
|
|
98
80
|
ignore
|
|
99
81
|
}), {
|
|
100
82
|
idInterpolationPattern: "[sha512:contenthash:base64:6]"
|
|
@@ -119,7 +101,10 @@ var getTtossExtractedTranslations = async () => {
|
|
|
119
101
|
if (argv["no-compile"]) {
|
|
120
102
|
return;
|
|
121
103
|
}
|
|
122
|
-
const translations =
|
|
104
|
+
const translations = import_fast_glob.default.sync("**/*.json", {
|
|
105
|
+
cwd: EXTRACT_DIR,
|
|
106
|
+
absolute: true
|
|
107
|
+
});
|
|
123
108
|
await fs.promises.mkdir(COMPILE_DIR, {
|
|
124
109
|
recursive: true
|
|
125
110
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/i18n-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"author": "ttoss",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Pedro Arantes <arantespp@gmail.com> (https://arantespp.com)"
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@formatjs/cli-lib": "^6.3.3",
|
|
22
|
-
"glob": "^
|
|
22
|
+
"fast-glob": "^3.3.2",
|
|
23
23
|
"minimist": "^1.2.8"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
+
"@types/minimist": "^1.2.5",
|
|
26
27
|
"ts-node": "^10.9.2",
|
|
27
28
|
"tsup": "^8.0.2",
|
|
28
29
|
"@ttoss/config": "^1.31.5"
|