New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

start-envs

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

start-envs

多环境配置快速启动工具

latest
npmnpm
Version
1.0.9
Version published
Maintainers
0
Created
Source

多环境配置启动CLI

主要优化多环境多项目环境,把配置文件与项目代码分离,方便维护管理,开发运行尽量简单直接。

安装

pnpm i start-envs -D

使用

在项目根目录运行

pnpm run start-envs

CLI配置文件

在项目根目录下新建配置文件,文件名为start-envs.config.json,

{
    "configFolderName": "config",
    "envFileName": "src/envs/config.js",
    "script": ""
}

配置字段如下:

字段类型描述
configFolderNamestring配置文件夹名称,默认为config
envFileNamestring生成的配置文件,默认为src/envs/config.js
scriptstring项目中package.json中的 scripts 命令,默认为空

项目配置文件

项目配置文件是以yaml格式存储,文件名以.yaml结尾,文件名与环境名称一致,如:dev.yaml, test.yaml, prod.yaml,例如:

title: 项目名称  # 项目名称,必填
env: dev  # 环境名称,如dev, uat, sit, prod,必填
name: project # 项目名称英文简称, 必填
description: 项目描述 # 项目描述
version: 1.0.0  # 项目版本
api: # 接口地址
  baseUrl: http://localhost:8080
  apiUrl: /api
  apiPrefix: /api
  apiVersion: v1
  ...

多个环境,在config目录下新增yaml文件即可。

配置文件生成

在envFileName 中配置的配置文件,会生成在src/envs/config.js中,代码如下:

 module.exports = {
  "title": "项目名称",
  "env": "dev",
  "name": "project",
  "description": "项目描述",
  "version": "1.0.0",
  "api": {
    "baseUrl": "http://localhost:8080",
    "apiUrl": "/api",
    "apiPrefix": "/api",
    "apiVersion": "v1"
  }
}

命令行运行

支持命令行指定项目环境和运行命令

pnpm run start-envs name=project env=dev script=build

Keywords

start-envs-cli

FAQs

Package last updated on 06 Aug 2024

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