@momo-kits/foundation 0.81.48 → 0.81.49

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/verify.js +37 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.48",
3
+ "version": "0.81.49",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
package/verify.js CHANGED
@@ -1,8 +1,41 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
- try {
5
- } catch (error) {
6
- console.error(`Installation failed: ${error.message}`);
7
- process.exit(1);
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}`
40
+ );
8
41
  }