fwinit 1.3.9 → 1.3.11
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/dist/index.js +27 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Command } from "commander";
|
|
|
5
5
|
import ora from "ora";
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
import { readFileSync } from "fs";
|
|
8
|
-
import { mkdir as mkdir2, cp as cp2, access, readFile as readFile2 } from "fs/promises";
|
|
8
|
+
import { mkdir as mkdir2, cp as cp2, access, readFile as readFile2, readdir as readdir2 } from "fs/promises";
|
|
9
9
|
import { join as join2, basename } from "path";
|
|
10
10
|
|
|
11
11
|
// src/templates.ts
|
|
@@ -417,7 +417,7 @@ function adaptScriptToNode(script) {
|
|
|
417
417
|
return s;
|
|
418
418
|
}
|
|
419
419
|
async function adaptToNodeRuntime(projectPath) {
|
|
420
|
-
const { readFile: readFile3, writeFile: writeFile2, readdir:
|
|
420
|
+
const { readFile: readFile3, writeFile: writeFile2, readdir: readdir3 } = await import("fs/promises");
|
|
421
421
|
const { join: join3 } = await import("path");
|
|
422
422
|
const pkgPath = join3(projectPath, "package.json");
|
|
423
423
|
const pkg = JSON.parse(await readFile3(pkgPath, "utf-8"));
|
|
@@ -430,7 +430,7 @@ async function adaptToNodeRuntime(projectPath) {
|
|
|
430
430
|
delete pkg.devDependencies["bun-types"];
|
|
431
431
|
await writeFile2(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
432
432
|
async function walk(dir) {
|
|
433
|
-
const entries = await
|
|
433
|
+
const entries = await readdir3(dir, { withFileTypes: true });
|
|
434
434
|
for (const entry of entries) {
|
|
435
435
|
const full = join3(dir, entry.name);
|
|
436
436
|
if (entry.isDirectory()) {
|
|
@@ -564,6 +564,16 @@ async function installOpenCodeFiles(repoRoot, projectPath) {
|
|
|
564
564
|
command,
|
|
565
565
|
join2(projectPath, ".opencode", "commands", "create-specs.md")
|
|
566
566
|
);
|
|
567
|
+
try {
|
|
568
|
+
const examplesDir = join2(repoRoot, "skills", "create-specs", "examples");
|
|
569
|
+
await access(examplesDir);
|
|
570
|
+
await cp2(
|
|
571
|
+
examplesDir,
|
|
572
|
+
join2(projectPath, ".opencode", "skills", "create-specs", "examples"),
|
|
573
|
+
{ recursive: true }
|
|
574
|
+
);
|
|
575
|
+
} catch {
|
|
576
|
+
}
|
|
567
577
|
try {
|
|
568
578
|
await access(designDir);
|
|
569
579
|
await cp2(designDir, join2(projectPath, ".opencode", "skills", "design"), {
|
|
@@ -571,6 +581,20 @@ async function installOpenCodeFiles(repoRoot, projectPath) {
|
|
|
571
581
|
});
|
|
572
582
|
} catch {
|
|
573
583
|
}
|
|
584
|
+
try {
|
|
585
|
+
const designCommandsDir = join2(designDir, "commands");
|
|
586
|
+
await access(designCommandsDir);
|
|
587
|
+
const commandFiles = (await readdir2(designCommandsDir)).filter(
|
|
588
|
+
(f) => f.endsWith(".md")
|
|
589
|
+
);
|
|
590
|
+
for (const file of commandFiles) {
|
|
591
|
+
await cp2(
|
|
592
|
+
join2(designCommandsDir, file),
|
|
593
|
+
join2(projectPath, ".opencode", "commands", file)
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
} catch {
|
|
597
|
+
}
|
|
574
598
|
}
|
|
575
599
|
async function readTemplatePostInit(dir) {
|
|
576
600
|
try {
|