@tolgee/cli 2.11.0 → 2.12.1
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/commands/push.js +1 -1
- package/dist/config/tolgeerc.js +9 -8
- package/package.json +3 -2
- package/schema.json +1 -1
package/dist/commands/push.js
CHANGED
@@ -190,6 +190,6 @@ export default (config) => {
|
|
190
190
|
.addOption(new Option('-l, --languages <languages...>', 'Specifies which languages should be pushed (see push.files in config).').default((_g = config.push) === null || _g === void 0 ? void 0 : _g.languages))
|
191
191
|
.addOption(new Option('-n, --namespaces <namespaces...>', 'Specifies which namespaces should be pushed (see push.files in config).').default((_h = config.push) === null || _h === void 0 ? void 0 : _h.namespaces))
|
192
192
|
.addOption(new Option('--tag-new-keys <tags...>', 'Specify tags that will be added to newly created keys.').default((_j = config.push) === null || _j === void 0 ? void 0 : _j.tagNewKeys))
|
193
|
-
.addOption(new Option('--remove-other-keys', 'Remove keys which are not present in the import.').default((_k = config.push) === null || _k === void 0 ? void 0 : _k.removeOtherKeys))
|
193
|
+
.addOption(new Option('--remove-other-keys', 'Remove keys which are not present in the import (within imported namespaces).').default((_k = config.push) === null || _k === void 0 ? void 0 : _k.removeOtherKeys))
|
194
194
|
.action(pushHandler(config));
|
195
195
|
};
|
package/dist/config/tolgeerc.js
CHANGED
@@ -8,13 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
});
|
9
9
|
};
|
10
10
|
import { cosmiconfig, defaultLoaders } from 'cosmiconfig';
|
11
|
-
import { Validator } from 'jsonschema';
|
12
11
|
import { readFile } from 'fs/promises';
|
13
12
|
import { fileURLToPath } from 'url';
|
14
13
|
import { dirname, join, resolve } from 'path';
|
15
14
|
import { error, exitWithError } from '../utils/logger.js';
|
16
15
|
import { existsSync } from 'fs';
|
17
16
|
import { valueToArray } from '../utils/valueToArray.js';
|
17
|
+
import { Ajv } from 'ajv';
|
18
18
|
const explorer = cosmiconfig('tolgee', {
|
19
19
|
loaders: {
|
20
20
|
noExt: defaultLoaders['.json'],
|
@@ -34,7 +34,7 @@ function parseConfig(input, configDir) {
|
|
34
34
|
if (rc.projectId !== undefined) {
|
35
35
|
rc.projectId = Number(rc.projectId); // Number("") returns 0
|
36
36
|
if (!Number.isInteger(rc.projectId) || rc.projectId <= 0) {
|
37
|
-
throw new Error(
|
37
|
+
throw new Error("Invalid config: 'projectId' should be an integer representing your project Id");
|
38
38
|
}
|
39
39
|
}
|
40
40
|
// convert relative paths in config to absolute
|
@@ -70,6 +70,7 @@ function getSchema() {
|
|
70
70
|
}
|
71
71
|
export default function loadTolgeeRc(path) {
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
73
|
+
var _a;
|
73
74
|
let res;
|
74
75
|
if (path) {
|
75
76
|
try {
|
@@ -86,12 +87,12 @@ export default function loadTolgeeRc(path) {
|
|
86
87
|
if (!res || res.isEmpty)
|
87
88
|
return null;
|
88
89
|
const config = parseConfig(res.config, dirname(path || '.'));
|
89
|
-
const
|
90
|
-
const
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
const errMessage = `Tolgee config: '${
|
90
|
+
const ajv = new Ajv({ allowUnionTypes: true });
|
91
|
+
const validate = ajv.compile(yield getSchema());
|
92
|
+
validate(config);
|
93
|
+
const firstErr = (_a = validate.errors) === null || _a === void 0 ? void 0 : _a[0];
|
94
|
+
if (firstErr) {
|
95
|
+
const errMessage = `Tolgee config: '${firstErr.instancePath.replaceAll('/', '.').replace(/^\./, '')}' ${firstErr.message}`;
|
95
96
|
exitWithError(errMessage);
|
96
97
|
}
|
97
98
|
return config;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tolgee/cli",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.12.1",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A tool to interact with the Tolgee Platform through CLI",
|
6
6
|
"repository": {
|
@@ -30,12 +30,13 @@
|
|
30
30
|
"author": "Jan Cizmar",
|
31
31
|
"license": "MIT",
|
32
32
|
"dependencies": {
|
33
|
+
"ajv": "^8.17.1",
|
33
34
|
"ansi-colors": "^4.1.3",
|
34
35
|
"base32-decode": "^1.0.0",
|
35
36
|
"commander": "^12.1.0",
|
36
37
|
"cosmiconfig": "^9.0.0",
|
37
38
|
"json5": "^2.2.3",
|
38
|
-
"jsonschema": "^1.
|
39
|
+
"jsonschema": "^1.5.0",
|
39
40
|
"openapi-fetch": "0.13.1",
|
40
41
|
"tinyglobby": "^0.2.12",
|
41
42
|
"unescape-js": "^1.1.4",
|
package/schema.json
CHANGED