@kadaliao/geektime-downloader 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/download.js CHANGED
@@ -7,6 +7,7 @@ import ora from 'ora';
7
7
  import fs from 'fs/promises';
8
8
  import path from 'path';
9
9
  import { fileURLToPath } from 'url';
10
+ import { createRequire } from 'module';
10
11
  import * as pdfLib from 'pdf-lib';
11
12
  import { outlinePdfFactory } from '@lillallol/outline-pdf';
12
13
  import epubGenMemory from 'epub-gen-memory';
@@ -14,6 +15,8 @@ import epubGenMemory from 'epub-gen-memory';
14
15
  const { PDFDocument } = pdfLib;
15
16
  const outlinePdf = outlinePdfFactory(pdfLib);
16
17
  const epub = epubGenMemory.default || epubGenMemory;
18
+ const require = createRequire(import.meta.url);
19
+ const { version } = require('./package.json');
17
20
 
18
21
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
19
22
 
@@ -2230,7 +2233,7 @@ async function main(options) {
2230
2233
  program
2231
2234
  .name('geektime-dl')
2232
2235
  .description('批量下载极客时间专栏文章为PDF或EPUB')
2233
- .version('1.1.0')
2236
+ .version(version)
2234
2237
  .option('-u, --url <url>', '专栏文章URL(任意一篇)')
2235
2238
  .option('-c, --cookie <cookie>', 'Cookie字符串(用于认证)')
2236
2239
  .option('-o, --output <dir>', '输出目录', './downloads')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kadaliao/geektime-downloader",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "极客时间专栏文章批量下载工具 - 支持一键下载整个专栏为PDF或EPUB",
5
5
  "type": "module",
6
6
  "main": "download.js",