npx cdn-cli init
module.exports = {
rules: [
{
from: 'dist',
to: '.',
ignore: ['**/*.map', '**/.DS_store'],
noCache: ['**/*.html'],
lastUpload: ['**/*.html'],
},
],
environments: {
production: {
type: 'aliyun',
region: 'oss-cn-hangzhou',
bucket: 'xxx',
accessKeyId: 'xxx',
accessKeySecret: 'xxx',
domain: 'https://xxx.xxx.com',
},
testing: {
type: 'qiniu',
region: '',
bucket: '',
accessKey: '',
secretKey: '',
domain: '',
},
development: {
type: 'tencent',
region: '',
bucket: '',
appId: '',
secretId: '',
secretKey: '',
domain: '',
},
},
};
字段 | 类型 | 详情 |
---|---|---|
rules.from | string | 需要上传的资源目录 |
rules.to | string | 上传目标目录 |
rules.ignore | string[] | 过滤文件或目录 |
rules.noCache | string[] | 不缓存的文件或目录 |
rules.lastUpload | string[] | 最后上传的文件或目录 |
environments | object[] | 环境 |
如果配置文件的参数不存在,系统将从 process.env
中获取值。例如,如果 production
中的 region
值不存在,系统将从 process.env.region
中提取。
npx cdn-cli deploy production
npx cdn-cli deploy testing
npx cdn-cli deploy development
...