@fto-consult/expo-ui 8.66.0 → 8.67.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.
- package/babel.config.js +1 -0
- package/bin/generate-jsonconfig.js +86 -0
- package/package.json +1 -1
package/babel.config.js
CHANGED
@@ -0,0 +1,86 @@
|
|
1
|
+
/***
|
2
|
+
génère le fichier jsconfig.json de vs code pour notemment spécifier les emplacements des alias et autres
|
3
|
+
*/
|
4
|
+
const {writeFile,JSONFileManager,extendObj,isNonNullString} = require("@fto-consult/node-utils");
|
5
|
+
const fs = require("fs");
|
6
|
+
const path = require("path");
|
7
|
+
|
8
|
+
/****
|
9
|
+
génière les alias dans le fichier jsconfig.json
|
10
|
+
@param {
|
11
|
+
projectRoot {string}, le projectRoot
|
12
|
+
compilerOptions {obj}, les options de compilerOptions,
|
13
|
+
alias | paths {object}, les alias de l'application
|
14
|
+
}
|
15
|
+
*/
|
16
|
+
module.exports = function generateJSONConfig(opts){
|
17
|
+
opts = Object.assign({},opts);
|
18
|
+
const alias = extendObj({},opts.alias,opts.paths);
|
19
|
+
const projectRoot = opts.projectRoot && typeof opts.projectRoot ==="string" && fs.existsSync(path.resolve(opts.projectRoot)) && path.resolve(opts.projectRoot) || process.cwd();
|
20
|
+
const jsconfigPath = path.resolve(projectRoot,"jsconfig.json");
|
21
|
+
if(!fs.existsSync(jsconfigPath)){
|
22
|
+
try {
|
23
|
+
writeFile(jsconfigPath,`{}`);
|
24
|
+
} catch(e){
|
25
|
+
console.log("generatingn jsconfig.json file on path",jsconfigPath);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
if(!fs.existsSync(jsconfigPath)) {
|
29
|
+
console.log("unable to generate jsconfig.json on path "+jsconfigPath);
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
const paths = {};
|
33
|
+
const JManager = JSONFileManager(jsconfigPath);
|
34
|
+
if(JManager.hasPackage){
|
35
|
+
const baseUrl = path.resolve(projectRoot);
|
36
|
+
let hasFoundAlias = false;
|
37
|
+
for(let i in alias){
|
38
|
+
const alia = alias[i];
|
39
|
+
const p = Array.isArray(alia) && alia.length && alia || isNonNullString(alia) && alia.split(",") || undefined;
|
40
|
+
let aliasIndex = String(i);
|
41
|
+
if(Array.isArray(p)){
|
42
|
+
const rAlias = [];
|
43
|
+
p.map((a)=>{
|
44
|
+
if(!isNonNullString(a)) return;
|
45
|
+
const aa = path.resolve(a);
|
46
|
+
if(!fs.existsSync(aa)) return;
|
47
|
+
const lstat = fs.lstatSync(aa);
|
48
|
+
let np = path.relative(baseUrl,aa).trim().split("\\").join("/");
|
49
|
+
if(lstat.isDirectory() && !lstat.isFile()){
|
50
|
+
np = np.trim().rtrim("/*").rtrim("/").rtrim("\\").trim();
|
51
|
+
if(!np){
|
52
|
+
np = "./*"
|
53
|
+
} else if(!np.endsWith("/*")){
|
54
|
+
np+="/*";
|
55
|
+
}
|
56
|
+
aliasIndex = aliasIndex.rtrim("/*").rtrim("/").rtrim("\\")+"/*";
|
57
|
+
}
|
58
|
+
if(np){
|
59
|
+
rAlias.push(np);
|
60
|
+
}
|
61
|
+
});
|
62
|
+
if(rAlias.length){
|
63
|
+
paths[aliasIndex] = rAlias;
|
64
|
+
hasFoundAlias = true;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
const excludeA = JManager.get("exclude");
|
69
|
+
const jEx = Array.isArray(excludeA)? excludeA : [];
|
70
|
+
["node_modules", "build", "dist","out","web-build"].map((a)=>{
|
71
|
+
if(!jEx.includes(a)){
|
72
|
+
jEx.push(a);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
JManager.set("compilerOptions",extendObj(true,{},JManager.get("compilerOptions"),{
|
76
|
+
paths,
|
77
|
+
baseUrl : "./",
|
78
|
+
},opts.compilerOptions));
|
79
|
+
JManager.set("exclude",jEx);
|
80
|
+
JManager.persist();
|
81
|
+
if(!hasFoundAlias){
|
82
|
+
console.log("not valid alias to update in jsonconfig.json on path "+jsconfigPath);
|
83
|
+
}
|
84
|
+
console.log("jsconfig.json successfull created on path "+jsconfigPath);
|
85
|
+
}
|
86
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fto-consult/expo-ui",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.67.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": {
|