diff --git a/.eleventy.js b/.eleventy.js
index 6124b88..cb91258 100644
--- a/.eleventy.js
+++ b/.eleventy.js
@@ -1,10 +1,36 @@
import eleventyLucideicons from "@grimlink/eleventy-plugin-lucide-icons";
import prettier from "prettier";
+import Nunjucks from "nunjucks";
+import fs from "fs";
+import path from "path";
export default async function(eleventyConfig) {
eleventyConfig.setInputDirectory("./docs/src");
eleventyConfig.addPassthroughCopy({"docs/src/assets": "assets"});
+ eleventyConfig.addPassthroughCopy({ "src/js": "assets/js" });
eleventyConfig.addPlugin(eleventyLucideicons);
+ // eleventyConfig.addShortcode("fetchCode", async function(filePath) {
+ // return "HELLO";
+ // const absolutePath = path.resolve(process.cwd(), filePath);
+ // return absolutePath;
+ // try {
+ // console.log(absolutePath);
+ // return fs.readFileSync(absolutePath, 'utf8');
+ // } catch (error) {
+ // console.error(`[Eleventy FetchCode Error] Failed to read: ${absolutePath}`, error);
+ // return ``;
+ // }
+ // });
+ eleventyConfig.addShortcode("fetchCode", function(filePath) {
+ const absolutePath = path.resolve(process.cwd(), filePath);
+ try {
+ return fs.readFileSync(absolutePath, 'utf8');
+ } catch (error) {
+ console.error(`[Eleventy FetchCode Error] Failed to read: ${absolutePath}`, error);
+ return ``;
+ }
+ });
+
eleventyConfig.addNunjucksAsyncFilter("prettyHtml", async (code, callback) => {
try {
const formattedCode = await prettier.format(code, {
@@ -20,4 +46,12 @@ export default async function(eleventyConfig) {
callback(err, code);
}
});
+ let nunjucksEnvironment = new Nunjucks.Environment(
+ new Nunjucks.FileSystemLoader([
+ "src/nunjucks",
+ "docs/src/_includes"
+ ]),
+ { autoescape: true }
+ );
+ eleventyConfig.setLibrary("njk", nunjucksEnvironment);
}
\ No newline at end of file
diff --git a/cli/index.js b/cli/index.js
new file mode 100755
index 0000000..947bc7e
--- /dev/null
+++ b/cli/index.js
@@ -0,0 +1,60 @@
+#!/usr/bin/env node
+// ^^^ Makes the script executable
+
+import { Command } from 'commander';
+// We'll add fs-extra and inquirer later
+
+const program = new Command();
+
+console.log('Basecoat CLI');
+
+program
+ .name('basecoat')
+ .description('Add Basecoat components to your project')
+ .version('0.1.0'); // TODO: Get version from package.json
+
+program
+ .command('add')
+ .description('Add one or more components to your project')
+ .argument('[components...]', 'Names of components to add') // Optional arg for now
+ .action(async (components) => {
+ if (!components || components.length === 0) {
+ console.log('Please specify which component(s) to add, or run add without args for a list (TODO).');
+ // TODO: Implement interactive component selection if no args
+ return;
+ }
+
+ console.log(`Attempting to add: ${components.join(', ')}`);
+
+ for (const componentName of components) {
+ await addComponent(componentName);
+ }
+
+ console.log('\nComponent addition process finished.');
+ });
+
+// Placeholder function for adding a single component
+async function addComponent(componentName) {
+ console.log(`\nProcessing component: ${componentName}`);
+
+ // 1. Check if config file exists (TODO)
+ // 2. If not, run init command/ask questions (TODO)
+ // 3. Read config (template engine, paths) (TODO)
+ // 4. Determine source file paths based on component name and config (TODO)
+ // 5. Check if source files exist in the package (TODO)
+ // 6. Copy files to destination paths using fs-extra (TODO)
+
+ console.log(` -> Placeholder: Logic to copy ${componentName} files would go here.`);
+}
+
+// TODO: Implement init command
+// program
+// .command('init')
+// .description('Initialize basecoat configuration')
+// .action(async () => {
+// console.log('Running init...');
+// // Ask config questions
+// // Save config file
+// });
+
+program.parse(process.argv);
\ No newline at end of file
diff --git a/docs/css/custom.css b/docs/css/custom.css
index 1b06eea..882d322 100644
--- a/docs/css/custom.css
+++ b/docs/css/custom.css
@@ -23,6 +23,12 @@
ul {
@apply list-disc ml-6;
}
+ ol,
+ ul {
+ li {
+ @apply mt-2;
+ }
+ }
b,
strong {
@apply font-semibold;
@@ -35,7 +41,7 @@
> table,
> pre,
> p {
- @apply my-4;
+ @apply my-6;
}
> *:first-child {
@apply !mt-0;
diff --git a/docs/src/_includes/components/dialog-script.njk b/docs/src/_includes/components/dialog-script.njk
deleted file mode 100644
index 2c76bdd..0000000
--- a/docs/src/_includes/components/dialog-script.njk
+++ /dev/null
@@ -1,55 +0,0 @@
-
\ No newline at end of file
diff --git a/docs/src/_includes/components/dropdown-menu-script.njk b/docs/src/_includes/components/dropdown-menu-script.njk
deleted file mode 100644
index 3bc772c..0000000
--- a/docs/src/_includes/components/dropdown-menu-script.njk
+++ /dev/null
@@ -1,98 +0,0 @@
-
\ No newline at end of file
diff --git a/docs/src/_includes/components/popover-script.njk b/docs/src/_includes/components/popover-script.njk
deleted file mode 100644
index b9b330b..0000000
--- a/docs/src/_includes/components/popover-script.njk
+++ /dev/null
@@ -1,33 +0,0 @@
-
\ No newline at end of file
diff --git a/docs/src/_includes/components/select-script.njk b/docs/src/_includes/components/select-script.njk
deleted file mode 100644
index b031f61..0000000
--- a/docs/src/_includes/components/select-script.njk
+++ /dev/null
@@ -1,157 +0,0 @@
-
\ No newline at end of file
diff --git a/docs/src/_includes/components/tabs-script.njk b/docs/src/_includes/components/tabs-script.njk
deleted file mode 100644
index 5dce2be..0000000
--- a/docs/src/_includes/components/tabs-script.njk
+++ /dev/null
@@ -1,71 +0,0 @@
-
\ No newline at end of file
diff --git a/docs/src/_includes/components/toast-script.njk b/docs/src/_includes/components/toast-script.njk
deleted file mode 100644
index 315dafa..0000000
--- a/docs/src/_includes/components/toast-script.njk
+++ /dev/null
@@ -1,75 +0,0 @@
-
\ No newline at end of file
diff --git a/docs/src/_includes/layouts/base.njk b/docs/src/_includes/layouts/base.njk
index bcb07b1..9a7f08b 100644
--- a/docs/src/_includes/layouts/base.njk
+++ b/docs/src/_includes/layouts/base.njk
@@ -45,14 +45,24 @@
-
+
+
+
+
+
+
+
+
- {% include "components/dialog-script.njk" %}
- {% include "components/dropdown-menu-script.njk" %}
- {% include "components/popover-script.njk" %}
- {% include "components/select-script.njk" %}
- {% include "components/tabs-script.njk" %}
- {% include "components/toast-script.njk" %}
@@ -128,7 +138,7 @@
-{% from "components/toast.njk" import toaster %}
+{% from "toast.njk" import toaster %}
{{ toaster() }}