@shoutem/ui 8.1.3-rc.2 → 8.1.3-rc.4

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,10 +1,12 @@
1
1
  {
2
2
  "name": "@shoutem/ui",
3
- "version": "8.1.3-rc.2",
3
+ "version": "8.1.3-rc.4",
4
4
  "description": "Styleable set of components for React Native applications",
5
+ "type": "module",
5
6
  "scripts": {
6
7
  "lint": "eslint .",
7
8
  "lint-fix": "eslint . --fix",
9
+ "preinstall": "node ./scripts/remove-mobile-only-dependencies",
8
10
  "postinstall": "node ./scripts/add-native-deps",
9
11
  "release": "npm publish --access public --tag latest",
10
12
  "release-rc": "npm publish --access public --tag rc",
@@ -86,6 +88,9 @@
86
88
  "react-native-svg",
87
89
  "react-native-webview"
88
90
  ],
91
+ "mobileOnlyDependencies": [
92
+ "react-native-haptic-feedback"
93
+ ],
89
94
  "homepage": "http://shoutem.github.io/docs/ui-toolkit/introduction",
90
95
  "bugs": {
91
96
  "url": "https://github.com/shoutem/ui/issues"
@@ -1,4 +1,4 @@
1
- const fs = require('fs-extra');
1
+ import fs from 'fs-extra';
2
2
 
3
3
  const ROOT_PACKAGE_JSON_PATH = '../../../package.json';
4
4
  const UI_PACKAGE_JSON_PATH = './package.json';
@@ -0,0 +1,47 @@
1
+ import fs from 'fs';
2
+
3
+ const UI_PACKAGE_JSON_PATH = './package.json';
4
+
5
+ function removeMobileOnlyDependencies() {
6
+ try {
7
+ const uiPackageJsonRawData = fs.readFileSync(UI_PACKAGE_JSON_PATH);
8
+ const uiPackageJson = JSON.parse(uiPackageJsonRawData);
9
+
10
+ const uiDependencies = { ...uiPackageJson.dependencies };
11
+ const { mobileOnlyDependencies } = uiPackageJson;
12
+
13
+ mobileOnlyDependencies.forEach(dep => delete uiDependencies[dep]);
14
+
15
+ const newPackageJson = {
16
+ ...uiPackageJson,
17
+ dependencies: uiDependencies,
18
+ };
19
+
20
+ fs.writeFileSync(
21
+ UI_PACKAGE_JSON_PATH,
22
+ JSON.stringify(newPackageJson, null, 2),
23
+ );
24
+ // eslint-disable-next-line no-console
25
+ console.log(
26
+ '[@shoutem/ui] - removed mobile only dependencies, updated @shoutem/ui package.json',
27
+ );
28
+ } catch (e) {
29
+ // eslint-disable-next-line no-console
30
+ console.log(
31
+ `[@shoutem/ui] - error removing mobile only dependencies\n${e.message}`,
32
+ );
33
+ }
34
+ }
35
+
36
+ const ROOT_CONFIG_JSON_PATH = '../../../package.json';
37
+ const rootConfigJsonRawData = fs.readFileSync(ROOT_CONFIG_JSON_PATH);
38
+ const rootConfigJson = JSON.parse(rootConfigJsonRawData);
39
+
40
+ if (rootConfigJson.platform === 'web') {
41
+ // eslint-disable-next-line no-console
42
+ console.log(
43
+ '[@shoutem/ui] - removing mobile only dependencies from @shoutem/ui package.json',
44
+ );
45
+
46
+ removeMobileOnlyDependencies();
47
+ }