create-fornix 0.0.6 → 0.0.7
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 +60 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -305,14 +305,15 @@ ${blockImports.join("\n")}
|
|
|
305
305
|
${blockComponents.length > 0 ? blockComponents.join("\n") : ` <h1>Welcome to <span class="text-gradient">${config.projectName}</span></h1>`}
|
|
306
306
|
</main>
|
|
307
307
|
</Layout>
|
|
308
|
-
`.trim() + "
|
|
308
|
+
`.trim() + "\n";
|
|
309
309
|
files["src/pages/index.astro"] = indexAstroContent;
|
|
310
|
+
const tailwindImport = config.cssEngine === "tailwind" ? '\nimport "../../tailwind.css";' : "";
|
|
310
311
|
files["src/layouts/Layout.astro"] = `
|
|
311
312
|
---
|
|
312
313
|
interface Props {
|
|
313
314
|
title: string;
|
|
314
315
|
}
|
|
315
|
-
const { title } = Astro.props
|
|
316
|
+
const { title } = Astro.props;${tailwindImport}
|
|
316
317
|
---
|
|
317
318
|
<!doctype html>
|
|
318
319
|
<html lang="en">
|
|
@@ -403,6 +404,16 @@ function generateAstroConfig(config, blocks = []) {
|
|
|
403
404
|
configObject.integrations = configObject.integrations || [];
|
|
404
405
|
configObject.integrations.push(builders.functionCall("mdx"));
|
|
405
406
|
}
|
|
407
|
+
if (config.cssEngine === "tailwind") {
|
|
408
|
+
module.imports.$add({
|
|
409
|
+
from: "@tailwindcss/vite",
|
|
410
|
+
imported: "default",
|
|
411
|
+
local: "tailwindcss"
|
|
412
|
+
});
|
|
413
|
+
configObject.vite = {
|
|
414
|
+
plugins: [builders.functionCall("tailwindcss")]
|
|
415
|
+
};
|
|
416
|
+
}
|
|
406
417
|
const { code } = generateCode(module);
|
|
407
418
|
return ok(code);
|
|
408
419
|
} catch (error) {
|
|
@@ -427,8 +438,9 @@ function generateTailwindConfig(config) {
|
|
|
427
438
|
].join("\n");
|
|
428
439
|
const lines = [
|
|
429
440
|
'@import "tailwindcss";',
|
|
441
|
+
'@import "./src/styles/palettes/_current.css";',
|
|
430
442
|
"",
|
|
431
|
-
`@source "
|
|
443
|
+
`@source "./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}";`,
|
|
432
444
|
"",
|
|
433
445
|
themeBlock,
|
|
434
446
|
""
|
|
@@ -1491,6 +1503,7 @@ function manifest(name, overrides = {}) {
|
|
|
1491
1503
|
var FIXTURE_MANIFESTS = {
|
|
1492
1504
|
"hero-gradient": manifest("hero-gradient", {
|
|
1493
1505
|
category: "hero",
|
|
1506
|
+
conflicts: ["hero-video"],
|
|
1494
1507
|
ai: {
|
|
1495
1508
|
whenToUse: "Landing page hero with gradient background",
|
|
1496
1509
|
whenNotToUse: "Internal pages",
|
|
@@ -1975,13 +1988,7 @@ function loadFromCache2(blockName, blockCacheDir) {
|
|
|
1975
1988
|
});
|
|
1976
1989
|
}
|
|
1977
1990
|
const files = {};
|
|
1978
|
-
|
|
1979
|
-
for (const entry of entries) {
|
|
1980
|
-
const fullPath = join3(blockCacheDir, entry);
|
|
1981
|
-
if (statSync2(fullPath).isFile() && entry !== "block.json") {
|
|
1982
|
-
files[entry] = readFileSync3(fullPath, "utf-8");
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1991
|
+
readFilesRecursive(blockCacheDir, "", files);
|
|
1985
1992
|
return ok({
|
|
1986
1993
|
manifest: result.data,
|
|
1987
1994
|
files,
|
|
@@ -1996,6 +2003,18 @@ function loadFromCache2(blockName, blockCacheDir) {
|
|
|
1996
2003
|
});
|
|
1997
2004
|
}
|
|
1998
2005
|
}
|
|
2006
|
+
function readFilesRecursive(dir, prefix, files) {
|
|
2007
|
+
const entries = readdirSync2(dir, { withFileTypes: true });
|
|
2008
|
+
for (const entry of entries) {
|
|
2009
|
+
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
2010
|
+
const fullPath = join3(dir, entry.name);
|
|
2011
|
+
if (entry.isDirectory()) {
|
|
2012
|
+
readFilesRecursive(fullPath, relativePath, files);
|
|
2013
|
+
} else if (entry.name !== "block.json") {
|
|
2014
|
+
files[relativePath] = readFileSync3(fullPath, "utf-8");
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
1999
2018
|
|
|
2000
2019
|
// src/prompts/manual-flow.ts
|
|
2001
2020
|
import * as p from "@clack/prompts";
|
|
@@ -3328,7 +3347,7 @@ var RECIPES = {
|
|
|
3328
3347
|
themeSwitcher: false
|
|
3329
3348
|
},
|
|
3330
3349
|
agency: {
|
|
3331
|
-
renderMode: "
|
|
3350
|
+
renderMode: "server",
|
|
3332
3351
|
deployTarget: "cloudflare",
|
|
3333
3352
|
database: "none",
|
|
3334
3353
|
cssEngine: "tailwind",
|
|
@@ -3407,7 +3426,7 @@ var RECIPES = {
|
|
|
3407
3426
|
themeSwitcher: false
|
|
3408
3427
|
},
|
|
3409
3428
|
portfolio: {
|
|
3410
|
-
renderMode: "
|
|
3429
|
+
renderMode: "server",
|
|
3411
3430
|
deployTarget: "cloudflare",
|
|
3412
3431
|
database: "none",
|
|
3413
3432
|
cssEngine: "tailwind",
|
|
@@ -3560,6 +3579,33 @@ var createCommand = defineCommand({
|
|
|
3560
3579
|
}
|
|
3561
3580
|
},
|
|
3562
3581
|
async run({ args: args2 }) {
|
|
3582
|
+
const hasExplicitFlags = !!(args2.render || args2.deploy || args2.blocks || args2.database || args2.css || args2.locales || args2.palette || args2.recipe);
|
|
3583
|
+
let forceManual = false;
|
|
3584
|
+
if (!args2.manual && !hasExplicitFlags) {
|
|
3585
|
+
const providerName = parseProviderName(args2.provider);
|
|
3586
|
+
if (args2.provider && !providerName) {
|
|
3587
|
+
console.error(pc3.red(`\u2716 Unknown provider: ${String(args2.provider)}`));
|
|
3588
|
+
console.error(pc3.dim(` Available: ${VALID_PROVIDER_NAMES.join(", ")}`));
|
|
3589
|
+
process.exitCode = 1;
|
|
3590
|
+
return;
|
|
3591
|
+
}
|
|
3592
|
+
const legacyProvider = await resolveProvider({
|
|
3593
|
+
provider: providerName,
|
|
3594
|
+
skipOllamaDetect: false
|
|
3595
|
+
});
|
|
3596
|
+
if (!legacyProvider) {
|
|
3597
|
+
showNoProviderGuide();
|
|
3598
|
+
const fallback = await p2.confirm({
|
|
3599
|
+
message: "Would you like to continue in manual mode instead?",
|
|
3600
|
+
initialValue: true
|
|
3601
|
+
});
|
|
3602
|
+
if (p2.isCancel(fallback) || !fallback) {
|
|
3603
|
+
process.exitCode = 1;
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
forceManual = true;
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3563
3609
|
const registryResult = await fetchRegistryIndex();
|
|
3564
3610
|
if (!isOk(registryResult)) {
|
|
3565
3611
|
console.error(pc3.red(`\u2716 Failed to fetch block registry: ${registryResult.error.message}`));
|
|
@@ -3568,8 +3614,7 @@ var createCommand = defineCommand({
|
|
|
3568
3614
|
}
|
|
3569
3615
|
const manifests = registryResult.value.blocks;
|
|
3570
3616
|
const allPalettes = registryResult.value.palettes.length > 0 ? registryResult.value.palettes : loadAllPalettes();
|
|
3571
|
-
|
|
3572
|
-
if (args2.manual && !args2.yes) {
|
|
3617
|
+
if ((args2.manual || forceManual) && !args2.yes) {
|
|
3573
3618
|
const defaultProjectName = args2.dir ? basename2(resolve2(args2.dir)) : "my-project";
|
|
3574
3619
|
const config = await runManualFlow({
|
|
3575
3620
|
defaultProjectName,
|
|
@@ -3584,7 +3629,7 @@ var createCommand = defineCommand({
|
|
|
3584
3629
|
const finalConfig = { ...config, projectDir };
|
|
3585
3630
|
return runScaffold(finalConfig, manifests, allPalettes, args2["dry-run"] ?? false, args2.verbose ?? false, !(args2.install ?? true), !(args2.git ?? true));
|
|
3586
3631
|
}
|
|
3587
|
-
if (args2.manual || hasExplicitFlags) {
|
|
3632
|
+
if (args2.manual || hasExplicitFlags || forceManual) {
|
|
3588
3633
|
return runFlagDrivenMode(args2, manifests, allPalettes);
|
|
3589
3634
|
}
|
|
3590
3635
|
return runAIMode(args2, manifests, allPalettes);
|