hexo-theme-shokax 0.4.6-dev4 → 0.4.6-dev5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/toolbox/lib.mjs +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.4.6-dev4",
3
+ "version": "0.4.6-dev5",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
@@ -10,7 +10,7 @@
10
10
  "scripts": {
11
11
  "test": "tsc --build --verbose",
12
12
  "build": "node ./toolbox/compiler.mjs",
13
- "postinstall": "node ./toolbox/hoistdep.mjs"
13
+ "preinstall": "node ./toolbox/hoistdep.mjs"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@types/fancybox": "^3.5.7",
package/toolbox/lib.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from "fs/promises";
2
2
  import child_process from "child_process";
3
- import { dirname, resolve } from 'path';
3
+ import { dirname, resolve, join } from 'path';
4
4
 
5
5
  async function findScaffoldsDir(startPath) {
6
6
  let currentPath = resolve(startPath);
@@ -26,9 +26,11 @@ async function findScaffoldsDir(startPath) {
26
26
  return null;
27
27
  }
28
28
 
29
+ const hexoRoot = await findScaffoldsDir(process.cwd())
30
+
29
31
  async function checkFileAccessible(file) {
30
32
  try {
31
- await fs.access(file)
33
+ await fs.access(join((hexoRoot || ''),file))
32
34
  } catch {
33
35
  return false
34
36
  }
@@ -50,8 +52,6 @@ export async function hoistDeps() {
50
52
  const latestV = res['dist-tags'].latest
51
53
  const deps = res.versions[latestV].dependencies
52
54
  const depsList = Object.keys(deps).map(d => `${d}@${deps[d]}`)
53
- const hexoRoot = await findScaffoldsDir(process.cwd())
54
- throw Error(`${hexoRoot}\n${process.cwd()}`)
55
55
  child_process.exec(`${pm} ${depsList.join(' ')}`.trim(), {
56
56
  cwd: hexoRoot
57
57
  }, (code, stdout, stderr) => {