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

replace-api-path

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replace-api-path

根据定义好的url生成一份修改打包文件路径的shell脚本

latest
Source
npmnpm
Version
0.0.14
Version published
Weekly downloads
2
-95.35%
Maintainers
1
Weekly downloads
 
Created
Source

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的测试环境

FAQs

Package last updated on 28 Sep 2017

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