@fto-consult/expo-ui 9.2.1 → 9.3.0

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.
@@ -0,0 +1,7 @@
1
+ module.exports = [
2
+ "@expo/webpack-config",
3
+ "babel-plugin-inline-dotenv",
4
+ "crypto-browserify",
5
+ "stream-browserify",
6
+ "vm"
7
+ ];
@@ -1,18 +1,18 @@
1
- {
2
- "build": {
3
- "development": {
4
- "developmentClient": true,
5
- "distribution": "internal"
6
- },
7
- "preview": {
8
- "distribution": "internal",
9
- "android": {
10
- "buildType": "apk"
11
- }
12
- },
13
- "production": {}
14
- },
15
- "submit": {
16
- "production": {}
17
- }
18
- }
1
+ {
2
+ "build": {
3
+ "development": {
4
+ "developmentClient": true,
5
+ "distribution": "internal"
6
+ },
7
+ "preview": {
8
+ "distribution": "internal",
9
+ "android": {
10
+ "buildType": "apk"
11
+ }
12
+ },
13
+ "production": {}
14
+ },
15
+ "submit": {
16
+ "production": {}
17
+ }
18
+ }
package/bin/create-app.js CHANGED
@@ -47,6 +47,7 @@ module.exports = function(appName,{projectRoot:root}){
47
47
  "build-web" : "npx expo export -p web",
48
48
  "build-android" : "npx eas build --platform android --profile preview",
49
49
  "build-ios" : "eas build --platform ios",
50
+ "upgrade" : "npx @fto-consult/expo-ui upgrade",
50
51
  "generate-getTable" : "npx @fto-consult/expo-ui generate-getTable",
51
52
  "update" : "npx @fto-consult/expo-ui update"
52
53
  },
package/bin/index.js CHANGED
@@ -45,5 +45,10 @@ program.command('generate-getTable')
45
45
  require("./install");
46
46
  });
47
47
 
48
+ program.command('upgrade')
49
+ .description('Met à jour l\'application à la version d\'expo supérieure à la version actuelle')
50
+ .action((src, options) => {
51
+ require("./upgrade");
52
+ });
48
53
 
49
54
  program.parse();
