UNPKG

1.22 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const command_1 = require("@oclif/command");
4const qq = require("qqjs");
5const Tarballs = require("../../tarballs");
6class Pack extends command_1.Command {
7 async run() {
8 const prevCwd = qq.cwd();
9 if (process.platform === 'win32')
10 throw new Error('pack does not function on windows');
11 const { flags } = this.parse(Pack);
12 const targets = flags.targets ? flags.targets.split(',') : undefined;
13 const buildConfig = await Tarballs.buildConfig(flags.root, { xz: flags.xz, targets });
14 await Tarballs.build(buildConfig);
15 qq.cd(prevCwd);
16 }
17}
18exports.default = Pack;
19Pack.description = `packages oclif cli into tarballs
20
21This can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.
22`;
23Pack.flags = {
24 root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
25 targets: command_1.flags.string({ char: 't', description: 'comma-separated targets to pack (e.g.: linux-arm,win32-x64)' }),
26 xz: command_1.flags.boolean({ description: 'also build xz', allowNo: true }),
27};