@wjh666/ssh
v0.0.13
Published
### 安装 npm i @wjh666/ssh -g
Downloads
12
Readme
node 服务器操作
安装
npm i @wjh666/ssh -g
已有命令
w-ssh upFile
w-ssh upvrpc 完整路径
w-ssh createFile 名称 路径(可不填,使用模版中的outUrl)
w-ssh copyFile 文档后续补
upFile
上传文件到服务器,用于前端项目部署,本地打包后读取配置文件,根据配置文件信息,上传到服务器 项目根目录添加配置文件
文件命名格式:up-file.js up-file.**.js
文件内容事例
module.exports = {
host: '', // 服务器地址
port: '', // 端口
username: '', // 帐号
password: '', // 密码
localDir: './dist', // 要上传的文件地址(相对路径)
serverDir: '/data/demo01' // 要上传到服务器的目录
}
upvrpc
项目需求,需要在几百个文件夹中替换文件,不想手动写,写个脚本,慎用
完整路径 要替换文件的目录
createFile
根据本地模版生成文件/文件夹
小程序组件使用了官方的框架,创建组件与页面经常无法使用小程序的一键生成
react项目中组件创建一般需要定义 tsx文件,less文件,以及引入与导出。ts类型声明
所以写了这个组件
文件demo
module.exports = {
// 模版位置
templateBase: './a.html',
// 输出文件夹位置 如果有第2个参数则替换
outUrl: './page',
// 文件名称转换
fileName: (e: '第一个参数') => {
return e
},
// 模版中的变量替换
variable: {
a: 1,
b: (e: '第一个参数') => {
return e + 'abc'
}
}
}
文件夹demo
module.exports = {
// 模版文件夹位置
templateBase: './reactTemplate',
outUrl: './page',
// 文件夹名字处理
filesName: (e: '第一个参数') => {
return e
},
fileName: (e) => {
return 'index'
},
variable: {
a: 1,
b: (e) => {
return e + 'abc'
}
}
}