abler-api 0.1.31 → 0.1.34

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.
@@ -1562,9 +1562,9 @@ class preconditions$1 {
1562
1562
 
1563
1563
  }
1564
1564
 
1565
- async function createEnvSettingFile(fileName) {
1565
+ async function createEnvSettingFile(fileName, lastEnvSettingEx) {
1566
1566
  try {
1567
- const cfgText = await ppUtil$3.doCreateEnvSettingFile(fileName);
1567
+ const cfgText = await ppUtil$3.doCreateEnvSettingFile(fileName, lastEnvSettingEx);
1568
1568
 
1569
1569
  if (cfgText.indexOf(`cfgVersion: "${conf$2._envSetting.cfgVersion}"`) > 0) {
1570
1570
  console.log(`\n*** 已創建新的本機環境配置文件\n${fileName}\n请檢查各項內容是否正确(此项更新服务可正常运行)\n\n`);
@@ -1590,14 +1590,22 @@ async function checkExEnvSetting(loadjs) {
1590
1590
  if (envSettingEx.cfgVersion !== conf$2._envSettings.default.cfgVersion) {
1591
1591
  if (envSettingEx.cfgVersion !== "0.0") {
1592
1592
  let fp = path.parse(fileName);
1593
- let newFileName = path.join(fp.dir, fp.name + envSettingEx.cfgVersion + fp.ext);
1593
+ let lastVerFileName = path.join(fp.dir, fp.name + envSettingEx.cfgVersion + fp.ext);
1594
1594
 
1595
- if (!fs.existsSync(newFileName)) {
1596
- fs.renameSync(fileName, newFileName);
1595
+ if (!fs.existsSync(lastVerFileName)) {
1596
+ fs.renameSync(fileName, lastVerFileName);
1597
1597
  }
1598
1598
  }
1599
1599
 
1600
- return await createEnvSettingFile(fileName);
1600
+ let msg = await createEnvSettingFile(fileName, envSettingEx);
1601
+
1602
+ if (!msg) {
1603
+ delete require.cache[fileName];
1604
+ const envSettingEx = loadjs(fileName);
1605
+ ppUtil$3.importExEnvSetting(conf$2._envSetting, envSettingEx);
1606
+ }
1607
+
1608
+ return msg;
1601
1609
  }
1602
1610
  }
1603
1611
  } // async function checkDatabase() {
@@ -1549,9 +1549,9 @@ class preconditions$1 {
1549
1549
 
1550
1550
  }
1551
1551
 
1552
- async function createEnvSettingFile(fileName) {
1552
+ async function createEnvSettingFile(fileName, lastEnvSettingEx) {
1553
1553
  try {
1554
- const cfgText = await ppUtil$3.doCreateEnvSettingFile(fileName);
1554
+ const cfgText = await ppUtil$3.doCreateEnvSettingFile(fileName, lastEnvSettingEx);
1555
1555
 
1556
1556
  if (cfgText.indexOf(`cfgVersion: "${conf$2._envSetting.cfgVersion}"`) > 0) {
1557
1557
  console.log(`\n*** 已創建新的本機環境配置文件\n${fileName}\n请檢查各項內容是否正确(此项更新服务可正常运行)\n\n`);
@@ -1577,14 +1577,22 @@ async function checkExEnvSetting(loadjs) {
1577
1577
  if (envSettingEx.cfgVersion !== conf$2._envSettings.default.cfgVersion) {
1578
1578
  if (envSettingEx.cfgVersion !== "0.0") {
1579
1579
  let fp = path.parse(fileName);
1580
- let newFileName = path.join(fp.dir, fp.name + envSettingEx.cfgVersion + fp.ext);
1580
+ let lastVerFileName = path.join(fp.dir, fp.name + envSettingEx.cfgVersion + fp.ext);
1581
1581
 
1582
- if (!fs.existsSync(newFileName)) {
1583
- fs.renameSync(fileName, newFileName);
1582
+ if (!fs.existsSync(lastVerFileName)) {
1583
+ fs.renameSync(fileName, lastVerFileName);
1584
1584
  }
1585
1585
  }
1586
1586
 
1587
- return await createEnvSettingFile(fileName);
1587
+ let msg = await createEnvSettingFile(fileName, envSettingEx);
1588
+
1589
+ if (!msg) {
1590
+ delete require.cache[fileName];
1591
+ const envSettingEx = loadjs(fileName);
1592
+ ppUtil$3.importExEnvSetting(conf$2._envSetting, envSettingEx);
1593
+ }
1594
+
1595
+ return msg;
1588
1596
  }
1589
1597
  }
1590
1598
  } // async function checkDatabase() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abler-api",
3
- "version": "0.1.31",
3
+ "version": "0.1.34",
4
4
  "description": "API服务相关工具",
5
5
  "main": "./dist/cjs/pp-util.js",
6
6
  "module": "./dist/es/pp-util.js",