@fto-consult/expo-ui 5.6.1 → 5.6.3

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/expo-ui-path.js CHANGED
@@ -17,6 +17,16 @@ module.exports = function (){
17
17
  const sep = path.sep;
18
18
  const rootPath = process.cwd();
19
19
  const src = path.resolve(rootPath,"src");
20
+ try {
21
+ const envPath = path.resolve(rootPath,".env");
22
+ const envObj = fs.existsSync(envPath)? require("./parse-env")(fs.readFileSync(envPath,'utf8')) : {};
23
+ const euPathm = typeof envObj.EXPO_UI_PATH =="string" && envObj.EXPO_UI_PATH && path.resolve(envObj.EXPO_UI_PATH)||'';
24
+ const eu = euPathm && fs.existsSync(euPathm)? euPathm : null;
25
+ console.log(eu," is eu path and env object is",envObj," is env objecct feeeeee");
26
+ if(eu && fs.existsSync(path.resolve(eu,"src")) && fs.existsSync(path.resolve(eu,"webpack.config.js"))){
27
+ return path.resolve(eu,suffix).replace(sep,(sep+sep));
28
+ }
29
+ } catch{}
20
30
  const expoUi = path.resolve(rootPath,"expo-ui");
21
31
  if(fs.existsSync(src) && fs.existsSync(expoUi) && fs.existsSync(path.resolve(expoUi,"webpack.config.js"))){
22
32
  return path.resolve(expoUi,suffix).replace(sep,(sep+sep));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "5.6.1",
3
+ "version": "5.6.3",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/parse-env.js ADDED
@@ -0,0 +1,41 @@
1
+ const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg
2
+
3
+ // Parser src into an Object
4
+ module.exports = function parse (src) {
5
+ if(typeof src !=='string' || !src) return {};
6
+ const obj = {}
7
+
8
+ // Convert buffer to string
9
+ let lines = src.toString()
10
+
11
+ // Convert line breaks to same format
12
+ lines = lines.replace(/\r\n?/mg, '\n')
13
+
14
+ let match
15
+ while ((match = LINE.exec(lines)) != null) {
16
+ const key = match[1]
17
+
18
+ // Default undefined or null to empty string
19
+ let value = (match[2] || '')
20
+
21
+ // Remove whitespace
22
+ value = value.trim()
23
+
24
+ // Check if double quoted
25
+ const maybeQuote = value[0]
26
+
27
+ // Remove surrounding quotes
28
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2')
29
+
30
+ // Expand newlines if double quoted
31
+ if (maybeQuote === '"') {
32
+ value = value.replace(/\\n/g, '\n')
33
+ value = value.replace(/\\r/g, '\r')
34
+ }
35
+
36
+ // Add to object
37
+ obj[key] = value
38
+ }
39
+
40
+ return obj
41
+ }