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

m-fe-cli-utils

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

m-fe-cli-utils

FE Cli 工具方法集

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

m-fe-cli-utils

FE-CLI 以及相关的插件需要用到的 utils 方法及常量

Getting Started

  • $ npm install m-fe-cli-utils --save

举个栗子:

import { WORKSPACE, getInfo } from 'm-fe-cli-utils';

getInfo().then(userInfo => {
  console.log('>> Your name: ', userInfo.name);
});

API

consts 静态常量

namedesctypevalue
WORKSPACE当前的执行目录,即 process.cwd()string
CONFIG_PATH全局配置根目录 ~/.feconfigstring
PLUGIN_PATH全局插件根目录 ~/.feconfig/lib/node_modulesstring
USER_PROFILE用户信息配置文件 ~/.feconfig/profile.jsonstring
FNPM_REGISTRY_URLfnpm registry 地址string'http://registry.npm.cfuture.cc'
FNPM_WEB_URLfnpm 地址string'http://npm.cfuture.cc'

version 版本号相关方法

  1. checkUpdate(registry: string, current: string): Promise<false | string> 检查是否需要更新,如果有新版本,则返回版本号

  2. needUpdate(registry: string, current: string): Promise<boolean> 是否有新版本,以及是否需要升级(控制台二次确认)

userinfo 用户信息相关方法

  1. getInfo(): Promise<UserConfig> 获取用户信息,如果没果,则会调用设置

  2. setInfo(isUpdate = false) 设置用户信息, isUpdate 表示强制更新

config 获取工作区配置

  1. getWorkspaceConfig(): Promise<WorkspaceConfig> 获取当前工程目录的配置,包含 git 相关信息
interface WorkspaceConfig extends Record<string, any> {
  /** 配置类型,一般是 builder */
  type: string;
  /** 项目构建插件名 (fnpm 包名) */
  builder: string;

  /** 项目相关信息 */
  projectInfo?: {
    group: string;
    project: string;
    version: string;
    gitBranch: string;
    remote: string;
  };
}

helper 生成 helper 信息相关方法

  1. createHelperInfo(options) 创建 helper 字符串

CHANGELOG

  • 1.2.0:init

Keywords

FAQs

Package last updated on 16 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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