@ace-de/eua-translations-sync
Advanced tools
Comparing version 2.1.3 to 2.1.4
{ | ||
"name": "@ace-de/eua-translations-sync", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "EUA sync local translate with Google sheet", | ||
@@ -29,3 +29,3 @@ "author": "Computer Rock", | ||
}, | ||
"gitHead": "8415d887eb50e0579be177cc7a7093792d7d7595" | ||
"gitHead": "d79841d8ea0772e5add3bc199612bc77ad4f02aa" | ||
} |
@@ -39,3 +39,3 @@ const spawn = require('@computerrock/react-dev-utils/crossSpawn'); | ||
function getGitDifferences() { | ||
function getGitDifferences(nextVersion, isPreviousAlphaVersion) { | ||
const latestTagResult = spawn.sync('git', ['describe', '--tags', '--abbrev=0']); | ||
@@ -45,4 +45,7 @@ if (latestTagResult.error) throw new Error('Failed to get the latest git version tag.'); | ||
const latestTag = latestTagResult.stdout.toString().trim(); | ||
const comparisonTag = isPreviousAlphaVersion && !nextVersion.includes('alpha') | ||
? latestTag.replace(/.$/, '0') | ||
: latestTag | ||
const gitDifferenceResult = spawn.sync('git', ['diff', `${latestTag}..HEAD`, '--', process.env.LOCALE_TRANSLATIONS_PATH]); | ||
const gitDifferenceResult = spawn.sync('git', ['diff', `${comparisonTag}..HEAD`, '--', process.env.LOCALE_TRANSLATIONS_PATH]); | ||
@@ -49,0 +52,0 @@ if (gitDifferenceResult.error) { |
@@ -17,3 +17,5 @@ 'use strict'; | ||
const appVersion = getAppVersion(); | ||
if (!appVersion) { | ||
const nextVersion = process.env.npm_new_version; | ||
if (!appVersion || !nextVersion) { | ||
console.log('No defined app version. Skipping translation sync.'); | ||
@@ -30,10 +32,11 @@ return; | ||
const environments = appVersion.includes('alpha') ? ['DEV', 'INT'] : ['PP']; | ||
const environments = nextVersion.includes('alpha') ? ['DEV', 'INT'] : ['PP']; | ||
let parsedGitDifferences = {}; | ||
// Get git differences | ||
try { | ||
parsedGitDifferences = getGitDifferences(); | ||
parsedGitDifferences = getGitDifferences(nextVersion, appVersion.includes('alpha')); | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
process.env.PARSED_GIT_DIFFERENCES = JSON.stringify(parsedGitDifferences); | ||
@@ -43,3 +46,3 @@ process.env.npm_config_get_new_tokens = 'true'; | ||
environments.forEach(environment => { | ||
console.log(`Starting translation sync for app version: ${appVersion}. Environment: ${environment}`); | ||
console.log(`Starting translation sync for app version: ${nextVersion}. Environment: ${environment}`); | ||
@@ -77,5 +80,5 @@ const sheet = sheets.find(sheet => sheet.name === environment); | ||
}) | ||
commitAndPushChanges(`[sync translations] App version: ${appVersion}`); | ||
commitAndPushChanges(`[sync translations] App version: ${nextVersion}`); | ||
} | ||
module.exports = {syncTranslations}; |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
35030
735
51