Socket
Socket
Sign inDemoInstall

@oclif/plugin-plugins

Package Overview
Dependencies
Maintainers
4
Versions
275
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/plugin-plugins - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

8

CHANGELOG.md

@@ -0,1 +1,9 @@

<a name="1.3.0"></a>
# [1.3.0](https://github.com/oclif/plugin-plugins/compare/v1.2.1...v1.3.0) (2018-06-01)
### Features
* allow installing from github urls ([4ae4f3d](https://github.com/oclif/plugin-plugins/commit/4ae4f3d))
<a name="1.2.1"></a>

@@ -2,0 +10,0 @@ ## [1.2.1](https://github.com/oclif/plugin-plugins/compare/v1.2.0...v1.2.1) (2018-05-25)

15

lib/commands/plugins/index.d.ts

@@ -5,16 +5,3 @@ import { Command } from '@oclif/command';

static flags: {
core: {
name: string;
char?: "a" | "b" | "i" | "p" | "q" | "s" | "u" | "g" | "c" | "d" | "e" | "f" | "h" | "j" | "k" | "l" | "m" | "n" | "o" | "r" | "t" | "v" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "X" | "Y" | "Z" | undefined;
description?: string | undefined;
hidden?: boolean | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
exclusive?: string[] | undefined;
env?: string | undefined;
parse(input: boolean, context: any): boolean;
} & {
type: "boolean";
allowNo: boolean;
};
core: import("../../../node_modules/@oclif/parser/lib/flags").IBooleanFlag<boolean>;
};

@@ -21,0 +8,0 @@ static description: string;

@@ -14,30 +14,4 @@ import { Command } from '@oclif/command';

static flags: {
help: {
name: string;
char?: "a" | "b" | "i" | "p" | "q" | "s" | "u" | "g" | "c" | "d" | "e" | "f" | "h" | "j" | "k" | "l" | "m" | "n" | "o" | "r" | "t" | "v" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "X" | "Y" | "Z" | undefined;
description?: string | undefined;
hidden?: boolean | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
exclusive?: string[] | undefined;
env?: string | undefined;
parse(input: boolean, context: any): void;
} & {
type: "boolean";
allowNo: boolean;
};
verbose: {
name: string;
char?: "a" | "b" | "i" | "p" | "q" | "s" | "u" | "g" | "c" | "d" | "e" | "f" | "h" | "j" | "k" | "l" | "m" | "n" | "o" | "r" | "t" | "v" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "X" | "Y" | "Z" | undefined;
description?: string | undefined;
hidden?: boolean | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
exclusive?: string[] | undefined;
env?: string | undefined;
parse(input: boolean, context: any): boolean;
} & {
type: "boolean";
allowNo: boolean;
};
help: import("../../../node_modules/@oclif/parser/lib/flags").IBooleanFlag<void>;
verbose: import("../../../node_modules/@oclif/parser/lib/flags").IBooleanFlag<boolean>;
};

@@ -44,0 +18,0 @@ static aliases: string[];

@@ -17,5 +17,11 @@ "use strict";

for (let plugin of argv) {
let { name, tag } = parsePlugin(plugin);
cli_ux_1.default.action.start(`Installing plugin ${chalk_1.default.cyan(this.plugins.friendlyName(name))}`);
await this.plugins.install(name, tag);
let p = parsePlugin(plugin);
if (p.type === 'npm') {
cli_ux_1.default.action.start(`Installing plugin ${chalk_1.default.cyan(this.plugins.friendlyName(p.name))}`);
await this.plugins.install(p.name, p.tag);
}
else {
cli_ux_1.default.action.start(`Installing plugin ${chalk_1.default.cyan(p.url)}`);
await this.plugins.install(p.url);
}
cli_ux_1.default.action.stop();

@@ -37,11 +43,17 @@ }

function parsePlugin(input) {
if (input.includes('/')) {
if (input.includes('@') && input.includes('/')) {
input = input.slice(1);
let [name, tag = 'latest'] = input.split('@');
return { name: '@' + name, tag };
return { name: '@' + name, tag, type: 'npm' };
}
else if (input.includes('/')) {
if (input.includes(':'))
return { url: input, type: 'repo' };
else
return { url: `https://github.com/${input}`, type: 'repo' };
}
else {
let [name, tag = 'latest'] = input.split('@');
return { name, tag };
return { name, tag, type: 'npm' };
}
}

@@ -14,30 +14,4 @@ import { Command } from '@oclif/command';

static flags: {
help: {
name: string;
char?: "a" | "b" | "i" | "p" | "q" | "s" | "u" | "g" | "c" | "d" | "e" | "f" | "h" | "j" | "k" | "l" | "m" | "n" | "o" | "r" | "t" | "v" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "X" | "Y" | "Z" | undefined;
description?: string | undefined;
hidden?: boolean | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
exclusive?: string[] | undefined;
env?: string | undefined;
parse(input: boolean, context: any): void;
} & {
type: "boolean";
allowNo: boolean;
};
verbose: {
name: string;
char?: "a" | "b" | "i" | "p" | "q" | "s" | "u" | "g" | "c" | "d" | "e" | "f" | "h" | "j" | "k" | "l" | "m" | "n" | "o" | "r" | "t" | "v" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "X" | "Y" | "Z" | undefined;
description?: string | undefined;
hidden?: boolean | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
exclusive?: string[] | undefined;
env?: string | undefined;
parse(input: boolean, context: any): boolean;
} & {
type: "boolean";
allowNo: boolean;
};
help: import("../../../node_modules/@oclif/parser/lib/flags").IBooleanFlag<void>;
verbose: import("../../../node_modules/@oclif/parser/lib/flags").IBooleanFlag<boolean>;
};

@@ -44,0 +18,0 @@ plugins: Plugins;

@@ -13,30 +13,4 @@ import { Command } from '@oclif/command';

static flags: {
help: {
name: string;
char?: "a" | "b" | "i" | "p" | "q" | "s" | "u" | "g" | "c" | "d" | "e" | "f" | "h" | "j" | "k" | "l" | "m" | "n" | "o" | "r" | "t" | "v" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "X" | "Y" | "Z" | undefined;
description?: string | undefined;
hidden?: boolean | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
exclusive?: string[] | undefined;
env?: string | undefined;
parse(input: boolean, context: any): void;
} & {
type: "boolean";
allowNo: boolean;
};
verbose: {
name: string;
char?: "a" | "b" | "i" | "p" | "q" | "s" | "u" | "g" | "c" | "d" | "e" | "f" | "h" | "j" | "k" | "l" | "m" | "n" | "o" | "r" | "t" | "v" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "X" | "Y" | "Z" | undefined;
description?: string | undefined;
hidden?: boolean | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
exclusive?: string[] | undefined;
env?: string | undefined;
parse(input: boolean, context: any): boolean;
} & {
type: "boolean";
allowNo: boolean;
};
help: import("../../../node_modules/@oclif/parser/lib/flags").IBooleanFlag<void>;
verbose: import("../../../node_modules/@oclif/parser/lib/flags").IBooleanFlag<boolean>;
};

@@ -43,0 +17,0 @@ static aliases: string[];

@@ -8,30 +8,4 @@ import { Command } from '@oclif/command';

static flags: {
help: {
name: string;
char?: "a" | "b" | "i" | "p" | "q" | "s" | "u" | "g" | "c" | "d" | "e" | "f" | "h" | "j" | "k" | "l" | "m" | "n" | "o" | "r" | "t" | "v" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "X" | "Y" | "Z" | undefined;
description?: string | undefined;
hidden?: boolean | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
exclusive?: string[] | undefined;
env?: string | undefined;
parse(input: boolean, context: any): void;
} & {
type: "boolean";
allowNo: boolean;
};
verbose: {
name: string;
char?: "a" | "b" | "i" | "p" | "q" | "s" | "u" | "g" | "c" | "d" | "e" | "f" | "h" | "j" | "k" | "l" | "m" | "n" | "o" | "r" | "t" | "v" | "x" | "y" | "z" | "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "X" | "Y" | "Z" | undefined;
description?: string | undefined;
hidden?: boolean | undefined;
required?: boolean | undefined;
dependsOn?: string[] | undefined;
exclusive?: string[] | undefined;
env?: string | undefined;
parse(input: boolean, context: any): boolean;
} & {
type: "boolean";
allowNo: boolean;
};
help: import("../../../node_modules/@oclif/parser/lib/flags").IBooleanFlag<void>;
verbose: import("../../../node_modules/@oclif/parser/lib/flags").IBooleanFlag<boolean>;
};

@@ -38,0 +12,0 @@ plugins: Plugins;

@@ -12,3 +12,3 @@ import * as Config from '@oclif/config';

install(name: string, tag?: string): Promise<void>;
refresh(root: string, {prod}?: {
refresh(root: string, { prod }?: {
prod?: boolean;

@@ -25,7 +25,7 @@ }): Promise<void>;

friendlyName(name: string): string;
private createPJSON();
private createPJSON;
private readonly pjsonPath;
private npmHasPackage(name);
private savePJSON(pjson);
private normalizePlugins(input);
private npmHasPackage;
private savePJSON;
private normalizePlugins;
}

@@ -38,15 +38,31 @@ "use strict";

try {
const range = semver.validRange(tag);
const unfriendly = this.unfriendlyName(name);
if (unfriendly && await this.npmHasPackage(unfriendly)) {
name = unfriendly;
}
const yarnOpts = { cwd: this.config.dataDir, verbose: this.verbose };
await this.createPJSON();
await this.yarn.exec(['add', `${name}@${tag}`], { cwd: this.config.dataDir, verbose: this.verbose });
const plugin = await Config.load({ devPlugins: false, userPlugins: false, root: path.join(this.config.dataDir, 'node_modules', name), name });
if (!plugin.valid && !this.config.plugins.find(p => p.name === '@oclif/plugin-legacy')) {
throw new Error('plugin is invalid');
if (name.includes(':')) {
// url
const url = name;
await this.yarn.exec(['add', url], yarnOpts);
name = Object.entries((await this.pjson()).dependencies || {}).find(([, u]) => u === url)[0];
const plugin = await Config.load({ devPlugins: false, userPlugins: false, root: path.join(this.config.dataDir, 'node_modules', name), name });
await this.refresh(plugin.root);
if (!plugin.valid && !this.config.plugins.find(p => p.name === '@oclif/plugin-legacy')) {
throw new Error('plugin is invalid');
}
await this.add({ name, url, type: 'user' });
}
await this.refresh(plugin.root);
await this.add({ name, tag: range || tag, type: 'user' });
else {
// npm
const range = semver.validRange(tag);
const unfriendly = this.unfriendlyName(name);
if (unfriendly && await this.npmHasPackage(unfriendly)) {
name = unfriendly;
}
await this.yarn.exec(['add', `${name}@${tag}`], yarnOpts);
const plugin = await Config.load({ devPlugins: false, userPlugins: false, root: path.join(this.config.dataDir, 'node_modules', name), name });
if (!plugin.valid && !this.config.plugins.find(p => p.name === '@oclif/plugin-legacy')) {
throw new Error('plugin is invalid');
}
await this.refresh(plugin.root);
await this.add({ name, tag: range || tag, type: 'user' });
}
}

@@ -103,2 +119,3 @@ catch (err) {

cli_ux_1.default.action.start(`${this.config.name}: Updating plugins`);
await this.yarn.exec(['upgrade'], { cwd: this.config.dataDir, verbose: this.verbose });
await this.yarn.exec(['add', ...plugins.map(p => `${p.name}@${p.tag}`)], { cwd: this.config.dataDir, verbose: this.verbose });

@@ -105,0 +122,0 @@ for (let p of plugins) {

import { IConfig } from '@oclif/config';
export default class Yarn {
config: IConfig;
constructor({config}: {
constructor({ config }: {
config: IConfig;

@@ -6,0 +6,0 @@ });

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

{"version":"1.2.1","commands":{"plugins":{"id":"plugins","description":"list installed plugins","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":[],"examples":["$ <%- config.bin %> plugins"],"flags":{"core":{"name":"core","type":"boolean","description":"show core plugins"}},"args":[]},"plugins:install":{"id":"plugins:install","description":"installs a plugin into the CLI","usage":"plugins:install PLUGIN...","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":["plugins:add"],"examples":["$ <%= config.bin %> plugins:install <%- config.pjson.oclif.examplePlugin || \"myplugin\" %> "],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help"},"verbose":{"name":"verbose","type":"boolean","char":"v"}},"args":[{"name":"plugin","description":"plugin to install","required":true}]},"plugins:link":{"id":"plugins:link","description":"links a plugin into the CLI for development","usage":"plugins:link PLUGIN","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":[],"examples":["$ <%= config.bin %> plugins:link <%- config.pjson.oclif.examplePlugin || \"myplugin\" %> "],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help"},"verbose":{"name":"verbose","type":"boolean","char":"v"}},"args":[{"name":"path","description":"path to plugin","required":true,"default":"."}]},"plugins:uninstall":{"id":"plugins:uninstall","description":"removes a plugin from the CLI","usage":"plugins:uninstall PLUGIN...","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":["plugins:unlink","plugins:remove"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help"},"verbose":{"name":"verbose","type":"boolean","char":"v"}},"args":[{"name":"plugin","description":"plugin to uninstall"}]},"plugins:update":{"id":"plugins:update","description":"update installed plugins","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help"},"verbose":{"name":"verbose","type":"boolean","char":"v"}},"args":[]}}}
{"version":"1.3.0","commands":{"plugins":{"id":"plugins","description":"list installed plugins","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":[],"examples":["$ <%- config.bin %> plugins"],"flags":{"core":{"name":"core","type":"boolean","description":"show core plugins"}},"args":[]},"plugins:install":{"id":"plugins:install","description":"installs a plugin into the CLI","usage":"plugins:install PLUGIN...","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":["plugins:add"],"examples":["$ <%= config.bin %> plugins:install <%- config.pjson.oclif.examplePlugin || \"myplugin\" %> "],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help"},"verbose":{"name":"verbose","type":"boolean","char":"v"}},"args":[{"name":"plugin","description":"plugin to install","required":true}]},"plugins:link":{"id":"plugins:link","description":"links a plugin into the CLI for development","usage":"plugins:link PLUGIN","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":[],"examples":["$ <%= config.bin %> plugins:link <%- config.pjson.oclif.examplePlugin || \"myplugin\" %> "],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help"},"verbose":{"name":"verbose","type":"boolean","char":"v"}},"args":[{"name":"path","description":"path to plugin","required":true,"default":"."}]},"plugins:uninstall":{"id":"plugins:uninstall","description":"removes a plugin from the CLI","usage":"plugins:uninstall PLUGIN...","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":["plugins:unlink","plugins:remove"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help"},"verbose":{"name":"verbose","type":"boolean","char":"v"}},"args":[{"name":"plugin","description":"plugin to uninstall"}]},"plugins:update":{"id":"plugins:update","description":"update installed plugins","pluginName":"@oclif/plugin-plugins","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help"},"verbose":{"name":"verbose","type":"boolean","char":"v"}},"args":[]}}}
{
"name": "@oclif/plugin-plugins",
"description": "plugins plugin for oclif",
"version": "1.2.1",
"version": "1.3.0",
"author": "Jeff Dickey @jdxcode",

@@ -9,20 +9,20 @@ "bugs": "https://github.com/oclif/plugin-plugins/issues",

"@heroku-cli/color": "^1.1.5",
"@oclif/command": "^1.4.30",
"@oclif/command": "^1.4.32",
"chalk": "^2.4.1",
"cli-ux": "^4.4.0",
"cli-ux": "^4.6.0",
"debug": "^3.1.0",
"fs-extra": "^6.0.1",
"http-call": "^5.1.3",
"http-call": "^5.1.4",
"load-json-file": "^5.0.0",
"npm-run-path": "^2.0.2",
"semver": "^5.5.0",
"tslib": "^1.9.1",
"tslib": "^1.9.2",
"yarn": "^1.7.0"
},
"devDependencies": {
"@oclif/config": "^1.6.19",
"@oclif/dev-cli": "^1.13.22",
"@oclif/config": "^1.6.27",
"@oclif/dev-cli": "^1.13.29",
"@oclif/errors": "^1.1.2",
"@oclif/plugin-help": "^1.2.11",
"@oclif/test": "^1.0.6",
"@oclif/plugin-help": "^2.0.4",
"@oclif/test": "^1.0.9",
"@oclif/tslint": "^1.1.2",

@@ -33,3 +33,3 @@ "@types/chai": "^4.1.3",

"@types/mocha": "^5.2.0",
"@types/node": "^10.1.2",
"@types/node": "^10.3.0",
"@types/semver": "^5.5.0",

@@ -39,8 +39,8 @@ "@types/supports-color": "^5.3.0",

"concurrently": "^3.5.1",
"fancy-test": "^1.0.8",
"fancy-test": "^1.1.4",
"globby": "^8.0.1",
"mocha": "^5.2.0",
"ts-node": "^6.0.4",
"ts-node": "^6.0.5",
"tslint": "^5.10.0",
"typescript": "^2.8.3"
"typescript": "^2.9.1"
},

