@ts-for-gir/cli 4.0.0-rc.12 → 4.0.0-rc.14
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 +46 -18
- package/bin/ts-for-gir-gjs +9790 -15011
- package/dist-templates/types-locally/package.json +1 -1
- package/dist-templates/types-npm/package.json +5 -5
- package/dist-templates/types-workspace/package.json +1 -1
- package/package.json +24 -13
- package/src/commands/create.ts +53 -11
- package/src/config/config-loader.ts +6 -2
package/bin/ts-for-gir
CHANGED
|
@@ -7268,7 +7268,7 @@ import { dirname, join } from "node:path";
|
|
|
7268
7268
|
import { fileURLToPath } from "node:url";
|
|
7269
7269
|
function getPackageVersion() {
|
|
7270
7270
|
if (true) {
|
|
7271
|
-
return "4.0.0-rc.
|
|
7271
|
+
return "4.0.0-rc.14";
|
|
7272
7272
|
}
|
|
7273
7273
|
const currentModulePath = fileURLToPath(import.meta.url);
|
|
7274
7274
|
const currentDir = dirname(currentModulePath);
|
|
@@ -8165,7 +8165,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
8165
8165
|
var NEW_LINE_REG_EXP = /[\n\r]+/g;
|
|
8166
8166
|
function getPackageVersion2() {
|
|
8167
8167
|
if (true) {
|
|
8168
|
-
return "4.0.0-rc.
|
|
8168
|
+
return "4.0.0-rc.14";
|
|
8169
8169
|
}
|
|
8170
8170
|
try {
|
|
8171
8171
|
const currentModulePath = fileURLToPath2(import.meta.url);
|
|
@@ -21072,6 +21072,7 @@ import { existsSync as existsSync2, readFileSync as readFileSync3, writeFileSync
|
|
|
21072
21072
|
|
|
21073
21073
|
// src/config/config-loader.ts
|
|
21074
21074
|
import { dirname as dirname5, resolve as resolve4 } from "node:path";
|
|
21075
|
+
import { pathToFileURL } from "node:url";
|
|
21075
21076
|
import { cosmiconfig } from "cosmiconfig";
|
|
21076
21077
|
|
|
21077
21078
|
// src/config/config-writer.ts
|
|
@@ -21502,9 +21503,12 @@ var analyzeOptions = {
|
|
|
21502
21503
|
async function loadConfigFile(configName) {
|
|
21503
21504
|
const configSearchOptions = {
|
|
21504
21505
|
loaders: {
|
|
21505
|
-
// ESM loader
|
|
21506
|
+
// ESM loader. cosmiconfig hands us an absolute filesystem path; Node's import()
|
|
21507
|
+
// tolerates that as a non-spec extension, but spec-compliant runtimes (GJS /
|
|
21508
|
+
// SpiderMonkey) reject it with "Module not found: <abs-path>". Convert to a
|
|
21509
|
+
// file:// URL so the loader works in both runtimes.
|
|
21506
21510
|
".js": async (filepath) => {
|
|
21507
|
-
const file = await import(filepath);
|
|
21511
|
+
const file = await import(pathToFileURL(filepath).href);
|
|
21508
21512
|
if (file?.default?.default) {
|
|
21509
21513
|
return file.default.default;
|
|
21510
21514
|
}
|
|
@@ -22488,7 +22492,7 @@ var copy = {
|
|
|
22488
22492
|
|
|
22489
22493
|
// src/commands/create.ts
|
|
22490
22494
|
import { spawnSync } from "node:child_process";
|
|
22491
|
-
import { cpSync, existsSync as existsSync3, mkdirSync, readdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
22495
|
+
import { cpSync, existsSync as existsSync3, mkdirSync, readdirSync, readFileSync as readFileSync4, realpathSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
22492
22496
|
import { dirname as dirname6, join as join9, resolve as resolve5 } from "node:path";
|
|
22493
22497
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
22494
22498
|
import { input, select as select2 } from "@inquirer/prompts";
|
|
@@ -22526,19 +22530,34 @@ var builder3 = createBuilder(createOptions, examples3);
|
|
|
22526
22530
|
function findTemplatesRoot() {
|
|
22527
22531
|
const __filename = fileURLToPath4(import.meta.url);
|
|
22528
22532
|
const __dirname3 = dirname6(__filename);
|
|
22533
|
+
let realDirname = __dirname3;
|
|
22534
|
+
try {
|
|
22535
|
+
realDirname = dirname6(realpathSync(__filename));
|
|
22536
|
+
} catch {
|
|
22537
|
+
}
|
|
22529
22538
|
const candidates = [
|
|
22530
|
-
//
|
|
22539
|
+
// Symlink-resolved binary (`npm i -g` / `gjsify install -g`): the
|
|
22540
|
+
// realpath-aware candidate is required when the CLI is launched via a
|
|
22541
|
+
// `~/.local/bin/<name>` symlink that points at the real package's
|
|
22542
|
+
// `bin/<name>`. Try it first so the success path is symmetric across
|
|
22543
|
+
// install modes.
|
|
22544
|
+
resolve5(realDirname, "..", "dist-templates"),
|
|
22545
|
+
// Bundled production binary invoked at its real path (no symlink),
|
|
22546
|
+
// or a tarball extracted into a flat `bin/` + `dist-templates/` layout.
|
|
22531
22547
|
resolve5(__dirname3, "..", "dist-templates"),
|
|
22532
22548
|
// Source layout (src/commands/create.ts): ../../dist-templates then ../../templates
|
|
22533
22549
|
resolve5(__dirname3, "..", "..", "dist-templates"),
|
|
22534
22550
|
resolve5(__dirname3, "..", "..", "templates")
|
|
22535
22551
|
];
|
|
22552
|
+
const seen = /* @__PURE__ */ new Set();
|
|
22536
22553
|
for (const path of candidates) {
|
|
22554
|
+
if (seen.has(path)) continue;
|
|
22555
|
+
seen.add(path);
|
|
22537
22556
|
if (existsSync3(path)) return path;
|
|
22538
22557
|
}
|
|
22539
22558
|
throw new Error(
|
|
22540
22559
|
`Could not locate templates directory. Looked in:
|
|
22541
|
-
${
|
|
22560
|
+
${[...seen].join("\n ")}
|
|
22542
22561
|
If you are running from source, make sure packages/cli/templates/ exists. If you are running the published CLI, make sure dist-templates/ was packed.`
|
|
22543
22562
|
);
|
|
22544
22563
|
}
|
|
@@ -22577,16 +22596,21 @@ function walkAndSubstitute(rootDir, projectName) {
|
|
|
22577
22596
|
}
|
|
22578
22597
|
}
|
|
22579
22598
|
var handler3 = async (args) => {
|
|
22580
|
-
if (typeof __GJS_BUNDLE__ !== "undefined") {
|
|
22581
|
-
process.stderr.write(
|
|
22582
|
-
"The 'create' command is not yet supported in the GJS bundle.\nUse Node.js instead: npx @ts-for-gir/cli create ...\n"
|
|
22583
|
-
);
|
|
22584
|
-
process.exitCode = 1;
|
|
22585
|
-
return;
|
|
22586
|
-
}
|
|
22587
22599
|
const opts = args;
|
|
22588
22600
|
const log3 = new Logger(opts.verbose ?? false, "CreateCommand");
|
|
22589
|
-
|
|
22601
|
+
let templatesRoot;
|
|
22602
|
+
try {
|
|
22603
|
+
templatesRoot = findTemplatesRoot();
|
|
22604
|
+
} catch (err) {
|
|
22605
|
+
if (typeof __GJS_BUNDLE__ !== "undefined") {
|
|
22606
|
+
process.stderr.write(
|
|
22607
|
+
"The 'create' command needs templates that aren't shipped alongside this binary.\nInstall the full package instead so `dist-templates/` lives next to the bin:\n gjsify install -g @ts-for-gir/cli\n npm install -g @ts-for-gir/cli\n npx @ts-for-gir/cli create ... # one-shot, no install\n"
|
|
22608
|
+
);
|
|
22609
|
+
process.exitCode = 1;
|
|
22610
|
+
return;
|
|
22611
|
+
}
|
|
22612
|
+
throw err;
|
|
22613
|
+
}
|
|
22590
22614
|
const available = listTemplates(templatesRoot);
|
|
22591
22615
|
if (available.length === 0) {
|
|
22592
22616
|
throw new Error(`No templates found in ${templatesRoot}`);
|
|
@@ -27771,10 +27795,14 @@ import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
|
27771
27795
|
import { i18n, JSX as JSX8, ReflectionKind as ReflectionKind5 } from "typedoc";
|
|
27772
27796
|
function getTsForGirVersion() {
|
|
27773
27797
|
if (true) {
|
|
27774
|
-
return "4.0.0-rc.
|
|
27798
|
+
return "4.0.0-rc.14";
|
|
27799
|
+
}
|
|
27800
|
+
try {
|
|
27801
|
+
const __dirname3 = dirname8(fileURLToPath5(import.meta.url));
|
|
27802
|
+
return JSON.parse(readFileSync7(join14(__dirname3, "..", "..", "package.json"), "utf8")).version;
|
|
27803
|
+
} catch {
|
|
27804
|
+
return "";
|
|
27775
27805
|
}
|
|
27776
|
-
const __dirname3 = dirname8(fileURLToPath5(import.meta.url));
|
|
27777
|
-
return JSON.parse(readFileSync7(join14(__dirname3, "..", "..", "package.json"), "utf8")).version;
|
|
27778
27806
|
}
|
|
27779
27807
|
var TSFOR_GIR_VERSION = getTsForGirVersion();
|
|
27780
27808
|
function giDocgenModuleInfo(context, mod, nsMeta) {
|