3.0.0 • Published 8 months ago

@deepjs/cdn-cli v3.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

通过命令行将文件上传至对象存储,支持阿里云、腾讯云以及七牛云

npm package npm

1. 初始化项目
npx cdn-cli init
2. 配置
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.fromstring需要上传的资源目录
rules.tostring上传目标目录
rules.ignorestring[]过滤文件或目录
rules.noCachestring[]不缓存的文件或目录
rules.lastUploadstring[]最后上传的文件或目录
environmentsobject[]环境

如果配置文件的参数不存在,系统将从 process.env 中获取值。例如,如果 production 中的 region 值不存在,系统将从 process.env.region 中提取。

3. 发布项目
npx cdn-cli deploy production
npx cdn-cli deploy testing
npx cdn-cli deploy development
...