@opensea/i18n-dl
Advanced tools
Comparing version 0.0.26 to 0.0.27
@@ -123,3 +123,3 @@ #!/usr/bin/env node | ||
var DownloadClient = class extends SmartlingClient { | ||
async download(directory, files) { | ||
async download(directory, files, normalize = true) { | ||
if (!await fileExists(directory)) { | ||
@@ -150,3 +150,3 @@ await createDirectory(directory); | ||
const split = translatedFile.split(path2.sep); | ||
const targetLocaleId = split[split.length - (3 + path2.normalize(directory).split(path2.sep).length)]; | ||
const targetLocaleId = split[split.length - (normalize ? 3 + path2.normalize(directory).split(path2.sep).length : 4 + directory.split(path2.sep).length)]; | ||
const locale = getTargetLocalePath(targetLocaleId); | ||
@@ -176,3 +176,4 @@ const localeFolder = path2.join(directory, locale); | ||
projectId, | ||
directory | ||
directory, | ||
normalize = true | ||
}) => { | ||
@@ -188,3 +189,3 @@ const client = new DownloadClient({ | ||
const files = await glob2(`${directory}/${sourceLocaleId}/**/*.json`); | ||
await client.download(directory, files); | ||
await client.download(directory, files, normalize); | ||
}; | ||
@@ -214,4 +215,8 @@ | ||
process.env.DIRECTORY | ||
).option( | ||
"-n, --normalize <normalize>", | ||
"If path to the locale file should be normalized before being sent to Smartling", | ||
"false" | ||
); | ||
const { userSecret, userIdentifier, ref, projectId, directory } = program.parse().opts(); | ||
const { userSecret, userIdentifier, ref, projectId, directory, normalize } = program.parse().opts(); | ||
const spinner = ora("Processing files for translations...").start(); | ||
@@ -223,3 +228,4 @@ await download({ | ||
projectId, | ||
directory | ||
directory, | ||
normalize: normalize !== "false" | ||
}); | ||
@@ -226,0 +232,0 @@ spinner.succeed("Files for translation downloaded!"); |
{ | ||
"name": "@opensea/i18n-dl", | ||
"version": "0.0.26", | ||
"version": "0.0.27", | ||
"description": "Package for i18n key download", | ||
@@ -22,3 +22,3 @@ "license": "MIT", | ||
"commander": "11.0.0", | ||
"glob": "10.3.3", | ||
"glob": "10.3.4", | ||
"ky": "0.33.3", | ||
@@ -25,0 +25,0 @@ "ora": "7.0.1" |
7721
4
217
+ Addedglob@10.3.4(transitive)
- Removedglob@10.3.3(transitive)
Updatedglob@10.3.4