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

@sencha/cmd

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sencha/cmd - npm Package Compare versions

Comparing version 7.5.1 to 7.6.0-87

4

package.json

@@ -36,3 +36,3 @@ {

"name": "@sencha/cmd",
"version": "7.5.1",
"version": "7.6.0-87",
"bin": {

@@ -47,3 +47,3 @@ "sencha": "bin/sencha"

},
"version_full": "7.5.0.5"
"version_full": "7.6.0.87"
}

@@ -8,68 +8,142 @@ const pkg = require('./package.json');

var greenbold = `\x1b[32m\x1b[1m`
var end = `\x1b[0m`
var prefix = ``
if (require('os').platform() == 'darwin') {
prefix = `ℹ 「ext」:`
}
else {
prefix = `i [ext]:`
}
var app =(`${greenbold}${prefix}${end} platform-install:`)
function boldRed(s) {
var boldredcolor = `\x1b[31m\x1b[1m`
var endmarker = `\x1b[0m`
return (`${boldredcolor}${s}${endmarker}`)
}
let getPackageName = () => {
let name = `${pkg.name}-${platform}`;
if (!javaFound) {
if (platform === "windows") {
name += `-${arch === "x64" ? "64" : "32"}`;
}
name += `-jre`;
} else {
if (platform === "linux") {
name += `-${arch === "x64" ? "64" : "32" }`;
}
let name = `${pkg.name}-${platform}`;
if (!javaFound) {
if (platform === "windows") {
name += `-${arch === "x64" ? "64" : "32"}`;
}
return name;
name += `-jre`;
} else {
if (platform === "linux") {
name += `-${arch === "x64" ? "64" : "32" }`;
}
}
return name;
}
let validate = () => {
if (!javaFound && platform === "linux") {
console.error('A JRE is required to download and run Sencha Cmd in linux.');
process.exit(126);
}
let validateForJava = () => {
if (!javaFound && platform === "linux") {
console.error('A JRE is required to download and run Sencha Cmd in linux.');
process.exit(126);
}
}
let proceedWithInstall = () => {
let pkgName = getPackageName();
let loglevel = ["silent", "error", "warn", "http", "info", "verbose", "silly"].indexOf(process.env.npm_config_loglevel);
let args = [
'install',
`${pkgName}@${pkg.version}`
];
if (loglevel > -1) {
args.push('--loglevel');
args.push(process.env.npm_config_loglevel);
// console.log(`${app} ${pkg.name} v${pkg.sencha.version} post-install`)
console.log(`${app} ${pkg.name} v${pkg.version} installed`)
let pkgName = getPackageName()
// console.log(`${app} Sencha Cmd package name: ${pkgName}`)
// var npmConfigLogLevel = process.env.npm_config_loglevel
// console.log(`${app} npm config loglevel: ${npmConfigLogLevel}`)
// let loglevel = ["silent", "error", "warn", "http", "info", "verbose", "silly"].indexOf(process.env.npm_config_loglevel);
// if (loglevel > -1) {
// args.push('--loglevel');
// args.push(process.env.npm_config_loglevel);
// }
// console.log(`${app} args: ${args}`)
validateForJava();
var package = `${pkgName}@${pkg.version}`
var command = `npm${/^win/.test(require('os').platform()) ? ".cmd" : ""}`
var args = []
if (process.env.EXTGEN_VERBOSE == 'true') {
args = ['install',package]
}
else {
args = ['install','-s',package]
// if (require('os').platform() == 'win32') {
// args = ['install','-s','>','NUL',package]
// }
// else {
// args = ['install','-s','>','/dev/null',package]
// }
}
let options = {cwd: path.join(__dirname), stdio: 'inherit', encoding: 'utf-8'}
if (process.env.EXTGEN_VERBOSE == 'true') {
console.log(`${app} npm ${args.toString().replace(/,/g, " ")} started`)
}
let child = require('child_process').spawn(
command,
args,
options
)
child.on('close', (code) => {
if (code===0) {
console.log(`${app} npm ${args.toString().replace(/,/g, " ")} installed`)
require(`${pkgName}/install.js`)(__dirname);
}
validate();
console.log('\x1b[32m\x1b[1m[INF]\x1b[0m', 'Installing Sencha Cmd...');
let npmInstall = require('child_process').spawn(`npm${/^win/.test(require('os').platform()) ? ".cmd" : ""}`, args, {
cwd: path.join(__dirname)
});
npmInstall.on('close', (code) => {
console.log(`> [platform-installer]: Exited with code ${code}`);
if (code===0) {
require(`${pkgName}/install.js`)(__dirname);
}
});
npmInstall.on('error', (error) => {
console.error(`> [platform-installer][stderr]: ${error.message ? error.message : error}`);
});
npmInstall.stderr.on('data', (stderr) => {
console.error(`> [platform-installer][stderr]: ${stderr}`);
});
if (loglevel > 3) {
npmInstall.stdout.on('data', (stdout) => {
console.log(`> [platform-installer]: ${stdout}`);
});
else {
if (process.env.EXTGEN_VERBOSE == 'true') {
console.log(`${app} ${boldRed('[ERR]')} Closed with code ${code}`)
}
}
})
child.on('error', (error) => {
var s = error.message ? error.message : error
s = s.replace(/(\r\n\t|\n|\r\t)/gm,"");
console.log(`${app} ${boldRed('[ERR]')} ${s}`)
})
child.on('data', (error) => {
var s = error.message ? error.message : error
s = s.replace(/(\r\n\t|\n|\r\t)/gm,"");
console.log(`${app} ${boldRed('[DATA]')} ${s}`)
})
if (child.stdout) {
child.stdout.on('data', (stdout) => {
var s = stdout.toString()
s = s.replace(/(\r\n\t|\n|\r\t)/gm,"");
console.log(`${app} ${s}`)
})
}
else {
// var s = `no stdout`
// console.log(`${app} ${boldRed("[ERR]")} ${s}`)
}
if (child.stderr) {
child.stderr.on('data', (stderr) => {
var s = stderr.toString()
s = s.replace(/(\r\n\t|\n|\r\t)/gm,"");
console.log(`${app} ${boldRed('[ERR]')} ${s}`)
})
}
else {
// var s = `no stderr`
// console.log(`${app} ${boldRed("[ERR]")} ${s}`)
}
}
try {
which('java', (err, path) => {
javaFound = !err && path;
proceedWithInstall();
});
} catch (ex) {
console.error(`> [platform-installer][stderr]: ${ex.message ? ex.message : ex}`);
proceedWithInstall();
which('java', (err, path) => {
javaFound = !err && path //to deal with java 9 and above issue
//javaFound = false
//console.log(`${app} Found java at: ${javaFound}`)
proceedWithInstall()
})
} catch (error) {
var s = error.message ? error.message : error
s = s.replace(/(\r\n\t|\n|\r\t)/gm,"");
console.log(`${app} ${boldRed('[ERR]')} ${s}`)
proceedWithInstall()
}
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