@tolgee/cli 1.4.0 → 2.0.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/{index.js → cli.js} +54 -62
- package/dist/client/ApiClient.js +72 -0
- package/dist/client/ExportClient.js +19 -0
- package/dist/client/ImportClient.js +22 -0
- package/dist/client/TolgeeClient.js +18 -0
- package/dist/client/errorFromLoadable.js +35 -0
- package/dist/client/getApiKeyInformation.js +39 -0
- package/dist/client/internal/requester.js +2 -5
- package/dist/commands/extract/check.js +10 -8
- package/dist/commands/extract/print.js +10 -8
- package/dist/commands/extract.js +3 -5
- package/dist/commands/login.js +6 -14
- package/dist/commands/pull.js +38 -32
- package/dist/commands/push.js +89 -71
- package/dist/commands/sync/compare.js +14 -11
- package/dist/commands/sync/sync.js +41 -24
- package/dist/commands/tag.js +49 -0
- package/dist/config/tolgeerc.js +59 -36
- package/dist/constants.js +0 -1
- package/dist/extractor/machines/vue/decoder.js +1 -1
- package/dist/options.js +31 -7
- package/dist/utils/checkPathNotAFile.js +16 -0
- package/dist/utils/getSingleOption.js +10 -0
- package/dist/utils/getStackTrace.js +7 -0
- package/dist/utils/logger.js +18 -0
- package/dist/utils/mapExportFormat.js +62 -0
- package/dist/utils/mapImportFormat.js +18 -0
- package/dist/utils/prepareDir.js +12 -0
- package/dist/utils/zip.js +2 -7
- package/package.json +17 -13
- package/schema.json +175 -0
- package/dist/arguments.js +0 -2
- package/dist/client/errors.js +0 -37
- package/dist/client/export.js +0 -20
- package/dist/client/import.js +0 -55
- package/dist/client/index.js +0 -73
- package/dist/client/languages.js +0 -13
- package/dist/client/project.js +0 -41
- package/dist/utils/overwriteDir.js +0 -34
@@ -1,34 +0,0 @@
|
|
1
|
-
import { resolve } from 'path';
|
2
|
-
import { stat, rm, mkdir } from 'fs/promises';
|
3
|
-
import { askBoolean } from './ask.js';
|
4
|
-
import { warn, error } from './logger.js';
|
5
|
-
export async function overwriteDir(path, overwrite) {
|
6
|
-
try {
|
7
|
-
const stats = await stat(path);
|
8
|
-
if (!stats.isDirectory()) {
|
9
|
-
error('The specified path already exists and is not a directory.');
|
10
|
-
process.exit(1);
|
11
|
-
}
|
12
|
-
if (!overwrite) {
|
13
|
-
if (!process.stdout.isTTY) {
|
14
|
-
error('The specified path already exists.');
|
15
|
-
process.exit(1);
|
16
|
-
}
|
17
|
-
warn(`The specified path ${resolve(path)} already exists.`);
|
18
|
-
const userOverwrite = await askBoolean('Do you want to overwrite data? *BE CAREFUL, ALL THE CONTENTS OF THE DESTINATION FOLDER WILL BE DESTROYED*.');
|
19
|
-
if (!userOverwrite) {
|
20
|
-
error('Aborting.');
|
21
|
-
process.exit(1);
|
22
|
-
}
|
23
|
-
// Purge data as requested.
|
24
|
-
await rm(path, { recursive: true });
|
25
|
-
}
|
26
|
-
}
|
27
|
-
catch (e) {
|
28
|
-
if (e.code !== 'ENOENT') {
|
29
|
-
throw e;
|
30
|
-
}
|
31
|
-
}
|
32
|
-
// Create the directory
|
33
|
-
await mkdir(path, { recursive: true });
|
34
|
-
}
|