Socket
Socket
Sign inDemoInstall

@enonic/cli-test

Package Overview
Dependencies
1
Maintainers
5
Versions
71
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.19 to 0.0.20

4

package.json
{
"name": "@enonic/cli-test",
"description": "Command-line interface for Enonic XP",
"version": "0.0.19",
"version": "0.0.20",
"scripts": {
"postinstall": "node postinstall.js install",
"preuninstall": "node postinstall.js uninstall"
"uninstall": "node postinstall.js uninstall"
},

@@ -9,0 +9,0 @@ "repository": {

@@ -30,32 +30,25 @@ #!/usr/bin/env node

const value = await execShellCommand("npm bin -g");
const value = await execShellCommand("npm config get prefix");
var dir = null;
if (value) {
dir = path.join(value.trim(), "bin");
} else {
console.error('Enonic CLI could not be installed globally.');
}
var dir = null;
if (!value || value.length === 0) {
// We couldn't infer path from `npm bin`. Let's try to get it from
// Environment variables set by NPM when it runs.
// npm_config_prefix points to NPM's installation directory where `bin` folder is available
// Ex: /Users/foo/.nvm/versions/node/v4.3.0
var env = process.env;
if (env && env.npm_config_prefix) {
dir = path.join(env.npm_config_prefix, "bin");
}
} else {
dir = value.trim();
}
await mkdirp(dir);
return dir;
await mkdirp(dir);
return dir;
}
async function verifyAndPlaceBinary(binName, binPath, callback) {
if (!fs.existsSync(path.join(binPath, binName))) return callback('Downloaded binary does not contain the binary specified in configuration - ' + binName);
if (!fs.existsSync(path.join(binPath, binName))) {
return callback('Downloaded binary does not contain the binary specified in configuration - ' + binName);
}
// Get installation path for executables under node
const installationPath= await getInstallationPath();
console.log(installationPath);
const installationPath = await getInstallationPath();
// Copy the executable to the path
fs.rename(path.join(binPath, binName), path.join(installationPath, binName),(err)=>{
fs.rename(path.join(binPath, binName), path.join(installationPath, binName), (err) => {
if(!err){

@@ -117,3 +110,3 @@ console.info("Enonic CLI is successfully installed.");

var version = packageJson.version;
if (version[0] === 'v') version = version.substr(1); // strip the 'v' if necessary v0.0.1 => 0.0.1
if (version[0] === 'v') version = version.substring(1); // strip the 'v' if necessary v0.0.1 => 0.0.1

@@ -149,6 +142,5 @@ // Binary name on Windows has .exe suffix

var src = path.join('dist', `enonic_${PLATFORM_MAPPING[process.platform]}_${ARCH_MAPPING[process.arch]}`, opts.binName);
var target = path.join(opts.binPath, opts.binName);
var source = path.join('dist', `enonic_${PLATFORM_MAPPING[process.platform]}_${ARCH_MAPPING[process.arch]}`, opts.binName);
if (!fs.existsSync(src)) {
if (!fs.existsSync(source)) {
console.error('Downloaded binary does not contain the binary specified in configuration - ' + opts.binName);

@@ -158,22 +150,6 @@ return;

fs.copyFileSync(src, target, fs.constants.COPYFILE_FICLONE);
var target = path.join(opts.binPath, opts.binName);
fs.copyFileSync(source, target, fs.constants.COPYFILE_FICLONE);
await verifyAndPlaceBinary(opts.binName, opts.binPath, callback);
/*
await fs.copyFile(src, target, fs.constants.COPYFILE_FICLONE, (err) => {
if (err) throw err;
verifyAndPlaceBinary(opts.binName, opts.binPath, callback);
});
*/
/*
if (process.platform === "win32") {
shellCommand = `xcopy .\\dist\\enonic_${PLATFORM_MAPPING[process.platform]}_${ARCH_MAPPING[process.arch]}\\${opts.binName} .\\bin\\ /I /Y`;
} else {
shellCommand = `cp ./dist/enonic_${PLATFORM_MAPPING[process.platform]}_${ARCH_MAPPING[process.arch]}/${opts.binName} ./bin/${opts.binName}`;
}
console.log(shellCommand);
await execShellCommand(shellCommand);
await verifyAndPlaceBinary(opts.binName, opts.binPath, callback);
*/
}

@@ -180,0 +156,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc