UNPKG

2.64 kBJavaScriptView Raw
1"use strict";
2
3/**
4 * @see https://github.com/yargs/yargs/blob/master/docs/advanced.md#providing-a-command-module
5 */
6exports.command = "create <name> [loc]";
7
8exports.describe = "Create a new lerna-managed package";
9
10exports.builder = (yargs) => {
11 yargs
12 .positional("name", {
13 describe: "The package name (including scope), which must be locally unique _and_ publicly available",
14 type: "string",
15 })
16 .positional("loc", {
17 describe: "A custom package location, defaulting to the first configured package location",
18 type: "string",
19 })
20 .options({
21 access: {
22 group: "Command Options:",
23 defaultDescription: "public",
24 describe: "When using a scope, set publishConfig.access value",
25 choices: ["public", "restricted"],
26 },
27 bin: {
28 group: "Command Options:",
29 defaultDescription: "<name>",
30 describe: "Package has an executable. Customize with --bin <executableName>",
31 },
32 description: {
33 group: "Command Options:",
34 describe: "Package description",
35 type: "string",
36 },
37 dependencies: {
38 group: "Command Options:",
39 describe: "A list of package dependencies",
40 type: "array",
41 },
42 "es-module": {
43 group: "Command Options:",
44 describe: "Initialize a transpiled ES Module",
45 type: "boolean",
46 },
47 homepage: {
48 group: "Command Options:",
49 describe: "The package homepage, defaulting to a subpath of the root pkg.homepage",
50 type: "string",
51 },
52 keywords: {
53 group: "Command Options:",
54 describe: "A list of package keywords",
55 type: "array",
56 },
57 license: {
58 group: "Command Options:",
59 defaultDescription: "ISC",
60 describe: "The desired package license (SPDX identifier)",
61 type: "string",
62 },
63 private: {
64 group: "Command Options:",
65 describe: "Make the new package private, never published to any external registry",
66 type: "boolean",
67 },
68 registry: {
69 group: "Command Options:",
70 describe: "Configure the package's publishConfig.registry",
71 type: "string",
72 },
73 tag: {
74 group: "Command Options:",
75 describe: "Configure the package's publishConfig.tag",
76 type: "string",
77 },
78 y: {
79 group: "Command Options:",
80 describe: "Skip all prompts, accepting default values",
81 alias: "yes",
82 type: "boolean",
83 },
84 });
85
86 return yargs;
87};
88
89exports.handler = function handler(argv) {
90 return require(".")(argv);
91};