0.2.6 • Published 8 months ago

deploy-files v0.2.6

Weekly downloads
109
License
BSD
Repository
github
Last release
8 months ago

deploy-files

使用node上传文件到远程机器

代码说明

  • index.js 普通上传
  • fsr.js 使用邮箱验证的安全方式上传
  • webpack-plugin.js webpack插件
  • upload.js node使用上传插件,包含普通上传和fsr上传

配置

webpack.config.js增加deployMap字段

{
  ...
  
  deployMap: {
     sandbox: {
         receiver: 'http://YOUR_HOST/receiver',
         templatePath: '/home/work/nginx_static/html/test/template',
         templateSuffix: '.html', // 模板后缀,不配置默认使用.tpl,也可传入'.(san|html)'
         staticPath: '//home/work/nginx_static/html/test/static',
         staticDomain: 'http://test.com:8888',
         throttle: 200 // 文件上传的延迟时间,默认为200ms
     },
     sandbox2: {
         ...
     } 
  },
 ...
}

upload.js 使用

// 实例化
const upload = new Upload({
    disableFsr: false, // 默认启用fsr 默认false
    host: 'http://host.com',
    receiver: 'http://xxx.com:8xxx/receiver',
    to: 'dest', // 目标机器路径
    files: [{[filenam]: [sourceCode]}], // 文件对象
    replace: [{from:'a', to:'b'}, {from: new RegExp('oldCDN', 'ig'), to: 'newCDN'}] // 替换内容
});

// 开始上传
upload.run();

服务端配置

receiver.php,部署到远程机器,并保证receiver.php能被正常访问

直接访问http://YOUR_HOST/YOUR_PATH/receiver.php时,页面应该显示这行字

I'm ready for that, you know.

常见问题

  1. Error:部署token已过期
执行:  rm ~/.deploy-tmp/deploy.json,删除本地缓存文件即可。

Reference

0.2.6-test.0

8 months ago

0.2.6

8 months ago

0.2.5-alpha.0

1 year ago

0.2.5

1 year ago

0.2.3

1 year ago

0.2.4

1 year ago

0.2.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.2.2

2 years ago

0.1.3

2 years ago

0.1.5

2 years ago

0.1.1

3 years ago

0.1.0

4 years ago

0.0.5

4 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago