@stacksjs/bunpress 0.1.18 → 0.1.19
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/bin/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{I as a,J as b}from"../chunk-
|
|
3
|
+
import{I as a,J as b}from"../chunk-8c2rzrf5.js";import"../chunk-ss6yzy9f.js";import"../chunk-e5q66hsy.js";import"../chunk-w6byd4st.js";export{a as findMarkdownFiles,b as buildDocs};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{E as $,F as I,G as f,H as h,J as x}from"./chunk-
|
|
2
|
+
import{E as $,F as I,G as f,H as h,J as x}from"./chunk-8c2rzrf5.js";import"./chunk-ss6yzy9f.js";import{Q as _}from"./chunk-e5q66hsy.js";import"./chunk-w6byd4st.js";import{join as D}from"path";var Y="@stacksjs/ts-cloud";function E(j,A){let k=A||j?.provider;if(!k||k==="route53")return null;if(k==="porkbun"){let m=j?.apiKey||process.env.PORKBUN_API_KEY,w=j?.secretKey||process.env.PORKBUN_SECRET_KEY;if(!m||!w)throw Error("Porkbun API credentials not found. Set PORKBUN_API_KEY and PORKBUN_SECRET_KEY environment variables, or configure them in bunpress.config.ts under cloud.dnsProvider");return{provider:"porkbun",apiKey:m,secretKey:w}}if(k==="godaddy"){let m=j?.apiKey||process.env.GODADDY_API_KEY,w=j?.secretKey||process.env.GODADDY_API_SECRET,J=j?.environment||process.env.GODADDY_ENVIRONMENT;if(!m||!w)throw Error("GoDaddy API credentials not found. Set GODADDY_API_KEY and GODADDY_API_SECRET environment variables, or configure them in bunpress.config.ts under cloud.dnsProvider");return{provider:"godaddy",apiKey:m,apiSecret:w,environment:J}}throw Error(`Unknown DNS provider: ${k}. Supported: porkbun, godaddy, route53`)}async function v(j={}){let A=await _,k=A.cloud||{},m=j.verbose??A.verbose??!1,w=j.region||k.region||"us-east-1",J=j.domain||k.domain,M=j.subdomain||k.subdomain,N=j.baseDomain||k.baseDomain,O=j.bucket||k.bucket,P=j.stackName||k.stackName,U=j.hostedZoneId||k.hostedZoneId,Q=j.certificateArn||k.certificateArn,V=k.cacheControl||"max-age=31536000, public",B;if(J)B=J;else if(M&&N)B=`${M}.${N}`;let K=B?.replace(/\./g,"-")||"bunpress-site",G=null;try{G=E(k.dnsProvider,j.dnsProvider)}catch(H){return I(H.message),!1}let L=G!==null;if(j.dryRun){if(f("Dry run mode - no changes will be made"),console.log(`
|
|
3
3
|
Configuration:`),console.log(` Region: ${w}`),console.log(` Site Name: ${K}`),console.log(` Bucket: ${O||"auto-generated"}`),console.log(` Domain: ${B||"not specified"}`),console.log(` Stack Name: ${P||`${K}-static-site`}`),console.log(` DNS Provider: ${G?.provider||"route53 (AWS)"}`),!L)console.log(` Hosted Zone ID: ${U||"auto-detected"}`);return console.log(` Certificate ARN: ${Q||"auto-created"}`),!0}if(!process.env.AWS_ACCESS_KEY_ID||!process.env.AWS_SECRET_ACCESS_KEY)return I("AWS credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables."),!1;let z=new h("Building documentation...");try{if(!m)z.start();if(!await x({verbose:m})){if(!m)z.fail("Build failed");return!1}if(!m)z.succeed("Documentation built successfully");let C=A.outDir||"./dist",X=D(C,".bunpress");if(!m)z.text="Deploying infrastructure with CloudFormation...",z.start();else if(console.log(`
|
|
4
4
|
Deploying with CloudFormation...`),L)console.log(`Using external DNS provider: ${G.provider}`);let q;if(L&&B){let R={siteName:K,region:w,domain:B,bucket:O,stackName:P,certificateArn:Q,cacheControl:V,defaultRootObject:"index.html",errorDocument:"404.html",sourceDir:X,dnsProvider:G,tags:{Project:"BunPress",Environment:k.environment||"production"},onProgress:Z(z,m)},{deployStaticSiteWithExternalDnsFull:T}=await import(Y);q=await T(R)}else{let R={siteName:K,region:w,bucket:O,domain:B,subdomain:M,baseDomain:N,stackName:P,hostedZoneId:U,certificateArn:Q,cacheControl:V,defaultRootObject:"index.html",errorDocument:"404.html",sourceDir:X,tags:{Project:"BunPress",Environment:k.environment||"production"},onProgress:Z(z,m)},{deployStaticSiteFull:T}=await import(Y);q=await T(R)}if(!q.success){if(!m)z.fail("Deployment failed");return I(q.message),!1}if(console.log(`
|
|
5
5
|
`+"=".repeat(50)),$("Deployment complete!"),console.log("=".repeat(50)),console.log(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{L as W6,M as U6,O as V6}from"./chunk-ss6yzy9f.js";import{Q as O}from"./chunk-e5q66hsy.js";import{S as y}from"./chunk-w6byd4st.js";var{Glob:j6}=globalThis.Bun;import{copyFile as i6,mkdir as A6,readdir as s6}from"fs/promises";import{join as v}from"path";import I from"process";import{CLI as r6}from"@stacksjs/clapp";var s="0.1.
|
|
2
|
+
import{L as W6,M as U6,O as V6}from"./chunk-ss6yzy9f.js";import{Q as O}from"./chunk-e5q66hsy.js";import{S as y}from"./chunk-w6byd4st.js";var{Glob:j6}=globalThis.Bun;import{copyFile as i6,mkdir as A6,readdir as s6}from"fs/promises";import{join as v}from"path";import I from"process";import{CLI as r6}from"@stacksjs/clapp";var s="0.1.19";import{existsSync as z6}from"fs";import{rm as L6}from"fs/promises";import{join as I6}from"path";var z={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m"};function x(K,Z){return`${z[Z]}${K}${z.reset}`}function G(K){console.log(`${z.green}\u2713${z.reset} ${K}`)}function W(K){console.error(`${z.red}\u2717${z.reset} ${K}`)}function g(K){console.warn(`${z.yellow}\u26A0${z.reset} ${K}`)}function B(K){console.log(`${z.blue}\u2139${z.reset} ${K}`)}function S(K){if(K===0)return"0 B";let Z=1024,Q=["B","KB","MB","GB"],$=Math.floor(Math.log(K)/Math.log(Z));return`${Number.parseFloat((K/Z**$).toFixed(2))} ${Q[$]}`}function f(K){if(K<1000)return`${K}ms`;if(K<60000)return`${(K/1000).toFixed(2)}s`;return`${(K/60000).toFixed(2)}m`}var r=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);class D{frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];index=0;interval=null;text;constructor(K){this.text=K}start(){if(r){console.log(` ${this.text}`);return}process.stdout.write("\x1B[?25l"),this.interval=setInterval(()=>{let K=this.frames[this.index];process.stdout.write(`\r${z.cyan}${K}${z.reset} ${this.text}`),this.index=(this.index+1)%this.frames.length},80)}succeed(K){this.stop(),G(K||this.text)}fail(K){this.stop(),W(K||this.text)}stop(){if(this.interval)clearInterval(this.interval),this.interval=null;if(!r)process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}update(K){this.text=K}}async function u(K,Z=!1){let Q=Z?"Y/n":"y/N";process.stdout.write(`${z.cyan}?${z.reset} ${K} ${z.dim}(${Q})${z.reset}: `);let $=Bun.file("/dev/stdin").stream().getReader(),q=new TextDecoder,{value:X}=await $.read(),Y=q.decode(X).trim().toLowerCase();if(!Y)return Z;return Y==="y"||Y==="yes"}function h(K){if(K.length===0)return;let Z=Object.keys(K[0]),Q={};for(let q of Z)Q[q]=Math.max(q.length,...K.map((X)=>String(X[q]).length));let $=Z.map((q)=>q.padEnd(Q[q])).join(" ");console.log(x($,"bold")),console.log("\u2500".repeat($.length));for(let q of K){let X=Z.map((Y)=>String(q[Y]).padEnd(Q[Y])).join(" ");console.log(X)}}async function d(K){try{return Bun.file(K).size}catch{return 0}}async function S6(K){try{let{Glob:Z}=awaitPromise.resolve(globalThis.Bun),Q=new Z("**/*"),$=0;for await(let q of Q.scan(K)){let X=`${K}/${q}`,Y=await d(X);$+=Y}return $}catch{return 0}}async function e(K={}){let Z=await O,Q=K.outdir||Z.outDir||"./dist",$=I6(Q,".bunpress"),q=K.force||!1,X=K.verbose||!1;try{if(!z6($))return B(`Directory "${$}" does not exist, nothing to clean`),!0;let N=await S6($);if(X)B(`Found "${$}" (${S(N)})`);if(!q){if(!await u(`Delete "${$}" directory? (${S(N)})`,!1))return B("Clean cancelled"),!1}let _=process.env.VITEST==="true"||!1,R=null;if(!_&&!X)R=new D("Cleaning build artifacts..."),R.start();if(await L6($,{recursive:!0,force:!0}),R)R.succeed(`Cleaned ${S(N)} from "${$}"`);else if(X||_)G(`Cleaned ${S(N)} from "${$}"`);return!0}catch(Y){return W(`Failed to clean directory: ${Y}`),!1}}import{existsSync as p}from"fs";import{join as l}from"path";async function t(K={}){try{let Z=["bunpress.config.ts","bunpress.config.js"],Q=null;for(let q of Z){let X=l(process.cwd(),q);if(p(X)){Q=X;break}}if(!Q)return W("No configuration file found"),B('Run "bunpress config init" to create one'),!1;G(`Configuration file: ${Q}`),console.log();let $=await Bun.file(Q).text();return console.log(x("Configuration:","bold")),console.log($),!0}catch(Z){return W(`Failed to show configuration: ${Z}`),!1}}async function o(K={}){let Z=K.verbose||!1;try{let Q=["bunpress.config.ts","bunpress.config.js"],$=null;for(let N of Q){let _=l(process.cwd(),N);if(p(_)){$=_;break}}if(!$)return W("No configuration file found"),!1;if(Z)B(`Validating ${$}...`);let X=(await import($)).default;if(!X)return W("Configuration file does not export a default object"),!1;let Y=[];if(X.markdown){if(X.markdown.toc&&typeof X.markdown.toc!=="object"&&typeof X.markdown.toc!=="boolean")Y.push("markdown.toc should be an object or boolean");if(X.markdown.features){if(typeof X.markdown.features!=="object")Y.push("markdown.features should be an object")}}if(X.nav){if(!Array.isArray(X.nav))Y.push("nav should be an array");else for(let[N,_]of X.nav.entries())if(!_.text||!_.link)Y.push(`nav[${N}] is missing required fields (text, link)`)}if(X.sitemap){if(!X.sitemap.hostname)Y.push("sitemap.hostname is required for SEO")}if(Y.length>0){W("Configuration validation failed:");for(let N of Y)console.log(` \u2022 ${N}`);return!1}return G("Configuration is valid \u2713"),!0}catch(Q){return W(`Failed to validate configuration: ${Q}`),!1}}async function K6(K={}){let Z=l(process.cwd(),"bunpress.config.ts");if(p(Z))return W("Configuration file already exists"),!1;let Q=`import type { BunPressConfig } from '@stacksjs/bunpress'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
verbose: false,
|
|
@@ -463,5 +463,5 @@ Detected change in ${Y}, rebuilding...`),await R6(K)}),await new Promise(()=>{})
|
|
|
463
463
|
`}N+=`---
|
|
464
464
|
|
|
465
465
|
`}return await Bun.write($,N),console.log(`
|
|
466
|
-
LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.length/1024).toFixed(2)} KB`),!0}b.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--output <output>","Output file path",{default:"./docs.md"}).option("--full","Include full content (not just titles and headings)",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await Q4(K))I.exit(1)});b.command("init","Initialize a new BunPress project").option("--name <name>","Project name").option("--template <template>","Template to use").option("--force","Overwrite existing files",{default:!1}).action(async(K)=>{if(!await Z6(K))I.exit(1)});b.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:j.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{await N6(K)});b.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:j.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await e(K))I.exit(1)});b.command("doctor","Run diagnostic checks on the project").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await Q6(K))I.exit(1)});b.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await t(K))I.exit(1)});b.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await o(K))I.exit(1)});b.command("config:init","Initialize configuration file").action(async(K)=>{if(!await K6(K))I.exit(1)});b.command("new <path>","Create a new markdown file").option("--title <title>","Page title").option("--template <template>","Template to use (default, guide, api, blog)",{default:"default"}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K,Z)=>{if(!await X6(K,Z))I.exit(1)});b.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await _6(K))I.exit(1)});b.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(K)=>{await H6(K)});b.command("deploy","Deploy documentation to AWS using CloudFormation (S3 + CloudFront + Route53)").option("--region <region>","AWS region for S3 bucket",{default:"us-east-1"}).option("--bucket <bucket>","S3 bucket name (auto-generated if not provided)").option("--domain <domain>","Custom domain (e.g., docs.example.com)").option("--subdomain <subdomain>","Subdomain (used with --base-domain)").option("--base-domain <baseDomain>","Base domain (e.g., example.com) - must have Route53 hosted zone").option("--stack-name <stackName>","CloudFormation stack name").option("--hosted-zone-id <hostedZoneId>","Route53 hosted zone ID (auto-detected from domain)").option("--certificate-arn <certificateArn>","ACM certificate ARN (auto-created if not provided)").option("--dry-run","Show configuration without deploying",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-
|
|
466
|
+
LLM markdown generated successfully: ${$}`),console.log(`Total size: ${(N.length/1024).toFixed(2)} KB`),!0}b.command("llm","Generate LLM-friendly markdown file from documentation").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--output <output>","Output file path",{default:"./docs.md"}).option("--full","Include full content (not just titles and headings)",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await Q4(K))I.exit(1)});b.command("init","Initialize a new BunPress project").option("--name <name>","Project name").option("--template <template>","Template to use").option("--force","Overwrite existing files",{default:!1}).action(async(K)=>{if(!await Z6(K))I.exit(1)});b.command("preview","Preview the built documentation site").option("--port <port>","Port to listen on",{default:j.port}).option("--outdir <outdir>","Output directory (looks for .bunpress folder inside)").option("--open","Open in browser",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{await N6(K)});b.command("clean","Clean build artifacts").option("--outdir <outdir>","Output directory to clean",{default:j.outdir}).option("--force","Skip confirmation prompt",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await e(K))I.exit(1)});b.command("doctor","Run diagnostic checks on the project").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await Q6(K))I.exit(1)});b.command("config:show","Show current configuration").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await t(K))I.exit(1)});b.command("config:validate","Validate configuration file").option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await o(K))I.exit(1)});b.command("config:init","Initialize configuration file").action(async(K)=>{if(!await K6(K))I.exit(1)});b.command("new <path>","Create a new markdown file").option("--title <title>","Page title").option("--template <template>","Template to use (default, guide, api, blog)",{default:"default"}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K,Z)=>{if(!await X6(K,Z))I.exit(1)});b.command("stats","Show documentation statistics").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{if(!await _6(K))I.exit(1)});b.command("seo:check","Check SEO for all documentation pages").option("--dir <dir>","Documentation directory",{default:"./docs"}).option("--fix","Automatically fix issues (add missing titles/descriptions)",{default:!1}).action(async(K)=>{await H6(K)});b.command("deploy","Deploy documentation to AWS using CloudFormation (S3 + CloudFront + Route53)").option("--region <region>","AWS region for S3 bucket",{default:"us-east-1"}).option("--bucket <bucket>","S3 bucket name (auto-generated if not provided)").option("--domain <domain>","Custom domain (e.g., docs.example.com)").option("--subdomain <subdomain>","Subdomain (used with --base-domain)").option("--base-domain <baseDomain>","Base domain (e.g., example.com) - must have Route53 hosted zone").option("--stack-name <stackName>","CloudFormation stack name").option("--hosted-zone-id <hostedZoneId>","Route53 hosted zone ID (auto-detected from domain)").option("--certificate-arn <certificateArn>","ACM certificate ARN (auto-created if not provided)").option("--dry-run","Show configuration without deploying",{default:!1}).option("--verbose","Enable verbose logging",{default:j.verbose}).action(async(K)=>{let{deployCommand:Z}=await import("./chunk-0hhk4njs.js");if(!await Z(K))I.exit(1)});b.help();b.version(s);var n=Bun.argv[1]||"",Z4=n.endsWith("/bunpress")||n.endsWith("/cli.ts")||n.endsWith("/cli.js");if(Z4)b.parse();
|
|
467
467
|
export{G as E,W as F,B as G,D as H,M6 as I,R6 as J};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/bunpress",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.19",
|
|
5
5
|
"description": "Modern documentation engine. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@stacksjs/stx": "^0.2.82",
|
|
56
56
|
"@stacksjs/ts-md": "^0.1.1",
|
|
57
|
-
"@stacksjs/ts-cloud": "^0.7.
|
|
57
|
+
"@stacksjs/ts-cloud": "^0.7.50",
|
|
58
58
|
"bunfig": "^0.15.6"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|