Socket
Socket
Sign inDemoInstall

@zeplin/cli

Package Overview
Dependencies
Maintainers
5
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zeplin/cli - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

asd.ts

4

components.json

@@ -27,3 +27,3 @@ {

"repository": "zeplin/connected-components",
"url": "https://github.com"
"path": "hele hele hele"
},

@@ -57,3 +57,3 @@ "components": [

"name": "Text Area",
"path": "MyComponent.jsx",
"path": "hele hele/MyComponent.jsx",
"zeplinNames": [

@@ -60,0 +60,0 @@ "asdasd"

{
"name": "@zeplin/cli",
"version": "0.2.5",
"version": "0.2.6",
"description": "Zeplin CLI",

@@ -5,0 +5,0 @@ "main": "./dist/src/app",

@@ -45,3 +45,4 @@ "use strict";

branch: joi_1.default.string().optional(),
url: joi_1.default.string().optional()
url: joi_1.default.string().optional(),
path: joi_1.default.string().optional()
});

@@ -48,0 +49,0 @@ const componentConfigFileSchema = joi_1.default.object({

@@ -21,2 +21,3 @@ "use strict";

const service_1 = require("./service");
const text_1 = require("../../util/text");
function connect(options) {

@@ -46,3 +47,3 @@ return __awaiter(this, void 0, void 0, function* () {

${chalk_1.default.redBright(error.message)}
${chalk_1.default.redBright(text_1.indent(error.message))}
`;

@@ -49,0 +50,0 @@ throw error;

@@ -11,2 +11,3 @@ import { ComponentConfig, ConnectPlugin } from "connect-plugin";

url?: string;
path?: string;
}

@@ -13,0 +14,0 @@ export interface ComponentConfigFile {

@@ -25,4 +25,25 @@ "use strict";

const defaults_1 = require("../../config/defaults");
const dedent_1 = __importDefault(require("dedent"));
const chalk_1 = __importDefault(require("chalk"));
// Helper method to initialize plugin classses
const constructConnectPlugin = (Constructor) => new Constructor();
const createInstance = (pluginName, Plugin) => {
try {
const plugin = new Plugin();
// Check that plugin implements the required methods
if (!plugin.process || !plugin.supports) {
throw new Error();
}
plugin.name = pluginName;
return plugin;
}
catch (e) {
const error = new errors_1.CLIError(dedent_1.default `
${chalk_1.default.bold(pluginName)} does not conform Connected Components plugin interface.
Please make sure that the plugin implements the requirements listed on the documentation.
https://github.com/zeplin/cli/blob/develop/PLUGIN.md
`); // TODO add documentation link
error.stack = e.stack;
throw error;
}
};
const removeEmptyFields = (componentData) => {

@@ -45,9 +66,20 @@ if (typeof componentData.description === "undefined" || componentData.description.trim() === "") {

};
const importPlugin = (pluginName) => __awaiter(void 0, void 0, void 0, function* () {
try {
return (yield Promise.resolve().then(() => __importStar(require(pluginName)))).default;
}
catch (e) {
const error = new errors_1.CLIError(dedent_1.default `
Finding plugin module ${chalk_1.default.bold(pluginName)} failed.
Please make sure that it's installed and try again.
`);
error.stack = e.stack;
throw error;
}
});
const importPlugins = (plugins) => __awaiter(void 0, void 0, void 0, function* () {
try {
const imports = plugins.map((moduleName) => __awaiter(void 0, void 0, void 0, function* () {
const connectPluginConstructor = (yield Promise.resolve().then(() => __importStar(require(moduleName)))).default;
const connectPluginInstance = constructConnectPlugin(connectPluginConstructor);
connectPluginInstance.name = moduleName;
return connectPluginInstance;
const imports = plugins.map((pluginName) => __awaiter(void 0, void 0, void 0, function* () {
const pluginConstructor = yield importPlugin(pluginName);
return createInstance(pluginName, pluginConstructor);
}));

@@ -95,9 +127,10 @@ const pluginInstances = yield Promise.all(imports);

if (componentConfigFile.github) {
const branch = componentConfigFile.github.branch || defaults_1.defaults.github.branch;
const url = componentConfigFile.github.url || defaults_1.defaults.github.url;
const { repository } = componentConfigFile.github;
const encodedPath = encodeURIComponent(component.path);
const branch = componentConfigFile.github.branch || defaults_1.defaults.github.branch;
const path = encodeURIComponent(componentConfigFile.github.path || "");
const componentPath = encodeURIComponent(component.path);
urlPaths.push({
type: "github",
url: `${url}/${repository}/blob/${branch}/${encodedPath}`
url: url_join_1.default(url, repository, "/blob/", branch, path, componentPath)
});

@@ -104,0 +137,0 @@ }

@@ -32,3 +32,3 @@ "use strict";

console.log(dedent_1.default `${chalk_1.default.dim `ZEPLIN_ACCESS_TOKEN`} is already set.
Remove the environment variable to set it using CLI.`);
Remove the environment variable to login via CLI.`);
}

@@ -49,2 +49,3 @@ else {

yield authService.promptForLogin({ ignoreSaveTokenErrors: false });
console.log(chalk_1.default.bold("\n🦄 Successfully authenticated."));
}

@@ -51,0 +52,0 @@ });

import { AxiosResponse } from "axios";
export declare class APIError extends Error {
import { CLIError } from "./CLIError";
export declare class APIError extends CLIError {
status: number;
details: {
title: string;
message: string;
};
constructor(response: AxiosResponse);

@@ -9,0 +6,0 @@ static isAPIError(err: Error): err is APIError;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const http_status_codes_1 = require("http-status-codes");
class APIError extends Error {
const CLIError_1 = require("./CLIError");
class APIError extends CLIError_1.CLIError {
constructor(response) {

@@ -6,0 +7,0 @@ let message;

export declare class CLIError extends Error {
constructor(msg?: string);
details: any;
constructor(message: string, details?: any);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable @typescript-eslint/no-explicit-any */
class CLIError extends Error {
constructor(msg) {
const message = `${msg || "CLI Error."}`;
constructor(message, details) {
super(message);
this.details = details;
}

@@ -8,0 +9,0 @@ }

@@ -80,3 +80,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
console.log("Login into Zeplin…");
console.log("\nLogin into Zeplin…");
const credentials = yield inquirer_1.default.prompt([

@@ -83,0 +83,0 @@ {

{
"name": "@zeplin/cli",
"version": "0.2.5",
"version": "0.2.6",
"description": "Zeplin CLI",

@@ -5,0 +5,0 @@ "main": "./dist/src/app",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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