@carbonorm/carbonreact 3.3.8 → 3.3.10

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.
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ "use strict";
2
3
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
4
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
5
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
36
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
37
  }
37
38
  };
38
- var _this = this;
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ var fs_1 = require("fs");
39
41
  var c = require('ansi-colors');
40
42
  // Create an object to store the parsed arguments
41
43
  var args = {
@@ -49,13 +51,11 @@ for (var i = 2; i < process.argv.length; i++) {
49
51
  switch (arg) {
50
52
  case '--input':
51
53
  case '-i':
52
- args.inputDir = process.argv[i + 1];
53
- i++; // Skip the next argument since it's the value
54
+ args.inputDir = process.argv[++i];
54
55
  break;
55
56
  case '--output':
56
57
  case '-o':
57
- args.outputDir = process.argv[i + 1];
58
- i++; // Skip the next argument since it's the value
58
+ args.outputDir = process.argv[++i];
59
59
  break;
60
60
  case '--verbose':
61
61
  case '-v':
@@ -82,7 +82,7 @@ if (args.verbose) {
82
82
  var util = require('util');
83
83
  var exec = util.promisify(require('child_process').exec);
84
84
  var fs = require('fs');
85
- (function () { return __awaiter(_this, void 0, void 0, function () {
85
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
86
86
  var jsonValidSqlFiles, validExternalRequests, ManifestFile, stdout, revision;
87
87
  return __generator(this, function (_a) {
88
88
  switch (_a.label) {
@@ -93,8 +93,13 @@ var fs = require('fs');
93
93
  if (file === ManifestFile) {
94
94
  return;
95
95
  }
96
- var resource = require("".concat(args.outputDir).concat(file));
97
- jsonValidSqlFiles.push(resource);
96
+ var resource = (0, fs_1.readFileSync)("".concat(args.inputDir).concat(file), 'utf8');
97
+ var json = JSON.parse(resource);
98
+ if (json === undefined) {
99
+ console.error("Failed to parse ".concat(file, " as JSON"));
100
+ return;
101
+ }
102
+ jsonValidSqlFiles.push(json);
98
103
  });
99
104
  jsonValidSqlFiles.forEach(function (apiRequest) {
100
105
  Object.keys(apiRequest).forEach(function (testName) {
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import {readFile, readFileSync} from "fs";
4
+
3
5
  const c = require('ansi-colors');
4
6
 
5
7
  // Create an object to store the parsed arguments
6
- const args = {
8
+ let args = {
7
9
  inputDir: './logs/rest/',
8
10
  outputDir: './logs/rest/',
9
11
  verbose: false,
@@ -18,13 +20,11 @@ for (let i = 2; i < process.argv.length; i++) {
18
20
  switch (arg) {
19
21
  case '--input':
20
22
  case '-i':
21
- args.inputDir = process.argv[i + 1];
22
- i++; // Skip the next argument since it's the value
23
+ args.inputDir = process.argv[++i];
23
24
  break;
24
25
  case '--output':
25
26
  case '-o':
26
- args.outputDir = process.argv[i + 1];
27
- i++; // Skip the next argument since it's the value
27
+ args.outputDir = process.argv[++i];
28
28
  break;
29
29
  case '--verbose':
30
30
  case '-v':
@@ -91,9 +91,19 @@ const fs = require('fs');
91
91
 
92
92
  }
93
93
 
94
- const resource = require(`${args.outputDir}${file}`);
94
+ const resource = readFileSync(`${args.inputDir}${file}`, 'utf8');
95
+
96
+ const json = JSON.parse(resource)
97
+
98
+ if (json === undefined) {
99
+
100
+ console.error(`Failed to parse ${file} as JSON`);
101
+
102
+ return;
103
+
104
+ }
95
105
 
96
- jsonValidSqlFiles.push(resource);
106
+ jsonValidSqlFiles.push(json);
97
107
 
98
108
  });
99
109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonorm/carbonreact",
3
- "version": "3.3.8",
3
+ "version": "3.3.10",
4
4
  "browser": "dist/index.umd.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "main": "dist/index.cjs.js",