dceky 1.0.5-beta.ky-declarations.5 → 1.0.5-beta.ky-declarations.7
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.
|
@@ -17,11 +17,28 @@ var fs_1 = __importDefault(require("fs"));
|
|
|
17
17
|
var path_1 = __importDefault(require("path"));
|
|
18
18
|
// Import shared helpers
|
|
19
19
|
var getRootPath_1 = __importDefault(require("./helpers/getRootPath"));
|
|
20
|
+
/*------------------------------------------------------------------------*/
|
|
21
|
+
/* ------------------------------ Constants ----------------------------- */
|
|
22
|
+
/*------------------------------------------------------------------------*/
|
|
23
|
+
var STARTER = [
|
|
24
|
+
'/*----------------------------------------*/',
|
|
25
|
+
'/* ---------------- Type ---------------- */',
|
|
26
|
+
'/*----------------------------------------*/',
|
|
27
|
+
].join('\n');
|
|
28
|
+
var ENDER = [
|
|
29
|
+
'/*----------------------------------------*/',
|
|
30
|
+
'/* --------------- Command -------------- */',
|
|
31
|
+
'/*----------------------------------------*/',
|
|
32
|
+
].join('\n');
|
|
33
|
+
/*------------------------------------------------------------------------*/
|
|
34
|
+
/* -------------------------------- Main -------------------------------- */
|
|
35
|
+
/*------------------------------------------------------------------------*/
|
|
20
36
|
/**
|
|
21
37
|
* Generate a single, unified command declarations file for Ky functions
|
|
22
38
|
* @author Gabe Abrams
|
|
23
39
|
*/
|
|
24
40
|
var genKyCommandDeclarations = function () {
|
|
41
|
+
var _a;
|
|
25
42
|
var root = (0, getRootPath_1.default)();
|
|
26
43
|
// Get paths
|
|
27
44
|
var kyCommandsDir = path_1.default.join(root, 'node_modules/dceky/src/commands');
|
|
@@ -49,21 +66,9 @@ var genKyCommandDeclarations = function () {
|
|
|
49
66
|
var filePath = path_1.default.join(kyCommandsDir, file);
|
|
50
67
|
var fileContents = fs_1.default.readFileSync(filePath, 'utf8');
|
|
51
68
|
// Extract declaration section
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// /*----------------------------------------*/
|
|
56
|
-
// [Declaration]
|
|
57
|
-
// /*----------------------------------------*/
|
|
58
|
-
// /* --------------- Command -------------- */
|
|
59
|
-
// /*----------------------------------------*/
|
|
60
|
-
var declarationMatch = fileContents.match(
|
|
61
|
-
// eslint-disable-next-line max-len
|
|
62
|
-
/\/\*[-]{40,}\*\/\s*\/\* [-]{16} Type [-]{16} \*\/\s*\/\*[-]{40,}\*\/\s*([\s\S]*?)\s*\/\*[-]{40,}\*\/\s*\/\* [-]{15} Command [-]{15} \*\/\s*\/\*[-]{40,}\*\//);
|
|
63
|
-
if (declarationMatch
|
|
64
|
-
&& declarationMatch[1]
|
|
65
|
-
&& declarationMatch[1].trim()) {
|
|
66
|
-
unprocessedDeclarations.push(declarationMatch[1].trim());
|
|
69
|
+
var declarationMatch = (_a = fileContents.split(STARTER)[1]) === null || _a === void 0 ? void 0 : _a.split(ENDER)[0];
|
|
70
|
+
if (declarationMatch) {
|
|
71
|
+
unprocessedDeclarations.push("".concat(declarationMatch, "\n"));
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
74
|
// Process each declaration
|
|
@@ -96,6 +101,9 @@ var genKyCommandDeclarations = function () {
|
|
|
96
101
|
' }',
|
|
97
102
|
'}',
|
|
98
103
|
'',
|
|
104
|
+
'// Export identity function to make this a module',
|
|
105
|
+
'export default () => {};',
|
|
106
|
+
'',
|
|
99
107
|
], false).join('\n');
|
|
100
108
|
// Write to file
|
|
101
109
|
fs_1.default.writeFileSync(declarationsPath, finalDeclarations, 'utf8');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genKyCommandDeclarations.js","sourceRoot":"","sources":["../../setup/genKyCommandDeclarations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,0CAAoB;AACpB,8CAAwB;AAExB,wBAAwB;AACxB,sEAAgD;AAEhD;;;GAGG;AACH,IAAM,wBAAwB,GAAG
|
|
1
|
+
{"version":3,"file":"genKyCommandDeclarations.js","sourceRoot":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xB,mCAAmC;QACnC,EAAE;QACF,mDAAmD;QACnD,EAAE;QACF,kBAAkB;QAClB,uBAAuB;QACvB,2BAA2B;OAExB,qBAAqB;QACxB,OAAO;QACP,KAAK;QACL,GAAG;QACH,EAAE;QACF,mDAAmD;QACnD,0BAA0B;QAC1B,EAAE;cACF,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,gBAAgB;IAChB,YAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,kBAAe,wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,6 +5,26 @@ import path from 'path';
|
|
|
5
5
|
// Import shared helpers
|
|
6
6
|
import getRootPath from './helpers/getRootPath';
|
|
7
7
|
|
|
8
|
+
/*------------------------------------------------------------------------*/
|
|
9
|
+
/* ------------------------------ Constants ----------------------------- */
|
|
10
|
+
/*------------------------------------------------------------------------*/
|
|
11
|
+
|
|
12
|
+
const STARTER = [
|
|
13
|
+
'/*----------------------------------------*/',
|
|
14
|
+
'/* ---------------- Type ---------------- */',
|
|
15
|
+
'/*----------------------------------------*/',
|
|
16
|
+
].join('\n');
|
|
17
|
+
|
|
18
|
+
const ENDER = [
|
|
19
|
+
'/*----------------------------------------*/',
|
|
20
|
+
'/* --------------- Command -------------- */',
|
|
21
|
+
'/*----------------------------------------*/',
|
|
22
|
+
].join('\n');
|
|
23
|
+
|
|
24
|
+
/*------------------------------------------------------------------------*/
|
|
25
|
+
/* -------------------------------- Main -------------------------------- */
|
|
26
|
+
/*------------------------------------------------------------------------*/
|
|
27
|
+
|
|
8
28
|
/**
|
|
9
29
|
* Generate a single, unified command declarations file for Ky functions
|
|
10
30
|
* @author Gabe Abrams
|
|
@@ -43,24 +63,9 @@ const genKyCommandDeclarations = () => {
|
|
|
43
63
|
const fileContents = fs.readFileSync(filePath, 'utf8');
|
|
44
64
|
|
|
45
65
|
// Extract declaration section
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// /*----------------------------------------*/
|
|
50
|
-
// [Declaration]
|
|
51
|
-
// /*----------------------------------------*/
|
|
52
|
-
// /* --------------- Command -------------- */
|
|
53
|
-
// /*----------------------------------------*/
|
|
54
|
-
const declarationMatch = fileContents.match(
|
|
55
|
-
// eslint-disable-next-line max-len
|
|
56
|
-
/\/\*[-]{40,}\*\/\s*\/\* [-]{16} Type [-]{16} \*\/\s*\/\*[-]{40,}\*\/\s*([\s\S]*?)\s*\/\*[-]{40,}\*\/\s*\/\* [-]{15} Command [-]{15} \*\/\s*\/\*[-]{40,}\*\//,
|
|
57
|
-
);
|
|
58
|
-
if (
|
|
59
|
-
declarationMatch
|
|
60
|
-
&& declarationMatch[1]
|
|
61
|
-
&& declarationMatch[1].trim()
|
|
62
|
-
) {
|
|
63
|
-
unprocessedDeclarations.push(declarationMatch[1].trim());
|
|
66
|
+
const declarationMatch = fileContents.split(STARTER)[1]?.split(ENDER)[0];
|
|
67
|
+
if (declarationMatch) {
|
|
68
|
+
unprocessedDeclarations.push(`${declarationMatch}\n`);
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
|
|
@@ -98,6 +103,9 @@ const genKyCommandDeclarations = () => {
|
|
|
98
103
|
' }',
|
|
99
104
|
'}',
|
|
100
105
|
'',
|
|
106
|
+
'// Export identity function to make this a module',
|
|
107
|
+
'export default () => {};',
|
|
108
|
+
'',
|
|
101
109
|
].join('\n');
|
|
102
110
|
|
|
103
111
|
// Write to file
|