@carbonorm/carbonreact 3.2.11 → 3.2.13
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.
|
@@ -36,28 +36,70 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
var _this = this;
|
|
39
|
+
var c = require('ansi-colors');
|
|
40
|
+
// Create an object to store the parsed arguments
|
|
41
|
+
var args = {
|
|
42
|
+
inputDir: './logs/rest/',
|
|
43
|
+
outputDir: './logs/rest/',
|
|
44
|
+
verbose: false,
|
|
45
|
+
};
|
|
46
|
+
// parse command line arguments
|
|
47
|
+
for (var i = 2; i < process.argv.length; i++) {
|
|
48
|
+
var arg = process.argv[i];
|
|
49
|
+
switch (arg) {
|
|
50
|
+
case '--input':
|
|
51
|
+
case '-i':
|
|
52
|
+
args.inputDir = process.argv[i + 1];
|
|
53
|
+
i++; // Skip the next argument since it's the value
|
|
54
|
+
break;
|
|
55
|
+
case '--output':
|
|
56
|
+
case '-o':
|
|
57
|
+
args.outputDir = process.argv[i + 1];
|
|
58
|
+
i++; // Skip the next argument since it's the value
|
|
59
|
+
break;
|
|
60
|
+
case '--verbose':
|
|
61
|
+
case '-v':
|
|
62
|
+
args.verbose = true;
|
|
63
|
+
break;
|
|
64
|
+
case '--help':
|
|
65
|
+
case '-h':
|
|
66
|
+
console.log(c.cyan('Usage:'));
|
|
67
|
+
console.log(c.cyan('--input or -i: Input directory'));
|
|
68
|
+
console.log(c.cyan('--output or -o: Output directory'));
|
|
69
|
+
console.log(c.cyan('--verbose or -v: Enable verbose mode'));
|
|
70
|
+
process.exit(0);
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
console.error("Unknown argument: ".concat(arg));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// print parsed arguments if verbose mode is enabled
|
|
78
|
+
if (args.verbose) {
|
|
79
|
+
console.log(c.cyan('Parsed arguments:'));
|
|
80
|
+
console.log(c.cyan(JSON.stringify(args, null, 4)));
|
|
81
|
+
}
|
|
39
82
|
var util = require('util');
|
|
40
83
|
var exec = util.promisify(require('child_process').exec);
|
|
41
84
|
var fs = require('fs');
|
|
42
85
|
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
43
|
-
var
|
|
86
|
+
var jsonValidSqlFiles, validExternalRequests, ManifestFile, stdout, revision;
|
|
44
87
|
return __generator(this, function (_a) {
|
|
45
88
|
switch (_a.label) {
|
|
46
89
|
case 0:
|
|
47
|
-
|
|
48
|
-
all = [], validExternalRequests = [];
|
|
90
|
+
jsonValidSqlFiles = [], validExternalRequests = [];
|
|
49
91
|
ManifestFile = 'validSQL.json';
|
|
50
|
-
fs.readdirSync(
|
|
92
|
+
fs.readdirSync(args.inputDir).forEach(function (file) {
|
|
51
93
|
if (file === ManifestFile) {
|
|
52
94
|
return;
|
|
53
95
|
}
|
|
54
|
-
var resource = require("".concat(
|
|
55
|
-
|
|
96
|
+
var resource = require("".concat(args.outputDir).concat(file));
|
|
97
|
+
jsonValidSqlFiles.push(resource);
|
|
56
98
|
});
|
|
57
|
-
|
|
99
|
+
jsonValidSqlFiles.forEach(function (apiRequest) {
|
|
58
100
|
Object.keys(apiRequest).forEach(function (testName) {
|
|
59
|
-
Object.keys(apiRequest[testName]).forEach(function (
|
|
60
|
-
apiRequest[testName][
|
|
101
|
+
Object.keys(apiRequest[testName]).forEach(function (restCallInfo) {
|
|
102
|
+
apiRequest[testName][restCallInfo].forEach(function (singleSqlInfoObject) {
|
|
61
103
|
if (true === singleSqlInfoObject['CarbonPHP\\Restful\\RestSettings::$externalRestfulRequestsAPI']) {
|
|
62
104
|
validExternalRequests.push(singleSqlInfoObject);
|
|
63
105
|
}
|
|
@@ -69,9 +111,9 @@ var fs = require('fs');
|
|
|
69
111
|
case 1:
|
|
70
112
|
stdout = (_a.sent()).stdout;
|
|
71
113
|
revision = stdout.trim();
|
|
72
|
-
fs.writeFileSync(
|
|
114
|
+
fs.writeFileSync(args.outputDir + ManifestFile, JSON.stringify({
|
|
73
115
|
"revision": revision,
|
|
74
|
-
"
|
|
116
|
+
"validSQL": validExternalRequests
|
|
75
117
|
}, undefined, 4));
|
|
76
118
|
return [2 /*return*/];
|
|
77
119
|
}
|
package/compileValidSQL.tsx
CHANGED
|
@@ -1,4 +1,55 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const c = require('ansi-colors');
|
|
4
|
+
|
|
5
|
+
// Create an object to store the parsed arguments
|
|
6
|
+
const args = {
|
|
7
|
+
inputDir: './logs/rest/',
|
|
8
|
+
outputDir: './logs/rest/',
|
|
9
|
+
verbose: false,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// parse command line arguments
|
|
14
|
+
for (let i = 2; i < process.argv.length; i++) {
|
|
15
|
+
|
|
16
|
+
const arg = process.argv[i];
|
|
17
|
+
|
|
18
|
+
switch (arg) {
|
|
19
|
+
case '--input':
|
|
20
|
+
case '-i':
|
|
21
|
+
args.inputDir = process.argv[i + 1];
|
|
22
|
+
i++; // Skip the next argument since it's the value
|
|
23
|
+
break;
|
|
24
|
+
case '--output':
|
|
25
|
+
case '-o':
|
|
26
|
+
args.outputDir = process.argv[i + 1];
|
|
27
|
+
i++; // Skip the next argument since it's the value
|
|
28
|
+
break;
|
|
29
|
+
case '--verbose':
|
|
30
|
+
case '-v':
|
|
31
|
+
args.verbose = true;
|
|
32
|
+
break;
|
|
33
|
+
case '--help':
|
|
34
|
+
case '-h':
|
|
35
|
+
console.log(c.cyan('Usage:'));
|
|
36
|
+
console.log(c.cyan('--input or -i: Input directory'));
|
|
37
|
+
console.log(c.cyan('--output or -o: Output directory'));
|
|
38
|
+
console.log(c.cyan('--verbose or -v: Enable verbose mode'));
|
|
39
|
+
process.exit(0);
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
console.error(`Unknown argument: ${arg}`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// print parsed arguments if verbose mode is enabled
|
|
48
|
+
if (args.verbose) {
|
|
49
|
+
console.log(c.cyan('Parsed arguments:'));
|
|
50
|
+
console.log(c.cyan(JSON.stringify(args, null, 4)));
|
|
51
|
+
}
|
|
52
|
+
|
|
2
53
|
interface iApiResponseLine {
|
|
3
54
|
"method": "GET" | "PUT" | "POST" | "DELETE",
|
|
4
55
|
"table": string,
|
|
@@ -25,15 +76,14 @@ const fs = require('fs');
|
|
|
25
76
|
|
|
26
77
|
(async () => {
|
|
27
78
|
|
|
28
|
-
const theDirectory = './logs/rest/'; // or whatever directory you want to read
|
|
29
79
|
|
|
30
|
-
let
|
|
80
|
+
let jsonValidSqlFiles: any[] = [],
|
|
31
81
|
validExternalRequests: iApiResponseLine[] = [];
|
|
32
82
|
|
|
33
83
|
|
|
34
84
|
const ManifestFile = 'validSQL.json';
|
|
35
85
|
|
|
36
|
-
fs.readdirSync(
|
|
86
|
+
fs.readdirSync(args.inputDir).forEach((file) => {
|
|
37
87
|
|
|
38
88
|
if (file === ManifestFile) {
|
|
39
89
|
|
|
@@ -41,19 +91,19 @@ const fs = require('fs');
|
|
|
41
91
|
|
|
42
92
|
}
|
|
43
93
|
|
|
44
|
-
const resource = require(`${
|
|
94
|
+
const resource = require(`${args.outputDir}${file}`);
|
|
45
95
|
|
|
46
|
-
|
|
96
|
+
jsonValidSqlFiles.push(resource);
|
|
47
97
|
|
|
48
98
|
});
|
|
49
99
|
|
|
50
|
-
|
|
100
|
+
jsonValidSqlFiles.forEach(apiRequest => {
|
|
51
101
|
|
|
52
102
|
Object.keys(apiRequest).forEach(testName => {
|
|
53
103
|
|
|
54
|
-
Object.keys(apiRequest[testName]).forEach(
|
|
104
|
+
Object.keys(apiRequest[testName]).forEach(restCallInfo => {
|
|
55
105
|
|
|
56
|
-
apiRequest[testName][
|
|
106
|
+
apiRequest[testName][restCallInfo].forEach(singleSqlInfoObject => {
|
|
57
107
|
|
|
58
108
|
if (true === singleSqlInfoObject['CarbonPHP\\Restful\\RestSettings::$externalRestfulRequestsAPI']) {
|
|
59
109
|
|
|
@@ -69,15 +119,14 @@ const fs = require('fs');
|
|
|
69
119
|
|
|
70
120
|
});
|
|
71
121
|
|
|
72
|
-
|
|
73
122
|
// @link https://stackoverflow.com/questions/12941083/execute-and-get-the-output-of-a-shell-command-in-node-js
|
|
74
123
|
const {stdout} = await exec('git rev-parse HEAD')
|
|
75
124
|
|
|
76
125
|
const revision = stdout.trim();
|
|
77
126
|
|
|
78
|
-
fs.writeFileSync(
|
|
127
|
+
fs.writeFileSync(args.outputDir + ManifestFile, JSON.stringify({
|
|
79
128
|
"revision": revision,
|
|
80
|
-
"
|
|
129
|
+
"validSQL": validExternalRequests
|
|
81
130
|
}, undefined, 4));
|
|
82
131
|
|
|
83
132
|
})()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbonorm/carbonreact",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.13",
|
|
4
4
|
"browser": "dist/index.umd.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
|
12
12
|
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
|
13
13
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
14
|
+
"ansi-colors": "^4.1.3",
|
|
14
15
|
"axios": "^1.4.0",
|
|
15
16
|
"bootstrap": "^5.3.1",
|
|
16
17
|
"classnames": "^2.3.2",
|
|
@@ -60,16 +61,16 @@
|
|
|
60
61
|
"rollup-watch": "^4.3.1",
|
|
61
62
|
"sass": "^1.64.1",
|
|
62
63
|
"scss": "^0.2.4",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
64
|
+
"ts-node": "^10.9.1",
|
|
65
|
+
"typescript": "^5.1.6"
|
|
65
66
|
},
|
|
66
67
|
"bin": {
|
|
67
|
-
"compileValidSQL": "./compileValidSQL.
|
|
68
|
+
"compileValidSQL": "./compileValidSQL.cjs"
|
|
68
69
|
},
|
|
69
70
|
"scripts": {
|
|
70
71
|
"prepublishOnly": "npm run build",
|
|
71
72
|
"c6": "wget https://raw.githubusercontent.com/RichardTMiles/CarbonPHP/lts/view/C6.tsx -O src/variables/C6.tsx",
|
|
72
|
-
"build": "rm -rf ./dist/ && npm run build:css && npm run build:index && rollup -c && tsc compileValidSQL.tsx",
|
|
73
|
+
"build": "rm -rf ./dist/ && npm run build:css && npm run build:index && rollup -c && tsc compileValidSQL.tsx && mv compileValidSQL.js compileValidSQL.cjs",
|
|
73
74
|
"dev": "rollup -c -w",
|
|
74
75
|
"test": "node test/test.js",
|
|
75
76
|
"pretest": "npm run build",
|