Comparing version 6.1.7 to 6.2.0
# Changelog | ||
## 6.2.0 | ||
- Add simplified interface for creating sitemaps and index | ||
- fix bug where sitemap and index stream would not properly wait to emit finish event until all sitemaps had been written | ||
- bump deps | ||
## 6.1.7 | ||
@@ -4,0 +10,0 @@ |
@@ -14,1 +14,2 @@ /*! | ||
export { parseSitemap, XMLToSitemapItemStream, XMLToSitemapItemStreamOptions, ObjectStreamToJSON, ObjectStreamToJSONOptions, } from './lib/sitemap-parser'; | ||
export { simpleSitemapAndIndex } from './lib/sitemap-simple'; |
@@ -42,1 +42,3 @@ "use strict"; | ||
Object.defineProperty(exports, "ObjectStreamToJSON", { enumerable: true, get: function () { return sitemap_parser_1.ObjectStreamToJSON; } }); | ||
var sitemap_simple_1 = require("./lib/sitemap-simple"); | ||
Object.defineProperty(exports, "simpleSitemapAndIndex", { enumerable: true, get: function () { return sitemap_simple_1.simpleSitemapAndIndex; } }); |
@@ -136,8 +136,9 @@ "use strict"; | ||
else if (this.i % this.limit === 0) { | ||
this.currentSitemap.end(); | ||
const [idxItem, currentSitemap] = this.getSitemapStream(this.i / this.limit); | ||
this.currentSitemap = currentSitemap; | ||
this._writeSMI(item); | ||
// push to index stream | ||
super._transform(idxItem, encoding, callback); | ||
this.currentSitemap.end(() => { | ||
const [idxItem, currentSitemap] = this.getSitemapStream(this.i / this.limit); | ||
this.currentSitemap = currentSitemap; | ||
this._writeSMI(item); | ||
// push to index stream | ||
super._transform(idxItem, encoding, callback); | ||
}); | ||
} | ||
@@ -150,6 +151,5 @@ else { | ||
_flush(cb) { | ||
this.currentSitemap.end(); | ||
super._flush(cb); | ||
this.currentSitemap.end(() => super._flush(cb)); | ||
} | ||
} | ||
exports.SitemapAndIndexStream = SitemapAndIndexStream; |
{ | ||
"name": "sitemap", | ||
"version": "6.1.7", | ||
"version": "6.2.0", | ||
"description": "Sitemap-generating lib/cli", | ||
@@ -152,3 +152,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@types/node": "^14.0.14", | ||
"@types/node": "^14.0.18", | ||
"@types/sax": "^1.2.1", | ||
@@ -166,11 +166,11 @@ "arg": "^4.1.3", | ||
"@babel/preset-typescript": "^7.10.4", | ||
"@types/jest": "^26.0.3", | ||
"@typescript-eslint/eslint-plugin": "^3.5.0", | ||
"@typescript-eslint/parser": "^3.5.0", | ||
"@types/jest": "^26.0.4", | ||
"@typescript-eslint/eslint-plugin": "^3.6.0", | ||
"@typescript-eslint/parser": "^3.6.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-polyfill": "^6.26.0", | ||
"concurrently": "^5.2.0", | ||
"eslint": "^7.3.1", | ||
"eslint": "^7.4.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-jest": "^23.17.1", | ||
"eslint-plugin-jest": "^23.18.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
@@ -187,3 +187,3 @@ "express": "^4.17.1", | ||
"through2-map": "^3.0.0", | ||
"typescript": "^3.9.5" | ||
"typescript": "^3.9.6" | ||
}, | ||
@@ -190,0 +190,0 @@ "engines": { |
@@ -114,2 +114,29 @@ # sitemap ![MIT License](https://img.shields.io/npm/l/sitemap)[![Build Status](https://travis-ci.org/ekalinin/sitemap.js.svg?branch=master)](https://travis-ci.org/ekalinin/sitemap.js)![Monthly Downloads](https://img.shields.io/npm/dm/sitemap) | ||
const { | ||
simpleSitemapAndIndex, | ||
lineSeparatedURLsToSitemapOptions | ||
} = require('sitemap') | ||
// writes sitemaps and index out to the destination you provide | ||
simpleSitemapAndIndex({ | ||
hostname: 'https://example.com', | ||
destinationDir: './', | ||
sourceData: lineSeparatedURLsToSitemapOptions( | ||
createReadStream('./your-data.json.txt') | ||
), | ||
// or | ||
sourceData: [{ url: '/page-1/', changefreq: 'daily'}, ...], | ||
// or | ||
sourceData: './your-data.json.txt', | ||
}).then(() => { | ||
// Do follow up actions | ||
}) | ||
``` | ||
Want to customize that? | ||
```js | ||
const { createReadStream, createWriteStream } = require('fs'); | ||
const { resolve } = require('path'); | ||
const { createGzip } = require('zlib') | ||
const { | ||
SitemapAndIndexStream, | ||
@@ -121,3 +148,3 @@ SitemapStream, | ||
const sms = new SitemapAndIndexStream({ | ||
limit: 10000, // defaults to 45k | ||
limit: 50000, // defaults to 45k | ||
// SitemapAndIndexStream will call this user provided function every time | ||
@@ -124,0 +151,0 @@ // it needs to create a new sitemap file. You merely need to return a stream |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
150372
32
2738
277
4
Updated@types/node@^14.0.18