@tolgee/cli
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -13,3 +13,3 @@ import { Command } from 'commander'; | ||
catch (e) { | ||
if (e instanceof HttpError && e.response.status === 403) { | ||
if (e instanceof HttpError && e.response.status === 401) { | ||
error("Couldn't log in: the API key you provided is invalid."); | ||
@@ -16,0 +16,0 @@ process.exit(1); |
import { Command, Option } from 'commander'; | ||
import { unzipBuffer } from '../utils/zip.js'; | ||
import { overwriteDir } from '../utils/overwriteDir.js'; | ||
import { loading, success } from '../utils/logger.js'; | ||
import { error, loading, success } from '../utils/logger.js'; | ||
import { HttpError } from '../client/errors.js'; | ||
async function fetchZipBlob(opts) { | ||
@@ -11,2 +12,3 @@ return opts.client.export.export({ | ||
structureDelimiter: opts.delimiter, | ||
filterNamespace: opts.namespaces, | ||
}); | ||
@@ -17,5 +19,15 @@ } | ||
await overwriteDir(path, opts.overwrite); | ||
const zipBlob = await loading('Fetching strings from Tolgee...', fetchZipBlob(opts)); | ||
await loading('Extracting strings...', unzipBuffer(zipBlob, path)); | ||
success('Done!'); | ||
try { | ||
const zipBlob = await loading('Fetching strings from Tolgee...', fetchZipBlob(opts)); | ||
await loading('Extracting strings...', unzipBuffer(zipBlob, path)); | ||
success('Done!'); | ||
} | ||
catch (e) { | ||
if (e instanceof HttpError && e.response.status === 400) { | ||
const res = await e.response.json(); | ||
error(`Please check if your parameters, including namespaces, are configured correctly. Tolgee responded with: ${res.code}`); | ||
return; | ||
} | ||
throw e; | ||
} | ||
} | ||
@@ -37,3 +49,4 @@ export default new Command() | ||
.argParser((v) => v || '')) | ||
.addOption(new Option('-n, --namespaces <namespaces...>', 'List of namespaces to pull. Defaults to all namespaces')) | ||
.option('-o, --overwrite', 'Whether to automatically overwrite existing files. BE CAREFUL, THIS WILL WIPE *ALL* THE CONTENTS OF THE TARGET FOLDER. If unspecified, the user will be prompted interactively, or the command will fail when in non-interactive') | ||
.action(pullHandler); |
@@ -52,3 +52,3 @@ import { cosmiconfig, defaultLoaders } from 'cosmiconfig'; | ||
} | ||
cfg.delimiter = rc.delimiter || void 0; | ||
cfg.delimiter = rc.delimiter || ''; | ||
} | ||
@@ -55,0 +55,0 @@ return cfg; |
@@ -11,2 +11,2 @@ import { readFileSync } from 'fs'; | ||
export const API_KEY_PAK_PREFIX = 'tgpak_'; | ||
export const SDKS = ['react']; | ||
export const SDKS = ['react', 'vue', 'svelte']; |
{ | ||
"name": "@tolgee/cli", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "A tool to interact with the Tolgee Platform through CLI", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
904350
4505