@momo-kits/foundation 0.92.30 → 0.92.32

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/verify.js CHANGED
@@ -1,47 +1,41 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
- try {
5
- const packageInfo = JSON.parse(
6
- fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8')
4
+ const packageInfo = JSON.parse(
5
+ fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8')
6
+ );
7
+ const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
8
+
9
+ const app = path.join(`${__dirname}/../../../`, 'app.json');
10
+ const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
11
+
12
+ if (!fs.existsSync(app) || !fs.existsSync(miniJson)) {
13
+ return;
14
+ }
15
+
16
+ const appInfo = JSON.parse(fs.readFileSync(app, 'utf8'));
17
+ const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
18
+
19
+ const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
20
+ const androidAppTarget = appInfo?.client?.android.deploymentTarget;
21
+
22
+ if (
23
+ miniInfo?.dependencies?.['@momo-platform/momo-core']?.includes('optimize')
24
+ ) {
25
+ return;
26
+ }
27
+
28
+ if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
29
+ throw new Error(
30
+ `\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`
31
+ );
32
+ }
33
+
34
+ if (
35
+ miniInfo?.dependencies?.['@momo-platform/momo-core'] &&
36
+ miniInfo?.dependencies?.['@momo-platform/momo-core'] !== packageInfo?.version
37
+ ) {
38
+ throw new Error(
39
+ `\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`
7
40
  );
8
- const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
9
-
10
- const app = path.join(`${__dirname}/../../../`, 'app.json');
11
- const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
12
-
13
- if (!fs.existsSync(app) || !fs.existsSync(miniJson)) {
14
- return;
15
- }
16
-
17
- const appInfo = JSON.parse(fs.readFileSync(app, 'utf8'));
18
- const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
19
-
20
- const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
21
- const androidAppTarget = appInfo?.client?.android.deploymentTarget;
22
-
23
- if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
24
- console.error(
25
- `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`
26
- );
27
- throw new Error(
28
- `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`
29
- );
30
- }
31
-
32
- if (
33
- miniInfo?.dependencies?.['@momo-platform/momo-core'] &&
34
- miniInfo?.dependencies?.['@momo-platform/momo-core'] !==
35
- packageInfo?.version
36
- ) {
37
- console.error(
38
- `Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`
39
- );
40
- throw new Error(
41
- `Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`
42
- );
43
- }
44
- } catch (error) {
45
- console.error(`Installation failed: ${error.message}`);
46
- process.exit(0);
47
41
  }