@vocab/phrase
Advanced tools
Comparing version 0.0.0-global-key-support-20231025223328 to 0.0.0-master-20240711232538
@@ -1,2 +0,2 @@ | ||
export { pull } from './pull-translations'; | ||
export { push } from './push-translations'; | ||
export { pull } from "./pull-translations.js"; | ||
export { push } from "./push-translations.js"; |
@@ -1,2 +0,2 @@ | ||
import type { UserConfig } from '@vocab/core'; | ||
import { type UserConfig } from '@vocab/core'; | ||
interface PullOptions { | ||
@@ -3,0 +3,0 @@ branch?: string; |
@@ -1,2 +0,2 @@ | ||
import type { UserConfig } from '@vocab/core'; | ||
import { type UserConfig } from '@vocab/core'; | ||
interface PushOptions { | ||
@@ -3,0 +3,0 @@ branch: string; |
export * from "./declarations/src/index"; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidm9jYWItcGhyYXNlLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ== |
@@ -8,5 +8,3 @@ 'use strict'; | ||
var core = require('@vocab/core'); | ||
var FormData = require('form-data'); | ||
var fetch = require('node-fetch'); | ||
var chalk = require('chalk'); | ||
var pc = require('picocolors'); | ||
var debug = require('debug'); | ||
@@ -18,5 +16,3 @@ var sync = require('csv-stringify/sync'); | ||
var path__default = /*#__PURE__*/_interopDefault(path); | ||
var FormData__default = /*#__PURE__*/_interopDefault(FormData); | ||
var fetch__default = /*#__PURE__*/_interopDefault(fetch); | ||
var chalk__default = /*#__PURE__*/_interopDefault(chalk); | ||
var pc__default = /*#__PURE__*/_interopDefault(pc); | ||
var debug__default = /*#__PURE__*/_interopDefault(debug); | ||
@@ -30,3 +26,3 @@ | ||
// eslint-disable-next-line no-console | ||
console.log(chalk__default["default"].yellow('Vocab'), ...params); | ||
console.log(pc__default["default"].yellow('Vocab'), ...params); | ||
}; | ||
@@ -48,4 +44,4 @@ | ||
altLanguages.map(language => { | ||
var _translations$languag, _translations$languag2; | ||
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0 ? void 0 : (_translations$languag2 = _translations$languag[key]) === null || _translations$languag2 === void 0 ? void 0 : _translations$languag2.message; | ||
var _translations$languag; | ||
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0 || (_translations$languag = _translations$languag[key]) === null || _translations$languag === void 0 ? void 0 : _translations$languag.message; | ||
if (altTranslationMessage) { | ||
@@ -86,3 +82,3 @@ csvFilesByLanguage[language].push([...sharedData, altTranslationMessage]); | ||
} | ||
return fetch__default["default"](path, { | ||
return fetch(path, { | ||
...options, | ||
@@ -92,3 +88,3 @@ headers: { | ||
// Provide identification via User Agent as requested in https://developers.phrase.com/api/#overview--identification-via-user-agent | ||
'User-Agent': 'SEEK Demo Candidate App (jhope@seek.com.au)', | ||
'User-Agent': 'Vocab Client (https://github.com/seek-oss/vocab)', | ||
...options.headers | ||
@@ -166,8 +162,6 @@ } | ||
for (const [language, csvFileString] of Object.entries(csvFileStrings)) { | ||
const formData = new FormData__default["default"](); | ||
const fileContents = Buffer.from(csvFileString); | ||
formData.append('file', fileContents, { | ||
contentType: 'text/csv', | ||
filename: `${language}.translations.csv` | ||
}); | ||
const formData = new FormData(); | ||
formData.append('file', new Blob([csvFileString], { | ||
type: 'text/csv' | ||
}), `${language}.translations.csv`); | ||
formData.append('file_format', 'csv'); | ||
@@ -177,6 +171,6 @@ formData.append('branch', branch); | ||
formData.append('update_descriptions', 'true'); | ||
formData.append(`locale_mapping[${language}]`, messageIndex); | ||
formData.append('format_options[key_index]', keyIndex); | ||
formData.append('format_options[comment_index]', commentIndex); | ||
formData.append('format_options[tag_column]', tagColumn); | ||
formData.append(`locale_mapping[${language}]`, messageIndex.toString()); | ||
formData.append('format_options[key_index]', keyIndex.toString()); | ||
formData.append('format_options[comment_index]', commentIndex.toString()); | ||
formData.append('format_options[tag_column]', tagColumn.toString()); | ||
formData.append('format_options[enable_pluralization]', 'false'); | ||
@@ -340,3 +334,2 @@ log(`Uploading translations for language ${language}`); | ||
for (const localKey of Object.keys(localTranslations)) { | ||
var _globalKey; | ||
const { | ||
@@ -349,7 +342,4 @@ tags = [], | ||
} | ||
let globalKey; | ||
if (loadedTranslation.languages[config.devLanguage][localKey].globalKey) { | ||
globalKey = loadedTranslation.languages[config.devLanguage][localKey].globalKey; | ||
} | ||
const phraseKey = (_globalKey = globalKey) !== null && _globalKey !== void 0 ? _globalKey : core.getUniqueKey(localKey, loadedTranslation.namespace); | ||
const globalKey = loadedTranslation.languages[config.devLanguage][localKey].globalKey; | ||
const phraseKey = globalKey !== null && globalKey !== void 0 ? globalKey : core.getUniqueKey(localKey, loadedTranslation.namespace); | ||
phraseTranslations[language][phraseKey] = localTranslation; | ||
@@ -356,0 +346,0 @@ } |
@@ -8,5 +8,3 @@ 'use strict'; | ||
var core = require('@vocab/core'); | ||
var FormData = require('form-data'); | ||
var fetch = require('node-fetch'); | ||
var chalk = require('chalk'); | ||
var pc = require('picocolors'); | ||
var debug = require('debug'); | ||
@@ -18,5 +16,3 @@ var sync = require('csv-stringify/sync'); | ||
var path__default = /*#__PURE__*/_interopDefault(path); | ||
var FormData__default = /*#__PURE__*/_interopDefault(FormData); | ||
var fetch__default = /*#__PURE__*/_interopDefault(fetch); | ||
var chalk__default = /*#__PURE__*/_interopDefault(chalk); | ||
var pc__default = /*#__PURE__*/_interopDefault(pc); | ||
var debug__default = /*#__PURE__*/_interopDefault(debug); | ||
@@ -30,3 +26,3 @@ | ||
// eslint-disable-next-line no-console | ||
console.log(chalk__default["default"].yellow('Vocab'), ...params); | ||
console.log(pc__default["default"].yellow('Vocab'), ...params); | ||
}; | ||
@@ -48,4 +44,4 @@ | ||
altLanguages.map(language => { | ||
var _translations$languag, _translations$languag2; | ||
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0 ? void 0 : (_translations$languag2 = _translations$languag[key]) === null || _translations$languag2 === void 0 ? void 0 : _translations$languag2.message; | ||
var _translations$languag; | ||
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0 || (_translations$languag = _translations$languag[key]) === null || _translations$languag === void 0 ? void 0 : _translations$languag.message; | ||
if (altTranslationMessage) { | ||
@@ -86,3 +82,3 @@ csvFilesByLanguage[language].push([...sharedData, altTranslationMessage]); | ||
} | ||
return fetch__default["default"](path, { | ||
return fetch(path, { | ||
...options, | ||
@@ -92,3 +88,3 @@ headers: { | ||
// Provide identification via User Agent as requested in https://developers.phrase.com/api/#overview--identification-via-user-agent | ||
'User-Agent': 'SEEK Demo Candidate App (jhope@seek.com.au)', | ||
'User-Agent': 'Vocab Client (https://github.com/seek-oss/vocab)', | ||
...options.headers | ||
@@ -166,8 +162,6 @@ } | ||
for (const [language, csvFileString] of Object.entries(csvFileStrings)) { | ||
const formData = new FormData__default["default"](); | ||
const fileContents = Buffer.from(csvFileString); | ||
formData.append('file', fileContents, { | ||
contentType: 'text/csv', | ||
filename: `${language}.translations.csv` | ||
}); | ||
const formData = new FormData(); | ||
formData.append('file', new Blob([csvFileString], { | ||
type: 'text/csv' | ||
}), `${language}.translations.csv`); | ||
formData.append('file_format', 'csv'); | ||
@@ -177,6 +171,6 @@ formData.append('branch', branch); | ||
formData.append('update_descriptions', 'true'); | ||
formData.append(`locale_mapping[${language}]`, messageIndex); | ||
formData.append('format_options[key_index]', keyIndex); | ||
formData.append('format_options[comment_index]', commentIndex); | ||
formData.append('format_options[tag_column]', tagColumn); | ||
formData.append(`locale_mapping[${language}]`, messageIndex.toString()); | ||
formData.append('format_options[key_index]', keyIndex.toString()); | ||
formData.append('format_options[comment_index]', commentIndex.toString()); | ||
formData.append('format_options[tag_column]', tagColumn.toString()); | ||
formData.append('format_options[enable_pluralization]', 'false'); | ||
@@ -340,3 +334,2 @@ log(`Uploading translations for language ${language}`); | ||
for (const localKey of Object.keys(localTranslations)) { | ||
var _globalKey; | ||
const { | ||
@@ -349,7 +342,4 @@ tags = [], | ||
} | ||
let globalKey; | ||
if (loadedTranslation.languages[config.devLanguage][localKey].globalKey) { | ||
globalKey = loadedTranslation.languages[config.devLanguage][localKey].globalKey; | ||
} | ||
const phraseKey = (_globalKey = globalKey) !== null && _globalKey !== void 0 ? _globalKey : core.getUniqueKey(localKey, loadedTranslation.namespace); | ||
const globalKey = loadedTranslation.languages[config.devLanguage][localKey].globalKey; | ||
const phraseKey = globalKey !== null && globalKey !== void 0 ? globalKey : core.getUniqueKey(localKey, loadedTranslation.namespace); | ||
phraseTranslations[language][phraseKey] = localTranslation; | ||
@@ -356,0 +346,0 @@ } |
import { promises } from 'fs'; | ||
import path from 'path'; | ||
import { getAltLanguages, loadAllTranslations, getUniqueKey, getAltLanguageFilePath } from '@vocab/core'; | ||
import FormData from 'form-data'; | ||
import fetch from 'node-fetch'; | ||
import chalk from 'chalk'; | ||
import pc from 'picocolors'; | ||
import debug from 'debug'; | ||
@@ -16,3 +14,3 @@ import { stringify } from 'csv-stringify/sync'; | ||
// eslint-disable-next-line no-console | ||
console.log(chalk.yellow('Vocab'), ...params); | ||
console.log(pc.yellow('Vocab'), ...params); | ||
}; | ||
@@ -34,4 +32,4 @@ | ||
altLanguages.map(language => { | ||
var _translations$languag, _translations$languag2; | ||
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0 ? void 0 : (_translations$languag2 = _translations$languag[key]) === null || _translations$languag2 === void 0 ? void 0 : _translations$languag2.message; | ||
var _translations$languag; | ||
const altTranslationMessage = (_translations$languag = translations[language]) === null || _translations$languag === void 0 || (_translations$languag = _translations$languag[key]) === null || _translations$languag === void 0 ? void 0 : _translations$languag.message; | ||
if (altTranslationMessage) { | ||
@@ -77,3 +75,3 @@ csvFilesByLanguage[language].push([...sharedData, altTranslationMessage]); | ||
// Provide identification via User Agent as requested in https://developers.phrase.com/api/#overview--identification-via-user-agent | ||
'User-Agent': 'SEEK Demo Candidate App (jhope@seek.com.au)', | ||
'User-Agent': 'Vocab Client (https://github.com/seek-oss/vocab)', | ||
...options.headers | ||
@@ -152,7 +150,5 @@ } | ||
const formData = new FormData(); | ||
const fileContents = Buffer.from(csvFileString); | ||
formData.append('file', fileContents, { | ||
contentType: 'text/csv', | ||
filename: `${language}.translations.csv` | ||
}); | ||
formData.append('file', new Blob([csvFileString], { | ||
type: 'text/csv' | ||
}), `${language}.translations.csv`); | ||
formData.append('file_format', 'csv'); | ||
@@ -162,6 +158,6 @@ formData.append('branch', branch); | ||
formData.append('update_descriptions', 'true'); | ||
formData.append(`locale_mapping[${language}]`, messageIndex); | ||
formData.append('format_options[key_index]', keyIndex); | ||
formData.append('format_options[comment_index]', commentIndex); | ||
formData.append('format_options[tag_column]', tagColumn); | ||
formData.append(`locale_mapping[${language}]`, messageIndex.toString()); | ||
formData.append('format_options[key_index]', keyIndex.toString()); | ||
formData.append('format_options[comment_index]', commentIndex.toString()); | ||
formData.append('format_options[tag_column]', tagColumn.toString()); | ||
formData.append('format_options[enable_pluralization]', 'false'); | ||
@@ -325,3 +321,2 @@ log(`Uploading translations for language ${language}`); | ||
for (const localKey of Object.keys(localTranslations)) { | ||
var _globalKey; | ||
const { | ||
@@ -334,7 +329,4 @@ tags = [], | ||
} | ||
let globalKey; | ||
if (loadedTranslation.languages[config.devLanguage][localKey].globalKey) { | ||
globalKey = loadedTranslation.languages[config.devLanguage][localKey].globalKey; | ||
} | ||
const phraseKey = (_globalKey = globalKey) !== null && _globalKey !== void 0 ? _globalKey : getUniqueKey(localKey, loadedTranslation.namespace); | ||
const globalKey = loadedTranslation.languages[config.devLanguage][localKey].globalKey; | ||
const phraseKey = globalKey !== null && globalKey !== void 0 ? globalKey : getUniqueKey(localKey, loadedTranslation.namespace); | ||
phraseTranslations[language][phraseKey] = localTranslation; | ||
@@ -341,0 +333,0 @@ } |
{ | ||
"name": "@vocab/phrase", | ||
"version": "0.0.0-global-key-support-20231025223328", | ||
"version": "0.0.0-master-20240711232538", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/seek-oss/vocab.git", | ||
"directory": "packages/phrase" | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"main": "dist/vocab-phrase.cjs.js", | ||
@@ -9,12 +17,10 @@ "module": "dist/vocab-phrase.esm.js", | ||
"dependencies": { | ||
"@vocab/core": "0.0.0-global-key-support-20231025223328", | ||
"chalk": "^4.1.0", | ||
"csv-stringify": "^6.2.3", | ||
"debug": "^4.3.1", | ||
"form-data": "^3.0.0", | ||
"node-fetch": "^2.6.1" | ||
"picocolors": "^1.0.0", | ||
"@vocab/core": "^1.6.2" | ||
}, | ||
"devDependencies": { | ||
"@types/debug": "^4.1.5", | ||
"@types/node-fetch": "^2.5.7" | ||
"@types/node": "^18.11.9" | ||
}, | ||
@@ -21,0 +27,0 @@ "files": [ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4
10
3
43920
10
1036
+ Addedpicocolors@^1.0.0
+ Added@vocab/core@1.6.3(transitive)
+ Addedpicocolors@1.1.1(transitive)
- Removedchalk@^4.1.0
- Removedform-data@^3.0.0
- Removednode-fetch@^2.6.1
- Removed@vocab/core@0.0.0-global-key-support-20231025223328(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedform-data@3.0.2(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
Updated@vocab/core@^1.6.2