Skip to content

Commit

Permalink
feat: 允许直接定义 Artifact 的下载地址
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Apr 13, 2020
1 parent 1645ca7 commit bade49b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/generator/artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class Artifact extends EventEmitter {
name: artifactName,
template,
templateString,
downloadUrl,
} = artifact;

assert(artifactName, '必须指定 artifact 的 name 属性');
Expand All @@ -100,6 +101,7 @@ export class Artifact extends EventEmitter {
const {
name: artifactName,
customParams,
downloadUrl,
} = this.artifact;
// tslint:disable-next-line:no-this-assignment
const {
Expand All @@ -118,7 +120,7 @@ export class Artifact extends EventEmitter {

return {
proxyTestUrl: config.proxyTestUrl,
downloadUrl: getDownloadUrl(config.urlBase, artifactNameWithParams, true, gatewayHasToken ? gatewayConfig?.accessToken : undefined),
downloadUrl: downloadUrl ? downloadUrl : getDownloadUrl(config.urlBase, artifactNameWithParams, true, gatewayHasToken ? gatewayConfig?.accessToken : undefined),
nodes: nodeList,
names: nodeNameList,
remoteSnippets,
Expand Down
1 change: 1 addition & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export interface ArtifactConfig {
readonly proxyGroupModifier?: ProxyGroupModifier;
readonly destDir?: string;
readonly templateString?: string;
readonly downloadUrl?: string;
}

export interface ProviderConfig {
Expand Down
1 change: 1 addition & 0 deletions lib/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const validateConfig = (userConfig: Partial<CommandConfig>): void => {
customParams: Joi.object(),
proxyGroupModifier: Joi.function(),
destDir: Joi.string(),
downloadUrl: Joi.string(),
});
const remoteSnippetSchema = Joi.object({
url: Joi.string().uri({
Expand Down

0 comments on commit bade49b

Please sign in to comment.