hexo-swpp 1.2.8 → 1.2.9

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.
Files changed (2) hide show
  1. package/index.js +4 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -18,7 +18,7 @@ if (pluginConfig?.enable) {
18
18
  // 生成 update.json
19
19
  hexo.extend.console.register('swpp', '生成前端更新需要的 json 文件以及相关缓存', {}, async () => {
20
20
  if (!fs.existsSync(config.public_dir))
21
- return logger.info('跳过生成 update.json')
21
+ return logger.info('未检测到发布目录,跳过 swpp 执行')
22
22
  const cachePath = 'cacheList.json'
23
23
  const updatePath = 'update.json'
24
24
  const oldCache = await getJsonFromNetwork(cachePath)
@@ -124,7 +124,7 @@ const buildNewJson = path => {
124
124
  let publicRoot = config.public_dir || 'public/'
125
125
  if (!publicRoot.endsWith('/')) publicRoot += '/'
126
126
  fs.writeFileSync(`${publicRoot}${path}`, JSON.stringify(result), 'utf-8')
127
- logger.info(`SwppGenerated: ${path}`)
127
+ logger.info(`Generated: ${path}`)
128
128
  return result
129
129
  }
130
130
 
@@ -218,7 +218,7 @@ const buildUpdateJson = (name, dif, oldUpdate) => {
218
218
  /** 将对象写入文件,如果对象为 null 或 undefined 则跳过写入 */
219
219
  const writeJson = json => {
220
220
  if (json) {
221
- logger.info(`SwppGenerated: ${name}`)
221
+ logger.info(`Generated: ${name}`)
222
222
  fs.writeFileSync(`public/${name}`, JSON.stringify(json), 'utf-8')
223
223
  }
224
224
  }
@@ -238,7 +238,7 @@ const buildUpdateJson = (name, dif, oldUpdate) => {
238
238
  }
239
239
  // 整理更新的数据
240
240
  const tidied = tidyDiff(dif, expand)
241
- if (expand.all) return writeJson({
241
+ if (expand?.all) return writeJson({
242
242
  global: (oldUpdate?.global ?? 0) + (tidied.updateGlobal ? 1 : 0),
243
243
  info: [newInfo]
244
244
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-swpp",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "hexo-log": "^3.0.0",