From aee26e69d49f56f1caf08e08c63e9cbf19e9b1c1 Mon Sep 17 00:00:00 2001 From: val Date: Tue, 9 Mar 2021 21:29:53 +0800 Subject: [PATCH] Remove unnecessary dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 虽然 package.json 中仅定义了两个依赖,但最终会安装 290 个包。而实际上一个依赖 都不需要添加。 对于 hexo-fs,此项目使用到的几个 API,直接使用 Node.js 的 fs 模块就足够了。 hexo-fs 是添加了更多的文件 watch 等功能,此项目并没有用到。 对于 hexo-log,在 `hexo` 变量上,已经有初始化过的 `log` 可以直接用,没必自 己引入 hexo-log 再创建个实例。而且使用 `hexo.log` 还有个好处是 debug 和 slient 等配置,还会继承用户执行 `hexo` 命令时使用的 `--debug` 和 `--slient` 等参数配置。 Signed-off-by: val --- index.js | 4 ++-- package.json | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index ae0cfa8..b057e1e 100644 --- a/index.js +++ b/index.js @@ -3,9 +3,9 @@ 'use strict'; const crypto = require('crypto'); -const fs = require('hexo-fs'); +const fs = require('fs'); const path = require('path'); -const log = require('hexo-log')({ 'debug': false, 'slient': false }); +const log = hexo.log; const defaultConfig = { 'abstract': 'Here\'s something encrypted, password is required to continue reading.', diff --git a/package.json b/package.json index c54c848..8648985 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,6 @@ "bugs": { "url": "https://github.com/D0n9X1n/hexo-blog-encrypt/issues" }, - "dependencies": { - "hexo-fs": "^1.0.2", - "hexo-log": "^0.2.0" - }, "description": "Yet, just another blog encrypt plugin for hexo.", "homepage": "https://github.com/D0n9X1n/hexo-blog-encrypt#readme", "keywords": [ @@ -25,7 +21,6 @@ } ], "name": "hexo-blog-encrypt", - "optionalDependencies": {}, "repository": { "type": "git", "url": "git+ssh://git@github.com/D0n9X1n/hexo-blog-encrypt.git"