Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sitemap-generator-custom-volodzya

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sitemap-generator-custom-volodzya - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

package.json
{
"name": "sitemap-generator-custom-volodzya",
"version": "1.0.4",
"version": "1.0.5",
"description": "A library to generate sitemaps in various formats",

@@ -5,0 +5,0 @@ "main": "src/SitemapGenerator.js",

@@ -7,36 +7,13 @@ const fs = require('fs');

class SitemapGenerator {
constructor(basePath, fileType, filePath) {
this.basePath = basePath;
constructor(pages, fileType, filePath) {
this.pages = pages;
this.fileType = fileType;
this.filePath = filePath;
this.pages = this.getPages(this.basePath);
this.validatePages(this.pages);
this.generateSitemap();
}
getPages(dir, baseURL = '') {
let pages = [];
const files = fs.readdirSync(dir);
files.forEach(file => {
const fullPath = path.join(dir, file);
const stat = fs.statSync(fullPath);
if (stat.isDirectory()) {
pages = pages.concat(this.getPages(fullPath, path.join(baseURL, file)));
} else if (file.endsWith('.html')) {
pages.push({
loc: path.join(baseURL, file).replace(/\\/g, '/'),
lastmod: stat.mtime.toISOString().split('T')[0],
changefreq: 'daily',
priority: '0.5'
});
}
});
return pages;
}
validatePages(pages) {

@@ -43,0 +20,0 @@ for (const page of pages) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc