npm i alioss-upload --save
package.json
{
"script": {
"upload": "alioss-upload -c {{configPathForOss}} -p {{sourceDir}}"
}
}
configPathForOss
: 配置文件路径(可不传,默认值: {process.cwd()}/.aliossrc),内容如下
{
"region": "your region",
"bucket": "your bucket",
"bucketPath": "your bucketPath",
"accessKeyId": "your accessKeyId",
"accessKeySecret": "your accessKeySecret"
}
sourceDir
: 静态资源目录,也可为当个文件路径 (可不传,默认值: {process.cwd()}/dist)