Migrate to ESLint 9 flat config (#239)
* eslint 9 * fix lint errors * update package-lock.json
This commit is contained in:
1 parent
d9d8bbebe1
commit
a4b3068850
9 files changed
+5830
-5854
No files matched your search
+12
-12
@@ -1,15 +1,15 @@
|
||||
const { Feed } = require('feed')
|
||||
const axios = require('axios')
|
||||
const fs = require('fs').promises
|
||||
const { Feed } = require("feed")
|
||||
const axios = require("axios")
|
||||
const fs = require("fs").promises
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: 'https://api.tmshv.com/hudozka',
|
||||
baseURL: "https://api.tmshv.com/hudozka",
|
||||
})
|
||||
|
||||
async function getArticles(limit) {
|
||||
const query = ['post', 'event', 'album']
|
||||
const query = ["post", "event", "album"]
|
||||
.map(t => `tag=${t}`)
|
||||
.join('&')
|
||||
.join("&")
|
||||
const url = `/api/pages/tags?${query}&sortBy=-date&skip=0&pageSize=${limit}`
|
||||
const res = await api.get(url)
|
||||
|
||||
@@ -19,15 +19,15 @@ async function getArticles(limit) {
|
||||
(async () => {
|
||||
const articles = await getArticles(30)
|
||||
|
||||
const url = 'https://art.shlisselburg.org'
|
||||
const url = "https://art.shlisselburg.org"
|
||||
const feed = new Feed({
|
||||
title: 'Шлиссельбургская ДХШ',
|
||||
title: "Шлиссельбургская ДХШ",
|
||||
id: url,
|
||||
link: url,
|
||||
feedLinks: {
|
||||
atom: 'https://art.shlisselburg.org/feed.xml',
|
||||
atom: "https://art.shlisselburg.org/feed.xml",
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
articles.forEach(article => {
|
||||
feed.addItem({
|
||||
@@ -41,6 +41,6 @@ async function getArticles(limit) {
|
||||
|
||||
const content = feed.atom1()
|
||||
|
||||
await fs.writeFile('dist/feed.xml', content, { encoding: 'utf-8' })
|
||||
await fs.writeFile("dist/feed.xml", content, { encoding: "utf-8" })
|
||||
})()
|
||||
|
||||
|
||||
+14
-14
@@ -1,28 +1,28 @@
|
||||
const sitemap = require('sitemap')
|
||||
const axios = require('axios')
|
||||
const fs = require('fs').promises
|
||||
const homeUrl = 'https://art.shlisselburg.org'
|
||||
const sitemap = require("sitemap")
|
||||
const axios = require("axios")
|
||||
const fs = require("fs").promises
|
||||
const homeUrl = "https://art.shlisselburg.org"
|
||||
const sitemapCacheTime = 600000
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: 'https://api.tmshv.com/hudozka',
|
||||
baseURL: "https://api.tmshv.com/hudozka",
|
||||
})
|
||||
|
||||
async function getMenuUrls(frequency = 'daily') {
|
||||
async function getMenuUrls(frequency = "daily") {
|
||||
const menu = [
|
||||
'/',
|
||||
'/collective',
|
||||
"/",
|
||||
"/collective",
|
||||
]
|
||||
return menu
|
||||
// .filter(i => 'url' in i)
|
||||
.map(url => ({
|
||||
url,
|
||||
changefreq: frequency
|
||||
changefreq: frequency,
|
||||
}))
|
||||
}
|
||||
|
||||
async function getPageUrls(frequency = 'daily') {
|
||||
const res = await api.get('/api/pages/urls')
|
||||
async function getPageUrls(frequency = "daily") {
|
||||
const res = await api.get("/api/pages/urls")
|
||||
|
||||
return res.data.items.map(url => ({
|
||||
changefreq: frequency,
|
||||
@@ -40,9 +40,9 @@ async function getPageUrls(frequency = 'daily') {
|
||||
let map = sitemap.createSitemap({
|
||||
hostname: homeUrl,
|
||||
cacheTime: sitemapCacheTime,
|
||||
urls
|
||||
urls,
|
||||
})
|
||||
const content = map.toString()
|
||||
|
||||
await fs.writeFile('dist/sitemap.xml', content, { encoding: 'utf-8' })
|
||||
})()
|
||||
await fs.writeFile("dist/sitemap.xml", content, { encoding: "utf-8" })
|
||||
})()
|
||||
Reference in new issue
Block a user