bunki 0.4.0 → 0.4.1
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/cli.js +43 -0
- package/dist/index.js +43 -0
- package/dist/site-generator.d.ts +2 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -33102,6 +33102,7 @@ class SiteGenerator {
|
|
|
33102
33102
|
await this.generateYearArchives();
|
|
33103
33103
|
await this.generateRSSFeed();
|
|
33104
33104
|
await this.generateSitemap();
|
|
33105
|
+
await this.generateRobotsTxt();
|
|
33105
33106
|
await this.copyStaticAssets();
|
|
33106
33107
|
console.log("Site generation complete!");
|
|
33107
33108
|
}
|
|
@@ -33457,6 +33458,48 @@ ${rssItems}
|
|
|
33457
33458
|
sitemapContent += `</urlset>`;
|
|
33458
33459
|
await Bun.write(path5.join(this.options.outputDir, "sitemap.xml"), sitemapContent);
|
|
33459
33460
|
console.log("Generated sitemap.xml");
|
|
33461
|
+
const urlCount = this.site.posts.length + Object.keys(this.site.tags).length + 10;
|
|
33462
|
+
const sitemapSize = sitemapContent.length;
|
|
33463
|
+
if (urlCount > 1000 || sitemapSize > 40000) {
|
|
33464
|
+
await this.generateSitemapIndex();
|
|
33465
|
+
}
|
|
33466
|
+
}
|
|
33467
|
+
async generateSitemapIndex() {
|
|
33468
|
+
const currentDate = this.getPacificDate(new Date).toISOString();
|
|
33469
|
+
const config = this.options.config;
|
|
33470
|
+
let sitemapIndexContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
33471
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
33472
|
+
`;
|
|
33473
|
+
sitemapIndexContent += ` <sitemap>
|
|
33474
|
+
<loc>${config.baseUrl}/sitemap.xml</loc>
|
|
33475
|
+
<lastmod>${currentDate}</lastmod>
|
|
33476
|
+
</sitemap>
|
|
33477
|
+
`;
|
|
33478
|
+
sitemapIndexContent += `</sitemapindex>`;
|
|
33479
|
+
await Bun.write(path5.join(this.options.outputDir, "sitemap_index.xml"), sitemapIndexContent);
|
|
33480
|
+
console.log("Generated sitemap_index.xml");
|
|
33481
|
+
}
|
|
33482
|
+
async generateRobotsTxt() {
|
|
33483
|
+
const config = this.options.config;
|
|
33484
|
+
const robotsTxtContent = `# Robots.txt for ${config.domain}
|
|
33485
|
+
# Generated by Bunki
|
|
33486
|
+
|
|
33487
|
+
User-agent: *
|
|
33488
|
+
Allow: /
|
|
33489
|
+
|
|
33490
|
+
# Sitemaps
|
|
33491
|
+
Sitemap: ${config.baseUrl}/sitemap.xml
|
|
33492
|
+
|
|
33493
|
+
# Crawl-delay (optional, adjust as needed)
|
|
33494
|
+
# Crawl-delay: 1
|
|
33495
|
+
|
|
33496
|
+
# Disallow specific paths (uncomment as needed)
|
|
33497
|
+
# Disallow: /private/
|
|
33498
|
+
# Disallow: /admin/
|
|
33499
|
+
# Disallow: /api/
|
|
33500
|
+
`;
|
|
33501
|
+
await Bun.write(path5.join(this.options.outputDir, "robots.txt"), robotsTxtContent);
|
|
33502
|
+
console.log("Generated robots.txt");
|
|
33460
33503
|
}
|
|
33461
33504
|
}
|
|
33462
33505
|
|
package/dist/index.js
CHANGED
|
@@ -30974,6 +30974,7 @@ class SiteGenerator {
|
|
|
30974
30974
|
await this.generateYearArchives();
|
|
30975
30975
|
await this.generateRSSFeed();
|
|
30976
30976
|
await this.generateSitemap();
|
|
30977
|
+
await this.generateRobotsTxt();
|
|
30977
30978
|
await this.copyStaticAssets();
|
|
30978
30979
|
console.log("Site generation complete!");
|
|
30979
30980
|
}
|
|
@@ -31329,6 +31330,48 @@ ${rssItems}
|
|
|
31329
31330
|
sitemapContent += `</urlset>`;
|
|
31330
31331
|
await Bun.write(path5.join(this.options.outputDir, "sitemap.xml"), sitemapContent);
|
|
31331
31332
|
console.log("Generated sitemap.xml");
|
|
31333
|
+
const urlCount = this.site.posts.length + Object.keys(this.site.tags).length + 10;
|
|
31334
|
+
const sitemapSize = sitemapContent.length;
|
|
31335
|
+
if (urlCount > 1000 || sitemapSize > 40000) {
|
|
31336
|
+
await this.generateSitemapIndex();
|
|
31337
|
+
}
|
|
31338
|
+
}
|
|
31339
|
+
async generateSitemapIndex() {
|
|
31340
|
+
const currentDate = this.getPacificDate(new Date).toISOString();
|
|
31341
|
+
const config = this.options.config;
|
|
31342
|
+
let sitemapIndexContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
31343
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
31344
|
+
`;
|
|
31345
|
+
sitemapIndexContent += ` <sitemap>
|
|
31346
|
+
<loc>${config.baseUrl}/sitemap.xml</loc>
|
|
31347
|
+
<lastmod>${currentDate}</lastmod>
|
|
31348
|
+
</sitemap>
|
|
31349
|
+
`;
|
|
31350
|
+
sitemapIndexContent += `</sitemapindex>`;
|
|
31351
|
+
await Bun.write(path5.join(this.options.outputDir, "sitemap_index.xml"), sitemapIndexContent);
|
|
31352
|
+
console.log("Generated sitemap_index.xml");
|
|
31353
|
+
}
|
|
31354
|
+
async generateRobotsTxt() {
|
|
31355
|
+
const config = this.options.config;
|
|
31356
|
+
const robotsTxtContent = `# Robots.txt for ${config.domain}
|
|
31357
|
+
# Generated by Bunki
|
|
31358
|
+
|
|
31359
|
+
User-agent: *
|
|
31360
|
+
Allow: /
|
|
31361
|
+
|
|
31362
|
+
# Sitemaps
|
|
31363
|
+
Sitemap: ${config.baseUrl}/sitemap.xml
|
|
31364
|
+
|
|
31365
|
+
# Crawl-delay (optional, adjust as needed)
|
|
31366
|
+
# Crawl-delay: 1
|
|
31367
|
+
|
|
31368
|
+
# Disallow specific paths (uncomment as needed)
|
|
31369
|
+
# Disallow: /private/
|
|
31370
|
+
# Disallow: /admin/
|
|
31371
|
+
# Disallow: /api/
|
|
31372
|
+
`;
|
|
31373
|
+
await Bun.write(path5.join(this.options.outputDir, "robots.txt"), robotsTxtContent);
|
|
31374
|
+
console.log("Generated robots.txt");
|
|
31332
31375
|
}
|
|
31333
31376
|
}
|
|
31334
31377
|
// src/utils/image-uploader.ts
|
package/dist/site-generator.d.ts
CHANGED
package/package.json
CHANGED