replace-api-path

0.0.14 • Public • Published

replace-api-path

开始使用

  1. 添加依赖 npm i replace-api-path --save-dev
  2. 添加./node_modules/.bin/replace-path到faas命令

参数

./node_modules/.bin/replace-path s=source-path d=dist-path

s url-map文件的路径 可选 默认为 '/config/urls.js'

d shell脚本生成目录 可选 默认为 '/dist'

url-map格式

const URL_MAP = {
  alpha: {
    SSO: 'alpha-sso',
    API_PREFIX: 'alpha-httpizza'
  },
  beta: {
    SSO: 'beta-sso',
    API_PREFIX: 'beta-httpizza'
  },
  prod: {
    SSO: 'prod-sso',
    API_PREFIX: 'prod-httpizza'
  }
}
const CURRENT_ENV = 'alpha'
const SSO = URL_MAP[CURRENT_ENV].SSO
const API_PREFIX = URL_MAP[CURRENT_ENV].API_PREFIX
const prodReplace = [
  {
    from: 'a.com',
    to: 'b.com',
    type: 'html'
  },
  {
    from: 'e.com',
    to: 'f.com',
    type: 'html'
  }
]
const testReplace = [
  {
    from: 'c.com',
    to: 'd.com',
    type: 'html'
  },
  {
    from: 'g.com',
    to: 'h.com',
    type: 'js'
  }
]

module.exports = { SSO, API_PREFIX, URL_MAP, prodReplace, testReplace }

URL_MAP中的prod对应的是production环境,其余的对应faas的测试环境

Readme

Keywords

none

Package Sidebar

Install

npm i replace-api-path

Weekly Downloads

2

Version

0.0.14

License

ISC

Last publish

Collaborators

  • quietcoder