ali-oss-publish
a cli interface of publish resources to ali-oss
Installation
yarn add ali-oss-publish
Api
publish: function(options: object[, cb: function(err: Error, stats: Stats)]): Promise
options: object
: publish optionsoptions.id: string
: accessKeyId in ali oss, see ali-oss-optionsoptions.secret: string
: accessKeySecret in ali oss, see ali-oss-optionsoptions.token: string
: stsToken in ali oss, see ali-oss-optionsoptions.region: string,
: region in ali oss, see ali-oss-optionsoptions.bucket: string,
: bucket in ali oss, see ali-oss-optionsoptions.entry = '.': string
: entry point, defaults to "."options.include: ?RegExp
: match files will publish to ali ossoptions.exclude: ?RegExp
: match files will ignore to publish to ali ossoptions.mime: ?(string|function(path: string): string|void)
: custom mime to all files, see ali-oss-put-file-optionsoptions.meta: ?(object|function(path: string): object|void)
: custom meta to all files, see ali-oss-put-file-optionsoptions.headers: ?(object|function(path: string): object|void)
: custom headers to all files, see ali-oss-put-file-optionsoptions.rules = []: Array<object>
: custom operations options for the match files, defaults to []options.rules[].test: ?RegExp|boolean
: match files or the test is true will apply custom operationsoptions.rules[].include: ?RegExp
: match files will apply custom operationsoptions.rules[].exclude: ?RegExp
: match files will ignore to apply custom operationsoptions.rules[].use: ?object
: custom operationsoptions.rules[].use.mime: ?(string|function(path: string): string|void)
: custom mime to the match files, see ali-oss-put-file-optionsoptions.rules[].use.meta: ?(object|function(path: string): object|void)
: custom meta to the match files, see ali-oss-put-file-optionsoptions.rules[].use.headers: ?(object|function(path: string): object|void)
: custom headers to the match files, see ali-oss-put-file-options
options.output = '.': string
: output path for publish to ali oss, defaults to "."options.force: boolean
: force remove the files that not in the publish entryoptions.config: string
: path to the config file, defaults to try load config from "ali-oss-publish.config.js" when config is not setoptions.retry: ?number
: retry times when encountered non-fatal errorsoptions.concurrency: ?number
: concurrency for publish
cb = noop: function(err: Error[, stats: Stats])
: callback function, defaults to nooperr: Error
: fatal errorstats: Stats
: publish statsstats.message: string
: message for statsstats.type: ?string
: type for statsstats.index: ?number
: concurrency indexstats.current: ?number
: current stepstats.total: ?number
: total stepstats.warnings: ?Array<string>
: warnings for statsstats.errors: ?Array<Error>
: errors for statsstats.hasProgress: function(): boolean
: ensure whether has progressstats.hasWarnings: function(): boolean
: ensure whether has warningsstats.hasErrors: function(): boolean
: ensure whether has errors
- Returns
Promise
: promise
const publish =
Cli
Usage: ali-oss-publish [options]
a cli interface of publish resources to ali oss
Options:
-V, --version output the version number
-i, --id <id> accessKeyId in ali oss
-s, --secret <secret> accessKeySecret in ali oss
-t, --token <token> stsToken in ali oss
-r, --region <region> region in ali oss
-b, --bucket <bucket> bucket in ali oss
-e, --entry <entry> entry point, defaults to "."
-o, --output <output> output path for publish to ali oss, defaults to "."
-c, --config <config> path to the config file, defaults to try load config from "ali-oss-publish.config.js" when config is not set
--retry <retry> retry times when encountered non-fatal errors
--concurrency <concurrency> concurrency for publish
--force force remove the files that not in the publish entry
-h, --help display help for command
Environment
Env Name | Config Name |
---|---|
ALI_OSS_PUBLISH_ID | id |
ALI_OSS_PUBLISH_SECRET | secret |
ALI_OSS_PUBLISH_TOKEN | token |
ALI_OSS_PUBLISH_REGION | regin |
ALI_OSS_PUBLISH_BUCKET | bucket |
ALI_OSS_PUBLISH_ENTRY | entry |
ALI_OSS_PUBLISH_OUTPUT | output |
Config File
moduleexports = // publish options
Options Override
EnvOptions < FileOptions < ParamsOptions