@kengic/uni 0.6.3-beta.59 → 0.6.3-beta.60

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/uni",
3
- "version": "0.6.3-beta.59",
3
+ "version": "0.6.3-beta.60",
4
4
  "scripts": {
5
5
  "postinstall": "node ./script/postinstall.mjs"
6
6
  },
@@ -18,16 +18,31 @@ console.log(`${now()}${process.cwd()}`);
18
18
  let json01 = null;
19
19
 
20
20
  try {
21
- console.log(`${now()}开始读取 package.json`);
22
- json01 = (await import(`${PROJECT_DIR}/package.json`)).default;
23
- console.log(`${now()}成功读取 package.json`);
21
+ console.log(`${now()}开始读取组件的 package.json`);
22
+ json01 = (await import(`./package.json`)).default;
23
+ console.log(`${now()}成功读取组件的 package.json`);
24
24
  } catch (e) {
25
- console.log(`${now()}失败读取 package.json`);
26
- console.error(e);
25
+ console.log(`${now()}失败读取组件的 package.json`);
26
+ throw e;
27
27
  }
28
28
 
29
- if (json01) {
30
- console.log(`${now()}开始写入 package.json`);
31
- fs.writeFileSync(`${PROJECT_DIR}/package.json`, `${JSON.stringify(json01, null, 4)}\n`, {});
32
- console.log(`${now()}成功写入 package.json`);
29
+ let json02 = null;
30
+
31
+ try {
32
+ console.log(`${now()}开始读取项目的 package.json`);
33
+ json02 = (await import(`${PROJECT_DIR}/package.json`)).default;
34
+ console.log(`${now()}成功读取项目的 package.json`);
35
+ } catch (e) {
36
+ console.log(`${now()}失败读取项目的 package.json`);
37
+ throw e;
38
+ }
39
+
40
+ if (json02) {
41
+ for (let key of Object.keys(json01.dependencies)) {
42
+ json02.dependencies[key] = json01.dependencies[key];
43
+ }
44
+
45
+ console.log(`${now()}开始写入项目的 package.json`);
46
+ fs.writeFileSync(`${PROJECT_DIR}/package.json`, `${JSON.stringify(json02, null, 4)}\n`, {});
47
+ console.log(`${now()}成功写入项目的 package.json`);
33
48
  }