1
0
mirror of https://github.com/dzeiocom/libs.git synced 2025-04-22 10:52:11 +00:00

feat: add support for easy-sitemap for ESM and CJS
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 2m18s

Signed-off-by: Avior <github@avior.me>
This commit is contained in:
Florian Bouillon 2023-08-16 01:04:05 +02:00
parent df43d5c2c0
commit 2f1e72d77b
4 changed files with 8025 additions and 15 deletions

View File

@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]() ## [Unreleased]()
## [1.2.0] - 2023-08-16
### Added
- Full support for both ESM and CommonJS builds
## [1.1.0] - 2021-03-16 ## [1.1.0] - 2021-03-16
### Added ### Added

View File

@ -1,19 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Basic Sitemap Tests should not add changefreq if value is incorrect 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\"><url><loc>https://www.example.com/path</loc></url></urlset>"`; exports[`Basic Sitemap Tests should not add changefreq if value is incorrect 1`] = `"<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"><url><loc>https://www.example.com/path</loc></url></urlset>"`;
exports[`Basic Sitemap Tests should not add priority when it is incorrect 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\"><url><loc>https://www.example.com/path</loc></url></urlset>"`; exports[`Basic Sitemap Tests should not add priority when it is incorrect 1`] = `"<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"><url><loc>https://www.example.com/path</loc></url></urlset>"`;
exports[`Basic Sitemap Tests should return a basic sitemap 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\"><url><loc>https://www.example.com/path</loc></url><url><loc>https://www.example.com/</loc></url></urlset>"`; exports[`Basic Sitemap Tests should return a basic sitemap 1`] = `"<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"><url><loc>https://www.example.com/path</loc></url><url><loc>https://www.example.com/</loc></url></urlset>"`;
exports[`Basic Sitemap Tests should return a sitemap 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\"><url><loc>https://www.example.com/path</loc><changefreq>always</changefreq><lastmod>2021-01-20T00:00:00.000Z</lastmod><priority>1</priority></url><url><loc>https://www.example.com/</loc></url></urlset>"`; exports[`Basic Sitemap Tests should return a sitemap 1`] = `"<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"><url><loc>https://www.example.com/path</loc><changefreq>always</changefreq><lastmod>2021-01-20T00:00:00.000Z</lastmod><priority>1</priority></url><url><loc>https://www.example.com/</loc></url></urlset>"`;
exports[`Basic Sitemap Tests should return an empty sitemap 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\"></urlset>"`; exports[`Basic Sitemap Tests should return an empty sitemap 1`] = `"<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"></urlset>"`;
exports[`image:image tests should build corretcly with multiple image:image 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\"><url><loc>https://www.example.com/path</loc><image:image><image:loc>https://www.example.com/test</image:loc><image:caption>Image Caption</image:caption><image:geo_location>Nantes</image:geo_location><image:title>Title</image:title><image:license>Example license url</image:license></image:image><image:image><image:loc>https://www.example.com/test-2</image:loc><image:caption>Image Caption2</image:caption><image:geo_location>Paris</image:geo_location><image:title>Title2</image:title><image:license>Example license url</image:license></image:image></url></urlset>"`; exports[`image:image tests should build corretcly with multiple image:image 1`] = `"<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"><url><loc>https://www.example.com/path</loc><image:image><image:loc>https://www.example.com/test</image:loc><image:caption>Image Caption</image:caption><image:geo_location>Nantes</image:geo_location><image:title>Title</image:title><image:license>Example license url</image:license></image:image><image:image><image:loc>https://www.example.com/test-2</image:loc><image:caption>Image Caption2</image:caption><image:geo_location>Paris</image:geo_location><image:title>Title2</image:title><image:license>Example license url</image:license></image:image></url></urlset>"`;
exports[`image:image tests should build corretcly with single image:image 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\"><url><loc>https://www.example.com/path</loc><image:image><image:loc>https://www.example.com/test</image:loc><image:caption>Image Caption</image:caption><image:geo_location>Nantes</image:geo_location><image:title>Title</image:title><image:license>Example license url</image:license></image:image></url></urlset>"`; exports[`image:image tests should build corretcly with single image:image 1`] = `"<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"><url><loc>https://www.example.com/path</loc><image:image><image:loc>https://www.example.com/test</image:loc><image:caption>Image Caption</image:caption><image:geo_location>Nantes</image:geo_location><image:title>Title</image:title><image:license>Example license url</image:license></image:image></url></urlset>"`;
exports[`image:image tests should skip image:image if no location is set 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\"><url><loc>https://www.example.com/path</loc></url></urlset>"`; exports[`image:image tests should skip image:image if no location is set 1`] = `"<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"><url><loc>https://www.example.com/path</loc></url></urlset>"`;
exports[`image:image tests should skip image:image if there is more than 1000 images 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?><urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\"><url><loc>https://www.example.com/path</loc></url></urlset>"`; exports[`image:image tests should skip image:image if there is more than 1000 images 1`] = `"<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"><url><loc>https://www.example.com/path</loc></url></urlset>"`;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "easy-sitemap", "name": "easy-sitemap",
"version": "1.1.2", "version": "1.2.0",
"description": "A very easy sitemap maker library", "description": "A very easy sitemap maker library",
"repository": { "repository": {
"type": "git", "type": "git",
@ -10,11 +10,27 @@
"homepage": "https://github.com/dzeiocom/libs/tree/master/packages/easy-sitemap#readme", "homepage": "https://github.com/dzeiocom/libs/tree/master/packages/easy-sitemap#readme",
"author": "Aviortheking", "author": "Aviortheking",
"license": "MIT", "license": "MIT",
"files": [
"dist"
],
"main": "./dist/Sitemap.js", "main": "./dist/Sitemap.js",
"module": "./dist/Sitemap.mjs",
"types": "./dist/Sitemap.d.ts", "types": "./dist/Sitemap.d.ts",
"exports": {
".": {
"require": {
"types": "./dist/Sitemap.d.ts",
"default": "./dist/Sitemap.js"
},
"import": {
"types": "./dist/Sitemap.d.mts",
"default": "./dist/Sitemap.mjs"
}
}
},
"scripts": { "scripts": {
"prepublishOnly": "yarn build", "prepublishOnly": "npm run build",
"build": "tsc", "build": "tsup ./src/Sitemap.ts --format cjs,esm --dts --clean",
"test": "jest --coverage" "test": "jest --coverage"
}, },
"keywords": [ "keywords": [
@ -25,5 +41,13 @@
"generator", "generator",
"SEO", "SEO",
"search-engine" "search-engine"
] ],
"devDependencies": {
"@types/jest": "^29",
"jest": "^29",
"jest-sonar-reporter": "^2.0.0",
"ts-jest": "^29.1.1",
"tsup": "^7",
"typescript": "^5"
}
} }