-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
42 lines (37 loc) · 976 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env node
import chalk from "chalk";
import { exit } from "process";
import { parse } from "./lib/cli";
import { promptConfig } from "./lib/cli/prompt";
import { createPackage } from "./lib/package/create";
import { makeTargets } from "./lib/package/target";
import packageJson from "./package.json";
const cli = parse(process.argv, packageJson);
(async function () {
const config = await promptConfig(cli.projectDirectory);
if (config == null) {
console.log("Exiting.");
exit(1);
}
try {
const targets = makeTargets(config);
const success = await createPackage({
config,
targets,
options: {
dryRun: cli.dryRun,
interactive: true,
runSwiftBuild: cli.swiftBuild,
promptXcode: cli.promptXcode,
},
});
if (!success) {
exit(1);
}
} catch (err) {
console.error(
chalk.red(`Couldn't create package: ${(err as Error).message}`)
);
exit(1);
}
})();