@common-stack/mobile-stack-react 6.0.8-alpha.7 → 8.0.1-alpha.1
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/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{createClientContainer}from'./config/client.service.js';export{createReduxStore,epicMiddlewareFunc,persistConfig}from'./config/redux-config.js';export{UtilityClass,logger}from'./utils/index.js';export{loadContext}from'./load-context.mobile.js';export{default as history}from'./config/router-history.js';
|
|
1
|
+
export{createClientContainer}from'./config/client.service.js';export{createReduxStore,epicMiddlewareFunc,persistConfig}from'./config/redux-config.js';export{UtilityClass,logger}from'./utils/index.js';export{loadContext}from'./load-context.mobile.js';export{updateMobileDependencies}from'./tools/update-mobile-dependencies.js';export{default as history}from'./config/router-history.js';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import path from'path';import fs from'fs/promises';import pkg from'glob';import {promisify}from'util';// eslint-disable-next-line no-underscore-dangle
|
|
2
|
+
const { glob } = pkg;
|
|
3
|
+
const globPromise = promisify(glob);
|
|
4
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
5
|
+
// const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
6
|
+
// const monorepoRoot = path.resolve(process.cwd(), '..');
|
|
7
|
+
const monorepoRoot = path.resolve(process.cwd());
|
|
8
|
+
async function findPackageJsonFiles(rootFolderPath) {
|
|
9
|
+
try {
|
|
10
|
+
// Use glob pattern and the correct options
|
|
11
|
+
const files = await globPromise(`${rootFolderPath}/+(portable-devices)/**/mobile*/package.json`, // Glob pattern
|
|
12
|
+
{ ignore: '**/node_modules/**', nodir: true });
|
|
13
|
+
return files;
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
throw new Error(`Unable to scan directory: ${err}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Merge peer dependencies, removing '*' version and updating with mobile versions if applicable
|
|
20
|
+
function mergePeerDependencies(baseDeps, additionalDeps, excludedPrefixes = []) {
|
|
21
|
+
const filterDeps = (deps) => Object.entries(deps).reduce((acc, [key, value]) => {
|
|
22
|
+
// Skip dependencies with version "*" or ones that match excluded prefixes
|
|
23
|
+
if (value !== '*' && !excludedPrefixes.some((prefix) => key.startsWith(prefix))) {
|
|
24
|
+
acc[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return acc;
|
|
27
|
+
}, {});
|
|
28
|
+
const filteredBaseDeps = filterDeps(baseDeps);
|
|
29
|
+
const filteredAdditionalDeps = filterDeps(additionalDeps);
|
|
30
|
+
// Merge the filtered dependencies
|
|
31
|
+
return { ...filteredBaseDeps, ...filteredAdditionalDeps };
|
|
32
|
+
}
|
|
33
|
+
// Read and extract peer dependencies from a package's package.json
|
|
34
|
+
async function getPeerDependencies(pkg, rootPath) {
|
|
35
|
+
const modulePackageJsonFilePath = path.join(rootPath, `node_modules/${pkg}/package.json`);
|
|
36
|
+
const modulePackageJsonFileData = await fs.readFile(modulePackageJsonFilePath, 'utf-8');
|
|
37
|
+
const modulePackageJsonData = JSON.parse(modulePackageJsonFileData);
|
|
38
|
+
return modulePackageJsonData.peerDependencies || {};
|
|
39
|
+
}
|
|
40
|
+
// Function to get the peer dependencies of @common-stack/mobile-stack-react
|
|
41
|
+
async function getCommonStackPeerDependencies(config, rootPath) {
|
|
42
|
+
const mobileStackReactPackageName = config?.copyOperations?.packageName ?? '@common-stack/mobile-stack-react';
|
|
43
|
+
return getPeerDependencies(`${mobileStackReactPackageName}`, rootPath);
|
|
44
|
+
}
|
|
45
|
+
const updateMobileDependencies = async ({ packagePrefixesToExclude = [], rootPath = monorepoRoot, } = {}) => {
|
|
46
|
+
const rootFolderPath = rootPath || monorepoRoot;
|
|
47
|
+
const excludePrefixes = packagePrefixesToExclude || [];
|
|
48
|
+
const packageJsonFiles = (await findPackageJsonFiles(rootFolderPath));
|
|
49
|
+
packageJsonFiles.forEach(async (file) => {
|
|
50
|
+
const mobileConfigFilePath = path.join(path.dirname(file), './config.json');
|
|
51
|
+
const packageJson = JSON.parse(await fs.readFile(file, 'utf-8'));
|
|
52
|
+
const config = JSON.parse(await fs.readFile(mobileConfigFilePath, 'utf-8'));
|
|
53
|
+
let mergedPeerDependencies = {};
|
|
54
|
+
const mobileDependencies = packageJson.dependencies || {};
|
|
55
|
+
// Get peer dependencies from @common-stack/mobile-stack-react
|
|
56
|
+
const commonStackPeerDeps = await getCommonStackPeerDependencies(config, rootFolderPath);
|
|
57
|
+
mergedPeerDependencies = mergePeerDependencies(mergedPeerDependencies, commonStackPeerDeps, excludePrefixes);
|
|
58
|
+
// Loop over the modules from config.json and extract their peer dependencies
|
|
59
|
+
for (const pkg of [...config.modules, ...config.externalModulesDependencies]) {
|
|
60
|
+
if (excludePrefixes.some((prefix) => pkg.startsWith(prefix))) {
|
|
61
|
+
console.log(`Ignoring package: ${pkg} due to prefix filter.`);
|
|
62
|
+
// eslint-disable-next-line no-continue
|
|
63
|
+
continue; // Skip this package
|
|
64
|
+
}
|
|
65
|
+
const modulePeerDeps = await getPeerDependencies(pkg, rootFolderPath);
|
|
66
|
+
mergedPeerDependencies = mergePeerDependencies(modulePeerDeps, mergedPeerDependencies, excludePrefixes);
|
|
67
|
+
// Update mergedPeerDependencies with the version from the mobile package.json if present
|
|
68
|
+
if (mobileDependencies[pkg]) {
|
|
69
|
+
// If the module is in mobileDependencies, update the version in mergedPeerDependencies
|
|
70
|
+
mergedPeerDependencies[pkg] = mobileDependencies[pkg];
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
// If not in mobileDependencies, merge peer dependencies normally
|
|
74
|
+
mergedPeerDependencies = mergePeerDependencies(modulePeerDeps, mergedPeerDependencies, excludePrefixes);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
packageJson.dependencies = {
|
|
78
|
+
...packageJson.dependencies,
|
|
79
|
+
...mergedPeerDependencies,
|
|
80
|
+
};
|
|
81
|
+
// Save the updated mobile package.json
|
|
82
|
+
await fs.writeFile(file, JSON.stringify(packageJson, null, 2));
|
|
83
|
+
console.log('Updated mobile package.json with merged peer dependencies.');
|
|
84
|
+
});
|
|
85
|
+
};export{updateMobileDependencies};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/mobile-stack-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.1-alpha.1",
|
|
4
4
|
"description": "Client Module for mobile app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -32,12 +32,26 @@
|
|
|
32
32
|
"preset": "jest-expo"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@react-native-async-storage/async-storage": "~1.23.1"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@babel/core": "^7.25.2",
|
|
39
|
+
"@types/jest": "^29.5.12",
|
|
40
|
+
"@types/react": "~18.3.12",
|
|
41
|
+
"@types/react-dom": "~18.3.1",
|
|
42
|
+
"@types/react-test-renderer": "^18.3.0",
|
|
43
|
+
"jest": "^29.2.1",
|
|
44
|
+
"jest-expo": "~52.0.2",
|
|
45
|
+
"react-test-renderer": "18.3.1",
|
|
46
|
+
"typescript": "^5.3.3"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
35
49
|
"@apollo/client": "^3.9.0",
|
|
36
50
|
"@cdm-logger/client": "^9.0.3",
|
|
37
|
-
"@common-stack/client-core": "
|
|
38
|
-
"@common-stack/client-react": "
|
|
39
|
-
"@common-stack/components-pro": "
|
|
40
|
-
"@common-stack/core": "
|
|
51
|
+
"@common-stack/client-core": "8.0.1-alpha.0",
|
|
52
|
+
"@common-stack/client-react": "8.0.1-alpha.0",
|
|
53
|
+
"@common-stack/components-pro": "8.0.1-alpha.0",
|
|
54
|
+
"@common-stack/core": "8.0.1-alpha.0",
|
|
41
55
|
"@expo/vector-icons": "^14.0.2",
|
|
42
56
|
"@react-native-async-storage/async-storage": "~1.23.1",
|
|
43
57
|
"@react-native-community/datetimepicker": "8.2.0",
|
|
@@ -57,12 +71,14 @@
|
|
|
57
71
|
"envalid": "~7.2.2",
|
|
58
72
|
"expo": "~52.0.17",
|
|
59
73
|
"expo-apple-authentication": "~7.1.2",
|
|
74
|
+
"expo-asset": "~11.0.1",
|
|
60
75
|
"expo-auth-session": "^6.0.0",
|
|
61
76
|
"expo-blur": "~14.0.1",
|
|
62
77
|
"expo-build-properties": "~0.13.1",
|
|
63
78
|
"expo-constants": "~17.0.3",
|
|
64
79
|
"expo-dev-client": "~5.0.5",
|
|
65
80
|
"expo-device": "~7.0.1",
|
|
81
|
+
"expo-file-system": "~18.0.6",
|
|
66
82
|
"expo-font": "~13.0.1",
|
|
67
83
|
"expo-haptics": "~14.0.0",
|
|
68
84
|
"expo-image-picker": "~16.0.3",
|
|
@@ -70,7 +86,7 @@
|
|
|
70
86
|
"expo-localization": "~16.0.0",
|
|
71
87
|
"expo-notifications": "~0.29.11",
|
|
72
88
|
"expo-random": "~14.0.1",
|
|
73
|
-
"expo-router": "~4.0.
|
|
89
|
+
"expo-router": "~4.0.15",
|
|
74
90
|
"expo-secure-store": "~14.0.0",
|
|
75
91
|
"expo-splash-screen": "~0.29.15",
|
|
76
92
|
"expo-status-bar": "~2.0.0",
|
|
@@ -99,21 +115,15 @@
|
|
|
99
115
|
"react-native-dotenv": "^3.3.1",
|
|
100
116
|
"react-native-gesture-handler": "~2.20.2",
|
|
101
117
|
"react-native-get-random-values": "~1.11.0",
|
|
102
|
-
"react-native-keyboard-aware-scroll-view": "^0.9.3",
|
|
103
|
-
"react-native-keyboard-spacer": "^0.4.1",
|
|
104
|
-
"react-native-maps": "1.18.0",
|
|
105
118
|
"react-native-mime-types": "^2.3.0",
|
|
106
|
-
"react-native-modal": "^11.6.1",
|
|
107
119
|
"react-native-pager-view": "6.5.1",
|
|
108
120
|
"react-native-reanimated": "~3.16.1",
|
|
109
121
|
"react-native-safe-area-context": "4.12.0",
|
|
110
|
-
"react-native-screens": "~4.
|
|
122
|
+
"react-native-screens": "~4.4.0",
|
|
111
123
|
"react-native-svg": "15.8.0",
|
|
112
124
|
"react-native-tab-view": "^3.5.2",
|
|
113
|
-
"react-native-tags": "2.2.1",
|
|
114
125
|
"react-native-url-polyfill": "^2.0.0",
|
|
115
126
|
"react-native-web": "~0.19.13",
|
|
116
|
-
"react-native-web-maps": "~0.3.0",
|
|
117
127
|
"react-native-webview": "13.12.5",
|
|
118
128
|
"react-redux": "^9.1.1",
|
|
119
129
|
"redux-logger": "^3.0.6",
|
|
@@ -128,28 +138,11 @@
|
|
|
128
138
|
"text-encoding-polyfill": "^0.6.7",
|
|
129
139
|
"ts-invariant": "^0.10.3"
|
|
130
140
|
},
|
|
131
|
-
"devDependencies": {
|
|
132
|
-
"@babel/core": "^7.25.2",
|
|
133
|
-
"@types/jest": "^29.5.12",
|
|
134
|
-
"@types/react": "~18.3.12",
|
|
135
|
-
"@types/react-dom": "~18.3.1",
|
|
136
|
-
"@types/react-test-renderer": "^18.3.0",
|
|
137
|
-
"jest": "^29.2.1",
|
|
138
|
-
"jest-expo": "~52.0.2",
|
|
139
|
-
"react-test-renderer": "18.3.1",
|
|
140
|
-
"typescript": "^5.3.3"
|
|
141
|
-
},
|
|
142
|
-
"peerDependencies": {
|
|
143
|
-
"@apollo/client": ">=3.0.0",
|
|
144
|
-
"react": ">=18",
|
|
145
|
-
"react-dom": ">=18",
|
|
146
|
-
"redux": ">=5.0.1"
|
|
147
|
-
},
|
|
148
141
|
"publishConfig": {
|
|
149
142
|
"access": "public"
|
|
150
143
|
},
|
|
151
|
-
"gitHead": "6fb0dbf3e838663c8524b0746a11322b30490268",
|
|
152
144
|
"typescript": {
|
|
153
145
|
"definition": "lib/index.d.ts"
|
|
154
|
-
}
|
|
146
|
+
},
|
|
147
|
+
"gitHead": "dbcfef4c673be6402ba321de60b67a7c172ceccb"
|
|
155
148
|
}
|