replace-api-path
v0.0.14
Published
根据定义好的url生成一份修改打包文件路径的shell脚本
Downloads
5
Readme
replace-api-path
开始使用
- 添加依赖
npm i replace-api-path --save-dev
- 添加
./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的测试环境