Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@crowdin/cli

Package Overview
Dependencies
Maintainers
7
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crowdin/cli - npm Package Compare versions

Comparing version 3.7.8 to 3.7.9

jdeploy-bundle/icon.png

8

CHANGELOG.md
# Changelog
All notable changes to this project will be documented in this file.
## [3.7.9]
### Updated
- Support language ID in list languages command ([#454](https://github.com/crowdin/crowdin-cli/pull/454))
- Update jDeploy ([#437](https://github.com/crowdin/crowdin-cli/pull/437))
- Dependencies update ([#442](https://github.com/crowdin/crowdin-cli/pull/442))
## [3.7.8]

@@ -5,0 +13,0 @@

178

jdeploy-bundle/jdeploy.js

@@ -10,4 +10,15 @@ #! /usr/bin/env node

var tryJavaHomeFirst = false;
var javafx = false;
var bundleType = 'jre';
if ('{{JAVAFX}}' === 'true') {
javafx = true;
}
if ('{{JDK}}' === 'true') {
bundleType = 'jdk';
}
var jdk = (bundleType === 'jdk');
var jdkProvider = 'zulu';
function njreWrap() {

@@ -39,2 +50,8 @@ 'use strict'

function download (dir, url) {
if (url.indexOf("?") > 0 || jdkProvider === 'zulu') {
var destName = bundleType + ".zip";
} else {
destName = path.basename(url);
}
return new Promise((resolve, reject) => {

@@ -44,3 +61,3 @@ createDir(dir)

.then(response => {
const destFile = path.join(dir, path.basename(url))
const destFile = path.join(dir, destName)
const destStream = fs.createWriteStream(destFile)

@@ -93,8 +110,11 @@ response.body.pipe(destStream).on('finish', () => resolve(destFile))

var jreDir = path.join(jdeployDir, 'jre');
var jreDir = path.join(jdeployDir, bundleType);
if (!fs.existsSync(jreDir)) {
fs.mkdirSync(jreDir);
}
jreDir = path.join(jreDir, javaVersionString);
var vs = javaVersionString;
if (javafx) {
vs += 'fx';
}
jreDir = path.join(jreDir, vs);
if (!fs.existsSync(jreDir)) {

@@ -104,3 +124,3 @@ fs.mkdirSync(jreDir);

const newFile = path.join(jreDir, file.split(path.sep).slice(-1)[0])
//console.log("Copying file "+file+" to "+newFile);
fs.copyFile(file, newFile, err => {

@@ -118,2 +138,3 @@ if (err) reject(err)

function extractZip (file, dir) {
//console.log("Extracting "+file+" to "+dir);
return new Promise((resolve, reject) => {

@@ -166,4 +187,6 @@ yauzl.open(file, { lazyEntries: true }, (err, zipFile) => {

function extract (file) {
const dir = path.join(path.dirname(file), 'jre')
var dirString = jdk? 'jdk' : 'jre';
const dir = path.join(path.dirname(file), dirString)
//console.log("About to extract "+file+" to "+dir);
return createDir(dir).then(() => {

@@ -208,5 +231,10 @@ return path.extname(file) === '.zip'

*/
function install (version = 8, options = {}) {
const { openjdk_impl = 'hotspot', release = 'latest', type = 'jre' } = options
function install (version = 11, options = {}) {
const { openjdk_impl = 'hotspot', release = 'latest', type = 'jre', javafx = false, provider = 'zulu' } = options
options = { ...options, openjdk_impl, release, type }
if (provider === 'zulu') {
return installZulu(version, options);
}
let url = 'https://api.adoptopenjdk.net/v2/info/releases/openjdk' + version + '?'

@@ -256,2 +284,46 @@

function installZulu(version = 11, options = {}) {
const { type = 'jre', javafx = false } = options
var q = {
java_version: version,
ext: 'zip',
bundle_type: type,
javafx: ''+javafx,
arch: 'x86',
hw_bitness: '64',
};
var zuluBaseURL = "https://api.azul.com/zulu/download/community/v1.0/bundles/latest/binary?"
if (!options.os) {
switch (process.platform) {
case 'darwin':
q.os = 'macos'
break
case 'linux':
q.os = 'linux'
break
case 'win32':
case 'win64':
q.os = 'windows'
break
default:
return Promise.reject(new Error('Unsupported operating system'))
}
}
var url = zuluBaseURL;
Object.keys(q).forEach(key => { url += key + '=' + q[key] + '&' })
const tmpdir = path.join(os.tmpdir(), 'njre')
//console.log("Downloading "+url);
return download(tmpdir, url)
.then(move)
.then(extract)
}
return {install:install};

@@ -311,2 +383,62 @@

function getJavaHomeInPath(basepath) {
var dirs = null;
try {
dirs = getDirectories(basepath);
} catch (e) {
return null;
}
if (dirs && dirs.length > 0) {
basepath = path.join(basepath, dirs[0]);
if (os.platform() != 'darwin') {
return basepath;
}
if (fs.existsSync(path.join(basepath, 'Contents', 'Home'))) {
return path.join(basepath, 'Contents', 'Home');
}
var adapterDirectories = getDirectories(basepath).filter(subdir => {
return subdir.match(/^zulu/) && fs.existsSync(path.join(basepath, subdir, 'Contents', 'Home'));
});
if (adapterDirectories && adapterDirectories.length > 0) {
return path.join(basepath, adapterDirectories[0], 'Contents', 'Home');
}
}
return null;
}
function findSupportedRuntime(javaVersion, jdk, javafx) {
var jdeployDir = path.join(os.homedir(), ".jdeploy");
// First check for the full-meal deal
var _javaHomePath = getJavaHomeInPath(path.join(jdeployDir, 'jdk', javaVersion+'fx', 'jdk'));
if (_javaHomePath && fs.existsSync(_javaHomePath)) {
return _javaHomePath;
}
if (!javafx) {
var _javaHomePath = getJavaHomeInPath(path.join(jdeployDir, 'jdk', javaVersion, 'jdk'));
if (_javaHomePath && fs.existsSync(_javaHomePath)) {
return _javaHomePath;
}
}
if (!jdk) {
var _javaHomePath = getJavaHomeInPath(path.join(jdeployDir, 'jre', javaVersion+'fx', 'jre'));
if (_javaHomePath && fs.existsSync(_javaHomePath)) {
return _javaHomePath;
}
}
if (!jdk && !javafx) {
var _javaHomePath = getJavaHomeInPath(path.join(jdeployDir, 'jre', javaVersion, 'jre'));
if (_javaHomePath && fs.existsSync(_javaHomePath)) {
return _javaHomePath;
}
}
return null;
}
function getEmbeddedJavaHome() {

@@ -322,4 +454,9 @@ var _platform = os.platform();

}
var vs = javaVersionString;
if (javafx) {
vs += 'fx';
}
var typeDir = jdk ? 'jdk' : 'jre';
var jreDir = path.join(os.homedir(), '.jdeploy', 'jre', javaVersionString, 'jre');
var jreDir = path.join(os.homedir(), '.jdeploy', 'jre', vs, 'jre');
try {

@@ -376,3 +513,3 @@ var out = jreDir + path.sep + getDirectories(jreDir)[0] + (_driver ? (path.sep + _driver) : '');

var _javaHome = getEmbeddedJavaHome();
var _javaHome = findSupportedRuntime(javaVersionString, bundleType === 'jdk', javafx);
if (_javaHome && fs.existsSync(_javaHome)) {

@@ -392,9 +529,18 @@ var javaVersion = getJavaVersion(path.join(_javaHome, 'bin'));

console.log("Downloading java runtime environment for version "+targetJavaVersion);
njre.install(targetJavaVersion).then(function(dir) {
let dirCont = fs.readdirSync( dir );
if (os.platform() == 'darwin') {
env['JAVA_HOME'] = path.join(dir, dirCont[0], 'Contents', 'Home');
} else {
env['JAVA_HOME'] = path.join(dir, dirCont[0]);
njre.install(targetJavaVersion, {type: bundleType, javafx: javafx}).then(function(dir) {
var _javaHome = getJavaHomeInPath(dir);
if (_javaHome == null)
if (!_javaHome || !fs.existsSync(_javaHome)) {
throw new Error("After install, could not find java home at "+_javaHome);
}
env['JAVA_HOME'] = _javaHome;
var javaBinary = path.join(_javaHome, 'bin', 'java');
if (!fs.existsSync(javaBinary)) {
javaBinary += '.exe';
}
fs.chmodSync(javaBinary, 0755);
env['PATH'] = path.join(env['JAVA_HOME'], 'bin') + path.delimiter + env['PATH'];

@@ -401,0 +547,0 @@

2

package.json

@@ -13,3 +13,3 @@ {

},
"version": "3.7.8",
"version": "3.7.9",
"jdeploy": {

@@ -16,0 +16,0 @@ "jar": "dist/crowdin-cli.jar"

@@ -1,4 +0,4 @@

[<p align="center"><img src="https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png" data-canonical-src="https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png" width="200" height="200" align="center"/></p>](https://crowdin.com)
[<p align="center"><img src="https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png" data-canonical-src="https://support.crowdin.com/assets/logos/crowdin-dark-symbol.png" width="150" height="150" align="center"/></p>](https://crowdin.com)
# Crowdin CLI [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fcrowdin%2Fcrowdin-cli&text=Crowdin%20CLI%20is%20an%20open-source%20command-line%20tool%20that%20allows%20you%20to%20manage%20and%20synchronize%20your%20localization%20resources%20with%20your%20Crowdin%20project)
# Crowdin CLI [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fcrowdin%2Fcrowdin-cli&text=Crowdin%20CLI%20is%20an%20open-source%20command-line%20tool%20that%20allows%20you%20to%20manage%20and%20synchronize%20your%20localization%20resources%20with%20your%20Crowdin%20project)&nbsp;[![GitHub Repo stars](https://img.shields.io/github/stars/crowdin/crowdin-cli?style=social&cacheSeconds=1800)](https://github.com/crowdin/crowdin-cli/stargazers)

@@ -14,4 +14,8 @@ Crowdin CLI is a command line tool that allows you to manage and synchronize your localization resources with your Crowdin project. Using CLI, you can:

## Status
<div align="center">
[**`Docs`**](https://developer.crowdin.com/cli-tool/) |
[**`Configuration File`**](https://developer.crowdin.com/configuration-file/) |
[**`Wiki`**](https://github.com/crowdin/crowdin-cli/wiki)
[![Build Status](https://dev.azure.com/crowdin/crowdin-cli-3/_apis/build/status/Build%20and%20Test?branchName=cli3)](https://dev.azure.com/crowdin/crowdin-cli-3/_build/latest?definitionId=22&branchName=cli3&cacheSeconds=1000)

@@ -27,2 +31,4 @@ [![Docker Pulls](https://img.shields.io/docker/pulls/crowdin/cli?logo=docker&cacheSeconds=2000)](https://hub.docker.com/r/crowdin/cli)

</div>
## Table of Contents

@@ -29,0 +35,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc