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 1.1.1 to 1.1.2

dist/src/service/project-type/configurators/storybook.d.ts

5

dist/package.json
{
"name": "@zeplin/cli",
"version": "1.1.1",
"version": "1.1.2",
"description": "Zeplin CLI",

@@ -51,2 +51,3 @@ "main": "./dist/src/index.js",

"@types/parse-git-config": "^3.0.0",
"@types/semver": "^7.3.4",
"@types/strip-comments": "^2.0.0",

@@ -68,2 +69,3 @@ "@types/update-notifier": "^4.1.0",

"@hapi/joi": "^17.1.1",
"argparse": "^1.0.10",
"axios": "^0.21.1",

@@ -96,2 +98,3 @@ "chalk": "^3.0.0",

"parse-git-config": "^3.0.0",
"semver": "^5.7.1",
"strip-ansi": "^6.0.0",

@@ -98,0 +101,0 @@ "strip-comments": "^2.0.1",

2

dist/src/service/project-type/detect.js

@@ -24,5 +24,5 @@ "use strict";

};
return array_1.asyncFilter(project_types_1.supportedProjectTypes, spt => spt.matcher.match(context));
return array_1.asyncFilter(project_types_1.supportedProjectTypes, spt => spt.matcher(context));
});
}
exports.detectProjectTypes = detectProjectTypes;

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

import { Matcher } from ".";
export declare function fileMatcherFactory(files: string[], mode?: "every" | "some"): Matcher;
import { ProjectMatcher } from ".";
export declare function fileMatcherFactory(files: string[], mode?: "every" | "some"): ProjectMatcher;

@@ -15,11 +15,9 @@ "use strict";

function fileMatcherFactory(files, mode = "some") {
return {
match: () => __awaiter(this, void 0, void 0, function* () {
const results = yield Promise.all(files.map(f => file_1.pathExists(f)));
return mode === "every"
? results.every(r => r)
: results.some(r => r);
})
};
return () => __awaiter(this, void 0, void 0, function* () {
const results = yield Promise.all(files.map(f => file_1.pathExists(f)));
return mode === "every"
? results.every(r => r)
: results.some(r => r);
});
}
exports.fileMatcherFactory = fileMatcherFactory;

@@ -1,7 +0,2 @@

import { Matcher } from ".";
import { PackageJson } from "../../../util/js/config";
export interface JsDependencies {
packageJson?: PackageJson | null;
bowerJson?: PackageJson | null;
}
export declare function jsDependencyMatcherFactory(dependencies: string[], mode?: "every" | "some"): Matcher;
import { ProjectMatcher } from ".";
export declare function jsDependencyMatcherFactory(dependencies: string[], mode?: "every" | "some"): ProjectMatcher;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.jsDependencyMatcherFactory = void 0;
function hasDependency(packageJson, name) {
var _a, _b, _c;
return !!((_a = packageJson.dependencies) === null || _a === void 0 ? void 0 : _a[name]) ||
!!((_b = packageJson.devDependencies) === null || _b === void 0 ? void 0 : _b[name]) ||
!!((_c = packageJson.peerDependencies) === null || _c === void 0 ? void 0 : _c[name]);
}
const dependency_1 = require("../../../util/js/dependency");
function jsDependencyMatcherFactory(dependencies, mode = "some") {
return {
match: (ctx) => {
const dependencyFile = ctx.packageJson || ctx.bowerJson;
if (dependencyFile) {
return mode === "every"
? dependencies.every(d => hasDependency(dependencyFile, d))
: dependencies.some(d => hasDependency(dependencyFile, d));
}
return false;
return (ctx) => {
const dependencyFile = ctx.packageJson || ctx.bowerJson;
if (dependencyFile) {
return mode === "every"
? dependencies.every(d => dependency_1.hasDependency(dependencyFile, d))
: dependencies.some(d => dependency_1.hasDependency(dependencyFile, d));
}
return false;
};
}
exports.jsDependencyMatcherFactory = jsDependencyMatcherFactory;

@@ -1,2 +0,3 @@

import { Matcher } from "./matchers";
import { ProjectMatcher } from "./matchers";
import { Configurator } from "./configurators";
export declare enum ProjectType {

@@ -12,6 +13,7 @@ REACT = "react",

type: ProjectType;
matcher: Matcher;
matcher: ProjectMatcher;
installPackages?: string[];
configurator?: Configurator;
}
export declare const supportedProjectTypes: SupportedProjectType[];
export declare function getSupportedProjectType(projectType: string): SupportedProjectType | undefined;

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

const storybook_1 = require("./storybook");
const storybook_2 = require("./configurators/storybook");
var ProjectType;

@@ -51,3 +52,4 @@ (function (ProjectType) {

"@zeplin/cli-connect-storybook-plugin"
]
],
configurator: storybook_2.storybookConfiguratorFactory()
}

@@ -54,0 +56,0 @@ ];

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

