@tolgee/cli 2.8.4 → 2.10.0
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/cli.js +116 -94
- package/dist/client/ApiClient.js +40 -32
- package/dist/client/ExportClient.js +24 -11
- package/dist/client/ImportClient.js +25 -16
- package/dist/client/TolgeeClient.js +1 -5
- package/dist/client/errorFromLoadable.js +3 -2
- package/dist/client/getApiKeyInformation.js +16 -6
- package/dist/commands/extract/check.js +38 -27
- package/dist/commands/extract/print.js +46 -35
- package/dist/commands/login.js +39 -26
- package/dist/commands/pull.js +60 -43
- package/dist/commands/push.js +167 -117
- package/dist/commands/sync/compare.js +43 -31
- package/dist/commands/sync/sync.js +118 -99
- package/dist/commands/sync/syncUtils.js +2 -1
- package/dist/commands/tag.js +52 -38
- package/dist/config/credentials.js +110 -93
- package/dist/config/tolgeerc.js +51 -35
- package/dist/extractor/extractor.js +45 -31
- package/dist/extractor/parser/extractComment.js +1 -1
- package/dist/extractor/parser/generateReport.js +8 -6
- package/dist/extractor/parser/iterator.js +2 -1
- package/dist/extractor/parser/mergerMachine.js +2 -11
- package/dist/extractor/parser/nodeUtils.js +1 -1
- package/dist/extractor/parser/parser.js +4 -2
- package/dist/extractor/parser/rules/tNsSourceGeneral.js +1 -1
- package/dist/extractor/parser/tree/getTranslateProps.js +21 -16
- package/dist/extractor/parser/tree/getValue.js +1 -1
- package/dist/extractor/parser/tree/parseTag.js +1 -1
- package/dist/extractor/parserNgx/ParserNgx.js +1 -3
- package/dist/extractor/parserNgx/ngxMapper.js +2 -1
- package/dist/extractor/parserNgx/ngxTreeTransform.js +3 -2
- package/dist/extractor/parserNgx/rules/translatePipe.js +1 -1
- package/dist/extractor/parserReact/ParserReact.js +1 -3
- package/dist/extractor/parserSvelte/ParserSvelte.js +1 -3
- package/dist/extractor/parserVue/ParserVue.js +1 -3
- package/dist/extractor/parserVue/tokenMergers/hyphenPropsMerger.js +1 -4
- package/dist/extractor/parserVue/vueTreeTransform.js +13 -2
- package/dist/extractor/runner.js +53 -39
- package/dist/extractor/tokenizer.js +50 -35
- package/dist/extractor/visualizers/printTokens.js +2 -1
- package/dist/extractor/visualizers/visualizeRules.js +4 -7
- package/dist/extractor/warnings.js +3 -2
- package/dist/extractor/worker.js +29 -16
- package/dist/options.js +2 -1
- package/dist/utils/apiKeyList.js +31 -19
- package/dist/utils/ask.js +35 -21
- package/dist/utils/checkPathNotAFile.js +22 -11
- package/dist/utils/filesTemplate.js +147 -0
- package/dist/utils/mapExportFormat.js +2 -0
- package/dist/utils/mapImportFormat.js +1 -1
- package/dist/utils/moduleLoader.js +37 -23
- package/dist/utils/prepareDir.js +20 -9
- package/dist/utils/valueToArray.js +8 -0
- package/package.json +2 -2
- package/schema.json +20 -4
@@ -1,3 +1,12 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
1
10
|
import { Command } from 'commander';
|
2
11
|
import ansi from 'ansi-colors';
|
3
12
|
import { compareKeys, printKey } from './syncUtils.js';
|
@@ -5,39 +14,42 @@ import { extractKeysOfFiles, filterExtractionResult, } from '../../extractor/run
|
|
5
14
|
import { dumpWarnings } from '../../extractor/warnings.js';
|
6
15
|
import { loading } from '../../utils/logger.js';
|
7
16
|
import { handleLoadableError } from '../../client/TolgeeClient.js';
|
8
|
-
const asyncHandler = (config) =>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
const asyncHandler = (config) => function () {
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
19
|
+
var _a;
|
20
|
+
const opts = this.optsWithGlobals();
|
21
|
+
const rawKeys = yield loading('Analyzing code...', extractKeysOfFiles(opts));
|
22
|
+
dumpWarnings(rawKeys);
|
23
|
+
const localKeys = filterExtractionResult(rawKeys);
|
24
|
+
const loadable = yield opts.client.GET('/v2/projects/{projectId}/all-keys', { params: { path: { projectId: opts.client.getProjectId() } } });
|
25
|
+
handleLoadableError(loadable);
|
26
|
+
const remoteKeys = (_a = loadable.data._embedded.keys) !== null && _a !== void 0 ? _a : [];
|
27
|
+
const diff = compareKeys(localKeys, remoteKeys);
|
28
|
+
if (!diff.added.length && !diff.removed.length) {
|
29
|
+
console.log(ansi.green('Your code project is in sync with the associated Tolgee project!'));
|
30
|
+
process.exit(0);
|
31
|
+
}
|
32
|
+
console.log('Your code project and Tolgee project are out of sync.');
|
33
|
+
if (diff.added.length) {
|
34
|
+
const key = diff.added.length === 1 ? 'key' : 'keys';
|
35
|
+
console.log(ansi.green.bold(`${diff.added.length} new ${key} found`));
|
36
|
+
for (const key of diff.added) {
|
37
|
+
printKey(key, false);
|
38
|
+
}
|
39
|
+
// Line break
|
40
|
+
console.log('');
|
27
41
|
}
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
42
|
+
if (diff.removed.length) {
|
43
|
+
const key = diff.removed.length === 1 ? 'key' : 'keys';
|
44
|
+
console.log(ansi.red.bold(`${diff.removed.length} unused ${key}`));
|
45
|
+
for (const key of diff.removed) {
|
46
|
+
printKey(key, true);
|
47
|
+
}
|
48
|
+
// Line break
|
49
|
+
console.log('');
|
36
50
|
}
|
37
|
-
|
38
|
-
|
39
|
-
}
|
40
|
-
console.log('Run `tolgee sync` to synchronize the projects.');
|
51
|
+
console.log('Run `tolgee sync` to synchronize the projects.');
|
52
|
+
});
|
41
53
|
};
|
42
54
|
export default (config) => new Command()
|
43
55
|
.name('compare')
|
@@ -1,3 +1,12 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
1
10
|
import { Command, Option } from 'commander';
|
2
11
|
import ansi from 'ansi-colors';
|
3
12
|
import { extractKeysOfFiles, filterExtractionResult, } from '../../extractor/runner.js';
|
@@ -8,114 +17,124 @@ import { unzipBuffer } from '../../utils/zip.js';
|
|
8
17
|
import { askBoolean } from '../../utils/ask.js';
|
9
18
|
import { loading, exitWithError } from '../../utils/logger.js';
|
10
19
|
import { handleLoadableError, } from '../../client/TolgeeClient.js';
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
20
|
+
function backup(client, dest) {
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
22
|
+
const loadable = yield client.export.export({
|
23
|
+
format: 'JSON',
|
24
|
+
supportArrays: false,
|
25
|
+
filterState: ['UNTRANSLATED', 'TRANSLATED', 'REVIEWED'],
|
26
|
+
structureDelimiter: '',
|
27
|
+
});
|
28
|
+
handleLoadableError(loadable);
|
29
|
+
const blob = loadable.data;
|
30
|
+
yield unzipBuffer(blob, dest);
|
17
31
|
});
|
18
|
-
handleLoadableError(loadable);
|
19
|
-
const blob = loadable.data;
|
20
|
-
await unzipBuffer(blob, dest);
|
21
32
|
}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
34
|
-
const syncHandler = (config) => async function () {
|
35
|
-
const opts = this.optsWithGlobals();
|
36
|
-
const rawKeys = await loading('Analyzing code...', extractKeysOfFiles(opts));
|
37
|
-
const warnCount = dumpWarnings(rawKeys);
|
38
|
-
if (!opts.continueOnWarning && warnCount) {
|
39
|
-
console.log(ansi.bold.red('Aborting as warnings have been emitted.'));
|
40
|
-
process.exit(1);
|
41
|
-
}
|
42
|
-
const localKeys = filterExtractionResult(rawKeys);
|
43
|
-
const allKeysLoadable = await opts.client.GET('/v2/projects/{projectId}/all-keys', {
|
44
|
-
params: { path: { projectId: opts.client.getProjectId() } },
|
45
|
-
});
|
46
|
-
handleLoadableError(allKeysLoadable);
|
47
|
-
const remoteKeys = allKeysLoadable.data?._embedded?.keys ?? [];
|
48
|
-
const diff = compareKeys(localKeys, remoteKeys);
|
49
|
-
if (!diff.added.length && !diff.removed.length) {
|
50
|
-
console.log(ansi.green('Your code project is in sync with the associated Tolgee project!'));
|
51
|
-
process.exit(0);
|
52
|
-
}
|
53
|
-
// Load project settings. We're interested in the default locale here.
|
54
|
-
const projectLoadable = await opts.client.GET('/v2/projects/{projectId}', {
|
55
|
-
params: { path: { projectId: opts.client.getProjectId() } },
|
33
|
+
function askForConfirmation(keys, operation) {
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
35
|
+
if (!process.stdout.isTTY) {
|
36
|
+
exitWithError('You must run this command interactively, or specify --yes to proceed.');
|
37
|
+
}
|
38
|
+
const str = `The following keys will be ${operation}:`;
|
39
|
+
console.log(operation === 'created' ? ansi.bold.green(str) : ansi.bold.red(str));
|
40
|
+
keys.forEach((k) => printKey(k, operation === 'deleted'));
|
41
|
+
const shouldContinue = yield askBoolean('Does this look correct?', true);
|
42
|
+
if (!shouldContinue) {
|
43
|
+
exitWithError('Aborting.');
|
44
|
+
}
|
56
45
|
});
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
}
|
68
|
-
// Create new keys
|
69
|
-
if (diff.added.length) {
|
70
|
-
if (!opts.yes) {
|
71
|
-
await askForConfirmation(diff.added, 'created');
|
46
|
+
}
|
47
|
+
const syncHandler = (config) => function () {
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
49
|
+
var _a, _b, _c;
|
50
|
+
const opts = this.optsWithGlobals();
|
51
|
+
const rawKeys = yield loading('Analyzing code...', extractKeysOfFiles(opts));
|
52
|
+
const warnCount = dumpWarnings(rawKeys);
|
53
|
+
if (!opts.continueOnWarning && warnCount) {
|
54
|
+
console.log(ansi.bold.red('Aborting as warnings have been emitted.'));
|
55
|
+
process.exit(1);
|
72
56
|
}
|
73
|
-
const
|
74
|
-
|
75
|
-
namespace: key.namespace,
|
76
|
-
translations: key.defaultValue
|
77
|
-
? { [baseLanguage.tag]: key.defaultValue }
|
78
|
-
: {},
|
79
|
-
tags: opts.tagNewKeys,
|
80
|
-
}));
|
81
|
-
const loadable = await loading('Creating missing keys...', opts.client.POST('/v2/projects/{projectId}/keys/import', {
|
57
|
+
const localKeys = filterExtractionResult(rawKeys);
|
58
|
+
const allKeysLoadable = yield opts.client.GET('/v2/projects/{projectId}/all-keys', {
|
82
59
|
params: { path: { projectId: opts.client.getProjectId() } },
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
60
|
+
});
|
61
|
+
handleLoadableError(allKeysLoadable);
|
62
|
+
const remoteKeys = (_c = (_b = (_a = allKeysLoadable.data) === null || _a === void 0 ? void 0 : _a._embedded) === null || _b === void 0 ? void 0 : _b.keys) !== null && _c !== void 0 ? _c : [];
|
63
|
+
const diff = compareKeys(localKeys, remoteKeys);
|
64
|
+
if (!diff.added.length && !diff.removed.length) {
|
65
|
+
console.log(ansi.green('Your code project is in sync with the associated Tolgee project!'));
|
66
|
+
process.exit(0);
|
67
|
+
}
|
68
|
+
// Load project settings. We're interested in the default locale here.
|
69
|
+
const projectLoadable = yield opts.client.GET('/v2/projects/{projectId}', {
|
70
|
+
params: { path: { projectId: opts.client.getProjectId() } },
|
71
|
+
});
|
72
|
+
handleLoadableError(projectLoadable);
|
73
|
+
const baseLanguage = projectLoadable.data.baseLanguage;
|
74
|
+
if (!baseLanguage) {
|
75
|
+
// I'm highly unsure how we could reach this state, but this is what the OAI spec tells me ¯\_(ツ)_/¯
|
76
|
+
exitWithError('Your project does not have a base language!');
|
77
|
+
}
|
78
|
+
// Prepare backup
|
79
|
+
if (opts.backup) {
|
80
|
+
yield prepareDir(opts.backup, opts.yes);
|
81
|
+
yield loading('Backing up Tolgee project', backup(opts.client, opts.backup));
|
82
|
+
}
|
83
|
+
// Create new keys
|
84
|
+
if (diff.added.length) {
|
90
85
|
if (!opts.yes) {
|
91
|
-
|
86
|
+
yield askForConfirmation(diff.added, 'created');
|
92
87
|
}
|
93
|
-
const
|
94
|
-
|
88
|
+
const keys = diff.added.map((key) => ({
|
89
|
+
name: key.keyName,
|
90
|
+
namespace: key.namespace,
|
91
|
+
translations: key.defaultValue
|
92
|
+
? { [baseLanguage.tag]: key.defaultValue }
|
93
|
+
: {},
|
94
|
+
tags: opts.tagNewKeys,
|
95
|
+
}));
|
96
|
+
const loadable = yield loading('Creating missing keys...', opts.client.POST('/v2/projects/{projectId}/keys/import', {
|
95
97
|
params: { path: { projectId: opts.client.getProjectId() } },
|
96
|
-
body: {
|
98
|
+
body: { keys },
|
97
99
|
}));
|
98
100
|
handleLoadableError(loadable);
|
99
101
|
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
102
|
+
if (opts.removeUnused) {
|
103
|
+
// Delete unused keys.
|
104
|
+
if (diff.removed.length) {
|
105
|
+
if (!opts.yes) {
|
106
|
+
yield askForConfirmation(diff.removed, 'deleted');
|
107
|
+
}
|
108
|
+
const ids = yield diff.removed.map((k) => k.id);
|
109
|
+
const loadable = yield loading('Deleting unused keys...', opts.client.DELETE('/v2/projects/{projectId}/keys', {
|
110
|
+
params: { path: { projectId: opts.client.getProjectId() } },
|
111
|
+
body: { ids },
|
112
|
+
}));
|
113
|
+
handleLoadableError(loadable);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
console.log(ansi.bold.green('Sync complete!'));
|
117
|
+
console.log(ansi.green(`+ ${diff.added.length} string${diff.added.length === 1 ? '' : 's'}`));
|
118
|
+
if (opts.removeUnused) {
|
119
|
+
console.log(ansi.red(`- ${diff.removed.length} string${diff.removed.length === 1 ? '' : 's'}`));
|
120
|
+
}
|
121
|
+
else {
|
122
|
+
console.log(ansi.italic(`${diff.removed.length} unused key${diff.removed.length === 1 ? '' : 's'} could be deleted.`));
|
123
|
+
}
|
124
|
+
if (opts.backup) {
|
125
|
+
console.log(ansi.blueBright(`A backup of the project prior to the synchronization has been dumped in ${opts.backup}.`));
|
126
|
+
}
|
127
|
+
});
|
128
|
+
};
|
129
|
+
export default (config) => {
|
130
|
+
var _a, _b, _c, _d, _e, _f;
|
131
|
+
return new Command()
|
132
|
+
.name('sync')
|
133
|
+
.description('Synchronizes the keys in your code project and in the Tolgee project, by creating missing keys and optionally deleting unused ones. For a dry-run, use `tolgee compare`.')
|
134
|
+
.addOption(new Option('-B, --backup <path>', 'Store translation files backup (only translation files, not states, comments, tags, etc.). If something goes wrong, the backup can be used to restore the project to its previous state.').default((_b = (_a = config.sync) === null || _a === void 0 ? void 0 : _a.backup) !== null && _b !== void 0 ? _b : false))
|
135
|
+
.addOption(new Option('--continue-on-warning', 'Set this flag to continue the sync if warnings are detected during string extraction. By default, as warnings may indicate an invalid extraction, the CLI will abort the sync.').default((_d = (_c = config.sync) === null || _c === void 0 ? void 0 : _c.continueOnWarning) !== null && _d !== void 0 ? _d : false))
|
136
|
+
.addOption(new Option('-Y, --yes', 'Skip prompts and automatically say yes to them. You will not be asked for confirmation before creating/deleting keys.').default(false))
|
137
|
+
.addOption(new Option('--remove-unused', 'Delete unused keys from the Tolgee project.').default((_f = (_e = config.sync) === null || _e === void 0 ? void 0 : _e.removeUnused) !== null && _f !== void 0 ? _f : false))
|
138
|
+
.option('--tag-new-keys <tags...>', 'Specify tags that will be added to newly created keys.')
|
139
|
+
.action(syncHandler(config));
|
112
140
|
};
|
113
|
-
export default (config) => new Command()
|
114
|
-
.name('sync')
|
115
|
-
.description('Synchronizes the keys in your code project and in the Tolgee project, by creating missing keys and optionally deleting unused ones. For a dry-run, use `tolgee compare`.')
|
116
|
-
.addOption(new Option('-B, --backup <path>', 'Store translation files backup (only translation files, not states, comments, tags, etc.). If something goes wrong, the backup can be used to restore the project to its previous state.').default(config.sync?.backup ?? false))
|
117
|
-
.addOption(new Option('--continue-on-warning', 'Set this flag to continue the sync if warnings are detected during string extraction. By default, as warnings may indicate an invalid extraction, the CLI will abort the sync.').default(config.sync?.continueOnWarning ?? false))
|
118
|
-
.addOption(new Option('-Y, --yes', 'Skip prompts and automatically say yes to them. You will not be asked for confirmation before creating/deleting keys.').default(false))
|
119
|
-
.addOption(new Option('--remove-unused', 'Delete unused keys from the Tolgee project.').default(config.sync?.removeUnused ?? false))
|
120
|
-
.option('--tag-new-keys <tags...>', 'Specify tags that will be added to newly created keys.')
|
121
|
-
.action(syncHandler(config));
|
@@ -26,11 +26,12 @@ export function printKey(key, deletion) {
|
|
26
26
|
* @returns A list of added and removed keys.
|
27
27
|
*/
|
28
28
|
export function compareKeys(local, remote) {
|
29
|
+
var _a;
|
29
30
|
const result = { added: [], removed: [] };
|
30
31
|
// Deleted keys
|
31
32
|
for (const remoteKey of remote) {
|
32
33
|
const namespace = remoteKey.namespace || NullNamespace;
|
33
|
-
const keyExists = local[namespace]
|
34
|
+
const keyExists = (_a = local[namespace]) === null || _a === void 0 ? void 0 : _a.delete(remoteKey.name);
|
34
35
|
if (!keyExists) {
|
35
36
|
result.removed.push({
|
36
37
|
id: remoteKey.id,
|
package/dist/commands/tag.js
CHANGED
@@ -1,45 +1,59 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
1
10
|
import { Command, Option } from 'commander';
|
2
11
|
import { handleLoadableError } from '../client/TolgeeClient.js';
|
3
12
|
import { exitWithError, loading, success } from '../utils/logger.js';
|
4
13
|
import { extractKeysOfFiles } from '../extractor/runner.js';
|
5
|
-
const tagHandler = (config) =>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
if (opts.filterExtracted
|
10
|
-
|
14
|
+
const tagHandler = (config) => function () {
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
16
|
+
const opts = this.optsWithGlobals();
|
17
|
+
let extractedKeys;
|
18
|
+
if (opts.filterExtracted || opts.filterNotExtracted) {
|
19
|
+
if (opts.filterExtracted && opts.filterNotExtracted) {
|
20
|
+
exitWithError('Use either "--filter-extracted" or "--filter-not-extracted", not both');
|
21
|
+
}
|
22
|
+
const extracted = yield loading('Analyzing code...', extractKeysOfFiles(opts));
|
23
|
+
const keys = [...extracted.values()].flatMap((item) => item.keys);
|
24
|
+
extractedKeys = keys.map((key) => ({
|
25
|
+
name: key.keyName,
|
26
|
+
namespace: key.namespace,
|
27
|
+
}));
|
11
28
|
}
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
29
|
+
const loadable = yield loading('Tagging...', opts.client.PUT('/v2/projects/{projectId}/tag-complex', {
|
30
|
+
params: { path: { projectId: opts.client.getProjectId() } },
|
31
|
+
body: {
|
32
|
+
filterTag: opts.filterTag,
|
33
|
+
filterTagNot: opts.filterNoTag,
|
34
|
+
tagFiltered: opts.tag,
|
35
|
+
tagOther: opts.tagOther,
|
36
|
+
untagFiltered: opts.untag,
|
37
|
+
untagOther: opts.untagOther,
|
38
|
+
filterKeys: opts.filterExtracted ? extractedKeys : undefined,
|
39
|
+
filterKeysNot: opts.filterNotExtracted ? extractedKeys : undefined,
|
40
|
+
},
|
17
41
|
}));
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
42
|
+
handleLoadableError(loadable);
|
43
|
+
success('Done!');
|
44
|
+
});
|
45
|
+
};
|
46
|
+
export default (config) => {
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
48
|
+
return new Command('tag')
|
49
|
+
.description('Update tags in your project.')
|
50
|
+
.addOption(new Option('--filter-extracted', 'Extract keys from code and filter by it.').default((_a = config.tag) === null || _a === void 0 ? void 0 : _a.filterExtracted))
|
51
|
+
.addOption(new Option('--filter-not-extracted', 'Extract keys from code and filter them out.').default((_b = config.tag) === null || _b === void 0 ? void 0 : _b.filterNotExtracted))
|
52
|
+
.addOption(new Option('--filter-tag <tags...>', 'Filter only keys with tag. Use * as a wildcard.').default((_c = config.tag) === null || _c === void 0 ? void 0 : _c.filterTag))
|
53
|
+
.addOption(new Option('--filter-no-tag <tags...>', 'Filter only keys without tag. Use * as a wildcard.').default((_d = config.tag) === null || _d === void 0 ? void 0 : _d.filterNoTag))
|
54
|
+
.addOption(new Option('--tag <tags...>', 'Add tag to filtered keys.').default((_e = config.tag) === null || _e === void 0 ? void 0 : _e.tag))
|
55
|
+
.addOption(new Option('--tag-other <tags...>', 'Tag keys which are not filtered.').default((_f = config.tag) === null || _f === void 0 ? void 0 : _f.tagOther))
|
56
|
+
.addOption(new Option('--untag <tags...>', 'Remove tag from filtered keys. Use * as a wildcard.').default((_g = config.tag) === null || _g === void 0 ? void 0 : _g.untag))
|
57
|
+
.addOption(new Option('--untag-other <tags...>', 'Remove tag from keys which are not filtered. Use * as a wildcard.').default((_h = config.tag) === null || _h === void 0 ? void 0 : _h.untagOther))
|
58
|
+
.action(tagHandler(config));
|
34
59
|
};
|
35
|
-
export default (config) => new Command('tag')
|
36
|
-
.description('Update tags in your project.')
|
37
|
-
.addOption(new Option('--filter-extracted', 'Extract keys from code and filter by it.').default(config.tag?.filterExtracted))
|
38
|
-
.addOption(new Option('--filter-not-extracted', 'Extract keys from code and filter them out.').default(config.tag?.filterNotExtracted))
|
39
|
-
.addOption(new Option('--filter-tag <tags...>', 'Filter only keys with tag. Use * as a wildcard.').default(config.tag?.filterTag))
|
40
|
-
.addOption(new Option('--filter-no-tag <tags...>', 'Filter only keys without tag. Use * as a wildcard.').default(config.tag?.filterNoTag))
|
41
|
-
.addOption(new Option('--tag <tags...>', 'Add tag to filtered keys.').default(config.tag?.tag))
|
42
|
-
.addOption(new Option('--tag-other <tags...>', 'Tag keys which are not filtered.').default(config.tag?.tagOther))
|
43
|
-
.addOption(new Option('--untag <tags...>', 'Remove tag from filtered keys. Use * as a wildcard.').default(config.tag?.untag))
|
44
|
-
.addOption(new Option('--untag-other <tags...>', 'Remove tag from keys which are not filtered. Use * as a wildcard.').default(config.tag?.untagOther))
|
45
|
-
.action(tagHandler(config));
|