1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const command_1 = require("@oclif/command");
|
4 | const qq = require("qqjs");
|
5 | const aws_1 = require("../../aws");
|
6 | const log_1 = require("../../log");
|
7 | const Tarballs = require("../../tarballs");
|
8 | class PublishMacos extends command_1.Command {
|
9 | async run() {
|
10 | const { flags } = this.parse(PublishMacos);
|
11 | const buildConfig = await Tarballs.buildConfig(flags.root);
|
12 | const { s3Config, version, config } = buildConfig;
|
13 | const S3Options = {
|
14 | Bucket: s3Config.bucket,
|
15 | ACL: s3Config.acl || 'public-read',
|
16 | };
|
17 | const root = buildConfig.channel === 'stable' ? '' : `channels/${buildConfig.channel}/`;
|
18 | const pkg = buildConfig.dist(`macos/${config.bin}-v${buildConfig.version}.pkg`);
|
19 | if (await qq.exists(pkg))
|
20 | await aws_1.default.s3.uploadFile(pkg, Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=86400', Key: `${root}${config.bin}.pkg` }));
|
21 | log_1.log(`published macos ${version}`);
|
22 | }
|
23 | }
|
24 | exports.default = PublishMacos;
|
25 | PublishMacos.description = 'publish macos installers built with pack:macos';
|
26 | PublishMacos.flags = {
|
27 | root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
|
28 | };
|