@lx-frontend/multi-ajax 0.2.5 → 0.2.6-beta.1

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.
@@ -7,8 +7,14 @@ const { resolveAxiosPath, copyFiles } = require('../utils')
7
7
  function patchAxios() {
8
8
  const patchSourceAxiosPath = path.resolve(__dirname, './axios')
9
9
  const targetAxiosPath = resolveAxiosPath()
10
-
11
- copyFiles(patchSourceAxiosPath, targetAxiosPath);
10
+ console.log('打补丁: source', patchSourceAxiosPath)
11
+ console.log('打补丁: target', targetAxiosPath)
12
+ try {
13
+ copyFiles(patchSourceAxiosPath, targetAxiosPath);
14
+ console.log('打补丁完成')
15
+ } catch (e) {
16
+ console.log('打补丁异常', e)
17
+ }
12
18
  }
13
19
 
14
20
  patchAxios()
package/build/utils.js CHANGED
@@ -15,14 +15,16 @@ function copyFiles(sourceDir, targetDir) {
15
15
 
16
16
  const files = fs.readdirSync(sourceDir);
17
17
  files.forEach(file => {
18
- const sourceFilePath = path.join(sourceDir, file);
19
- const targetFilePath = path.join(targetDir, file);
18
+ const sourceFilePath = path.resolve(sourceDir, file);
19
+ const targetFilePath = path.resolve(targetDir, file);
20
+
21
+ console.log('file', file)
22
+ console.info(`覆盖: ${targetFilePath},来源:${sourceFilePath}`)
20
23
 
21
24
  if (fs.statSync(sourceFilePath).isDirectory()) {
22
25
  copyFiles(sourceFilePath, targetFilePath); // 递归处理子目录
23
26
  } else {
24
27
  fs.copyFileSync(sourceFilePath, targetFilePath); // 复制文件
25
- console.info(`覆盖: ${targetFilePath},来源:${sourceFilePath}`)
26
28
  }
27
29
  });
28
30
  }