ctx.installGlobally = installedGlobally;
ctx.packageJson = packageJson;
});

@@ -54,0 +55,0 @@ exports.detectEnvironment = new task_1.Task({

@@ -45,23 +45,42 @@ "use strict";

});
const executeConfigurators = (pluginName, projectTypes, packageJson) => __awaiter(void 0, void 0, void 0, function* () {
const pluginConfigs = yield Promise.all(projectTypes.filter(pt => pt.installPackages && pt.installPackages.includes(pluginName)).map((pt) => __awaiter(void 0, void 0, void 0, function* () {
if (pt.configurator) {
const pluginConfig = yield pt.configurator(packageJson);
return pluginConfig;
}
return null;
})));
return pluginConfigs.filter(Boolean);
});
const getPluginConfigs = (installedPlugins, projectTypes, packageJson) => Promise.all(installedPlugins.map((name) => __awaiter(void 0, void 0, void 0, function* () {
const configs = yield executeConfigurators(name, projectTypes, packageJson);
if (configs.length > 0) {
const pluginConfig = configs.reduce((prev, curr) => Object.assign(prev, curr), {});
return {
name,
config: pluginConfig
};
}
return { name };
})));
const generate = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
const { installedPlugins = [], projectTypes = [], packageJson, selectedResource, selectedComponents, file, git, cliOptions: { configFile } } = ctx;
const config = Object.create(null);
const resource = ctx.selectedResource;
config.plugins = ctx.installedPlugins.map(p => ({
name: p
}));
if (resource.type === "Project") {
config.projects = [resource._id];
config.plugins = yield getPluginConfigs(installedPlugins, projectTypes, packageJson);
if (selectedResource.type === "Project") {
config.projects = [selectedResource._id];
}
else {
config.styleguides = [resource._id];
config.styleguides = [selectedResource._id];
}
config.components = [{
path: ctx.file.path,
zeplinIds: ctx.selectedComponents.map(c => c._id)
path: file.path,
zeplinIds: selectedComponents.map(c => c._id)
}];
if (ctx.git) {
config[ctx.git.type] = ctx.git.config;
if (git) {
config[git.type] = git.config;
}
logger_1.default.debug(`Generated config file: ${text_1.stringify(config)}`);
yield writeFile(ctx.cliOptions.configFile, config);
yield writeFile(configFile, config);
});

@@ -68,0 +87,0 @@ exports.generateConfig = new task_1.Task({

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

const projectTypes = ctx.projectTypes || [];
const plugins = projectTypes.reduce((p, c) => p.concat(c.installPackages || []), []);
const plugins = Array.from(new Set(projectTypes.reduce((p, c) => p.concat(c.installPackages || []), [])));
ctx.installedPlugins = plugins;

@@ -80,2 +80,3 @@ const packageNames = [

yield config_1.writePackageJson(packageJson);
ctx.packageJson = packageJson;
}

@@ -82,0 +83,0 @@ });

{
"name": "@zeplin/cli",
"version": "1.1.1",
"version": "1.1.2",
"description": "Zeplin CLI",

@@ -51,2 +51,3 @@ "main": "./dist/src/index.js",

"@types/parse-git-config": "^3.0.0",
"@types/semver": "^7.3.4",
"@types/strip-comments": "^2.0.0",

@@ -68,2 +69,3 @@ "@types/update-notifier": "^4.1.0",

"@hapi/joi": "^17.1.1",
"argparse": "^1.0.10",
"axios": "^0.21.1",

@@ -96,2 +98,3 @@ "chalk": "^3.0.0",

"parse-git-config": "^3.0.0",
"semver": "^5.7.1",
"strip-ansi": "^6.0.0",

@@ -98,0 +101,0 @@ "strip-comments": "^2.0.1",

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