@ts-for-gir/cli 4.0.0-beta.32 → 4.0.0-beta.33
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/bin/ts-for-gir +28 -27
- package/package.json +10 -10
- package/src/commands/copy.ts +1 -1
- package/src/commands/doc.ts +1 -1
- package/src/commands/generate.ts +1 -1
- package/src/commands/json.ts +1 -1
- package/src/commands/list.ts +11 -21
- package/src/module-loader/file-finder.ts +20 -6
package/bin/ts-for-gir
CHANGED
|
@@ -17250,12 +17250,23 @@ var FileFinder = class {
|
|
|
17250
17250
|
if (!globPackageNames[i]) {
|
|
17251
17251
|
continue;
|
|
17252
17252
|
}
|
|
17253
|
-
|
|
17254
|
-
|
|
17255
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
17258
|
-
|
|
17253
|
+
if (globPackageNames[i] === "*") {
|
|
17254
|
+
for (const girDirectory of this.girDirectories) {
|
|
17255
|
+
const pattern = join7(girDirectory, "*.gir");
|
|
17256
|
+
const ignoreGirs = ignore.map((ignored) => join7(girDirectory, `${ignored}.gir`));
|
|
17257
|
+
const files = await glob2(pattern, { ignore: ignoreGirs });
|
|
17258
|
+
for (const file of files) {
|
|
17259
|
+
foundFiles.add(file);
|
|
17260
|
+
}
|
|
17261
|
+
}
|
|
17262
|
+
} else {
|
|
17263
|
+
const filename = `${globPackageNames[i]}.gir`;
|
|
17264
|
+
const pattern = this.girDirectories.map((girDirectory) => join7(girDirectory, filename));
|
|
17265
|
+
const ignoreGirs = ignore.map((girDirectory) => `${girDirectory}.gir`);
|
|
17266
|
+
const files = await glob2(pattern, { ignore: ignoreGirs });
|
|
17267
|
+
for (const file of files) {
|
|
17268
|
+
foundFiles.add(file);
|
|
17269
|
+
}
|
|
17259
17270
|
}
|
|
17260
17271
|
}
|
|
17261
17272
|
return foundFiles;
|
|
@@ -17635,7 +17646,7 @@ var ModuleLoader = class {
|
|
|
17635
17646
|
// src/commands/copy.ts
|
|
17636
17647
|
var command2 = "copy [modules..]";
|
|
17637
17648
|
var description2 = "Scan for *.gir files and copy them to a new directory";
|
|
17638
|
-
var logger3 = new Logger(
|
|
17649
|
+
var logger3 = new Logger(true, "CopyCommand");
|
|
17639
17650
|
var examples2 = [
|
|
17640
17651
|
[`${APP_NAME} copy -o ./gir`, "Copy found *.gir files to ./gir"],
|
|
17641
17652
|
[
|
|
@@ -19773,7 +19784,7 @@ var GenerationHandler = class {
|
|
|
19773
19784
|
// src/commands/doc.ts
|
|
19774
19785
|
var command3 = "doc [modules..]";
|
|
19775
19786
|
var description3 = "The HTML documentation generator is not yet implemented, but feel free to implement it \u{1F917}";
|
|
19776
|
-
var logger4 = new Logger(
|
|
19787
|
+
var logger4 = new Logger(true, "DocCommand");
|
|
19777
19788
|
var builder3 = (yargs2) => {
|
|
19778
19789
|
const optionNames = Object.keys(docOptions);
|
|
19779
19790
|
for (const optionName of optionNames) {
|
|
@@ -19833,7 +19844,7 @@ var TypeScriptFormatter = class extends Formatter {
|
|
|
19833
19844
|
// src/commands/generate.ts
|
|
19834
19845
|
var command4 = "generate [modules..]";
|
|
19835
19846
|
var description4 = "Generates Typescript type definition .d.ts files from GIR for GJS";
|
|
19836
|
-
var logger6 = new Logger(
|
|
19847
|
+
var logger6 = new Logger(true, "GenerateCommand");
|
|
19837
19848
|
var examples4 = [
|
|
19838
19849
|
[
|
|
19839
19850
|
`${APP_NAME} generate`,
|
|
@@ -19897,7 +19908,7 @@ var generate = {
|
|
|
19897
19908
|
// src/commands/json.ts
|
|
19898
19909
|
var command5 = "json [modules..]";
|
|
19899
19910
|
var description5 = "Generates JSON representation from GIR files for analysis and tooling";
|
|
19900
|
-
var logger7 = new Logger(
|
|
19911
|
+
var logger7 = new Logger(true, "JsonCommand");
|
|
19901
19912
|
var examples5 = [
|
|
19902
19913
|
[`${APP_NAME} json`, `Run '${APP_NAME} json' in your gjs project to generate JSON files for your project`],
|
|
19903
19914
|
[`${APP_NAME} json Gtk*`, "You can also use wild cards"],
|
|
@@ -19957,7 +19968,7 @@ var json = {
|
|
|
19957
19968
|
// src/commands/list.ts
|
|
19958
19969
|
var command6 = "list [modules..]";
|
|
19959
19970
|
var description6 = "Lists all available GIR modules";
|
|
19960
|
-
var logger8 = new Logger(
|
|
19971
|
+
var logger8 = new Logger(true, "ListCommand");
|
|
19961
19972
|
var examples6 = [
|
|
19962
19973
|
[`${APP_NAME} list -g ./vala-girs/gir-1.0`, "Lists all available GIR modules in ./vala-girs/gir-1.0"],
|
|
19963
19974
|
[
|
|
@@ -19977,26 +19988,16 @@ var handler6 = async (args) => {
|
|
|
19977
19988
|
return logger8.error(ERROR_NO_MODULES_FOUND(config.girDirectories));
|
|
19978
19989
|
}
|
|
19979
19990
|
const conflictModules = moduleGroups.filter((moduleGroup) => moduleGroup.hasConflict);
|
|
19980
|
-
const
|
|
19981
|
-
const depModules = moduleGroups.filter((moduleGroup) => moduleGroup.modules[0].resolvedBy === 0 /* DEPENDENCE */);
|
|
19991
|
+
const allModules = moduleGroups.filter((moduleGroup) => !moduleGroup.hasConflict);
|
|
19982
19992
|
logger8.info("\nSearch for gir files in:");
|
|
19983
19993
|
for (const dir of config.girDirectories) {
|
|
19984
19994
|
logger8.white(`- ${dir}`);
|
|
19985
19995
|
}
|
|
19986
|
-
logger8.info("\
|
|
19987
|
-
for (const moduleGroup of
|
|
19988
|
-
for (const
|
|
19989
|
-
logger8.white(`- ${
|
|
19990
|
-
logger8.gray(` - ${
|
|
19991
|
-
}
|
|
19992
|
-
}
|
|
19993
|
-
if (depModules.length > 0) {
|
|
19994
|
-
logger8.yellow("\nDependencies:");
|
|
19995
|
-
for (const moduleGroup of depModules) {
|
|
19996
|
-
for (const depModule of moduleGroup.modules) {
|
|
19997
|
-
logger8.white(`- ${depModule.packageName}`);
|
|
19998
|
-
logger8.gray(`- ${depModule.path}`);
|
|
19999
|
-
}
|
|
19996
|
+
logger8.info("\nAvailable Modules:");
|
|
19997
|
+
for (const moduleGroup of allModules) {
|
|
19998
|
+
for (const module of moduleGroup.modules) {
|
|
19999
|
+
logger8.white(`- ${module.packageName}`);
|
|
20000
|
+
logger8.gray(` - ${module.path}`);
|
|
20000
20001
|
}
|
|
20001
20002
|
}
|
|
20002
20003
|
if (conflictModules.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-for-gir/cli",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.33",
|
|
4
4
|
"description": "TypeScript type definition generator for GObject introspection GIR files",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"module": "src/index.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
|
-
"ts-for-gir": "bin/ts-for-gir",
|
|
10
9
|
"cli": "bin/ts-for-gir",
|
|
10
|
+
"ts-for-gir": "bin/ts-for-gir",
|
|
11
11
|
"ts-for-gir-dev": "bin/ts-for-gir-dev"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
".": "./src/index.ts"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@gi.ts/parser": "^4.0.0-beta.
|
|
57
|
-
"@ts-for-gir/generator-base": "^4.0.0-beta.
|
|
58
|
-
"@ts-for-gir/generator-html-doc": "^4.0.0-beta.
|
|
59
|
-
"@ts-for-gir/generator-json": "^4.0.0-beta.
|
|
60
|
-
"@ts-for-gir/generator-typescript": "^4.0.0-beta.
|
|
61
|
-
"@ts-for-gir/lib": "^4.0.0-beta.
|
|
62
|
-
"@ts-for-gir/reporter": "^4.0.0-beta.
|
|
56
|
+
"@gi.ts/parser": "^4.0.0-beta.33",
|
|
57
|
+
"@ts-for-gir/generator-base": "^4.0.0-beta.33",
|
|
58
|
+
"@ts-for-gir/generator-html-doc": "^4.0.0-beta.33",
|
|
59
|
+
"@ts-for-gir/generator-json": "^4.0.0-beta.33",
|
|
60
|
+
"@ts-for-gir/generator-typescript": "^4.0.0-beta.33",
|
|
61
|
+
"@ts-for-gir/lib": "^4.0.0-beta.33",
|
|
62
|
+
"@ts-for-gir/reporter": "^4.0.0-beta.33",
|
|
63
63
|
"@types/ejs": "^3.1.5",
|
|
64
64
|
"@types/inquirer": "^9.0.9",
|
|
65
65
|
"@types/node": "^24.2.1",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@inquirer/prompts": "^7.8.2",
|
|
73
|
-
"@ts-for-gir/templates": "^4.0.0-beta.
|
|
73
|
+
"@ts-for-gir/templates": "^4.0.0-beta.33",
|
|
74
74
|
"colorette": "^2.0.20",
|
|
75
75
|
"cosmiconfig": "^9.0.0",
|
|
76
76
|
"ejs": "^3.1.10",
|
package/src/commands/copy.ts
CHANGED
|
@@ -15,7 +15,7 @@ const command = "copy [modules..]";
|
|
|
15
15
|
|
|
16
16
|
const description = "Scan for *.gir files and copy them to a new directory";
|
|
17
17
|
|
|
18
|
-
const logger = new Logger(
|
|
18
|
+
const logger = new Logger(true, "CopyCommand");
|
|
19
19
|
|
|
20
20
|
const examples: ReadonlyArray<[string, string?]> = [
|
|
21
21
|
[`${APP_NAME} copy -o ./gir`, "Copy found *.gir files to ./gir"],
|
package/src/commands/doc.ts
CHANGED
|
@@ -22,7 +22,7 @@ const command = "doc [modules..]";
|
|
|
22
22
|
|
|
23
23
|
const description = "The HTML documentation generator is not yet implemented, but feel free to implement it 🤗";
|
|
24
24
|
|
|
25
|
-
const logger = new Logger(
|
|
25
|
+
const logger = new Logger(true, "DocCommand");
|
|
26
26
|
|
|
27
27
|
const builder: BuilderCallback<DocCommandArgs, ConfigFlags> = (yargs: Argv<DocCommandArgs>) => {
|
|
28
28
|
const optionNames = Object.keys(docOptions);
|
package/src/commands/generate.ts
CHANGED
|
@@ -25,7 +25,7 @@ const command = "generate [modules..]";
|
|
|
25
25
|
|
|
26
26
|
const description = "Generates Typescript type definition .d.ts files from GIR for GJS";
|
|
27
27
|
|
|
28
|
-
const logger = new Logger(
|
|
28
|
+
const logger = new Logger(true, "GenerateCommand");
|
|
29
29
|
|
|
30
30
|
const examples: ReadonlyArray<[string, string?]> = [
|
|
31
31
|
[
|
package/src/commands/json.ts
CHANGED
|
@@ -24,7 +24,7 @@ const command = "json [modules..]";
|
|
|
24
24
|
|
|
25
25
|
const description = "Generates JSON representation from GIR files for analysis and tooling";
|
|
26
26
|
|
|
27
|
-
const logger = new Logger(
|
|
27
|
+
const logger = new Logger(true, "JsonCommand");
|
|
28
28
|
|
|
29
29
|
const examples: ReadonlyArray<[string, string?]> = [
|
|
30
30
|
[`${APP_NAME} json`, `Run '${APP_NAME} json' in your gjs project to generate JSON files for your project`],
|
package/src/commands/list.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { ConfigFlags } from "@ts-for-gir/lib";
|
|
6
|
-
import { APP_NAME, ERROR_NO_MODULES_FOUND, Logger, NSRegistry
|
|
6
|
+
import { APP_NAME, ERROR_NO_MODULES_FOUND, Logger, NSRegistry } from "@ts-for-gir/lib";
|
|
7
7
|
import { getOptionsGeneration, listOptions, load } from "../config.ts";
|
|
8
8
|
import { ModuleLoader } from "../module-loader.ts";
|
|
9
9
|
import type { ListCommandArgs } from "../types/index.ts";
|
|
@@ -13,7 +13,7 @@ const command = "list [modules..]";
|
|
|
13
13
|
|
|
14
14
|
const description = "Lists all available GIR modules";
|
|
15
15
|
|
|
16
|
-
const logger = new Logger(
|
|
16
|
+
const logger = new Logger(true, "ListCommand");
|
|
17
17
|
|
|
18
18
|
const examples: ReadonlyArray<[string, string?]> = [
|
|
19
19
|
[`${APP_NAME} list -g ./vala-girs/gir-1.0`, "Lists all available GIR modules in ./vala-girs/gir-1.0"],
|
|
@@ -32,39 +32,29 @@ const handler = async (args: ConfigFlags) => {
|
|
|
32
32
|
const moduleLoader = new ModuleLoader(generateConfig, registry);
|
|
33
33
|
const { grouped, failed } = await moduleLoader.getModules(config.modules, config.ignore);
|
|
34
34
|
const moduleGroups = Object.values(grouped);
|
|
35
|
+
|
|
35
36
|
if (Object.keys(grouped).length === 0) {
|
|
36
37
|
return logger.error(ERROR_NO_MODULES_FOUND(config.girDirectories));
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
const conflictModules = moduleGroups.filter((moduleGroup) => moduleGroup.hasConflict);
|
|
40
|
-
|
|
41
|
-
const byHandModules = moduleGroups.filter((moduleGroup) => moduleGroup.modules[0].resolvedBy === ResolveType.BY_HAND);
|
|
42
|
-
|
|
43
|
-
const depModules = moduleGroups.filter((moduleGroup) => moduleGroup.modules[0].resolvedBy === ResolveType.DEPENDENCE);
|
|
41
|
+
const allModules = moduleGroups.filter((moduleGroup) => !moduleGroup.hasConflict);
|
|
44
42
|
|
|
45
43
|
logger.info("\nSearch for gir files in:");
|
|
46
44
|
for (const dir of config.girDirectories) {
|
|
47
45
|
logger.white(`- ${dir}`);
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
logger.
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (depModules.length > 0) {
|
|
59
|
-
logger.yellow("\nDependencies:");
|
|
60
|
-
for (const moduleGroup of depModules) {
|
|
61
|
-
for (const depModule of moduleGroup.modules) {
|
|
62
|
-
logger.white(`- ${depModule.packageName}`);
|
|
63
|
-
logger.gray(`- ${depModule.path}`);
|
|
64
|
-
}
|
|
48
|
+
// Show all available modules
|
|
49
|
+
logger.info("\nAvailable Modules:");
|
|
50
|
+
for (const moduleGroup of allModules) {
|
|
51
|
+
for (const module of moduleGroup.modules) {
|
|
52
|
+
logger.white(`- ${module.packageName}`);
|
|
53
|
+
logger.gray(` - ${module.path}`);
|
|
65
54
|
}
|
|
66
55
|
}
|
|
67
56
|
|
|
57
|
+
// Only show sections if there is actual content
|
|
68
58
|
if (conflictModules.length > 0) {
|
|
69
59
|
logger.danger("\nConflicts:");
|
|
70
60
|
for (const moduleGroup of conflictModules) {
|
|
@@ -26,13 +26,27 @@ export class FileFinder {
|
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
// Handle wildcard patterns
|
|
30
|
+
if (globPackageNames[i] === "*") {
|
|
31
|
+
// Special case: find all .gir files
|
|
32
|
+
for (const girDirectory of this.girDirectories) {
|
|
33
|
+
const pattern = join(girDirectory, "*.gir");
|
|
34
|
+
const ignoreGirs = ignore.map((ignored) => join(girDirectory, `${ignored}.gir`));
|
|
35
|
+
const files = await glob(pattern, { ignore: ignoreGirs });
|
|
36
|
+
for (const file of files) {
|
|
37
|
+
foundFiles.add(file);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
// Handle specific module names or patterns like "Gtk*"
|
|
42
|
+
const filename = `${globPackageNames[i]}.gir`;
|
|
43
|
+
const pattern = this.girDirectories.map((girDirectory) => join(girDirectory, filename));
|
|
44
|
+
const ignoreGirs = ignore.map((girDirectory) => `${girDirectory}.gir`);
|
|
45
|
+
const files = await glob(pattern, { ignore: ignoreGirs });
|
|
33
46
|
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
for (const file of files) {
|
|
48
|
+
foundFiles.add(file);
|
|
49
|
+
}
|
|
36
50
|
}
|
|
37
51
|
}
|
|
38
52
|
|