@fto-consult/expo-ui 6.66.5 → 6.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 CHANGED
@@ -14,34 +14,7 @@ module.exports = function(api,opts) {
14
14
  }
15
15
  /*** par défaut, les variables d'environnements sont stockés dans le fichier .env situé à la racine du projet, référencée par la prop base */
16
16
  const alias = require("./babel.config.alias")(options);
17
- const $eelectron = path.resolve(__dirname,"electron");
18
- const packageRootPath = path.resolve(process.cwd(),"package.json");
19
- const packageJSON = fs.existsSync(packageRootPath) && require(`${packageRootPath}`) || {};
20
- const envObj = require("./parse-env")();
21
- const writeFilePath = path.resolve($eelectron,"utils","writeFile.js");
22
- if($eelectron && fs.existsSync($eelectron)){
23
- if(fs.existsSync(writeFilePath)){
24
- const writeFile = require(`${writeFilePath}`);
25
- //generate getTable.js file
26
- const tableDataPath = envObj.TABLES_DATA_PATH && path.resolve(String(envObj.TABLES_DATA_PATH)) || packageJSON?.tablesDataPath && path.resolve(String(packageJSON.tablesDataPath)) || null;
27
- if(tableDataPath && fs.existsSync(tableDataPath)){
28
- const getTableJSContent = generateTableOrStructDataStr(tableDataPath);
29
- if(getTableJSContent){
30
- writeFile(path.resolve(tableDataPath,"getTable.js"),getTableJSContent);
31
- }
32
- }
33
-
34
- //generate getStructData.js file
35
- const structsDataPath = envObj.STRUCTS_DATA_PATH && path.resolve(String(envObj.STRUCTS_DATA_PATH)) || packageJSON?.structsDataPath && path.resolve(String(packageJSON.structsDataPath)) || null;
36
- if(structsDataPath && fs.existsSync(structsDataPath)){
37
- const getStructDataJSContent = generateTableOrStructDataStr(structsDataPath);
38
- if(getStructDataJSContent){
39
- writeFile(path.resolve(structsDataPath,"getStructData.js"),getStructDataJSContent);
40
- }
41
- }
42
- }
43
-
44
- }
17
+ require("@fto-consult/expo-ui/bin/generate-tables")();//génère les tables des bases de données
45
18
  return {
46
19
  presets: [
47
20
  ['babel-preset-expo']
@@ -57,43 +30,3 @@ module.exports = function(api,opts) {
57
30
  };
58
31
 
59
32
 
60
- /****
61
- retourne la chaine de caractère liée à la fonction getTable.js ou getStructData.js
62
- @param {string} tableDataPath, le chemin de la tableDataPath
63
- @return {string}, la chaine de caractère à enregistrer dans la fonction getTable.js ou getStructData.js
64
- */
65
- const generateTableOrStructDataStr = (tableDataPath)=>{
66
- if(typeof tableDataPath !== 'string' || !tableDataPath.trim()) return null;
67
- tableDataPath = tableDataPath.trim();
68
- const fs = require("fs"), path = require("path");
69
- if(fs.lstatSync(tableDataPath).isDirectory()){
70
- let getTableJSContent = '';
71
- const tables = fs.readdirSync(tableDataPath);
72
- if(Array.isArray(tables)){
73
- tables.map((table,i)=>{
74
- table = table.trim();
75
- const tableName = table.toUpperCase();
76
- const tablePath = path.join(tableDataPath, table);
77
- const indexTablePath = path.join(tablePath,"index.js");
78
- const stat = fs.lstatSync(tablePath);
79
- if(!stat.isDirectory() || !fs.existsSync(indexTablePath)) return;
80
- const indexContent = fs.readFileSync(indexTablePath,'utf8') ;
81
- if(!indexContent || (!indexContent.includes("table") && !indexContent.includes("tableName"))){
82
- return;
83
- }
84
- getTableJSContent+=`\t\tif(tableName === "${tableName}"){return require("./${table}").default;}\n`;
85
- });
86
- //on génère le fichier getTable des tables data de l'application
87
- if(getTableJSContent){
88
- return (`
89
- export default function(tableName){
90
- \tif(!tableName || typeof tableName !=="string") return null;
91
- \ttableName = tableName.toUpperCase().trim();
92
- ${getTableJSContent}\treturn null;
93
- }
94
- `);
95
- }
96
- }
97
- }
98
- return null;
99
- }
@@ -0,0 +1,69 @@
1
+
2
+ const path = require("path"), fs = require("fs");
3
+ const {writeFile} = require("./utils");
4
+
5
+ /*** permet de générer les tables des bases de données de l'application
6
+ */
7
+ module.exports = ()=>{
8
+ const projectRoot = path.resolve(process.cwd());
9
+ const packageRootPath = path.resolve(projectRoot,"package.json");
10
+ const packageJSON = fs.existsSync(packageRootPath) && require(`${packageRootPath}`) || {};
11
+ if(!packageJSON) return;
12
+
13
+ //generate getTable.js file
14
+ const tableDataPath = packageJSON?.tablesDataPath && path.resolve(String(packageJSON.tablesDataPath)) || null;
15
+ if(tableDataPath && fs.existsSync(tableDataPath)){
16
+ const getTableJSContent = generateTableOrStructDataStr(tableDataPath);
17
+ if(getTableJSContent){
18
+ writeFile(path.resolve(tableDataPath,"getTable.js"),getTableJSContent);
19
+ }
20
+ }
21
+
22
+ //generate getStructData.js file
23
+ const structsDataPath = packageJSON?.structsDataPath && path.resolve(String(packageJSON.structsDataPath)) || null;
24
+ if(structsDataPath && fs.existsSync(structsDataPath)){
25
+ const getStructDataJSContent = generateTableOrStructDataStr(structsDataPath);
26
+ if(getStructDataJSContent){
27
+ writeFile(path.resolve(structsDataPath,"getStructData.js"),getStructDataJSContent);
28
+ }
29
+ }
30
+ }
31
+ /****
32
+ retourne la chaine de caractère liée à la fonction getTable.js ou getStructData.js
33
+ @param {string} tableDataPath, le chemin de la tableDataPath
34
+ @return {string}, la chaine de caractère à enregistrer dans la fonction getTable.js ou getStructData.js
35
+ */
36
+ const generateTableOrStructDataStr = (tableDataPath)=>{
37
+ if(typeof tableDataPath !== 'string' || !tableDataPath.trim()) return null;
38
+ tableDataPath = tableDataPath.trim();
39
+ if(fs.lstatSync(tableDataPath).isDirectory()){
40
+ let getTableJSContent = '';
41
+ const tables = fs.readdirSync(tableDataPath);
42
+ if(Array.isArray(tables)){
43
+ tables.map((table,i)=>{
44
+ table = table.trim();
45
+ const tableName = table.toUpperCase();
46
+ const tablePath = path.join(tableDataPath, table);
47
+ const indexTablePath = path.join(tablePath,"index.js");
48
+ const stat = fs.lstatSync(tablePath);
49
+ if(!stat.isDirectory() || !fs.existsSync(indexTablePath)) return;
50
+ const indexContent = fs.readFileSync(indexTablePath,'utf8') ;
51
+ if(!indexContent || (!indexContent.includes("table") && !indexContent.includes("tableName"))){
52
+ return;
53
+ }
54
+ getTableJSContent+=`\t\tif(tableName === "${tableName}"){return require("./${table}").default;}\n`;
55
+ });
56
+ //on génère le fichier getTable des tables data de l'application
57
+ if(getTableJSContent){
58
+ return (`
59
+ export default function(tableName){
60
+ \tif(!tableName || typeof tableName !=="string") return null;
61
+ \ttableName = tableName.toUpperCase().trim();
62
+ ${getTableJSContent}\treturn null;
63
+ }
64
+ `);
65
+ }
66
+ }
67
+ }
68
+ return null;
69
+ }
package/bin/index.js CHANGED
@@ -15,9 +15,10 @@ const supportedScript = {
15
15
  "start" : true,//start electron
16
16
  "build" : true, //script pour faire un build,
17
17
  "package" : true, ///script pour le packagin de l'application
18
+ "generate-getTable" : true,/// script pour la génération de la fonction getTable des tables de l'application
18
19
  [createAppScript] : true,//les script de création de l'application
19
20
  }
20
- const {createDir,writeFile,electronDir,copy,exec,throwError} = require("./utils");
21
+ const {createDir,electronDir,copy,exec,throwError} = require("./utils");
21
22
  const path= require("path");
22
23
  const fs = require("fs");
23
24
  const dir = path.resolve(__dirname);
@@ -124,6 +125,9 @@ if(parsedArgs.electron){
124
125
  break;
125
126
  case "build":
126
127
  break;
128
+ case "generate-getTable" :
129
+ require("./generate-tables")();
130
+ break;
127
131
  default :
128
132
  if(!fs.existsSync(packagePath)){
129
133
  throwError("package.json file does not exist in "+projectRoot+". please make jure that your have running package script in expo root application");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "6.66.5",
3
+ "version": "6.67.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "main": "main",
6
6
  "scripts": {
package/webpack.config.js CHANGED
@@ -63,7 +63,6 @@ module.exports = async function(env, argv,opts) {
63
63
  config.performance.maxAssetSize = typeof config.performance.maxAssetSize =='number'? config.performance.maxAssetSize : 512000;
64
64
  config.devtool = (config.mode === 'development') ? 'inline-source-map' : false;
65
65
  require("./compiler.config.js")({config,...opts});
66
- require("./copy-env-file")();
67
66
  const extensions = config.resolve.extensions;
68
67
  if(isElectron){
69
68
  mainExtensions.map((ex)=>{
@@ -1,184 +0,0 @@
1
- // shim for using process in browser
2
- var process = module.exports = {};
3
-
4
- // cached from whatever global is present so that test runners that stub it
5
- // don't break things. But we need to wrap it in a try catch in case it is
6
- // wrapped in strict mode code which doesn't define any globals. It's inside a
7
- // function because try/catches deoptimize in certain engines.
8
-
9
- var cachedSetTimeout;
10
- var cachedClearTimeout;
11
-
12
- function defaultSetTimout() {
13
- throw new Error('setTimeout has not been defined');
14
- }
15
- function defaultClearTimeout () {
16
- throw new Error('clearTimeout has not been defined');
17
- }
18
- (function () {
19
- try {
20
- if (typeof setTimeout === 'function') {
21
- cachedSetTimeout = setTimeout;
22
- } else {
23
- cachedSetTimeout = defaultSetTimout;
24
- }
25
- } catch (e) {
26
- cachedSetTimeout = defaultSetTimout;
27
- }
28
- try {
29
- if (typeof clearTimeout === 'function') {
30
- cachedClearTimeout = clearTimeout;
31
- } else {
32
- cachedClearTimeout = defaultClearTimeout;
33
- }
34
- } catch (e) {
35
- cachedClearTimeout = defaultClearTimeout;
36
- }
37
- } ())
38
- function runTimeout(fun) {
39
- if (cachedSetTimeout === setTimeout) {
40
- //normal enviroments in sane situations
41
- return setTimeout(fun, 0);
42
- }
43
- // if setTimeout wasn't available but was latter defined
44
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
45
- cachedSetTimeout = setTimeout;
46
- return setTimeout(fun, 0);
47
- }
48
- try {
49
- // when when somebody has screwed with setTimeout but no I.E. maddness
50
- return cachedSetTimeout(fun, 0);
51
- } catch(e){
52
- try {
53
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
54
- return cachedSetTimeout.call(null, fun, 0);
55
- } catch(e){
56
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
57
- return cachedSetTimeout.call(this, fun, 0);
58
- }
59
- }
60
-
61
-
62
- }
63
- function runClearTimeout(marker) {
64
- if (cachedClearTimeout === clearTimeout) {
65
- //normal enviroments in sane situations
66
- return clearTimeout(marker);
67
- }
68
- // if clearTimeout wasn't available but was latter defined
69
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
70
- cachedClearTimeout = clearTimeout;
71
- return clearTimeout(marker);
72
- }
73
- try {
74
- // when when somebody has screwed with setTimeout but no I.E. maddness
75
- return cachedClearTimeout(marker);
76
- } catch (e){
77
- try {
78
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
79
- return cachedClearTimeout.call(null, marker);
80
- } catch (e){
81
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
82
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
83
- return cachedClearTimeout.call(this, marker);
84
- }
85
- }
86
-
87
-
88
-
89
- }
90
- var queue = [];
91
- var draining = false;
92
- var currentQueue;
93
- var queueIndex = -1;
94
-
95
- function cleanUpNextTick() {
96
- if (!draining || !currentQueue) {
97
- return;
98
- }
99
- draining = false;
100
- if (currentQueue.length) {
101
- queue = currentQueue.concat(queue);
102
- } else {
103
- queueIndex = -1;
104
- }
105
- if (queue.length) {
106
- drainQueue();
107
- }
108
- }
109
-
110
- function drainQueue() {
111
- if (draining) {
112
- return;
113
- }
114
- var timeout = runTimeout(cleanUpNextTick);
115
- draining = true;
116
-
117
- var len = queue.length;
118
- while(len) {
119
- currentQueue = queue;
120
- queue = [];
121
- while (++queueIndex < len) {
122
- if (currentQueue) {
123
- currentQueue[queueIndex].run();
124
- }
125
- }
126
- queueIndex = -1;
127
- len = queue.length;
128
- }
129
- currentQueue = null;
130
- draining = false;
131
- runClearTimeout(timeout);
132
- }
133
-
134
- process.nextTick = function (fun) {
135
- var args = new Array(arguments.length - 1);
136
- if (arguments.length > 1) {
137
- for (var i = 1; i < arguments.length; i++) {
138
- args[i - 1] = arguments[i];
139
- }
140
- }
141
- queue.push(new Item(fun, args));
142
- if (queue.length === 1 && !draining) {
143
- runTimeout(drainQueue);
144
- }
145
- };
146
-
147
- // v8 likes predictible objects
148
- function Item(fun, array) {
149
- this.fun = fun;
150
- this.array = array;
151
- }
152
- Item.prototype.run = function () {
153
- this.fun.apply(null, this.array);
154
- };
155
- process.title = 'browser';
156
- process.browser = true;
157
- process.env = {};
158
- process.argv = [];
159
- process.version = ''; // empty string to avoid regexp issues
160
- process.versions = {};
161
-
162
- function noop() {}
163
-
164
- process.on = noop;
165
- process.addListener = noop;
166
- process.once = noop;
167
- process.off = noop;
168
- process.removeListener = noop;
169
- process.removeAllListeners = noop;
170
- process.emit = noop;
171
- process.prependListener = noop;
172
- process.prependOnceListener = noop;
173
-
174
- process.listeners = function (name) { return [] }
175
-
176
- process.binding = function (name) {
177
- throw new Error('process.binding is not supported');
178
- };
179
-
180
- process.cwd = function () { return '/' };
181
- process.chdir = function (dir) {
182
- throw new Error('process.chdir is not supported');
183
- };
184
- process.umask = function() { return 0; };