@@ -0,0 +1,19 @@
1
+ /****
2
+ upgrade to expo sdk version 51, @see : https://expo.dev/changelog/2024/05-07-sdk-51
3
+ */
4
+ module.exports = ({version,dependencies,packageObj,currentVersion,devDependencies,packageManager,depreciatedDependencies,projectRoot})=>{
5
+ const {exec} = require("@fto-consult/node-utils");
6
+ return new Promise((resolve,reject)=>{
7
+ console.log("Updating eas cli : npm i -g eas-cli");
8
+ const runExec = async (command)=>{
9
+ return await exec(command,{projectRoot});
10
+ };
11
+ runExec(`npm i -g eas-cli`).finally(()=>{
12
+ console.log("installing expo sdk 51 : npx expo install expo@^51.0.0 --fix");
13
+ runExec(`npx expo install expo@^51.0.0 --fix`).finally(()=>{
14
+ console.log("fix expo doctor : npx expo-doctor@latest");
15
+ runExec(`npx expo-doctor@latest`,{projectRoot}).then(resolve).catch(reject);
16
+ });
17
+ });
18
+ })
19
+ }
@@ -0,0 +1,64 @@
1
+ const path = require("path");
2
+ const fs = require("fs");
3
+ const {JSONManager,compareNPMVersions,writeFile} = require("@fto-consult/node-utils");
4
+ const dependencies = require(path.resolve(__dirname,"../create-app/dependencies"));
5
+ const devDependencies = require(path.resolve(__dirname,"../create-app/dependencies"));
6
+ const depreciatedDependencies = require(path.resolve(__dirname,"../create-app/depreciatedDependencies"));
7
+ const expoVersion = dependencies?.expo;
8
+ const projectRoot = process.cwd();
9
+ const projectRootPackagePath = path.resolve(projectRoot,"package.json");
10
+ const packageObj = fs.existsSync(projectRootPackagePath) ? require(projectRootPackagePath) : null;
11
+
12
+ const getSDKVersion = (version)=>{
13
+ const split = String(version).trim().replace("^","").replace("~","").replace(/\s/g, '').split(".")[0];
14
+ return String(parseInt(split)) == split ? split : null;
15
+ }
16
+
17
+ if(typeof expoVersion !="string" || !expoVersion){
18
+ console.log("Invalid expo version, cannot perform application upgrade");
19
+ } else {
20
+ if(!packageObj || typeof packageObj !=="object"){
21
+ console.log(`Invalid package json file at ${projectRoot}`);
22
+ } else {
23
+ const eVersion = packageObj?.dependencies?.expo;
24
+ if(!eVersion){
25
+ console.log(`Invalid expo sdk version for application located at ${projectRoot}`);
26
+ return;
27
+ }
28
+ if(compareNPMVersions(expoVersion,eVersion) < 1){
29
+ console.log(`App already to date, current version of expo sdk is ${eVersion}, expo sdk version on @fto-consult/expo-ui is ${expoVersion}`);
30
+ return;
31
+ }
32
+ const version = getSDKVersion(expoVersion);
33
+ if(!version){
34
+ console.log(`Invalid expo version number parsed from ${expoVersion}`);
35
+ return;
36
+ }
37
+ const versionPath = path.resolve(__dirname,`${version}.js`);
38
+ const currentVersion = getSDKVersion(eVersion) || eVersion;
39
+ if(!fs.existsSync(versionPath)){
40
+ console.log(`No expo ui upgrade file available to upgrade expo sdk version from ${currentVersion} to ${version}, version path : ${versionPath}`);
41
+ return;
42
+ }
43
+ const upgradeTool = require(`${versionPath}`);
44
+ if(typeof upgradeTool !== "function"){
45
+ console.log(`No defined function available to upgrade expo sdk version from ${currentVersion} to ${version}, version path : ${versionPath}`);
46
+ return;
47
+ }
48
+ console.log(`*********************************** UPGRADE Expo sdk version from ${currentVersion} to ${version} ****************************************`);
49
+ const packageManager = JSONManager(projectRootPackagePath);
50
+ (Array.isArray(depreciatedDependencies)? depreciatedDependencies : []).map(dep=>{
51
+ if(typeof dep =="string" && dep){
52
+ packageManager.remove(`dependencies.${dep}`);
53
+ packageManager.remove(`devDependencies.${dep}`);
54
+ }
55
+ });
56
+ packageManager.persist();
57
+ return Promise.resolve(upgradeTool({version,dependencies,packageObj,packageManager,currentVersion,depreciatedDependencies,devDependencies,projectRoot})).catch((e)=>{
58
+ console.log(e,`An error occurs during expo skd version upgrage from ${currentVersion} to ${version}`);
59
+ writeFile(projectRootPackagePath,JSON.stringify(packageObj,null,2));
60
+ }).then(()=>{
61
+ console.log(`expo sdk version ${currentVersion} updated successfull to ${version}`);
62
+ });
63
+ }
64
+ }
package/expo-ui.json CHANGED
@@ -1,11 +1,11 @@
1
- {
2
- "name": "@fto-consult/expo-ui",
3
- "version": "6.44.4",
4
- "description": "Bibliothèque de composants UI Expo,react-native",
5
- "bin": {
6
- "expo-ui": "./bin/index.js"
7
- },
8
- "author": "Boris Fouomene",
9
- "license": "ISC",
10
- "homepage": "https://github.com/borispipo/expo-ui#readme"
1
+ {
2
+ "name": "@fto-consult/expo-ui",
3
+ "version": "6.44.4",
4
+ "description": "Bibliothèque de composants UI Expo,react-native",
5
+ "bin": {
6
+ "expo-ui": "./bin/index.js"
7
+ },
8
+ "author": "Boris Fouomene",
9
+ "license": "ISC",
10
+ "homepage": "https://github.com/borispipo/expo-ui#readme"
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "9.2.1",
3
+ "version": "9.3.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "react-native-paper-doc": "https://github.com/callstack/react-native-paper/tree/main/docs/docs/guides",
6
6
  "scripts": {
@@ -13,6 +13,7 @@
13
13
  "start-p": "npm run start-d",
14
14
  "start-no-minify": "npx expo start --no-dev --minify",
15
15
  "start-no-dev": "npx expo start --no-dev --minify",
16
+ "upgrade": "node ./bin/upgrade",
16
17
  "expo-start-client": "npx expo start --dev --no-minify --dev-client",
17
18
  "generate-jsonconfig": "node ./bin/generate-jsonconfig.js",
18
19
  "start-m": "npx expo start - c--dev--no -minify",
@@ -68,6 +69,7 @@
68
69
  "@emotion/react": "^11.11.4",
69
70
  "@faker-js/faker": "^8.0.2",
70
71
  "@fto-consult/common": "^4.53.0",
72
+ "@fto-consult/node-utils": "^1.9.3",
71
73
  "apexcharts": "^3.49.0",
72
74
  "file-saver": "^2.0.5",
73
75
  "google-libphonenumber": "^3.2.34",