From 8b71ecde15f6489ef5d8e8bd5b509b02895bc93c Mon Sep 17 00:00:00 2001 From: Diluka W Date: Tue, 4 Jan 2022 10:18:32 +0800 Subject: [PATCH] feat: export file --- Dockerfile | 2 +- index.js | 60 +--------------- lib/app.js | 19 +++++ lib/create-calendar.js | 42 +++++++++++ lib/export.js | 4 ++ package-lock.json | 160 +++++++++++++++++------------------------ package.json | 9 ++- 7 files changed, 138 insertions(+), 158 deletions(-) create mode 100644 lib/app.js create mode 100644 lib/create-calendar.js create mode 100644 lib/export.js diff --git a/Dockerfile b/Dockerfile index a02bf6d..ad017a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM node:${NODE_VERSION}-alpine # 设置时区为CST ENV TZ=Asia/Shanghai ENV SERVER_PORT=3000 -ARG NPM_CONFIG_REGISTRY=$NPM_CONFIG_REGISTRY +ARG NPM_CONFIG_REGISTRY ENV NPM_CONFIG_REGISTRY=$NPM_CONFIG_REGISTRY # Create app directory diff --git a/index.js b/index.js index 0b49803..409a4b5 100644 --- a/index.js +++ b/index.js @@ -1,59 +1 @@ -import ChineseHolidays from 'chinese-holidays'; -import ical from 'ical-generator'; -import _ from 'lodash'; -import moment from 'moment'; -import http from 'http'; - -const port = +process.env.SERVER_PORT || 3000; - -async function createCalendar() { - const calendar = ical({ name: '中国放假安排', timezone: 'Asia/Shanghai' }); - console.log('正在准备节假日数据...'); - - const book = await ChineseHolidays.ready(); - console.log('节假日数据加载完成'); - - for (const event of book.events()) { - console.log(event.name, event.days(), event.isHoliday(), event.isWorkingday()); - - const from = _.first(event.days()); - const to = _.last(event.days()); - - const ev = calendar.createEvent({ - id: `HD-CN-${+from}`, - start: moment(from), - end: moment(to).add(1, 'd'), - summary: event.name + (event.isWorkingday() ? '补班' : ''), - allDay: true, - }); - - if (event.isWorkingday()) { - const description = '明天要上班记得定闹钟'; - ev.description(description); - - event.days().map((o) => - ev.createAlarm({ - type: 'display', - trigger: moment(o).add(-4, 'hours'), - description, - }), - ); - } - } - - return calendar; -} - -(async () => { - let calendar = await createCalendar(); - - setInterval(async () => { - calendar = await createCalendar(); - }, 24 * 3600 * 1000); - - http - .createServer((req, res) => calendar.serve(res)) - .listen(port, () => { - console.log(`Server running at http://localhost:${port}/`); - }); -})(); +import './lib/app.js'; diff --git a/lib/app.js b/lib/app.js new file mode 100644 index 0000000..94a465f --- /dev/null +++ b/lib/app.js @@ -0,0 +1,19 @@ +import http from 'http'; + +import { createCalendar } from './create-calendar.js'; + +const port = +process.env.SERVER_PORT || 3000; + +(async () => { + let calendar = await createCalendar(); + + setInterval(async () => { + calendar = await createCalendar(); + }, 24 * 3600 * 1000); + + http + .createServer((req, res) => calendar.serve(res)) + .listen(port, () => { + console.log(`Server running at http://localhost:${port}/`); + }); +})(); diff --git a/lib/create-calendar.js b/lib/create-calendar.js new file mode 100644 index 0000000..cb19a40 --- /dev/null +++ b/lib/create-calendar.js @@ -0,0 +1,42 @@ +import ChineseHolidays from 'chinese-holidays'; +import ical from 'ical-generator'; +import _ from 'lodash'; +import moment from 'moment'; + +export async function createCalendar() { + const calendar = ical({ name: '中国放假安排', timezone: 'Asia/Shanghai' }); + console.log('正在准备节假日数据...'); + + const book = await ChineseHolidays.ready(); + console.log('节假日数据加载完成'); + + for (const event of book.events()) { + console.log(event.name, event.days(), event.isHoliday(), event.isWorkingday()); + + const from = _.first(event.days()); + const to = _.last(event.days()); + + const ev = calendar.createEvent({ + id: `HD-CN-${+from}`, + start: moment(from), + end: moment(to).add(1, 'd'), + summary: event.name + (event.isWorkingday() ? '补班' : ''), + allDay: true, + }); + + if (event.isWorkingday()) { + const description = '明天要上班记得定闹钟'; + ev.description(description); + + event.days().map((o) => + ev.createAlarm({ + type: 'display', + trigger: moment(o).add(-4, 'hours'), + description, + }), + ); + } + } + + return calendar; +} diff --git a/lib/export.js b/lib/export.js new file mode 100644 index 0000000..f10d35e --- /dev/null +++ b/lib/export.js @@ -0,0 +1,4 @@ +import { createCalendar } from './create-calendar.js'; + +const calendar = await createCalendar(); +calendar.saveSync('./calendar.ics'); diff --git a/package-lock.json b/package-lock.json index a06f4ca..d90d043 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "chinese-holidays-ics", - "version": "1.2.0", + "version": "1.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "chinese-holidays-ics", - "version": "1.1.0", + "version": "1.3.0", "license": "ISC", "dependencies": { "chinese-holidays": "^1.4.1", @@ -15,9 +15,7 @@ "moment": "^2.29.1" }, "devDependencies": { - "@types/lodash": "^4.14.178", - "@types/node": "^14.18.3", - "eslint": "^8.5.0", + "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "prettier": "^2.5.1" @@ -65,18 +63,6 @@ "dev": true, "license": "BSD-3-Clause" }, - "node_modules/@types/lodash": { - "version": "4.14.178", - "resolved": "https://registry.npmmirror.com/@types/lodash/download/@types/lodash-4.14.178.tgz", - "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==", - "dev": true - }, - "node_modules/@types/node": { - "version": "14.18.3", - "resolved": "https://registry.npmmirror.com/@types/node/download/@types/node-14.18.3.tgz", - "integrity": "sha512-GtTH2crF4MtOIrrAa+jgTV9JX/PfoUCYr6MiZw7O/dkZu5b6gm5dc1nAL0jwGo4ortSBBtGyeVaxdC8X6V+pLg==", - "devOptional": true - }, "node_modules/acorn": { "version": "8.7.0", "resolved": "https://registry.npmmirror.com/acorn/download/acorn-8.7.0.tgz", @@ -100,8 +86,8 @@ }, "node_modules/ajv": { "version": "6.12.6", - "resolved": "https://registry.nlark.com/ajv/download/ajv-6.12.6.tgz?cache=0&sync_timestamp=1631470912358&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fajv%2Fdownload%2Fajv-6.12.6.tgz", - "integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=", + "resolved": "https://registry.npmmirror.com/ajv/download/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -220,7 +206,7 @@ }, "node_modules/chalk": { "version": "4.1.2", - "resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.2.tgz?cache=0&sync_timestamp=1627646614989&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.2.tgz", + "resolved": "https://registry.npmmirror.com/chalk/download/chalk-4.1.2.tgz", "integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE=", "dev": true, "dependencies": { @@ -245,7 +231,7 @@ }, "node_modules/color-convert": { "version": "2.0.1", - "resolved": "https://registry.nlark.com/color-convert/download/color-convert-2.0.1.tgz?cache=0&sync_timestamp=1624607968569&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcolor-convert%2Fdownload%2Fcolor-convert-2.0.1.tgz", + "resolved": "https://registry.npmmirror.com/color-convert/download/color-convert-2.0.1.tgz", "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", "dev": true, "dependencies": { @@ -382,9 +368,9 @@ } }, "node_modules/eslint": { - "version": "8.5.0", - "resolved": "https://registry.npmmirror.com/eslint/download/eslint-8.5.0.tgz", - "integrity": "sha512-tVGSkgNbOfiHyVte8bCM8OmX+xG9PzVG/B4UCF60zx7j61WIVY/AqJECDgpLD4DbbESD0e174gOg3ZlrX15GDg==", + "version": "8.6.0", + "resolved": "https://registry.npmmirror.com/eslint/download/eslint-8.6.0.tgz", + "integrity": "sha512-UvxdOJ7mXFlw7iuHZA4jmzPaUqIw54mZrv+XPYKNbKdLR0et4rf60lIZUU9kiNtnzzMzGWxMV+tQ7uG7JG8DPw==", "dev": true, "dependencies": { "@eslint/eslintrc": "^1.0.5", @@ -399,7 +385,7 @@ "eslint-scope": "^7.1.0", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.1.0", - "espree": "^9.2.0", + "espree": "^9.3.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -447,7 +433,7 @@ }, "node_modules/eslint-plugin-prettier": { "version": "4.0.0", - "resolved": "https://registry.nlark.com/eslint-plugin-prettier/download/eslint-plugin-prettier-4.0.0.tgz", + "resolved": "https://registry.npmmirror.com/eslint-plugin-prettier/download/eslint-plugin-prettier-4.0.0.tgz", "integrity": "sha1-i5nR5LiySnYkcrRWeZICNhnLmOA=", "dev": true, "dependencies": { @@ -496,7 +482,7 @@ }, "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { "version": "2.1.0", - "resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-2.1.0.tgz", + "resolved": "https://registry.npmmirror.com/eslint-visitor-keys/download/eslint-visitor-keys-2.1.0.tgz?cache=0&sync_timestamp=1636378433512&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Feslint-visitor-keys%2Fdownload%2Feslint-visitor-keys-2.1.0.tgz", "integrity": "sha1-9lMoJZMFknOSyTjtROsKXJsr0wM=", "dev": true, "engines": { @@ -513,12 +499,12 @@ } }, "node_modules/espree": { - "version": "9.2.0", - "resolved": "https://registry.npmmirror.com/espree/download/espree-9.2.0.tgz", - "integrity": "sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg==", + "version": "9.3.0", + "resolved": "https://registry.npmmirror.com/espree/download/espree-9.3.0.tgz", + "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==", "dev": true, "dependencies": { - "acorn": "^8.6.0", + "acorn": "^8.7.0", "acorn-jsx": "^5.3.1", "eslint-visitor-keys": "^3.1.0" }, @@ -576,7 +562,7 @@ }, "node_modules/extsprintf": { "version": "1.3.0", - "resolved": "https://registry.nlark.com/extsprintf/download/extsprintf-1.3.0.tgz", + "resolved": "https://registry.npmmirror.com/extsprintf/download/extsprintf-1.3.0.tgz?cache=0&sync_timestamp=1635889908126&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fextsprintf%2Fdownload%2Fextsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "engines": [ "node >=0.6.0" @@ -732,7 +718,7 @@ }, "node_modules/har-validator": { "version": "5.1.5", - "resolved": "https://registry.nlark.com/har-validator/download/har-validator-5.1.5.tgz", + "resolved": "https://registry.npmmirror.com/har-validator/download/har-validator-5.1.5.tgz", "integrity": "sha1-HwgDufjLIMD6E4It8ezds2veHv0=", "deprecated": "this library is no longer supported", "dependencies": { @@ -754,7 +740,7 @@ }, "node_modules/http-signature": { "version": "1.2.0", - "resolved": "https://registry.npm.taobao.org/http-signature/download/http-signature-1.2.0.tgz", + "resolved": "https://registry.npmmirror.com/http-signature/download/http-signature-1.2.0.tgz?cache=0&sync_timestamp=1637178703812&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fhttp-signature%2Fdownload%2Fhttp-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "dependencies": { "assert-plus": "^1.0.0", @@ -819,7 +805,7 @@ }, "node_modules/ignore": { "version": "4.0.6", - "resolved": "https://registry.nlark.com/ignore/download/ignore-4.0.6.tgz", + "resolved": "https://registry.npmmirror.com/ignore/download/ignore-4.0.6.tgz", "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", "dev": true, "engines": { @@ -904,8 +890,8 @@ }, "node_modules/js-yaml": { "version": "4.1.0", - "resolved": "https://registry.nlark.com/js-yaml/download/js-yaml-4.1.0.tgz?cache=0&sync_timestamp=1618847165988&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjs-yaml%2Fdownload%2Fjs-yaml-4.1.0.tgz", - "integrity": "sha1-wftl+PUBeQHN0slRhkuhhFihBgI=", + "resolved": "https://registry.npmmirror.com/js-yaml/download/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "dependencies": { "argparse": "^2.0.1" @@ -969,8 +955,8 @@ }, "node_modules/lodash": { "version": "4.17.21", - "resolved": "https://registry.nlark.com/lodash/download/lodash-4.17.21.tgz", - "integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=" + "resolved": "https://registry.npmmirror.com/lodash/download/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "node_modules/lodash.merge": { "version": "4.6.2", @@ -1023,8 +1009,8 @@ }, "node_modules/moment": { "version": "2.29.1", - "resolved": "https://registry.nlark.com/moment/download/moment-2.29.1.tgz", - "integrity": "sha1-sr52n6MZQL6e7qZGnAdeNQBvo9M=", + "resolved": "https://registry.npmmirror.com/moment/download/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", "engines": { "node": "*" } @@ -1145,8 +1131,8 @@ }, "node_modules/progress": { "version": "2.0.3", - "resolved": "https://registry.npm.taobao.org/progress/download/progress-2.0.3.tgz", - "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=", + "resolved": "https://registry.npmmirror.com/progress/download/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true, "engines": { "node": ">=0.4.0" @@ -1184,7 +1170,7 @@ }, "node_modules/request": { "version": "2.88.2", - "resolved": "https://registry.nlark.com/request/download/request-2.88.2.tgz?cache=0&sync_timestamp=1618847131102&other_urls=https%3A%2F%2Fregistry.nlark.com%2Frequest%2Fdownload%2Frequest-2.88.2.tgz", + "resolved": "https://registry.npmmirror.com/request/download/request-2.88.2.tgz", "integrity": "sha1-1zyRhzHLWofaBH4gcjQUb2ZNErM=", "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", "dependencies": { @@ -1229,7 +1215,7 @@ }, "node_modules/request-promise-native": { "version": "1.0.9", - "resolved": "https://registry.nlark.com/request-promise-native/download/request-promise-native-1.0.9.tgz?cache=0&sync_timestamp=1618846904727&other_urls=https%3A%2F%2Fregistry.nlark.com%2Frequest-promise-native%2Fdownload%2Frequest-promise-native-1.0.9.tgz", + "resolved": "https://registry.npmmirror.com/request-promise-native/download/request-promise-native-1.0.9.tgz", "integrity": "sha1-5AcSBSal79yaObKKVnm/R7nZ3Cg=", "deprecated": "request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142", "dependencies": { @@ -1255,7 +1241,7 @@ }, "node_modules/rimraf": { "version": "3.0.2", - "resolved": "https://registry.nlark.com/rimraf/download/rimraf-3.0.2.tgz", + "resolved": "https://registry.npmmirror.com/rimraf/download/rimraf-3.0.2.tgz", "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=", "dev": true, "dependencies": { @@ -1366,7 +1352,7 @@ }, "node_modules/supports-color": { "version": "7.2.0", - "resolved": "https://registry.nlark.com/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz", + "resolved": "https://registry.npmmirror.com/supports-color/download/supports-color-7.2.0.tgz", "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=", "dev": true, "dependencies": { @@ -1424,7 +1410,7 @@ }, "node_modules/type-fest": { "version": "0.20.2", - "resolved": "https://registry.nlark.com/type-fest/download/type-fest-0.20.2.tgz?cache=0&sync_timestamp=1632134160608&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftype-fest%2Fdownload%2Ftype-fest-0.20.2.tgz", + "resolved": "https://registry.npmmirror.com/type-fest/download/type-fest-0.20.2.tgz", "integrity": "sha1-G/IH9LKPkVg2ZstfvTJ4hzAc1fQ=", "dev": true, "engines": { @@ -1461,7 +1447,7 @@ }, "node_modules/verror": { "version": "1.10.0", - "resolved": "https://registry.nlark.com/verror/download/verror-1.10.0.tgz", + "resolved": "https://registry.npmmirror.com/verror/download/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "engines": [ "node >=0.6.0" @@ -1544,18 +1530,6 @@ "integrity": "sha1-tSBSnsIdjllFoYUd/Rwy6U45/0U=", "dev": true }, - "@types/lodash": { - "version": "4.14.178", - "resolved": "https://registry.npmmirror.com/@types/lodash/download/@types/lodash-4.14.178.tgz", - "integrity": "sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==", - "dev": true - }, - "@types/node": { - "version": "14.18.3", - "resolved": "https://registry.npmmirror.com/@types/node/download/@types/node-14.18.3.tgz", - "integrity": "sha512-GtTH2crF4MtOIrrAa+jgTV9JX/PfoUCYr6MiZw7O/dkZu5b6gm5dc1nAL0jwGo4ortSBBtGyeVaxdC8X6V+pLg==", - "devOptional": true - }, "acorn": { "version": "8.7.0", "resolved": "https://registry.npmmirror.com/acorn/download/acorn-8.7.0.tgz", @@ -1571,8 +1545,8 @@ }, "ajv": { "version": "6.12.6", - "resolved": "https://registry.nlark.com/ajv/download/ajv-6.12.6.tgz?cache=0&sync_timestamp=1631470912358&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fajv%2Fdownload%2Fajv-6.12.6.tgz", - "integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=", + "resolved": "https://registry.npmmirror.com/ajv/download/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1672,7 +1646,7 @@ }, "chalk": { "version": "4.1.2", - "resolved": "https://registry.nlark.com/chalk/download/chalk-4.1.2.tgz?cache=0&sync_timestamp=1627646614989&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fchalk%2Fdownload%2Fchalk-4.1.2.tgz", + "resolved": "https://registry.npmmirror.com/chalk/download/chalk-4.1.2.tgz", "integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE=", "dev": true, "requires": { @@ -1693,7 +1667,7 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://registry.nlark.com/color-convert/download/color-convert-2.0.1.tgz?cache=0&sync_timestamp=1624607968569&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcolor-convert%2Fdownload%2Fcolor-convert-2.0.1.tgz", + "resolved": "https://registry.npmmirror.com/color-convert/download/color-convert-2.0.1.tgz", "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", "dev": true, "requires": { @@ -1798,9 +1772,9 @@ "dev": true }, "eslint": { - "version": "8.5.0", - "resolved": "https://registry.npmmirror.com/eslint/download/eslint-8.5.0.tgz", - "integrity": "sha512-tVGSkgNbOfiHyVte8bCM8OmX+xG9PzVG/B4UCF60zx7j61WIVY/AqJECDgpLD4DbbESD0e174gOg3ZlrX15GDg==", + "version": "8.6.0", + "resolved": "https://registry.npmmirror.com/eslint/download/eslint-8.6.0.tgz", + "integrity": "sha512-UvxdOJ7mXFlw7iuHZA4jmzPaUqIw54mZrv+XPYKNbKdLR0et4rf60lIZUU9kiNtnzzMzGWxMV+tQ7uG7JG8DPw==", "dev": true, "requires": { "@eslint/eslintrc": "^1.0.5", @@ -1815,7 +1789,7 @@ "eslint-scope": "^7.1.0", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.1.0", - "espree": "^9.2.0", + "espree": "^9.3.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -1852,7 +1826,7 @@ }, "eslint-plugin-prettier": { "version": "4.0.0", - "resolved": "https://registry.nlark.com/eslint-plugin-prettier/download/eslint-plugin-prettier-4.0.0.tgz", + "resolved": "https://registry.npmmirror.com/eslint-plugin-prettier/download/eslint-plugin-prettier-4.0.0.tgz", "integrity": "sha1-i5nR5LiySnYkcrRWeZICNhnLmOA=", "dev": true, "requires": { @@ -1880,7 +1854,7 @@ "dependencies": { "eslint-visitor-keys": { "version": "2.1.0", - "resolved": "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-2.1.0.tgz", + "resolved": "https://registry.npmmirror.com/eslint-visitor-keys/download/eslint-visitor-keys-2.1.0.tgz?cache=0&sync_timestamp=1636378433512&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Feslint-visitor-keys%2Fdownload%2Feslint-visitor-keys-2.1.0.tgz", "integrity": "sha1-9lMoJZMFknOSyTjtROsKXJsr0wM=", "dev": true } @@ -1893,12 +1867,12 @@ "dev": true }, "espree": { - "version": "9.2.0", - "resolved": "https://registry.npmmirror.com/espree/download/espree-9.2.0.tgz", - "integrity": "sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg==", + "version": "9.3.0", + "resolved": "https://registry.npmmirror.com/espree/download/espree-9.3.0.tgz", + "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==", "dev": true, "requires": { - "acorn": "^8.6.0", + "acorn": "^8.7.0", "acorn-jsx": "^5.3.1", "eslint-visitor-keys": "^3.1.0" } @@ -1940,7 +1914,7 @@ }, "extsprintf": { "version": "1.3.0", - "resolved": "https://registry.nlark.com/extsprintf/download/extsprintf-1.3.0.tgz", + "resolved": "https://registry.npmmirror.com/extsprintf/download/extsprintf-1.3.0.tgz?cache=0&sync_timestamp=1635889908126&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fextsprintf%2Fdownload%2Fextsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, "fast-deep-equal": { @@ -2064,7 +2038,7 @@ }, "har-validator": { "version": "5.1.5", - "resolved": "https://registry.nlark.com/har-validator/download/har-validator-5.1.5.tgz", + "resolved": "https://registry.npmmirror.com/har-validator/download/har-validator-5.1.5.tgz", "integrity": "sha1-HwgDufjLIMD6E4It8ezds2veHv0=", "requires": { "ajv": "^6.12.3", @@ -2079,7 +2053,7 @@ }, "http-signature": { "version": "1.2.0", - "resolved": "https://registry.npm.taobao.org/http-signature/download/http-signature-1.2.0.tgz", + "resolved": "https://registry.npmmirror.com/http-signature/download/http-signature-1.2.0.tgz?cache=0&sync_timestamp=1637178703812&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fhttp-signature%2Fdownload%2Fhttp-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", "requires": { "assert-plus": "^1.0.0", @@ -2097,7 +2071,7 @@ }, "ignore": { "version": "4.0.6", - "resolved": "https://registry.nlark.com/ignore/download/ignore-4.0.6.tgz", + "resolved": "https://registry.npmmirror.com/ignore/download/ignore-4.0.6.tgz", "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", "dev": true }, @@ -2166,8 +2140,8 @@ }, "js-yaml": { "version": "4.1.0", - "resolved": "https://registry.nlark.com/js-yaml/download/js-yaml-4.1.0.tgz?cache=0&sync_timestamp=1618847165988&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fjs-yaml%2Fdownload%2Fjs-yaml-4.1.0.tgz", - "integrity": "sha1-wftl+PUBeQHN0slRhkuhhFihBgI=", + "resolved": "https://registry.npmmirror.com/js-yaml/download/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "requires": { "argparse": "^2.0.1" @@ -2222,8 +2196,8 @@ }, "lodash": { "version": "4.17.21", - "resolved": "https://registry.nlark.com/lodash/download/lodash-4.17.21.tgz", - "integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw=" + "resolved": "https://registry.npmmirror.com/lodash/download/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "lodash.merge": { "version": "4.6.2", @@ -2264,8 +2238,8 @@ }, "moment": { "version": "2.29.1", - "resolved": "https://registry.nlark.com/moment/download/moment-2.29.1.tgz", - "integrity": "sha1-sr52n6MZQL6e7qZGnAdeNQBvo9M=" + "resolved": "https://registry.npmmirror.com/moment/download/moment-2.29.1.tgz", + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" }, "ms": { "version": "2.1.2", @@ -2356,8 +2330,8 @@ }, "progress": { "version": "2.0.3", - "resolved": "https://registry.npm.taobao.org/progress/download/progress-2.0.3.tgz", - "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=", + "resolved": "https://registry.npmmirror.com/progress/download/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, "psl": { @@ -2383,7 +2357,7 @@ }, "request": { "version": "2.88.2", - "resolved": "https://registry.nlark.com/request/download/request-2.88.2.tgz?cache=0&sync_timestamp=1618847131102&other_urls=https%3A%2F%2Fregistry.nlark.com%2Frequest%2Fdownload%2Frequest-2.88.2.tgz", + "resolved": "https://registry.npmmirror.com/request/download/request-2.88.2.tgz", "integrity": "sha1-1zyRhzHLWofaBH4gcjQUb2ZNErM=", "requires": { "aws-sign2": "~0.7.0", @@ -2418,7 +2392,7 @@ }, "request-promise-native": { "version": "1.0.9", - "resolved": "https://registry.nlark.com/request-promise-native/download/request-promise-native-1.0.9.tgz?cache=0&sync_timestamp=1618846904727&other_urls=https%3A%2F%2Fregistry.nlark.com%2Frequest-promise-native%2Fdownload%2Frequest-promise-native-1.0.9.tgz", + "resolved": "https://registry.npmmirror.com/request-promise-native/download/request-promise-native-1.0.9.tgz", "integrity": "sha1-5AcSBSal79yaObKKVnm/R7nZ3Cg=", "requires": { "request-promise-core": "1.1.4", @@ -2434,7 +2408,7 @@ }, "rimraf": { "version": "3.0.2", - "resolved": "https://registry.nlark.com/rimraf/download/rimraf-3.0.2.tgz", + "resolved": "https://registry.npmmirror.com/rimraf/download/rimraf-3.0.2.tgz", "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=", "dev": true, "requires": { @@ -2513,7 +2487,7 @@ }, "supports-color": { "version": "7.2.0", - "resolved": "https://registry.nlark.com/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1626703455199&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz", + "resolved": "https://registry.npmmirror.com/supports-color/download/supports-color-7.2.0.tgz", "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=", "dev": true, "requires": { @@ -2559,7 +2533,7 @@ }, "type-fest": { "version": "0.20.2", - "resolved": "https://registry.nlark.com/type-fest/download/type-fest-0.20.2.tgz?cache=0&sync_timestamp=1632134160608&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftype-fest%2Fdownload%2Ftype-fest-0.20.2.tgz", + "resolved": "https://registry.npmmirror.com/type-fest/download/type-fest-0.20.2.tgz", "integrity": "sha1-G/IH9LKPkVg2ZstfvTJ4hzAc1fQ=", "dev": true }, @@ -2589,7 +2563,7 @@ }, "verror": { "version": "1.10.0", - "resolved": "https://registry.nlark.com/verror/download/verror-1.10.0.tgz", + "resolved": "https://registry.npmmirror.com/verror/download/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", "requires": { "assert-plus": "^1.0.0", diff --git a/package.json b/package.json index c2f0041..30139e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chinese-holidays-ics", - "version": "1.2.0", + "version": "1.3.0", "description": "中国节假日日历订阅服务器", "private": true, "repository": "https://github.com/Diluka/chinese-holidays-ics", @@ -8,6 +8,7 @@ "type": "module", "scripts": { "start": "node .", + "export": "node lib/export.js", "test:download": "curl -sSL localhost:3000 -o calendar.ics" }, "keywords": [ @@ -25,11 +26,9 @@ "moment": "^2.29.1" }, "devDependencies": { - "@types/lodash": "^4.14.178", - "@types/node": "^14.18.3", - "eslint": "^8.5.0", + "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "prettier": "^2.5.1" } -} \ No newline at end of file +}