@superblocksteam/util 1.10.0 → 1.12.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/.prettierrc +17 -0
- package/LICENSE.txt +87 -0
- package/dist/component-configs.js +47 -12
- package/dist/data-types.js +2 -2
- package/dist/generate-component-types.js +1 -2
- package/dist/identifiers.js +3 -4
- package/dist/index.js +25 -12
- package/dist/login.js +38 -7
- package/dist/resource-configs.js +46 -11
- package/dist/types.d.ts +0 -1
- package/dist/unreachable.js +1 -2
- package/dist/validation.js +6 -5
- package/eslint.config.js +73 -0
- package/package.json +22 -15
- package/src/component-configs.ts +11 -11
- package/src/data-types.ts +1 -1
- package/src/file-uploader.ts +1 -1
- package/src/generate-component-types.ts +1 -1
- package/src/login.ts +1 -1
- package/src/resource-configs.ts +11 -10
- package/src/types.ts +2 -2
- package/tsconfig.json +0 -1
- package/tsconfig.tsbuildinfo +1 -0
- package/.eslintrc.json +0 -51
package/.prettierrc
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"printWidth": 80,
|
|
3
|
+
"tabWidth": 2,
|
|
4
|
+
"useTabs": false,
|
|
5
|
+
"semi": true,
|
|
6
|
+
"singleQuote": false,
|
|
7
|
+
"trailingComma": "all",
|
|
8
|
+
"arrowParens": "always",
|
|
9
|
+
"overrides": [
|
|
10
|
+
{
|
|
11
|
+
"files": ["*.ts", "*.tsx", "*.mts"],
|
|
12
|
+
"options": {
|
|
13
|
+
"parser": "typescript"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Superblocks Community Software License
|
|
2
|
+
|
|
3
|
+
This Superblocks Community License Agreement (the “Agreement”) sets forth the terms on which DayZero
|
|
4
|
+
Software, Inc. d/b/a Superblocks (“Superblocks”) makes available certain software made available by Superblocks
|
|
5
|
+
under this Agreement (the “Software”). BY INSTALLING, DOWNLOADING, ACCESSING, USING OR
|
|
6
|
+
DISTRIBUTING ANY OF THE SOFTWARE, YOU AGREE TO THE TERMS AND CONDITIONS OF THIS
|
|
7
|
+
AGREEMENT.IF YOU DO NOT AGREE TO SUCH TERMS AND CONDITIONS, YOU MUST NOT USE THE
|
|
8
|
+
SOFTWARE. IF YOU ARE RECEIVING THE SOFTWARE ON BEHALF OF A LEGAL ENTITY, YOU
|
|
9
|
+
REPRESENT AND WARRANT THAT YOU HAVE THE ACTUAL AUTHORITY TO AGREE TO THE
|
|
10
|
+
TERMS AND CONDITIONS OF THIS AGREEMENT ON BEHALF OF SUCH ENTITY. “Licensee” means you,
|
|
11
|
+
an individual, or the entity on whose behalf you are receiving the Software.
|
|
12
|
+
|
|
13
|
+
1. LICENSE GRANT AND CONDITIONS.
|
|
14
|
+
|
|
15
|
+
1.1 License. Subject to the terms and conditions of this Agreement, Superblocks hereby grants to Licensee a
|
|
16
|
+
non-exclusive, royalty-free, worldwide, non-transferable, non-sublicenseable license during the term of this
|
|
17
|
+
Agreement to: (a) use the Software; (b) prepare modifications and derivative works of the Software; (c)
|
|
18
|
+
distribute the Software (including without limitation in source code or object code form); and (d) reproduce
|
|
19
|
+
copies of the Software (the “License”). Licensee is not granted the right to, and Licensee shall not, exercise the
|
|
20
|
+
License for an Excluded Purpose. For purposes of this Agreement, “Excluded Purpose” means making
|
|
21
|
+
available any software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other similar online
|
|
22
|
+
service that competes with Superblocks’ products or services.
|
|
23
|
+
|
|
24
|
+
1.2 Conditions. In consideration of the License, Licensee’s distribution of the Software is subject to the
|
|
25
|
+
following conditions:
|
|
26
|
+
|
|
27
|
+
a. Licensee must cause any Software modified by Licensee to carry prominent notices stating that Licensee
|
|
28
|
+
modified the Software.
|
|
29
|
+
b. On each Software copy, Licensee shall reproduce and not remove or alter all Superblocks or third party
|
|
30
|
+
copyright or other proprietary notices contained in the Software, and Licensee must provide the notice
|
|
31
|
+
below with each copy.
|
|
32
|
+
|
|
33
|
+
“This software is made available by DayZero Software, Inc. d/b/a Superblocks, under the terms of the
|
|
34
|
+
Superblocks Community License Agreement. © 2022 DayZero Software, Inc.”
|
|
35
|
+
|
|
36
|
+
1.3 Licensee Modifications. Licensee may add its own copyright notices to modifications made by Licensee
|
|
37
|
+
and may provide additional or different license terms and conditions for use, reproduction, or distribution of
|
|
38
|
+
Licensee’s modifications. While redistributing the Software or modifications thereof, Licensee may choose to
|
|
39
|
+
offer, for a fee or free of charge, support, warranty, indemnity, or other obligations. Licensee, and not
|
|
40
|
+
Superblocks, will be responsible for any such obligations.
|
|
41
|
+
|
|
42
|
+
1.4 No Sublicensing. The License does not include the right to sublicense the Software, however, each recipient
|
|
43
|
+
to which Licensee provides the Software may exercise the Licenses so long as such recipient agrees to the terms
|
|
44
|
+
and conditions of this Agreement.
|
|
45
|
+
|
|
46
|
+
2. TERM AND TERMINATION. This Agreement will continue unless and until earlier terminated as set forth
|
|
47
|
+
herein. If Licensee breaches any of its conditions or obligations under this Agreement, this Agreement will
|
|
48
|
+
terminate automatically and the License will terminate automatically and permanently.
|
|
49
|
+
|
|
50
|
+
3. INTELLECTUAL PROPERTY. As between the parties, Superblocks will retain all right, title, and interest in
|
|
51
|
+
the Software, and all intellectual property rights therein. Superblocks hereby reserves all rights not expressly
|
|
52
|
+
granted to Licensee in this Agreement. Superblocks hereby reserves all rights in its trademarks and service
|
|
53
|
+
marks, and no licenses therein are granted in this Agreement.
|
|
54
|
+
|
|
55
|
+
4. DISCLAIMER. SUPERBLOCKS HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND
|
|
56
|
+
CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY
|
|
57
|
+
DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
|
|
58
|
+
PURPOSE, WITH RESPECT TO THE SOFTWARE.
|
|
59
|
+
|
|
60
|
+
5. LIMITATION OF LIABILITY. SUPERBLOCKS WILL NOT BE LIABLE FOR ANY DAMAGES OF
|
|
61
|
+
ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL,
|
|
62
|
+
SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY
|
|
63
|
+
THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL APPLY TO
|
|
64
|
+
THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
65
|
+
|
|
66
|
+
6. GENERAL.
|
|
67
|
+
|
|
68
|
+
6.1 Governing Law. This Agreement will be governed by and interpreted in accordance with the laws of the
|
|
69
|
+
state of California, without reference to its conflict of laws principles. If Licensee is located within the United
|
|
70
|
+
States, all disputes arising out of this Agreement are subject to the exclusive jurisdiction of courts located in San
|
|
71
|
+
Mateo County, California. USA. If Licensee is located outside of the United States, any dispute, controversy or
|
|
72
|
+
claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in
|
|
73
|
+
accordance with the JAMS International Arbitration Rules. The tribunal will consist of one neutral arbitrator.
|
|
74
|
+
The place of arbitration will be Palo Alto, California. The language to be used in the arbitral proceedings will be
|
|
75
|
+
English. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction
|
|
76
|
+
thereof.
|
|
77
|
+
|
|
78
|
+
6.2. Assignment. Licensee may not assign its rights under this Agreement to any third party. Superblocks may
|
|
79
|
+
freely assign its rights under this Agreement to any third party.
|
|
80
|
+
|
|
81
|
+
6.3. Other. This Agreement is the entire agreement between the parties regarding the subject matter hereof.
|
|
82
|
+
No amendment or modification of this Agreement will be valid or binding upon the parties unless made in
|
|
83
|
+
writing and signed by the duly authorized representatives of both parties. In the event that any provision,
|
|
84
|
+
including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and
|
|
85
|
+
all licenses and rights granted hereunder will immediately terminate. Waiver by Superblocks of a breach of any
|
|
86
|
+
provision of this Agreement or the failure by Superblocks to exercise any right hereunder will not be construed
|
|
87
|
+
as a waiver of any subsequent breach of that right or as a waiver of any other right.
|
|
@@ -1,12 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getContentType =
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const node_os_1 =
|
|
7
|
-
const node_path_1 =
|
|
8
|
-
const fs =
|
|
9
|
-
const mimeTypes =
|
|
39
|
+
exports.getContentType = void 0;
|
|
40
|
+
exports.getComponentConfigs = getComponentConfigs;
|
|
41
|
+
const node_child_process_1 = require("node:child_process");
|
|
42
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
43
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
44
|
+
const fs = __importStar(require("fs-extra"));
|
|
45
|
+
const mimeTypes = __importStar(require("mime-types"));
|
|
10
46
|
const constants_1 = require("./constants");
|
|
11
47
|
const generate_component_types_1 = require("./generate-component-types");
|
|
12
48
|
const validation_1 = require("./validation");
|
|
@@ -15,7 +51,7 @@ const compileTypeScript = (inputFilePath, outputDir) => {
|
|
|
15
51
|
try {
|
|
16
52
|
const tscPath = require.resolve("typescript/bin/tsc");
|
|
17
53
|
if (tscPath) {
|
|
18
|
-
(0,
|
|
54
|
+
(0, node_child_process_1.execFile)("node", [
|
|
19
55
|
tscPath,
|
|
20
56
|
node_path_1.default.resolve(inputFilePath),
|
|
21
57
|
"--outDir",
|
|
@@ -49,7 +85,7 @@ const compileTypeScript = (inputFilePath, outputDir) => {
|
|
|
49
85
|
});
|
|
50
86
|
}
|
|
51
87
|
}
|
|
52
|
-
catch
|
|
88
|
+
catch {
|
|
53
89
|
reject(new Error("Could not find TypeScript, please install it globally (npm install -g typescript)"));
|
|
54
90
|
}
|
|
55
91
|
});
|
|
@@ -83,7 +119,7 @@ async function getComponentConfigs(generateTypesFiles) {
|
|
|
83
119
|
console.log(`Found component in ${absPath}`);
|
|
84
120
|
return { ccpath, config };
|
|
85
121
|
}
|
|
86
|
-
catch
|
|
122
|
+
catch {
|
|
87
123
|
// Noop because there is a fallback
|
|
88
124
|
}
|
|
89
125
|
try {
|
|
@@ -100,7 +136,7 @@ async function getComponentConfigs(generateTypesFiles) {
|
|
|
100
136
|
await fs.ensureDir(outputDirectory);
|
|
101
137
|
await compileTypeScript(fileName, outputDirectory);
|
|
102
138
|
console.log(`Typescript compiled to ${ccpath}`);
|
|
103
|
-
const config = (await Promise.resolve(`${outputDirectory + "/config.js"}`).then(s =>
|
|
139
|
+
const config = (await Promise.resolve(`${outputDirectory + "/config.js"}`).then(s => __importStar(require(s)))).default;
|
|
104
140
|
const isValid = (0, validation_1.validateCustomComponents)(config);
|
|
105
141
|
if (!isValid.valid) {
|
|
106
142
|
// Not throwing because we don't need a stack trace here
|
|
@@ -135,7 +171,6 @@ async function getComponentConfigs(generateTypesFiles) {
|
|
|
135
171
|
hasError,
|
|
136
172
|
};
|
|
137
173
|
}
|
|
138
|
-
exports.getComponentConfigs = getComponentConfigs;
|
|
139
174
|
const getContentType = (filename) => {
|
|
140
175
|
const mimeType = mimeTypes.lookup(filename);
|
|
141
176
|
if (!mimeType) {
|
package/dist/data-types.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.dataTypeDefinions = exports.supportedDataTypes = void 0;
|
|
4
|
+
exports.isValidDataType = isValidDataType;
|
|
4
5
|
exports.supportedDataTypes = [
|
|
5
6
|
"string",
|
|
6
7
|
"number",
|
|
@@ -28,4 +29,3 @@ exports.dataTypeDefinions = {
|
|
|
28
29
|
function isValidDataType(input) {
|
|
29
30
|
return Object.prototype.hasOwnProperty.call(exports.dataTypeDefinions, input);
|
|
30
31
|
}
|
|
31
|
-
exports.isValidDataType = isValidDataType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateComponentTypesFile =
|
|
3
|
+
exports.generateComponentTypesFile = generateComponentTypesFile;
|
|
4
4
|
const data_types_1 = require("./data-types");
|
|
5
5
|
const indent = (str, spaces) => {
|
|
6
6
|
const spacesString = " ".repeat(spaces);
|
|
@@ -43,4 +43,3 @@ ${eventHandlers.length === 0
|
|
|
43
43
|
.join("")}};
|
|
44
44
|
`;
|
|
45
45
|
}
|
|
46
|
-
exports.generateComponentTypesFile = generateComponentTypesFile;
|
package/dist/identifiers.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.suggestIdentifier = suggestIdentifier;
|
|
4
|
+
exports.isValidIdentifier = isValidIdentifier;
|
|
5
|
+
exports.isReservedPropertyName = isReservedPropertyName;
|
|
4
6
|
// convert a string to upper camel case, e.g. "123 & this is my component, foo-bar" -> "123ThisIsMyComponentFooBar"
|
|
5
7
|
function wordsToUpperCamelCase(str) {
|
|
6
8
|
return str
|
|
@@ -30,12 +32,10 @@ function suggestIdentifier(label, capitalizeFirst = false) {
|
|
|
30
32
|
return upperCamelCase[0].toLowerCase() + upperCamelCase.slice(1);
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
exports.suggestIdentifier = suggestIdentifier;
|
|
34
35
|
const IdentifierRegex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
35
36
|
function isValidIdentifier(str) {
|
|
36
37
|
return IdentifierRegex.test(str);
|
|
37
38
|
}
|
|
38
|
-
exports.isValidIdentifier = isValidIdentifier;
|
|
39
39
|
const reservedPropertyNames = new Set([
|
|
40
40
|
"ENTITY_TYPE",
|
|
41
41
|
"bindingPaths",
|
|
@@ -65,4 +65,3 @@ function isReservedPropertyName(str) {
|
|
|
65
65
|
// also treat any property name starting with "default_" as reserved since we use this prefix for default properties
|
|
66
66
|
str.startsWith("default_"));
|
|
67
67
|
}
|
|
68
|
-
exports.isReservedPropertyName = isReservedPropertyName;
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
tslib_1.__exportStar(require("./unreachable"), exports);
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./component-configs"), exports);
|
|
19
|
+
__exportStar(require("./events"), exports);
|
|
20
|
+
__exportStar(require("./file-uploader"), exports);
|
|
21
|
+
__exportStar(require("./login"), exports);
|
|
22
|
+
__exportStar(require("./resource-configs"), exports);
|
|
23
|
+
__exportStar(require("./data-types"), exports);
|
|
24
|
+
__exportStar(require("./types"), exports);
|
|
25
|
+
__exportStar(require("./identifiers"), exports);
|
|
26
|
+
__exportStar(require("./localGitRepoState"), exports);
|
|
27
|
+
__exportStar(require("./unreachable"), exports);
|
package/dist/login.js
CHANGED
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
36
|
+
exports.saveApiToken = saveApiToken;
|
|
37
|
+
exports.getLocalTokenWithUrlIfExists = getLocalTokenWithUrlIfExists;
|
|
38
|
+
exports.getLocalTokenWithUrl = getLocalTokenWithUrl;
|
|
5
39
|
const node_os_1 = require("node:os");
|
|
6
40
|
const node_path_1 = require("node:path");
|
|
7
|
-
const fs =
|
|
41
|
+
const fs = __importStar(require("fs-extra"));
|
|
8
42
|
const constants_1 = require("./constants");
|
|
9
43
|
async function saveApiToken(superblocksBaseUrl, token) {
|
|
10
44
|
try {
|
|
@@ -27,7 +61,6 @@ async function saveApiToken(superblocksBaseUrl, token) {
|
|
|
27
61
|
throw new constants_1.FileAccessError("Could not save token");
|
|
28
62
|
}
|
|
29
63
|
}
|
|
30
|
-
exports.saveApiToken = saveApiToken;
|
|
31
64
|
async function getLocalTokenWithUrlIfExists() {
|
|
32
65
|
try {
|
|
33
66
|
return await getLocalTokenWithUrl();
|
|
@@ -36,10 +69,9 @@ async function getLocalTokenWithUrlIfExists() {
|
|
|
36
69
|
return undefined;
|
|
37
70
|
}
|
|
38
71
|
}
|
|
39
|
-
exports.getLocalTokenWithUrlIfExists = getLocalTokenWithUrlIfExists;
|
|
40
72
|
async function getLocalTokenWithUrl() {
|
|
41
73
|
try {
|
|
42
|
-
const tokenConfig = await fs.readJSON((0, node_path_1.join)((0, node_os_1.homedir)(), constants_1.TOKEN_CONFIG_PATH));
|
|
74
|
+
const tokenConfig = await fs.readJSON(process.env.SUPERBLOCKS_AUTH_FILE || (0, node_path_1.join)((0, node_os_1.homedir)(), constants_1.TOKEN_CONFIG_PATH));
|
|
43
75
|
if (tokenConfig.token) {
|
|
44
76
|
// user logged in
|
|
45
77
|
return {
|
|
@@ -58,4 +90,3 @@ async function getLocalTokenWithUrl() {
|
|
|
58
90
|
throw new Error("No local API key found");
|
|
59
91
|
}
|
|
60
92
|
}
|
|
61
|
-
exports.getLocalTokenWithUrl = getLocalTokenWithUrl;
|
package/dist/resource-configs.js
CHANGED
|
@@ -1,9 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
39
|
+
exports.getSuperblocksMonorepoConfigJson = getSuperblocksMonorepoConfigJson;
|
|
40
|
+
exports.getSuperblocksApplicationConfigJson = getSuperblocksApplicationConfigJson;
|
|
41
|
+
exports.getSuperblocksApplicationConfigIfExists = getSuperblocksApplicationConfigIfExists;
|
|
42
|
+
exports.getSuperblocksBackendConfigIfExists = getSuperblocksBackendConfigIfExists;
|
|
43
|
+
exports.getSuperblocksBackendConfigJson = getSuperblocksBackendConfigJson;
|
|
44
|
+
exports.getSuperblocksResourceConfigIfExists = getSuperblocksResourceConfigIfExists;
|
|
45
|
+
const path_1 = __importDefault(require("path"));
|
|
46
|
+
const fs = __importStar(require("fs-extra"));
|
|
7
47
|
const constants_1 = require("./constants");
|
|
8
48
|
/**
|
|
9
49
|
* Get the Superblocks config file from the current directory (and optionally) hierarchy
|
|
@@ -35,12 +75,12 @@ async function getSuperblocksMonorepoConfigJson(checkParentDir = false, pathPref
|
|
|
35
75
|
catch {
|
|
36
76
|
if (!checkParentDir) {
|
|
37
77
|
// no superblocks config file found
|
|
38
|
-
throw new Error("No Superblocks config file found in current directory " +
|
|
78
|
+
throw new Error("No Superblocks config file found in current directory " +
|
|
79
|
+
attemptedPath);
|
|
39
80
|
}
|
|
40
81
|
return getSuperblocksMonorepoConfigJson(true, "../" + pathPrefix);
|
|
41
82
|
}
|
|
42
83
|
}
|
|
43
|
-
exports.getSuperblocksMonorepoConfigJson = getSuperblocksMonorepoConfigJson;
|
|
44
84
|
async function getSuperblocksApplicationConfigJson(applicationPath) {
|
|
45
85
|
let superblocksConfig;
|
|
46
86
|
try {
|
|
@@ -58,7 +98,6 @@ async function getSuperblocksApplicationConfigJson(applicationPath) {
|
|
|
58
98
|
}
|
|
59
99
|
return superblocksConfig;
|
|
60
100
|
}
|
|
61
|
-
exports.getSuperblocksApplicationConfigJson = getSuperblocksApplicationConfigJson;
|
|
62
101
|
async function getSuperblocksApplicationConfigIfExists(applicationPath) {
|
|
63
102
|
let superblocksConfig;
|
|
64
103
|
try {
|
|
@@ -75,7 +114,6 @@ async function getSuperblocksApplicationConfigIfExists(applicationPath) {
|
|
|
75
114
|
}
|
|
76
115
|
return superblocksConfig;
|
|
77
116
|
}
|
|
78
|
-
exports.getSuperblocksApplicationConfigIfExists = getSuperblocksApplicationConfigIfExists;
|
|
79
117
|
async function getSuperblocksBackendConfigIfExists(backendPath) {
|
|
80
118
|
let superblocksConfig;
|
|
81
119
|
try {
|
|
@@ -92,7 +130,6 @@ async function getSuperblocksBackendConfigIfExists(backendPath) {
|
|
|
92
130
|
}
|
|
93
131
|
return superblocksConfig;
|
|
94
132
|
}
|
|
95
|
-
exports.getSuperblocksBackendConfigIfExists = getSuperblocksBackendConfigIfExists;
|
|
96
133
|
async function getSuperblocksBackendConfigJson() {
|
|
97
134
|
let superblocksConfig;
|
|
98
135
|
try {
|
|
@@ -107,7 +144,6 @@ async function getSuperblocksBackendConfigJson() {
|
|
|
107
144
|
}
|
|
108
145
|
return superblocksConfig;
|
|
109
146
|
}
|
|
110
|
-
exports.getSuperblocksBackendConfigJson = getSuperblocksBackendConfigJson;
|
|
111
147
|
async function getSuperblocksResourceConfigIfExists() {
|
|
112
148
|
let config;
|
|
113
149
|
try {
|
|
@@ -124,4 +160,3 @@ async function getSuperblocksResourceConfigIfExists() {
|
|
|
124
160
|
}
|
|
125
161
|
return config;
|
|
126
162
|
}
|
|
127
|
-
exports.getSuperblocksResourceConfigIfExists = getSuperblocksResourceConfigIfExists;
|
package/dist/types.d.ts
CHANGED
package/dist/unreachable.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unreachable =
|
|
3
|
+
exports.unreachable = unreachable;
|
|
4
4
|
function unreachable(value) {
|
|
5
5
|
throw new TypeError("Encountered impossible value: " + JSON.stringify(value));
|
|
6
6
|
}
|
|
7
|
-
exports.unreachable = unreachable;
|
package/dist/validation.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateCustomComponents =
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const better_ajv_errors_1 = tslib_1.__importDefault(require("better-ajv-errors"));
|
|
6
|
+
exports.validateCustomComponents = validateCustomComponents;
|
|
7
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
8
|
+
const better_ajv_errors_1 = __importDefault(require("better-ajv-errors"));
|
|
7
9
|
const identifiers_1 = require("./identifiers");
|
|
8
10
|
const ajv = new ajv_1.default();
|
|
9
11
|
ajv.addKeyword({
|
|
@@ -147,4 +149,3 @@ function validateCustomComponents(data) {
|
|
|
147
149
|
}
|
|
148
150
|
return { valid: true };
|
|
149
151
|
}
|
|
150
|
-
exports.validateCustomComponents = validateCustomComponents;
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const js = require("@eslint/js");
|
|
2
|
+
const importPlugin = require("eslint-plugin-import");
|
|
3
|
+
const prettier = require("eslint-plugin-prettier");
|
|
4
|
+
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended");
|
|
5
|
+
const unicorn = require("eslint-plugin-unicorn");
|
|
6
|
+
const globals = require("globals");
|
|
7
|
+
const tseslint = require("typescript-eslint");
|
|
8
|
+
|
|
9
|
+
const config = [
|
|
10
|
+
{
|
|
11
|
+
ignores: [
|
|
12
|
+
"**/public/*",
|
|
13
|
+
"**/build/*",
|
|
14
|
+
"**/node_modules/*",
|
|
15
|
+
"**/dist/*",
|
|
16
|
+
"**/assets/",
|
|
17
|
+
"**/.*",
|
|
18
|
+
"eslint.config.js",
|
|
19
|
+
"tsup.config.ts",
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
js.configs.recommended,
|
|
23
|
+
...tseslint.configs.recommended,
|
|
24
|
+
eslintPluginPrettierRecommended,
|
|
25
|
+
{
|
|
26
|
+
plugins: {
|
|
27
|
+
"@typescript-eslint": tseslint.plugin,
|
|
28
|
+
prettier,
|
|
29
|
+
import: importPlugin,
|
|
30
|
+
unicorn,
|
|
31
|
+
},
|
|
32
|
+
languageOptions: {
|
|
33
|
+
ecmaVersion: 2020,
|
|
34
|
+
sourceType: "commonjs",
|
|
35
|
+
globals: globals.node,
|
|
36
|
+
},
|
|
37
|
+
rules: {
|
|
38
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
39
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
40
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
41
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
42
|
+
"unicorn/no-nested-ternary": "off",
|
|
43
|
+
"import/order": [
|
|
44
|
+
"error",
|
|
45
|
+
{
|
|
46
|
+
alphabetize: { order: "asc" },
|
|
47
|
+
groups: [
|
|
48
|
+
"builtin",
|
|
49
|
+
"external",
|
|
50
|
+
"internal",
|
|
51
|
+
"parent",
|
|
52
|
+
"sibling",
|
|
53
|
+
"index",
|
|
54
|
+
"object",
|
|
55
|
+
"type",
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
"import/no-cycle": "error",
|
|
60
|
+
"no-template-curly-in-string": "off",
|
|
61
|
+
"no-useless-escape": "off",
|
|
62
|
+
"no-void": ["error", { allowAsStatement: true }],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
files: ["**/*.test.ts", "test/**/*.js", "test/helpers/init.js"],
|
|
67
|
+
rules: {
|
|
68
|
+
"@typescript-eslint/no-unused-expressions": "off",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
module.exports = config;
|
package/package.json
CHANGED
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/util",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"homepage": "https://www.superblocks.com",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "tsc --watch",
|
|
8
|
-
"build": "tsc --build",
|
|
9
|
-
"clean": "npm run clean:build && rm -rf node_modules",
|
|
10
|
-
"clean:build": "tsc --build --clean && rm -rf dist tsconfig.tsbuildinfo",
|
|
11
|
-
"lint": "eslint . --ext .ts --config .eslintrc.json",
|
|
12
|
-
"lint:fix": "eslint . --ext .ts --config .eslintrc.json --fix",
|
|
13
|
-
"typecheck": "tsc --noEmit"
|
|
14
|
-
},
|
|
15
6
|
"license": "Superblocks Community Software License",
|
|
16
7
|
"description": "",
|
|
17
8
|
"dependencies": {
|
|
18
9
|
"ajv": "^8.12.0",
|
|
19
10
|
"better-ajv-errors": "^1.2.0",
|
|
11
|
+
"fs-extra": "^11.1.1",
|
|
12
|
+
"lodash": "^4.17.21",
|
|
20
13
|
"mime-types": "^2.1.35"
|
|
21
14
|
},
|
|
22
15
|
"devDependencies": {
|
|
16
|
+
"@types/fs-extra": "^11.0.1",
|
|
17
|
+
"@types/lodash": "^4.17.7",
|
|
23
18
|
"@types/mime-types": "^2.1.1",
|
|
24
|
-
"@
|
|
25
|
-
"@typescript-eslint/
|
|
26
|
-
"eslint": "^8.
|
|
19
|
+
"@types/node": "^20.11.18",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
21
|
+
"@typescript-eslint/parser": "^8.25.0",
|
|
22
|
+
"eslint": "^9.21.0",
|
|
27
23
|
"eslint-plugin-unicorn": "^47.0.0",
|
|
28
|
-
"prettier": "^
|
|
24
|
+
"prettier": "^3.5.2",
|
|
25
|
+
"tslib": "^2.5.0",
|
|
29
26
|
"typescript": "^5.1.3"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"dev": "tsc --watch",
|
|
30
|
+
"build": "tsc --build",
|
|
31
|
+
"clean": "npm run clean:build && rm -rf node_modules",
|
|
32
|
+
"clean:build": "tsc --build --clean && rm -rf dist tsconfig.tsbuildinfo",
|
|
33
|
+
"lint": "eslint .",
|
|
34
|
+
"lint:fix": "eslint . --fix",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"check": "pnpm run lint && pnpm run typecheck"
|
|
30
37
|
}
|
|
31
|
-
}
|
|
38
|
+
}
|
package/src/component-configs.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execFile } from "child_process";
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import * as fs from "fs-extra";
|
|
@@ -46,14 +46,14 @@ const compileTypeScript = (inputFilePath: string, outputDir: string) => {
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
resolve("Compilation successful!");
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
|
-
} catch
|
|
52
|
+
} catch {
|
|
53
53
|
reject(
|
|
54
54
|
new Error(
|
|
55
|
-
"Could not find TypeScript, please install it globally (npm install -g typescript)"
|
|
56
|
-
)
|
|
55
|
+
"Could not find TypeScript, please install it globally (npm install -g typescript)",
|
|
56
|
+
),
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
});
|
|
@@ -71,22 +71,22 @@ async function getFolderPaths() {
|
|
|
71
71
|
(dirent.isSymbolicLink() &&
|
|
72
72
|
fs
|
|
73
73
|
.statSync(path.join(CUSTOM_COMPONENTS_PATH, dirent.name))
|
|
74
|
-
.isDirectory())
|
|
74
|
+
.isDirectory()),
|
|
75
75
|
);
|
|
76
76
|
// map each directory to its path
|
|
77
77
|
const folderPathsArray = directories.map((dirent) =>
|
|
78
|
-
path.join(CUSTOM_COMPONENTS_PATH, dirent.name)
|
|
78
|
+
path.join(CUSTOM_COMPONENTS_PATH, dirent.name),
|
|
79
79
|
);
|
|
80
80
|
return folderPathsArray;
|
|
81
81
|
} catch {
|
|
82
82
|
throw new Error(
|
|
83
|
-
"Could not access component directory, check your permissions"
|
|
83
|
+
"Could not access component directory, check your permissions",
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export async function getComponentConfigs(
|
|
89
|
-
generateTypesFiles: boolean
|
|
89
|
+
generateTypesFiles: boolean,
|
|
90
90
|
): Promise<{
|
|
91
91
|
configs: Record<string, any>;
|
|
92
92
|
hasError: boolean;
|
|
@@ -99,7 +99,7 @@ export async function getComponentConfigs(
|
|
|
99
99
|
const config = await fs.readJSON(`${absPath}/config.json`);
|
|
100
100
|
console.log(`Found component in ${absPath}`);
|
|
101
101
|
return { ccpath, config };
|
|
102
|
-
} catch
|
|
102
|
+
} catch {
|
|
103
103
|
// Noop because there is a fallback
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -114,7 +114,7 @@ export async function getComponentConfigs(
|
|
|
114
114
|
const outputDirectory = path.resolve(
|
|
115
115
|
`${os.tmpdir()}/superblocks/${ccpath}/config.timestamp-${Date.now()}-${Math.random()
|
|
116
116
|
.toString(16)
|
|
117
|
-
.slice(2)}
|
|
117
|
+
.slice(2)}`,
|
|
118
118
|
);
|
|
119
119
|
await fs.ensureDir(outputDirectory);
|
|
120
120
|
await compileTypeScript(fileName, outputDirectory);
|
package/src/data-types.ts
CHANGED
package/src/file-uploader.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const COMPONENT_EVENT_HEADER = "x-superblocks-component-event";
|
|
|
4
4
|
|
|
5
5
|
// retrieves bucketeer base URL given the superblocks server base URL
|
|
6
6
|
export const getBucketeerUrlFromSuperblocksUrl = (
|
|
7
|
-
superblocksBaseUrl: string
|
|
7
|
+
superblocksBaseUrl: string,
|
|
8
8
|
): string => {
|
|
9
9
|
// if superblocks base URL is an EE, return bucketeer's dev URL
|
|
10
10
|
if (!isEmpty(superblocksBaseUrl.match(new RegExp("pr-.*.superblocks.dev")))) {
|
package/src/login.ts
CHANGED
|
@@ -46,7 +46,7 @@ export async function getLocalTokenWithUrl(): Promise<
|
|
|
46
46
|
> {
|
|
47
47
|
try {
|
|
48
48
|
const tokenConfig: TokenWithBaseUrl = await fs.readJSON(
|
|
49
|
-
join(homedir(), TOKEN_CONFIG_PATH)
|
|
49
|
+
process.env.SUPERBLOCKS_AUTH_FILE || join(homedir(), TOKEN_CONFIG_PATH),
|
|
50
50
|
);
|
|
51
51
|
if (tokenConfig.token) {
|
|
52
52
|
// user logged in
|
package/src/resource-configs.ts
CHANGED
|
@@ -69,7 +69,7 @@ export type SuperblocksConfig =
|
|
|
69
69
|
*/
|
|
70
70
|
export async function getSuperblocksMonorepoConfigJson(
|
|
71
71
|
checkParentDir = false,
|
|
72
|
-
pathPrefix = ""
|
|
72
|
+
pathPrefix = "",
|
|
73
73
|
): Promise<[SuperblocksMonorepoConfig, string]> {
|
|
74
74
|
const absolutePath = path.resolve(pathPrefix);
|
|
75
75
|
|
|
@@ -87,7 +87,7 @@ export async function getSuperblocksMonorepoConfigJson(
|
|
|
87
87
|
) {
|
|
88
88
|
throw new Error(
|
|
89
89
|
"No Superblocks config file found in current directory hierarchy " +
|
|
90
|
-
pathPrefix
|
|
90
|
+
pathPrefix,
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -102,7 +102,8 @@ export async function getSuperblocksMonorepoConfigJson(
|
|
|
102
102
|
if (!checkParentDir) {
|
|
103
103
|
// no superblocks config file found
|
|
104
104
|
throw new Error(
|
|
105
|
-
"No Superblocks config file found in current directory " +
|
|
105
|
+
"No Superblocks config file found in current directory " +
|
|
106
|
+
attemptedPath,
|
|
106
107
|
);
|
|
107
108
|
}
|
|
108
109
|
return getSuperblocksMonorepoConfigJson(true, "../" + pathPrefix);
|
|
@@ -110,7 +111,7 @@ export async function getSuperblocksMonorepoConfigJson(
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
export async function getSuperblocksApplicationConfigJson(
|
|
113
|
-
applicationPath?: string
|
|
114
|
+
applicationPath?: string,
|
|
114
115
|
): Promise<SuperblocksApplicationConfig> {
|
|
115
116
|
let superblocksConfig;
|
|
116
117
|
try {
|
|
@@ -121,13 +122,13 @@ export async function getSuperblocksApplicationConfigJson(
|
|
|
121
122
|
} catch {
|
|
122
123
|
// no superblocks config file found
|
|
123
124
|
throw new Error(
|
|
124
|
-
"This command must be run within a Superblocks app directory."
|
|
125
|
+
"This command must be run within a Superblocks app directory.",
|
|
125
126
|
);
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
if (superblocksConfig.configType !== "APPLICATION") {
|
|
129
130
|
throw new Error(
|
|
130
|
-
"Please execute this command within a Superblocks application directory."
|
|
131
|
+
"Please execute this command within a Superblocks application directory.",
|
|
131
132
|
);
|
|
132
133
|
}
|
|
133
134
|
|
|
@@ -135,7 +136,7 @@ export async function getSuperblocksApplicationConfigJson(
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
export async function getSuperblocksApplicationConfigIfExists(
|
|
138
|
-
applicationPath: string
|
|
139
|
+
applicationPath: string,
|
|
139
140
|
): Promise<SuperblocksApplicationConfig | undefined> {
|
|
140
141
|
let superblocksConfig: SuperblocksApplicationConfig | undefined;
|
|
141
142
|
try {
|
|
@@ -155,7 +156,7 @@ export async function getSuperblocksApplicationConfigIfExists(
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
export async function getSuperblocksBackendConfigIfExists(
|
|
158
|
-
backendPath: string
|
|
159
|
+
backendPath: string,
|
|
159
160
|
): Promise<SuperblocksBackendConfig | undefined> {
|
|
160
161
|
let superblocksConfig: SuperblocksBackendConfig | undefined;
|
|
161
162
|
try {
|
|
@@ -181,13 +182,13 @@ export async function getSuperblocksBackendConfigJson(): Promise<SuperblocksBack
|
|
|
181
182
|
} catch {
|
|
182
183
|
// no superblocks config file found
|
|
183
184
|
throw new Error(
|
|
184
|
-
"This command must be run within a Superblocks backend resource (workflow/job) directory."
|
|
185
|
+
"This command must be run within a Superblocks backend resource (workflow/job) directory.",
|
|
185
186
|
);
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
if (superblocksConfig.configType !== "BACKEND") {
|
|
189
190
|
throw new Error(
|
|
190
|
-
"Please execute this command within a Superblocks backend resource (workflow/job) directory."
|
|
191
|
+
"Please execute this command within a Superblocks backend resource (workflow/job) directory.",
|
|
191
192
|
);
|
|
192
193
|
}
|
|
193
194
|
|
package/src/types.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["./src/component-configs.ts","./src/constants.ts","./src/data-types.ts","./src/events.ts","./src/file-uploader.ts","./src/generate-component-types.ts","./src/identifiers.ts","./src/index.ts","./src/localGitRepoState.ts","./src/login.ts","./src/resource-configs.ts","./src/types.ts","./src/unreachable.ts","./src/validation.ts"],"version":"5.7.3"}
|
package/.eslintrc.json
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"parser": "@typescript-eslint/parser",
|
|
3
|
-
"plugins": [
|
|
4
|
-
"@typescript-eslint",
|
|
5
|
-
"prettier",
|
|
6
|
-
"import",
|
|
7
|
-
"unicorn"
|
|
8
|
-
],
|
|
9
|
-
"extends": [
|
|
10
|
-
"eslint:recommended",
|
|
11
|
-
"plugin:@typescript-eslint/recommended",
|
|
12
|
-
"plugin:prettier/recommended",
|
|
13
|
-
"prettier",
|
|
14
|
-
"plugin:import/typescript"
|
|
15
|
-
],
|
|
16
|
-
"parserOptions": {
|
|
17
|
-
"ecmaVersion": 2020,
|
|
18
|
-
"sourceType": "module",
|
|
19
|
-
"project": true
|
|
20
|
-
},
|
|
21
|
-
"rules": {
|
|
22
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
23
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
24
|
-
"@typescript-eslint/no-unused-vars": "error",
|
|
25
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
26
|
-
"@typescript-eslint/no-unsafe-return": "off",
|
|
27
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
28
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
29
|
-
"import/order": [
|
|
30
|
-
"error",
|
|
31
|
-
{
|
|
32
|
-
"alphabetize": { "order": "asc" },
|
|
33
|
-
"groups": [
|
|
34
|
-
"builtin",
|
|
35
|
-
"external",
|
|
36
|
-
"internal",
|
|
37
|
-
"parent",
|
|
38
|
-
"sibling",
|
|
39
|
-
"index",
|
|
40
|
-
"object",
|
|
41
|
-
"type"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"import/no-cycle": "error",
|
|
46
|
-
"no-template-curly-in-string": "off",
|
|
47
|
-
"no-useless-escape": "off",
|
|
48
|
-
"no-void": ["error", { "allowAsStatement": true }]
|
|
49
|
-
},
|
|
50
|
-
"ignorePatterns": ["public", "build", "node_modules", "dist", "tsup.config.ts"]
|
|
51
|
-
}
|