@kununu/phraseapp-cli 4.0.3-beta.0 → 4.0.3-beta.2
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/check-translations.js +8 -5
- package/index.js +2 -0
- package/package.json +1 -1
package/check-translations.js
CHANGED
|
@@ -20,6 +20,9 @@ const POSSIBLE_DYNAMIC_KEYS_FILE = `${FOLDER_REPORT_CHECK_TRANSLATIONS}/possible
|
|
|
20
20
|
function extractTranslationKeys() {
|
|
21
21
|
const files = sync(
|
|
22
22
|
`${process.cwd()}/${process.env.SOURCE_DIR}/**/**/*.{js,jsx,ts,tsx}`,
|
|
23
|
+
{
|
|
24
|
+
ignore: [`**/*.spec.{js,jsx,ts,tsx}`],
|
|
25
|
+
}
|
|
23
26
|
);
|
|
24
27
|
const keys = new Set();
|
|
25
28
|
const possibleDynamicKeys = {};
|
|
@@ -82,7 +85,7 @@ function extractTranslationKeys() {
|
|
|
82
85
|
|
|
83
86
|
if (Object.keys(possibleDynamicKeys).length > 0) {
|
|
84
87
|
console.log(
|
|
85
|
-
`${Object.keys(possibleDynamicKeys).length} files contain possible dynamic keys were saved in ${POSSIBLE_DYNAMIC_KEYS_FILE}
|
|
88
|
+
`${Object.keys(possibleDynamicKeys).length} files contain possible dynamic keys were saved in ${POSSIBLE_DYNAMIC_KEYS_FILE}`.yellow.bold,
|
|
86
89
|
);
|
|
87
90
|
writeFileSync(
|
|
88
91
|
POSSIBLE_DYNAMIC_KEYS_FILE,
|
|
@@ -91,7 +94,7 @@ function extractTranslationKeys() {
|
|
|
91
94
|
} else if (existsSync(POSSIBLE_DYNAMIC_KEYS_FILE)) {
|
|
92
95
|
unlinkSync(POSSIBLE_DYNAMIC_KEYS_FILE);
|
|
93
96
|
console.log(
|
|
94
|
-
`${POSSIBLE_DYNAMIC_KEYS_FILE} was deleted as there are no possible dynamic keys
|
|
97
|
+
`${POSSIBLE_DYNAMIC_KEYS_FILE} was deleted as there are no possible dynamic keys.`.green.bold,
|
|
95
98
|
);
|
|
96
99
|
}
|
|
97
100
|
|
|
@@ -139,19 +142,19 @@ function compareKeys() {
|
|
|
139
142
|
} else if (existsSync(MISSING_KEYS_FILE)) {
|
|
140
143
|
unlinkSync(MISSING_KEYS_FILE);
|
|
141
144
|
console.log(
|
|
142
|
-
`${MISSING_KEYS_FILE} was deleted as there are no missing keys
|
|
145
|
+
`${MISSING_KEYS_FILE} was deleted as there are no missing keys.`.green.bold,
|
|
143
146
|
);
|
|
144
147
|
}
|
|
145
148
|
|
|
146
149
|
if (unusedKeys.length > 0) {
|
|
147
150
|
writeFileSync(UNUSED_KEYS_FILE, JSON.stringify(unusedKeys, null, 2));
|
|
148
151
|
console.log(
|
|
149
|
-
`${unusedKeys.length} unused keys were saved in ${UNUSED_KEYS_FILE}
|
|
152
|
+
`${unusedKeys.length} unused keys were saved in ${UNUSED_KEYS_FILE}`.yellow.bold,
|
|
150
153
|
);
|
|
151
154
|
} else if (existsSync(UNUSED_KEYS_FILE)) {
|
|
152
155
|
unlinkSync(UNUSED_KEYS_FILE);
|
|
153
156
|
console.log(
|
|
154
|
-
`${UNUSED_KEYS_FILE} was deleted as there are no
|
|
157
|
+
`${UNUSED_KEYS_FILE} was deleted as there are no unused keys.`.green.bold,
|
|
155
158
|
);
|
|
156
159
|
}
|
|
157
160
|
} catch (error) {
|
package/index.js
CHANGED