@@ -47,0 +47,0 @@ "engines": {

@@ -81,3 +81,3 @@ @oclif/plugin-plugins

_See code: [src/commands/plugins.ts](https://github.com/oclif/plugin-plugins/blob/v1.2.1/src/commands/plugins.ts)_
_See code: [src/commands/plugins/index.ts](https://github.com/oclif/plugin-plugins/blob/v1.3.0/src/commands/plugins/index.ts)_

@@ -106,3 +106,3 @@ ## `mycli plugins:install PLUGIN...`

_See code: [src/commands/plugins/install.ts](https://github.com/oclif/plugin-plugins/blob/v1.2.1/src/commands/plugins/install.ts)_
_See code: [src/commands/plugins/install.ts](https://github.com/oclif/plugin-plugins/blob/v1.3.0/src/commands/plugins/install.ts)_

@@ -128,3 +128,3 @@ ## `mycli plugins:link PLUGIN`

_See code: [src/commands/plugins/link.ts](https://github.com/oclif/plugin-plugins/blob/v1.2.1/src/commands/plugins/link.ts)_
_See code: [src/commands/plugins/link.ts](https://github.com/oclif/plugin-plugins/blob/v1.3.0/src/commands/plugins/link.ts)_

@@ -151,3 +151,3 @@ ## `mycli plugins:uninstall PLUGIN...`

_See code: [src/commands/plugins/uninstall.ts](https://github.com/oclif/plugin-plugins/blob/v1.2.1/src/commands/plugins/uninstall.ts)_
_See code: [src/commands/plugins/uninstall.ts](https://github.com/oclif/plugin-plugins/blob/v1.3.0/src/commands/plugins/uninstall.ts)_

@@ -167,3 +167,3 @@ ## `mycli plugins:update`

_See code: [src/commands/plugins/update.ts](https://github.com/oclif/plugin-plugins/blob/v1.2.1/src/commands/plugins/update.ts)_
_See code: [src/commands/plugins/update.ts](https://github.com/oclif/plugin-plugins/blob/v1.3.0/src/commands/plugins/update.ts)_
<!-- commandsstop -->
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