@ts-for-gir/cli 4.0.0-rc.3 → 4.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103,6 +103,12 @@ export const options: { [name: string]: Options } = {
103
103
  default: defaults.workspace,
104
104
  normalize: true,
105
105
  },
106
+ depVersionFormat: {
107
+ type: "string",
108
+ description:
109
+ "Dependency version spec format in generated package.json files. Defaults to 'workspace' when --workspace, else 'exact'",
110
+ choices: ["workspace", "caret", "any", "exact"] as const,
111
+ },
106
112
  onlyVersionPrefix: {
107
113
  type: "boolean",
108
114
  description:
@@ -160,6 +166,7 @@ export const generateOptions = {
160
166
  promisify: options.promisify,
161
167
  npmScope: options.npmScope,
162
168
  workspace: options.workspace,
169
+ depVersionFormat: options.depVersionFormat,
163
170
  onlyVersionPrefix: options.onlyVersionPrefix,
164
171
  noPrettyPrint: options.noPrettyPrint,
165
172
  noAdvancedVariants: options.noAdvancedVariants,
@@ -223,6 +230,26 @@ export const docOptions = {
223
230
  },
224
231
  };
225
232
 
233
+ export const createOptions = {
234
+ template: {
235
+ type: "string" as const,
236
+ alias: "t",
237
+ description: "Template to scaffold (types-locally, types-npm, types-workspace)",
238
+ choices: ["types-locally", "types-npm", "types-workspace"] as const,
239
+ },
240
+ install: {
241
+ type: "boolean" as const,
242
+ description: "Run npm install after scaffolding (use --no-install to skip)",
243
+ default: true,
244
+ },
245
+ force: {
246
+ type: "boolean" as const,
247
+ description: "Allow scaffolding into a non-empty target directory",
248
+ default: false,
249
+ },
250
+ verbose: options.verbose,
251
+ };
252
+
226
253
  export const analyzeOptions = {
227
254
  reportFile: {
228
255
  type: "string" as const,
package/src/start.ts CHANGED
@@ -2,7 +2,7 @@ import { APP_NAME, APP_USAGE, APP_VERSION } from "@ts-for-gir/lib";
2
2
  import yargs, { type CommandModule } from "yargs";
3
3
  import { hideBin } from "yargs/helpers";
4
4
 
5
- import { analyze, copy, doc, generate, json, list } from "./commands/index.ts";
5
+ import { analyze, copy, create, doc, generate, json, list } from "./commands/index.ts";
6
6
 
7
7
  void yargs(hideBin(process.argv))
8
8
  .scriptName(APP_NAME)
@@ -11,6 +11,7 @@ void yargs(hideBin(process.argv))
11
11
  .version(APP_VERSION)
12
12
  // TODO: Fix this
13
13
  .command(analyze as unknown as CommandModule)
14
+ .command(create as unknown as CommandModule)
14
15
  .command(generate as unknown as CommandModule)
15
16
  .command(json as unknown as CommandModule)
16
17
  .command(list as unknown as CommandModule)
@@ -36,6 +36,8 @@ export interface GenerateCommandArgs extends BaseCommandArgs {
36
36
  npmScope: string;
37
37
  /** Uses the workspace protocol for the generated packages which can be used with package managers like Yarn and PNPM */
38
38
  workspace: boolean;
39
+ /** Dependency version spec format in generated package.json files */
40
+ depVersionFormat?: "workspace" | "caret" | "any" | "exact";
39
41
  /** Only use the version prefix for the ambient module exports */
40
42
  onlyVersionPrefix: boolean;
41
43
  /** Do not prettify the generated types */
@@ -83,6 +85,27 @@ export interface DocCommandArgs extends GenerateCommandArgs {
83
85
  jsonDir?: string;
84
86
  }
85
87
 
88
+ /**
89
+ * Available scaffolding template identifiers for the create command.
90
+ */
91
+ export type CreateTemplateId = "types-locally" | "types-npm" | "types-workspace";
92
+
93
+ /**
94
+ * Arguments for the create command
95
+ */
96
+ export interface CreateCommandArgs {
97
+ /** Project name and target directory (positional) */
98
+ name?: string;
99
+ /** Template identifier */
100
+ template?: CreateTemplateId;
101
+ /** Run npm install after scaffolding (use --no-install to skip) */
102
+ install: boolean;
103
+ /** Allow scaffolding into a non-empty target directory */
104
+ force: boolean;
105
+ /** Switch on/off the verbose mode */
106
+ verbose: boolean;
107
+ }
108
+
86
109
  /**
87
110
  * Arguments for the analyze command
88
111
  */