New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

oclif

Package Overview
Dependencies
Maintainers
5
Versions
555
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oclif - npm Package Compare versions

Comparing version 4.17.20 to 4.17.21

3

lib/commands/manifest.d.ts

@@ -11,5 +11,4 @@ import { Command, Interfaces } from '@oclif/core';

run(): Promise<Interfaces.Manifest>;
private downloadTarball;
private executeCommand;
private getTarballUrl;
private getVersion;
}

@@ -44,6 +44,2 @@ "use strict";

const node_path_1 = __importDefault(require("node:path"));
const node_stream_1 = require("node:stream");
const node_util_1 = require("node:util");
const semver_1 = require("semver");
const pipeline = (0, node_util_1.promisify)(node_stream_1.pipeline);
async function fileExists(filePath) {

@@ -78,3 +74,3 @@ try {

const root = node_path_1.default.resolve(args.path);
const packageJson = (0, fs_extra_1.readJSONSync)('package.json');
const packageJson = (0, fs_extra_1.readJSONSync)(node_path_1.default.join(root, 'package.json'));
let jitPluginManifests = [];

@@ -84,3 +80,2 @@ if (flags.jit && packageJson.oclif?.jitPlugins) {

const tmpDir = os.tmpdir();
const { default: got } = await import('got');
const promises = Object.entries(packageJson.oclif.jitPlugins).map(async ([jitPlugin, version]) => {

@@ -92,6 +87,3 @@ const pluginDir = jitPlugin.replace('/', '-').replace('@', '');

await (0, fs_extra_1.mkdir)(fullPath, { recursive: true });
const resolvedVersion = await this.getVersion(jitPlugin, version);
const tarballUrl = await this.getTarballUrl(jitPlugin, resolvedVersion);
const tarball = node_path_1.default.join(fullPath, node_path_1.default.basename(tarballUrl));
await pipeline(got.stream(tarballUrl), (0, fs_extra_1.createWriteStream)(tarball));
const tarball = await this.downloadTarball(jitPlugin, version, fullPath);
await this.executeCommand(`tar -xzf "${tarball}"`, { cwd: fullPath });

@@ -141,2 +133,13 @@ const manifest = (await (0, fs_extra_1.readJSON)(node_path_1.default.join(fullPath, 'package', 'oclif.manifest.json')));

}
async downloadTarball(plugin, version, tarballStoragePath) {
const { stderr } = await this.executeCommand(`npm pack ${plugin}@${version} --pack-destination "${tarballStoragePath}" --json`);
// You can `npm pack` with multiple modules to download multiple at a time. There will be at least 1 if the command
// succeeded.
const tarballs = JSON.parse(stderr);
if (!Array.isArray(tarballs) || tarballs.length !== 1) {
throw new Error(`Could not download tarballs for ${plugin}. Tarball download was not in the correct format.`);
}
const { filename } = tarballs[0];
return node_path_1.default.join(tarballStoragePath, filename);
}
async executeCommand(command, options) {

@@ -157,22 +160,3 @@ return new Promise((resolve) => {

}
async getTarballUrl(plugin, version) {
const { stderr } = await this.executeCommand(`npm view ${plugin}@${version} --json`);
const { dist } = JSON.parse(stderr);
return dist.tarball;
}
async getVersion(plugin, version) {
if (version.startsWith('^') || version.startsWith('~')) {
// Grab latest from npm to get all the versions so we can find the max satisfying version.
// We explicitly ask for latest since this command is typically run inside of `npm prepack`,
// which sets the npm_config_tag env var, which is used as the default anytime a tag isn't
// provided to `npm view`. This can be problematic if you're building the `nightly` version
// of a CLI and all the JIT plugins don't have a `nightly` tag themselves.
// TL;DR - always ask for latest to avoid potentially requesting a non-existent tag.
const { stderr } = await this.executeCommand(`npm view ${plugin}@latest --json`);
const { versions } = JSON.parse(stderr);
return (0, semver_1.maxSatisfying)(versions, version) ?? version.replace('^', '').replace('~', '');
}
return version;
}
}
exports.default = Manifest;

@@ -1134,3 +1134,3 @@ {

},
"version": "4.17.20"
"version": "4.17.21"
}
{
"name": "oclif",
"description": "oclif: create your own CLI",
"version": "4.17.20",
"version": "4.17.21",
"author": "Salesforce",

@@ -6,0 +6,0 @@ "bin": {

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