Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DS_Store
fixtures/*
fixtures/zhihu/images/*
!fixtures/*.epub
test/fixtures/*
test/fixtures/zhihu/images/*
!test/fixtures/*.epub
dist
lib
temp
Expand Down
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
fixtures
test/fixtures
src
examples
.prettierrc
Expand Down
23 changes: 6 additions & 17 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
import { defineBuildConfig } from "unbuild";
import fs from 'node:fs';
import { writeFileSync } from 'write-file-safe';

export default defineBuildConfig({
entries: [
{
input: "src/bin/",
outDir: 'lib/bin/',
format: 'cjs',
ext: 'cjs',
declaration: false,
},
{
input: "src/",
outDir: "lib/",
pattern: "**/*.ts",
declaration: true,
pattern: "*.ts",
format: "esm",
},
{
input: "src/",
pattern: "*.ts",
declaration: true,
outDir: "lib/",
pattern: "**/*.ts",
declaration: true,
format: "cjs",
ext: "cjs",
},
Expand All @@ -31,13 +23,10 @@ export default defineBuildConfig({
"build:done"(ctx) {
const cliDir = './lib/bin/'
fs.readdirSync(cliDir).forEach((file) => {
if (file.endsWith('.cjs')) {
const t = fs.readFileSync(cliDir + file, 'utf8').replace('// #!', '#!').replace(/require\(['"]\.{2}[^'"]*/g, (a, v) => {
return a + '.cjs'
});
writeFileSync(cliDir + file, t)
if (file.match(/.(mjs|ts)$/)) {
fs.rmSync(cliDir + file)
}
});
}
}
});
});
2 changes: 1 addition & 1 deletion examples/simple/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
const { parseEpub } = require('../../lib')

parseEpub('../../fixtures/zhihu.epub').then((result) => {
parseEpub('../../test/fixtures/zhihu.epub').then((result) => {
console.log('result object has keys: ', Object.keys(result))
console.log('book info', result.info)
console.log('book structure', result.structure)
Expand Down
2 changes: 0 additions & 2 deletions fixtures/file-e.epub

This file was deleted.

9 changes: 0 additions & 9 deletions jest.config.ts

This file was deleted.

20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
"watch": "tsc --watch",
"clean": "rimraf lib dist",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,md,css,scss}\"",
"test": "jest",
"test-debug": "node --inspect-brk -r ts-node/register node_modules/.bin/jest --runInBand",
"test": "pnpm i && unbuild && vitest",
"test:integration": "pnpm i && unbuild && node ./test/utilities/integration.run.ts",
"test-debug": "vitest --inspect-brk --test-timeout=0 --no-file-parallelism",
"release": "pnpm dlx commit-and-tag-version --preset angular",
"release:patch": "pnpm run release --release-as patch",
"release:minor": "pnpm run release --release-as minor",
Expand Down Expand Up @@ -64,32 +65,35 @@
"beauty-json": "^1.0.0",
"fast-glob": "^3.3.3",
"fast-xml-parser": "^5.2.0",
"fflate": "^0.8.2",
"iterator-helpers-polyfill": "^3.0.1",
"jsdom": "^24.0.0",
"lodash": "^4.17.15",
"node-html-markdown": "^1.3.0",
"node-zip": "^1.1.1",
"picocolors": "^1.1.1",
"write-file-safe": "^1.3.1"
},
"devDependencies": {
"@jsdevtools/npm-publish": "^3.1.1",
"@types/args": "^5.0.0",
"@types/jest": "^24.0.18",
"@types/folder-hash": "^4.0.4",
"@types/jsdom": "^21.1.1",
"@types/lodash": "^4.14.137",
"@types/node": "^20.2.3",
"@types/node": "^25.0.2",
"cross-env": "^5.2.0",
"dotenv": "^8.1.0",
"express": "^4.17.1",
"jest": "^29.7.0",
"folder-hash": "^4.1.1",
"nock": "^14.0.10",
"package-directory": "^8.1.0",
"prettier": "^2.0.5",
"rimraf": "^6.0.1",
"source-map-support": "^0.5.13",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tslint": "^5.19.0",
"typescript": "^5.5.4",
"typescript": "^5.9.3",
"unbuild": "3.0.0-rc.7",
"vitest": "^4.0.15",
"vrsource-tslint-rules": "^6.0.0"
}
}
Loading