From 197f8b093630697ef7d8ab2b4f17cd159ab77af0 Mon Sep 17 00:00:00 2001 From: LetTTGACO <1225751694@qq.com> Date: Sun, 7 Apr 2024 20:44:13 +0800 Subject: [PATCH] test: test elog --- tests/test-elog/.gitignore | 6 +-- tests/test-elog/elog.config-muti.ts | 63 +++++++++++++++++++++++++++++ tests/test-elog/elog.config.ts | 14 +++++++ tests/test-elog/package.json | 1 + tests/test-elog/tsconfig.json | 2 +- 5 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 tests/test-elog/elog.config-muti.ts diff --git a/tests/test-elog/.gitignore b/tests/test-elog/.gitignore index 23f9dae8..2e841818 100644 --- a/tests/test-elog/.gitignore +++ b/tests/test-elog/.gitignore @@ -1,3 +1,3 @@ -docs -image -elog.cache.json +docs* +images* +elog.cache*.json diff --git a/tests/test-elog/elog.config-muti.ts b/tests/test-elog/elog.config-muti.ts new file mode 100644 index 00000000..cd9c2fa7 --- /dev/null +++ b/tests/test-elog/elog.config-muti.ts @@ -0,0 +1,63 @@ +import { defineConfig } from '@elogx-test/elog'; +import fromYuque from '@elogx-test/plugin-from-yuque'; +import toLocal from '@elogx-test/plugin-to-local'; +import imageLocal from '@elogx-test/plugin-image-local'; + +export default defineConfig([ + { + from: fromYuque({ + pwd: { + username: process.env.YUQUE_USERNAME, + password: process.env.YUQUE_PWD, + login: process.env.YUQUE_LOGIN, + repo: process.env.YUQUE_REPO, + onlyPublic: false, + linebreak: false, + cacheFilePath: 'elog.cache1.json', + }, + }), + to: [ + toLocal({ + outputDir: './docs1', + deployByStructure: true, + filename: 'title', + frontMatter: { enable: true }, + }), + ], + plugins: [ + imageLocal({ + outputDir: './images1', + // prefixKey: '../../images', + pathFollowDoc: { enable: true, docOutputDir: './docs1' }, + }), + ], + }, + { + from: fromYuque({ + pwd: { + username: process.env.YUQUE_USERNAME, + password: process.env.YUQUE_PWD, + login: process.env.YUQUE_LOGIN, + repo: process.env.YUQUE_REPO, + onlyPublic: false, + linebreak: false, + cacheFilePath: 'elog.cache2.json', + }, + }), + to: [ + toLocal({ + outputDir: './docs2', + deployByStructure: true, + filename: 'title', + frontMatter: { enable: true }, + }), + ], + plugins: [ + imageLocal({ + outputDir: './images2', + // prefixKey: '../../images', + pathFollowDoc: { enable: true, docOutputDir: './docs2' }, + }), + ], + }, +]); diff --git a/tests/test-elog/elog.config.ts b/tests/test-elog/elog.config.ts index df36902b..e2b33f7d 100644 --- a/tests/test-elog/elog.config.ts +++ b/tests/test-elog/elog.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from '@elogx-test/elog'; import fromYuque from '@elogx-test/plugin-from-yuque'; import toLocal from '@elogx-test/plugin-to-local'; +import imageLocal from '@elogx-test/plugin-image-local'; export default defineConfig({ from: fromYuque({ @@ -26,5 +27,18 @@ export default defineConfig({ filename: 'title', frontMatter: { enable: true }, }), + toLocal({ + outputDir: './docs-new', + deployByStructure: true, + filename: 'title', + frontMatter: { enable: true }, + }), + ], + plugins: [ + imageLocal({ + outputDir: './images', + prefixKey: '../../images', + // pathFollowDoc: { enable: true, docOutputDir: './docs' }, + }), ], }); diff --git a/tests/test-elog/package.json b/tests/test-elog/package.json index 48dcb436..8aee9550 100644 --- a/tests/test-elog/package.json +++ b/tests/test-elog/package.json @@ -8,6 +8,7 @@ "elog:init-templ": "elog init --template yuque-local", "elog:init": "elog init", "elog:sync": "elog sync --env .elog.env", + "elog:sync-muti": "elog sync --env .elog.env --config elog.config-muti.ts --cache elog.cache-muti.json ", "elog:version": "elog --version", "elog": "elog" }, diff --git a/tests/test-elog/tsconfig.json b/tests/test-elog/tsconfig.json index cbfc4e6a..55f96561 100644 --- a/tests/test-elog/tsconfig.json +++ b/tests/test-elog/tsconfig.json @@ -5,7 +5,7 @@ "module": "ESNext", "moduleResolution": "Bundler", "strict": true, - "declaration": true, + "declaration": false, "noImplicitOverride": true, "noUnusedLocals": true, "esModuleInterop": true,