@ts-for-gir/cli 4.0.0-beta.8 → 4.0.0-rc.1
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.
- package/README.md +295 -84
- package/bin/ts-for-gir +26569 -0
- package/bin/ts-for-gir-dev +43 -0
- package/package.json +39 -38
- package/src/commands/analyze.ts +344 -0
- package/src/commands/command-builder.ts +30 -0
- package/src/commands/copy.ts +71 -76
- package/src/commands/doc.ts +44 -47
- package/src/commands/generate.ts +35 -79
- package/src/commands/index.ts +6 -4
- package/src/commands/json.ts +43 -0
- package/src/commands/list.ts +71 -90
- package/src/commands/run-generation-command.ts +70 -0
- package/src/config/config-loader.ts +190 -0
- package/src/config/config-writer.ts +52 -0
- package/src/config/defaults.ts +66 -0
- package/src/config/index.ts +8 -0
- package/src/config/options.ts +315 -0
- package/src/config.ts +3 -456
- package/src/formatters/typescript-formatter.ts +24 -0
- package/src/generation-handler.ts +122 -67
- package/src/index.ts +4 -4
- package/src/module-loader/dependency-resolver.ts +100 -0
- package/src/module-loader/file-finder.ts +65 -0
- package/src/module-loader/index.ts +8 -0
- package/src/module-loader/module-grouper.ts +77 -0
- package/src/module-loader/prompt-handler.ts +111 -0
- package/src/module-loader.ts +289 -578
- package/src/start.ts +17 -14
- package/src/types/command-args.ts +118 -0
- package/src/types/command-definition.ts +17 -0
- package/src/types/commands.ts +30 -0
- package/src/types/index.ts +15 -0
- package/src/types/report-types.ts +34 -0
- package/lib/commands/copy.d.ts +0 -12
- package/lib/commands/copy.js +0 -80
- package/lib/commands/copy.js.map +0 -1
- package/lib/commands/doc.d.ts +0 -12
- package/lib/commands/doc.js +0 -40
- package/lib/commands/doc.js.map +0 -1
- package/lib/commands/generate.d.ts +0 -12
- package/lib/commands/generate.js +0 -71
- package/lib/commands/generate.js.map +0 -1
- package/lib/commands/index.d.ts +0 -4
- package/lib/commands/index.js +0 -5
- package/lib/commands/index.js.map +0 -1
- package/lib/commands/list.d.ts +0 -12
- package/lib/commands/list.js +0 -81
- package/lib/commands/list.js.map +0 -1
- package/lib/config.d.ts +0 -108
- package/lib/config.js +0 -410
- package/lib/config.js.map +0 -1
- package/lib/generation-handler.d.ts +0 -10
- package/lib/generation-handler.js +0 -48
- package/lib/generation-handler.js.map +0 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -5
- package/lib/index.js.map +0 -1
- package/lib/module-loader.d.ts +0 -148
- package/lib/module-loader.js +0 -468
- package/lib/module-loader.js.map +0 -1
- package/lib/start.d.ts +0 -2
- package/lib/start.js +0 -16
- package/lib/start.js.map +0 -1
package/src/start.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import yargs from
|
|
3
|
-
import { hideBin } from
|
|
1
|
+
import { APP_NAME, APP_USAGE, APP_VERSION } from "@ts-for-gir/lib";
|
|
2
|
+
import yargs, { type CommandModule } from "yargs";
|
|
3
|
+
import { hideBin } from "yargs/helpers";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Config } from './config.js'
|
|
5
|
+
import { analyze, copy, doc, generate, json, list } from "./commands/index.ts";
|
|
7
6
|
|
|
8
7
|
void yargs(hideBin(process.argv))
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
.scriptName(APP_NAME)
|
|
9
|
+
.strict()
|
|
10
|
+
.usage(APP_USAGE)
|
|
11
|
+
.version(APP_VERSION)
|
|
12
|
+
// TODO: Fix this
|
|
13
|
+
.command(analyze as unknown as CommandModule)
|
|
14
|
+
.command(generate as unknown as CommandModule)
|
|
15
|
+
.command(json as unknown as CommandModule)
|
|
16
|
+
.command(list as unknown as CommandModule)
|
|
17
|
+
.command(copy as unknown as CommandModule)
|
|
18
|
+
.command(doc as unknown as CommandModule)
|
|
19
|
+
.demandCommand(1)
|
|
20
|
+
.help().argv;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base interface for all command arguments extending ConfigFlags
|
|
3
|
+
*/
|
|
4
|
+
export interface BaseCommandArgs {
|
|
5
|
+
/** GIR modules to load, e.g. 'Gio-2.0'. Accepts multiple modules */
|
|
6
|
+
modules: string[];
|
|
7
|
+
/** GIR directories */
|
|
8
|
+
girDirectories: string[];
|
|
9
|
+
/** Root directory of your project */
|
|
10
|
+
root: string;
|
|
11
|
+
/** Modules that should be ignored */
|
|
12
|
+
ignore: string[];
|
|
13
|
+
/** Specify a custom name for the configuration file */
|
|
14
|
+
configName: string;
|
|
15
|
+
/** Switch on/off the verbose mode */
|
|
16
|
+
verbose: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Arguments for the generate command
|
|
21
|
+
*/
|
|
22
|
+
export interface GenerateCommandArgs extends BaseCommandArgs {
|
|
23
|
+
/** Directory to output to */
|
|
24
|
+
outdir: string | null;
|
|
25
|
+
/** Skip prompts for library version selection when multiple versions are detected */
|
|
26
|
+
ignoreVersionConflicts: boolean;
|
|
27
|
+
/** Print the output to console and create no files */
|
|
28
|
+
print: boolean;
|
|
29
|
+
/** Do not export all symbols for each module as a namespace */
|
|
30
|
+
noNamespace: boolean;
|
|
31
|
+
/** Do not generate documentation comments */
|
|
32
|
+
noComments: boolean;
|
|
33
|
+
/** Generate promisified functions for async/finish calls */
|
|
34
|
+
promisify: boolean;
|
|
35
|
+
/** Scope of the generated NPM packages */
|
|
36
|
+
npmScope: string;
|
|
37
|
+
/** Uses the workspace protocol for the generated packages which can be used with package managers like Yarn and PNPM */
|
|
38
|
+
workspace: boolean;
|
|
39
|
+
/** Only use the version prefix for the ambient module exports */
|
|
40
|
+
onlyVersionPrefix: boolean;
|
|
41
|
+
/** Do not prettify the generated types */
|
|
42
|
+
noPrettyPrint: boolean;
|
|
43
|
+
/** Disable GLib.Variant class with string parsing */
|
|
44
|
+
noAdvancedVariants: boolean;
|
|
45
|
+
/** Generate the typescript types with package.json support */
|
|
46
|
+
package: boolean;
|
|
47
|
+
/** Enable generation problem reporter and create a detailed report file */
|
|
48
|
+
reporter: boolean;
|
|
49
|
+
/** Output file path for the reporter */
|
|
50
|
+
reporterOutput: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Arguments for the list command
|
|
55
|
+
*/
|
|
56
|
+
export interface ListCommandArgs extends BaseCommandArgs {
|
|
57
|
+
// List command only uses base arguments
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Arguments for the copy command
|
|
62
|
+
*/
|
|
63
|
+
export interface CopyCommandArgs extends BaseCommandArgs {
|
|
64
|
+
/** Directory to output to */
|
|
65
|
+
outdir: string | null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Arguments for the doc command
|
|
70
|
+
*/
|
|
71
|
+
export interface DocCommandArgs extends GenerateCommandArgs {
|
|
72
|
+
/** Generate a single unified documentation for all modules (use --no-combined for separate per-module docs) */
|
|
73
|
+
combined: boolean;
|
|
74
|
+
/** URL template for source links in generated documentation. Supports {path}, {line}, {gitRevision} placeholders */
|
|
75
|
+
sourceLinkTemplate?: string;
|
|
76
|
+
/** Theme for HTML documentation generation (default: "gi-docgen") */
|
|
77
|
+
theme?: string;
|
|
78
|
+
/** Path to a README file to use as the documentation index page (default: "none") */
|
|
79
|
+
readme?: string;
|
|
80
|
+
/** Use TypeDoc merge mode to generate HTML from pre-generated JSON files */
|
|
81
|
+
merge?: boolean;
|
|
82
|
+
/** Directory containing pre-generated TypeDoc JSON files for merge mode */
|
|
83
|
+
jsonDir?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Arguments for the analyze command
|
|
88
|
+
*/
|
|
89
|
+
export interface AnalyzeCommandArgs {
|
|
90
|
+
/** Path to the report file to analyze */
|
|
91
|
+
reportFile: string;
|
|
92
|
+
/** Filter by problem severity (debug, info, warning, error, critical) */
|
|
93
|
+
severity?: string[];
|
|
94
|
+
/** Filter by problem category */
|
|
95
|
+
category?: string[];
|
|
96
|
+
/** Filter by namespace/module */
|
|
97
|
+
namespace?: string[];
|
|
98
|
+
/** Filter by specific type name */
|
|
99
|
+
type?: string[];
|
|
100
|
+
/** Show top N most problematic items */
|
|
101
|
+
top?: number;
|
|
102
|
+
/** Export filtered results to file */
|
|
103
|
+
export?: string;
|
|
104
|
+
/** Output format (json, csv, table) */
|
|
105
|
+
format?: string;
|
|
106
|
+
/** Show detailed problem information */
|
|
107
|
+
detailed?: boolean;
|
|
108
|
+
/** Show summary statistics only */
|
|
109
|
+
summary?: boolean;
|
|
110
|
+
/** Search for problems containing specific text */
|
|
111
|
+
search?: string;
|
|
112
|
+
/** Show problems from a specific time range (ISO date) */
|
|
113
|
+
since?: string;
|
|
114
|
+
/** Show problems until a specific time (ISO date) */
|
|
115
|
+
until?: string;
|
|
116
|
+
/** Switch on/off the verbose mode */
|
|
117
|
+
verbose?: boolean;
|
|
118
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ConfigFlags } from "@ts-for-gir/lib";
|
|
2
|
+
import type { BuilderCallback } from "yargs";
|
|
3
|
+
/**
|
|
4
|
+
* Base interface for command definition structure
|
|
5
|
+
*/
|
|
6
|
+
export interface CommandDefinition<TArgs> {
|
|
7
|
+
/** Command name and parameters */
|
|
8
|
+
command: string;
|
|
9
|
+
/** Command description */
|
|
10
|
+
description: string;
|
|
11
|
+
/** Builder function for yargs configuration */
|
|
12
|
+
builder: BuilderCallback<TArgs, ConfigFlags>;
|
|
13
|
+
/** Handler function for command execution */
|
|
14
|
+
handler: (args: ConfigFlags) => Promise<void>;
|
|
15
|
+
/** Example usage array */
|
|
16
|
+
examples: ReadonlyArray<[string, string?]>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for command structure and exports
|
|
3
|
+
*/
|
|
4
|
+
import type { CopyCommandArgs, DocCommandArgs, GenerateCommandArgs, ListCommandArgs } from "./command-args.ts";
|
|
5
|
+
import type { CommandDefinition } from "./command-definition.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Generate command definition type
|
|
9
|
+
*/
|
|
10
|
+
export type GenerateCommand = CommandDefinition<GenerateCommandArgs>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* List command definition type
|
|
14
|
+
*/
|
|
15
|
+
export type ListCommand = CommandDefinition<ListCommandArgs>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Copy command definition type
|
|
19
|
+
*/
|
|
20
|
+
export type CopyCommand = CommandDefinition<CopyCommandArgs>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Doc command definition type
|
|
24
|
+
*/
|
|
25
|
+
export type DocCommand = CommandDefinition<DocCommandArgs>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Union type for all command types
|
|
29
|
+
*/
|
|
30
|
+
export type AnyCommand = GenerateCommand | ListCommand | CopyCommand | DocCommand;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export all types from the CLI types module
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Command argument interfaces
|
|
6
|
+
export * from "./command-args.ts";
|
|
7
|
+
|
|
8
|
+
// Command definition interfaces
|
|
9
|
+
export * from "./command-definition.ts";
|
|
10
|
+
|
|
11
|
+
// Command type definitions
|
|
12
|
+
export * from "./commands.ts";
|
|
13
|
+
|
|
14
|
+
// Report analysis types
|
|
15
|
+
export * from "./report-types.ts";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for report analysis functionality
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ProblemEntry } from "@ts-for-gir/reporter";
|
|
6
|
+
|
|
7
|
+
export interface TypeStatistics {
|
|
8
|
+
commonUnresolvedTypes: Array<{ type: string; count: number; namespaces: string[] }>;
|
|
9
|
+
commonTypeConflicts: Array<{ conflictType: string; count: number; examples: string[] }>;
|
|
10
|
+
problematicNamespaces: Array<{ namespace: string; problems: number; types: string[] }>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ReportStatistics {
|
|
14
|
+
bySeverity: Record<string, number>;
|
|
15
|
+
byCategory: Record<string, number>;
|
|
16
|
+
byModule: Record<string, number>;
|
|
17
|
+
totalProblems: number;
|
|
18
|
+
mostProblematicModules: Array<{ module: string; count: number }>;
|
|
19
|
+
typeStatistics: TypeStatistics;
|
|
20
|
+
startTime: string | Date;
|
|
21
|
+
endTime?: string | Date;
|
|
22
|
+
durationMs?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ReportMetadata {
|
|
26
|
+
version: string;
|
|
27
|
+
generatedAt: string | Date;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ReportData {
|
|
31
|
+
metadata: ReportMetadata;
|
|
32
|
+
statistics: ReportStatistics;
|
|
33
|
+
problems: ProblemEntry[];
|
|
34
|
+
}
|
package/lib/commands/copy.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything you need for the `ts-for-gir copy` command is located here
|
|
3
|
-
*/
|
|
4
|
-
import { Argv } from 'yargs';
|
|
5
|
-
import type { ConfigFlags } from '@ts-for-gir/lib';
|
|
6
|
-
export declare const copy: {
|
|
7
|
-
command: string;
|
|
8
|
-
description: string;
|
|
9
|
-
builder: ((args: Argv<any>) => Argv<ConfigFlags>) | ((args: Argv<any>) => void);
|
|
10
|
-
handler: (args: ConfigFlags) => Promise<void>;
|
|
11
|
-
examples: readonly [string, (string | undefined)?][];
|
|
12
|
-
};
|
package/lib/commands/copy.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything you need for the `ts-for-gir copy` command is located here
|
|
3
|
-
*/
|
|
4
|
-
import { copyFile, mkdir } from 'fs/promises';
|
|
5
|
-
import { basename, join } from 'path';
|
|
6
|
-
import { ModuleLoader } from '../module-loader.js';
|
|
7
|
-
import { Config } from '../config.js';
|
|
8
|
-
import { Logger, ERROR_NO_MODULES_FOUND } from '@ts-for-gir/lib';
|
|
9
|
-
const command = 'copy [modules..]';
|
|
10
|
-
const description = 'Scan for *.gir files and copy them to a new directory';
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
const builder = (yargs) => {
|
|
13
|
-
const optionNames = Object.keys(Config.copyOptions);
|
|
14
|
-
for (const optionName of optionNames) {
|
|
15
|
-
yargs = yargs.option(optionName, Config.copyOptions[optionName]);
|
|
16
|
-
}
|
|
17
|
-
return yargs.example(examples);
|
|
18
|
-
};
|
|
19
|
-
const copyGirFile = async (config, depModule) => {
|
|
20
|
-
if (!depModule.path) {
|
|
21
|
-
Logger.danger(`- ${depModule.packageName} not found`);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (!config.outdir) {
|
|
25
|
-
Logger.error(`outdir not found`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const filename = basename(depModule.path);
|
|
29
|
-
const dest = join(config.outdir, filename);
|
|
30
|
-
if (depModule.path === dest) {
|
|
31
|
-
Logger.yellow(`Skip ${depModule.path}`);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
Logger.success(`Copy ${depModule.path}`);
|
|
35
|
-
await copyFile(depModule.path, dest);
|
|
36
|
-
};
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
-
const handler = async (args) => {
|
|
39
|
-
const config = await Config.load(args);
|
|
40
|
-
const generateConfig = Config.getOptionsGeneration(config);
|
|
41
|
-
const moduleLoader = new ModuleLoader(generateConfig);
|
|
42
|
-
const { grouped, failed } = await moduleLoader.getModules(config.modules, config.ignore);
|
|
43
|
-
const moduleGroups = Object.values(grouped);
|
|
44
|
-
if (Object.keys(grouped).length === 0) {
|
|
45
|
-
return Logger.error(ERROR_NO_MODULES_FOUND(config.girDirectories));
|
|
46
|
-
}
|
|
47
|
-
if (!config.outdir) {
|
|
48
|
-
Logger.error(`outdir not found`);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
await mkdir(config.outdir, { recursive: true }).catch((err) => {
|
|
52
|
-
Logger.error(`Failed to copy gir files to ${config.outdir}: ${err}`);
|
|
53
|
-
});
|
|
54
|
-
for (const module of moduleGroups) {
|
|
55
|
-
for (const mod of module.modules) {
|
|
56
|
-
await copyGirFile(config, mod);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (failed.length > 0) {
|
|
60
|
-
Logger.danger('\nDependencies not found:');
|
|
61
|
-
for (const fail of failed) {
|
|
62
|
-
Logger.white(`- ${fail}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const examples = [
|
|
67
|
-
[`${Config.appName} copy -o ./gir`, `Copy found *.gir files to ./gir`],
|
|
68
|
-
[
|
|
69
|
-
`${Config.appName} copy -g /usr/share/gir-1.0 --ignore=Gtk-3.0 xrandr-1.3 -o ./gir`,
|
|
70
|
-
'Copy all found *.gir files in /usr/share/gir-1.0 excluding Gtk-3.0 and xrandr-1.3 to ./gir',
|
|
71
|
-
],
|
|
72
|
-
];
|
|
73
|
-
export const copy = {
|
|
74
|
-
command,
|
|
75
|
-
description,
|
|
76
|
-
builder,
|
|
77
|
-
handler,
|
|
78
|
-
examples,
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=copy.js.map
|
package/lib/commands/copy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../src/commands/copy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAA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AAE,CAAC;QAChC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YAC/B,MAAM,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAClC,CAAC;IACL,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAA;QAC1C,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YACxB,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;QAC7B,CAAC;IACL,CAAC;AACL,CAAC,CAAA;AAED,MAAM,QAAQ,GAAqC;IAC/C,CAAC,GAAG,MAAM,CAAC,OAAO,gBAAgB,EAAE,iCAAiC,CAAC;IACtE;QACI,GAAG,MAAM,CAAC,OAAO,kEAAkE;QACnF,4FAA4F;KAC/F;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,IAAI,GAAG;IAChB,OAAO;IACP,WAAW;IACX,OAAO;IACP,OAAO;IACP,QAAQ;CACX,CAAA"}
|
package/lib/commands/doc.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything you need for the `ts-for-gir generate` command is located here
|
|
3
|
-
*/
|
|
4
|
-
import { Argv } from 'yargs';
|
|
5
|
-
import type { ConfigFlags } from '@ts-for-gir/lib';
|
|
6
|
-
export declare const doc: {
|
|
7
|
-
command: string;
|
|
8
|
-
description: string;
|
|
9
|
-
builder: ((args: Argv<any>) => Argv<ConfigFlags>) | ((args: Argv<any>) => void);
|
|
10
|
-
handler: (args: ConfigFlags) => Promise<void>;
|
|
11
|
-
examples: readonly [string, (string | undefined)?][];
|
|
12
|
-
};
|
package/lib/commands/doc.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything you need for the `ts-for-gir generate` command is located here
|
|
3
|
-
*/
|
|
4
|
-
import { Logger, ERROR_NO_MODULES_FOUND } from '@ts-for-gir/lib';
|
|
5
|
-
import { GeneratorType } from '@ts-for-gir/generator-base';
|
|
6
|
-
import { GenerationHandler } from '../generation-handler.js';
|
|
7
|
-
import { Config } from '../config.js';
|
|
8
|
-
import { ModuleLoader } from '../module-loader.js';
|
|
9
|
-
const command = 'doc [modules..]';
|
|
10
|
-
const description = 'The HTML documentation generator is not yet implemented, but feel free to implement it 🤗';
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
const builder = (yargs) => {
|
|
13
|
-
const optionNames = Object.keys(Config.docOptions);
|
|
14
|
-
for (const optionName of optionNames) {
|
|
15
|
-
yargs = yargs.option(optionName, Config.docOptions[optionName]);
|
|
16
|
-
}
|
|
17
|
-
return yargs.example(examples);
|
|
18
|
-
};
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
const handler = async (args) => {
|
|
21
|
-
const config = await Config.load(args);
|
|
22
|
-
const generateConfig = Config.getOptionsGeneration(config);
|
|
23
|
-
const moduleLoader = new ModuleLoader(generateConfig);
|
|
24
|
-
const { keep } = await moduleLoader.getModulesResolved(config.modules, config.ignore || [], config.ignoreVersionConflicts);
|
|
25
|
-
if (keep.length === 0) {
|
|
26
|
-
return Logger.error(ERROR_NO_MODULES_FOUND(config.girDirectories));
|
|
27
|
-
}
|
|
28
|
-
const tsForGir = new GenerationHandler(generateConfig, GeneratorType.HTML_DOC);
|
|
29
|
-
const registry = moduleLoader.dependencyManager;
|
|
30
|
-
await tsForGir.start(Array.from(keep).map((girModuleResolvedBy) => girModuleResolvedBy.module), registry);
|
|
31
|
-
};
|
|
32
|
-
const examples = [];
|
|
33
|
-
export const doc = {
|
|
34
|
-
command,
|
|
35
|
-
description,
|
|
36
|
-
builder,
|
|
37
|
-
handler,
|
|
38
|
-
examples,
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=doc.js.map
|
package/lib/commands/doc.js.map
DELETED
|
@@ -1 +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AAM,CAAC,sBAAsB,CAChC,CAAA;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAA;IACtE,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC9E,MAAM,QAAQ,GAAG,YAAY,CAAC,iBAAiB,CAAA;IAE/C,MAAM,QAAQ,CAAC,KAAK,CAChB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,EACzE,QAAQ,CACX,CAAA;AACL,CAAC,CAAA;AAED,MAAM,QAAQ,GAAqC,EAAE,CAAA;AAErD,MAAM,CAAC,MAAM,GAAG,GAAG;IACf,OAAO;IACP,WAAW;IACX,OAAO;IACP,OAAO;IACP,QAAQ;CACX,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything you need for the `ts-for-gir generate` command is located here
|
|
3
|
-
*/
|
|
4
|
-
import { Argv } from 'yargs';
|
|
5
|
-
import type { ConfigFlags } from '@ts-for-gir/lib';
|
|
6
|
-
export declare const generate: {
|
|
7
|
-
command: string;
|
|
8
|
-
description: string;
|
|
9
|
-
builder: ((args: Argv<any>) => Argv<ConfigFlags>) | ((args: Argv<any>) => void);
|
|
10
|
-
handler: (args: ConfigFlags) => Promise<void>;
|
|
11
|
-
examples: readonly [string, (string | undefined)?][];
|
|
12
|
-
};
|
package/lib/commands/generate.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything you need for the `ts-for-gir generate` command is located here
|
|
3
|
-
*/
|
|
4
|
-
import { ERROR_NO_MODULES_FOUND, Logger } from '@ts-for-gir/lib';
|
|
5
|
-
import { GeneratorType } from '@ts-for-gir/generator-base';
|
|
6
|
-
import { GenerationHandler } from '../generation-handler.js';
|
|
7
|
-
import { Config } from '../config.js';
|
|
8
|
-
import { ModuleLoader } from '../module-loader.js';
|
|
9
|
-
import prettier from 'prettier';
|
|
10
|
-
import { Formatter } from '@ts-for-gir/lib';
|
|
11
|
-
const command = 'generate [modules..]';
|
|
12
|
-
const description = 'Generates Typescript type definition .d.ts files from GIR for GJS';
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
const builder = (yargs) => {
|
|
15
|
-
const optionNames = Object.keys(Config.generateOptions);
|
|
16
|
-
for (const optionName of optionNames) {
|
|
17
|
-
yargs = yargs.option(optionName, Config.generateOptions[optionName]);
|
|
18
|
-
}
|
|
19
|
-
return yargs.example(examples);
|
|
20
|
-
};
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
const handler = async (args) => {
|
|
23
|
-
const config = await Config.load(args);
|
|
24
|
-
const generateConfig = Config.getOptionsGeneration(config);
|
|
25
|
-
const moduleLoader = new ModuleLoader(generateConfig);
|
|
26
|
-
const { keep } = await moduleLoader.getModulesResolved(config.modules, config.ignore || [], config.ignoreVersionConflicts);
|
|
27
|
-
if (keep.length === 0) {
|
|
28
|
-
return Logger.error(ERROR_NO_MODULES_FOUND(config.girDirectories));
|
|
29
|
-
}
|
|
30
|
-
moduleLoader.parse(keep);
|
|
31
|
-
const tsForGir = new GenerationHandler(generateConfig, GeneratorType.TYPES);
|
|
32
|
-
const girModules = Array.from(keep).map((girModuleResolvedBy) => girModuleResolvedBy.module);
|
|
33
|
-
moduleLoader.dependencyManager.registerFormatter('dts', new TypeScriptFormatter());
|
|
34
|
-
await tsForGir.start(girModules, moduleLoader.dependencyManager);
|
|
35
|
-
};
|
|
36
|
-
const examples = [
|
|
37
|
-
[
|
|
38
|
-
`${Config.appName} generate`,
|
|
39
|
-
`Run '${Config.appName} generate' in your gjs project to generate typings for your project, pass the gir modules you need for your project`,
|
|
40
|
-
],
|
|
41
|
-
[`${Config.appName} generate Gtk*`, 'You can also use wild cards'],
|
|
42
|
-
[`${Config.appName} generate '*'`, 'If you want to parse all of your locally installed gir modules run'],
|
|
43
|
-
[`${Config.appName} generate --configName='.ts-for-gir.gtk4.rc.js`, 'Use a special config file'],
|
|
44
|
-
[
|
|
45
|
-
`${Config.appName} generate --ignore=Gtk-4.0 xrandr-1.3`,
|
|
46
|
-
'Generate .d.ts. files but not for Gtk-4.0 and xrandr-1.3',
|
|
47
|
-
],
|
|
48
|
-
];
|
|
49
|
-
class TypeScriptFormatter extends Formatter {
|
|
50
|
-
format(input) {
|
|
51
|
-
try {
|
|
52
|
-
return prettier.format(input, {
|
|
53
|
-
singleQuote: true,
|
|
54
|
-
parser: 'typescript',
|
|
55
|
-
printWidth: 120,
|
|
56
|
-
tabWidth: 4,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
return Promise.resolve(input);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export const generate = {
|
|
65
|
-
command,
|
|
66
|
-
description,
|
|
67
|
-
builder,
|
|
68
|
-
handler,
|
|
69
|
-
examples,
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,QAAQ,MAAM,UAAU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ands/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA"}
|
package/lib/commands/list.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything you need for the `ts-for-gir list` command is located here
|
|
3
|
-
*/
|
|
4
|
-
import { Argv } from 'yargs';
|
|
5
|
-
import type { ConfigFlags } from '@ts-for-gir/lib';
|
|
6
|
-
export declare const list: {
|
|
7
|
-
command: string;
|
|
8
|
-
description: string;
|
|
9
|
-
builder: ((args: Argv<any>) => Argv<ConfigFlags>) | ((args: Argv<any>) => void);
|
|
10
|
-
handler: (args: ConfigFlags) => Promise<void>;
|
|
11
|
-
examples: readonly [string, (string | undefined)?][];
|
|
12
|
-
};
|
package/lib/commands/list.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything you need for the `ts-for-gir list` command is located here
|
|
3
|
-
*/
|
|
4
|
-
import { ModuleLoader } from '../module-loader.js';
|
|
5
|
-
import { Config } from '../config.js';
|
|
6
|
-
import { Logger, ERROR_NO_MODULES_FOUND, ResolveType } from '@ts-for-gir/lib';
|
|
7
|
-
const command = 'list [modules..]';
|
|
8
|
-
const description = 'Lists all available GIR modules';
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
const builder = (yargs) => {
|
|
11
|
-
const optionNames = Object.keys(Config.listOptions);
|
|
12
|
-
for (const optionName of optionNames) {
|
|
13
|
-
yargs = yargs.option(optionName, Config.listOptions[optionName]);
|
|
14
|
-
}
|
|
15
|
-
return yargs.example(examples);
|
|
16
|
-
};
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
const handler = async (args) => {
|
|
19
|
-
const config = await Config.load(args);
|
|
20
|
-
const generateConfig = Config.getOptionsGeneration(config);
|
|
21
|
-
const moduleLoader = new ModuleLoader(generateConfig);
|
|
22
|
-
const { grouped, failed } = await moduleLoader.getModules(config.modules, config.ignore);
|
|
23
|
-
const moduleGroups = Object.values(grouped);
|
|
24
|
-
if (Object.keys(grouped).length === 0) {
|
|
25
|
-
return Logger.error(ERROR_NO_MODULES_FOUND(config.girDirectories));
|
|
26
|
-
}
|
|
27
|
-
const conflictModules = moduleGroups.filter((moduleGroup) => moduleGroup.hasConflict);
|
|
28
|
-
const byHandModules = moduleGroups.filter((moduleGroup) => moduleGroup.modules[0].resolvedBy === ResolveType.BY_HAND);
|
|
29
|
-
const depModules = moduleGroups.filter((moduleGroup) => moduleGroup.modules[0].resolvedBy === ResolveType.DEPENDENCE);
|
|
30
|
-
Logger.info('\nSearch for gir files in:');
|
|
31
|
-
for (const dir of config.girDirectories) {
|
|
32
|
-
Logger.white(`- ${dir}`);
|
|
33
|
-
}
|
|
34
|
-
Logger.info('\nSelected Modules:');
|
|
35
|
-
for (const moduleGroup of byHandModules) {
|
|
36
|
-
for (const depModule of moduleGroup.modules) {
|
|
37
|
-
Logger.white(`- ${depModule.packageName}`);
|
|
38
|
-
Logger.gray(` - ${depModule.path}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (depModules.length > 0) {
|
|
42
|
-
Logger.yellow('\nDependencies:');
|
|
43
|
-
for (const moduleGroup of depModules) {
|
|
44
|
-
for (const depModule of moduleGroup.modules) {
|
|
45
|
-
Logger.white(`- ${depModule.packageName}`);
|
|
46
|
-
Logger.gray(`- ${depModule.path}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (conflictModules.length > 0) {
|
|
51
|
-
Logger.danger('\nConflicts:');
|
|
52
|
-
for (const moduleGroup of conflictModules) {
|
|
53
|
-
Logger.white(`- ${moduleGroup.namespace}`);
|
|
54
|
-
for (const conflictModule of moduleGroup.modules) {
|
|
55
|
-
Logger.white(` - ${conflictModule.packageName}`);
|
|
56
|
-
Logger.gray(` - ${conflictModule.path}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (failed.length > 0) {
|
|
61
|
-
Logger.danger('\nDependencies not found:');
|
|
62
|
-
for (const fail of failed) {
|
|
63
|
-
Logger.white(`- ${fail}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
const examples = [
|
|
68
|
-
[`${Config.appName} list -g ./vala-girs/gir-1.0`, `Lists all available GIR modules in ./vala-girs/gir-1.0`],
|
|
69
|
-
[
|
|
70
|
-
`${Config.appName} list --ignore=Gtk-3.0 xrandr-1.3`,
|
|
71
|
-
'Lists all available GIR modules in /usr/share/gir-1.0 but not Gtk-3.0 and xrandr-1.3',
|
|
72
|
-
],
|
|
73
|
-
];
|
|
74
|
-
export const list = {
|
|
75
|
-
command,
|
|
76
|
-
description,
|
|
77
|
-
builder,
|
|
78
|
-
handler,
|
|
79
|
-
examples,
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=list.js.map
|
package/lib/commands/list.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAI7E,MAAM,OAAO,GAAG,kBAAkB,CAAA;AAElC,MAAM,WAAW,GAAG,iCAAiC,CAAA;AAErD,8DAA8D;AAC9D,MAAM,OAAO,GAAsC,CAAC,KAAgB,EAAE,EAAE;IACpE,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW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