dceky 1.1.1 → 1.1.3

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.
Files changed (170) hide show
  1. package/docs/commands.html +961 -0
  2. package/genDocs/index.ts +322 -0
  3. package/lib/genDocs/index.d.ts +1 -0
  4. package/lib/genDocs/index.js +285 -0
  5. package/lib/genDocs/index.js.map +1 -0
  6. package/lib/postinstall/helpers/getRootPath.js +3 -3
  7. package/lib/postinstall/helpers/getRootPath.js.map +1 -1
  8. package/lib/postinstall/index.js +6 -6
  9. package/lib/postinstall/index.js.map +1 -1
  10. package/lib/preinstall/helpers/getRootPath.js +3 -3
  11. package/lib/preinstall/helpers/getRootPath.js.map +1 -1
  12. package/lib/preinstall/index.js +6 -6
  13. package/lib/preinstall/index.js.map +1 -1
  14. package/lib/setup/addToGitIgnore.js +13 -13
  15. package/lib/setup/addToGitIgnore.js.map +1 -1
  16. package/lib/setup/checkRequiredFiles/genEmptyGlobalFile.js +12 -12
  17. package/lib/setup/checkRequiredFiles/genEmptyGlobalFile.js.map +1 -1
  18. package/lib/setup/checkRequiredFiles/genEmptyProfileFile.js +23 -13
  19. package/lib/setup/checkRequiredFiles/genEmptyProfileFile.js.map +1 -1
  20. package/lib/setup/checkRequiredFiles/genExampleTest.js +8 -8
  21. package/lib/setup/checkRequiredFiles/genExampleTest.js.map +1 -1
  22. package/lib/setup/checkRequiredFiles/index.js +21 -21
  23. package/lib/setup/checkRequiredFiles/index.js.map +1 -1
  24. package/lib/setup/genCommandImportFile.js +24 -24
  25. package/lib/setup/genCommandImportFile.js.map +1 -1
  26. package/lib/setup/genDynamicConfigFile.js +8 -8
  27. package/lib/setup/genDynamicConfigFile.js.map +1 -1
  28. package/lib/setup/genE2ELaunchFile.js +8 -8
  29. package/lib/setup/genE2ELaunchFile.js.map +1 -1
  30. package/lib/setup/genKyCommandDeclarations.js +24 -24
  31. package/lib/setup/genKyCommandDeclarations.js.map +1 -1
  32. package/lib/setup/genTsConfigFile.js +9 -8
  33. package/lib/setup/genTsConfigFile.js.map +1 -1
  34. package/lib/setup/helpers/getRootPath.js +3 -3
  35. package/lib/setup/helpers/getRootPath.js.map +1 -1
  36. package/lib/setup/index.js +8 -8
  37. package/lib/setup/index.js.map +1 -1
  38. package/lib/setup/setupCypressDependencies.js +11 -11
  39. package/lib/setup/setupCypressDependencies.js.map +1 -1
  40. package/lib/src/commands/assertDoesNotHaveClass.js +3 -3
  41. package/lib/src/commands/assertDoesNotHaveClass.js.map +1 -1
  42. package/lib/src/commands/assertHasClass.js +3 -3
  43. package/lib/src/commands/assertHasClass.js.map +1 -1
  44. package/lib/src/commands/assertNumElements.js +3 -3
  45. package/lib/src/commands/assertNumElements.js.map +1 -1
  46. package/lib/src/commands/checkIfElementExists.js +3 -3
  47. package/lib/src/commands/checkIfElementExists.js.map +1 -1
  48. package/lib/src/commands/extractDataFromClass.js +8 -8
  49. package/lib/src/commands/extractDataFromClass.js.map +1 -1
  50. package/lib/src/commands/extractDataFromClassByContents.js +8 -8
  51. package/lib/src/commands/extractDataFromClassByContents.js.map +1 -1
  52. package/lib/src/commands/genTextOfLength.js +6 -6
  53. package/lib/src/commands/genTextOfLength.js.map +1 -1
  54. package/lib/src/commands/getAttribute.js +4 -4
  55. package/lib/src/commands/getAttribute.js.map +1 -1
  56. package/lib/src/commands/getClassName.js +3 -3
  57. package/lib/src/commands/getClassName.js.map +1 -1
  58. package/lib/src/commands/getCredentialValue.js +3 -4
  59. package/lib/src/commands/getCredentialValue.js.map +1 -1
  60. package/lib/src/commands/getCredentialValues.js +2 -2
  61. package/lib/src/commands/getCredentialValues.js.map +1 -1
  62. package/lib/src/commands/getCurrentDateInfo.js +4 -4
  63. package/lib/src/commands/getCurrentDateInfo.js.map +1 -1
  64. package/lib/src/commands/getId.js +3 -3
  65. package/lib/src/commands/getId.js.map +1 -1
  66. package/lib/src/commands/getJSON.js +2 -2
  67. package/lib/src/commands/getJSON.js.map +1 -1
  68. package/lib/src/commands/getNumElements.js +4 -4
  69. package/lib/src/commands/getNumElements.js.map +1 -1
  70. package/lib/src/commands/getProfileValue.js +1 -1
  71. package/lib/src/commands/getProfileValue.js.map +1 -1
  72. package/lib/src/commands/getSpecialChars.js +2 -2
  73. package/lib/src/commands/getSpecialChars.js.map +1 -1
  74. package/lib/src/commands/getTitle.js +3 -3
  75. package/lib/src/commands/getTitle.js.map +1 -1
  76. package/lib/src/commands/handleHarvardKey.js +12 -12
  77. package/lib/src/commands/handleHarvardKey.js.map +1 -1
  78. package/lib/src/commands/helpers/getFormData.js +13 -13
  79. package/lib/src/commands/helpers/getFormData.js.map +1 -1
  80. package/lib/src/commands/index.js +34 -34
  81. package/lib/src/commands/index.js.map +1 -1
  82. package/lib/src/commands/launchAs.js +25 -26
  83. package/lib/src/commands/launchAs.js.map +1 -1
  84. package/lib/src/commands/listSelectLabels.js +6 -6
  85. package/lib/src/commands/listSelectLabels.js.map +1 -1
  86. package/lib/src/commands/listSelectValues.js +7 -7
  87. package/lib/src/commands/listSelectValues.js.map +1 -1
  88. package/lib/src/commands/logIntoPorta.js +21 -31
  89. package/lib/src/commands/logIntoPorta.js.map +1 -1
  90. package/lib/src/commands/navigateToHref.js +7 -7
  91. package/lib/src/commands/navigateToHref.js.map +1 -1
  92. package/lib/src/commands/padWithZeros.js +6 -6
  93. package/lib/src/commands/padWithZeros.js.map +1 -1
  94. package/lib/src/commands/runScript.js +4 -4
  95. package/lib/src/commands/runScript.js.map +1 -1
  96. package/lib/src/commands/tap.js +2 -2
  97. package/lib/src/commands/tap.js.map +1 -1
  98. package/lib/src/commands/tapInIFrame.js +2 -2
  99. package/lib/src/commands/tapInIFrame.js.map +1 -1
  100. package/lib/src/commands/typeInto.js +9 -9
  101. package/lib/src/commands/typeInto.js.map +1 -1
  102. package/lib/src/commands/uniquify.js +7 -7
  103. package/lib/src/commands/uniquify.js.map +1 -1
  104. package/lib/src/commands/visitCanvasEndpoint.js +7 -18
  105. package/lib/src/commands/visitCanvasEndpoint.js.map +1 -1
  106. package/lib/src/commands/waitForAtLeastOneElementPresent.js +9 -9
  107. package/lib/src/commands/waitForAtLeastOneElementPresent.js.map +1 -1
  108. package/lib/src/commands/waitForElementVisible.js +4 -4
  109. package/lib/src/commands/waitForElementVisible.js.map +1 -1
  110. package/lib/src/genConfiguration/helpers/getRootPath.js +3 -3
  111. package/lib/src/genConfiguration/helpers/getRootPath.js.map +1 -1
  112. package/lib/src/genConfiguration/helpers/resolveDependents.js +8 -9
  113. package/lib/src/genConfiguration/helpers/resolveDependents.js.map +1 -1
  114. package/lib/src/genConfiguration/helpers/splitEnv.js +5 -6
  115. package/lib/src/genConfiguration/helpers/splitEnv.js.map +1 -1
  116. package/lib/src/genConfiguration/index.js +36 -44
  117. package/lib/src/genConfiguration/index.js.map +1 -1
  118. package/lib/src/index.js +1 -1
  119. package/lib/src/index.js.map +1 -1
  120. package/lib/start/constants/AVAILABLE_BROWSERS.js +1 -1
  121. package/lib/start/constants/AVAILABLE_BROWSERS.js.map +1 -1
  122. package/lib/start/constants/DEFAULT_THREADS_PER_COMBO.js +1 -1
  123. package/lib/start/constants/DEFAULT_THREADS_PER_COMBO.js.map +1 -1
  124. package/lib/start/helpers/collectPngFiles.js +8 -9
  125. package/lib/start/helpers/collectPngFiles.js.map +1 -1
  126. package/lib/start/helpers/exec.js +2 -2
  127. package/lib/start/helpers/exec.js.map +1 -1
  128. package/lib/start/helpers/executeAllHeadlessCombinations.js +58 -89
  129. package/lib/start/helpers/executeAllHeadlessCombinations.js.map +1 -1
  130. package/lib/start/helpers/executeCypress.js +32 -73
  131. package/lib/start/helpers/executeCypress.js.map +1 -1
  132. package/lib/start/helpers/extractArgValue.js +7 -7
  133. package/lib/start/helpers/extractArgValue.js.map +1 -1
  134. package/lib/start/helpers/findProfilesByNames.js +7 -7
  135. package/lib/start/helpers/findProfilesByNames.js.map +1 -1
  136. package/lib/start/helpers/generateHtmlReport.js +19 -19
  137. package/lib/start/helpers/generateHtmlReport.js.map +1 -1
  138. package/lib/start/helpers/generateReportHomepage.js +49 -68
  139. package/lib/start/helpers/generateReportHomepage.js.map +1 -1
  140. package/lib/start/helpers/generateReporterConfig.js +4 -4
  141. package/lib/start/helpers/generateReporterConfig.js.map +1 -1
  142. package/lib/start/helpers/getDateLabeledDir.js +17 -17
  143. package/lib/start/helpers/getDateLabeledDir.js.map +1 -1
  144. package/lib/start/helpers/getRootPath.js +3 -3
  145. package/lib/start/helpers/getRootPath.js.map +1 -1
  146. package/lib/start/helpers/mergeAllReportsAndGenerateHtml.js +29 -29
  147. package/lib/start/helpers/mergeAllReportsAndGenerateHtml.js.map +1 -1
  148. package/lib/start/helpers/mergeReports.js +22 -22
  149. package/lib/start/helpers/mergeReports.js.map +1 -1
  150. package/lib/start/helpers/parseCommaSeparated.js +3 -3
  151. package/lib/start/helpers/parseCommaSeparated.js.map +1 -1
  152. package/lib/start/helpers/print.js +19 -19
  153. package/lib/start/helpers/print.js.map +1 -1
  154. package/lib/start/helpers/prompt.js +5 -5
  155. package/lib/start/helpers/prompt.js.map +1 -1
  156. package/lib/start/helpers/runCypressHeadless.js +41 -52
  157. package/lib/start/helpers/runCypressHeadless.js.map +1 -1
  158. package/lib/start/helpers/runCypressVisible.js +13 -24
  159. package/lib/start/helpers/runCypressVisible.js.map +1 -1
  160. package/lib/start/helpers/showChooser.js +27 -38
  161. package/lib/start/helpers/showChooser.js.map +1 -1
  162. package/lib/start/helpers/validateBrowsers.js +8 -8
  163. package/lib/start/helpers/validateBrowsers.js.map +1 -1
  164. package/lib/start/index.js +58 -60
  165. package/lib/start/index.js.map +1 -1
  166. package/package.json +5 -2
  167. package/setup/checkRequiredFiles/genEmptyProfileFile.ts +15 -1
  168. package/setup/genTsConfigFile.ts +1 -0
  169. package/src/genConfiguration/index.ts +3 -1
  170. package/tsconfig.json +5 -3
@@ -0,0 +1,322 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
2
+ import fs from 'fs';
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
4
+ import path from 'path';
5
+ // eslint-disable-next-line import/no-extraneous-dependencies
6
+ import { marked } from 'marked';
7
+
8
+ /*----------------------------------------*/
9
+ /* ---------------- Types --------------- */
10
+ /*----------------------------------------*/
11
+
12
+ type Param = {
13
+ // Name of param
14
+ name: string,
15
+ // Whether it's optional (based on [] syntax in @param)
16
+ optional: boolean,
17
+ // Description text for the param
18
+ description: string,
19
+ };
20
+
21
+ type FunctionDoc = {
22
+ // Function name (e.g. "visit")
23
+ name: string,
24
+ // Description text from the JSDoc block (everything before the first @-tag)
25
+ description: string,
26
+ // List of @param entries
27
+ params: Param[],
28
+ // Text from @return tag, if present
29
+ returns: string,
30
+ };
31
+
32
+ /*----------------------------------------*/
33
+ /* --------------- Helpers -------------- */
34
+ /*----------------------------------------*/
35
+
36
+ /**
37
+ * Extract the JSDoc block that lives inside `interface Chainable` in a .ts file
38
+ * and parse it into a FunctionDoc object. Returns null if no JSDoc is found.
39
+ * @author Gabe Abrams
40
+ */
41
+ const parseCommandFile = (filePath: string): FunctionDoc | null => {
42
+ const source = fs.readFileSync(filePath, 'utf8');
43
+
44
+ // Find the JSDoc comment inside the Chainable interface
45
+ const jsdocMatch = source.match(/interface Chainable\s*\{[\s\S]*?(\/\*\*[\s\S]*?\*\/)/);
46
+ if (!jsdocMatch) {
47
+ return null;
48
+ }
49
+ const jsdocBlock = jsdocMatch[1];
50
+
51
+ // Strip leading `* ` from each line and collect content lines
52
+ const lines = (
53
+ jsdocBlock
54
+ .split('\n')
55
+ .slice(1, -1) // drop /** and */
56
+ .map((line: string) => {
57
+ return line.replace(/^\s*\*\s?/, '');
58
+ })
59
+ );
60
+
61
+ // Extract function name from the line immediately after */
62
+ const afterJsdoc = source.slice(source.indexOf(jsdocMatch[1]) + jsdocMatch[1].length);
63
+ const nameMatch = afterJsdoc.match(/^\s*(\w+)\s*[(<]/m);
64
+ if (!nameMatch) {
65
+ return null;
66
+ }
67
+ const name = nameMatch[1];
68
+
69
+ // Parse description (lines before the first @-tag)
70
+ const descriptionLines: string[] = [];
71
+ let i = 0;
72
+ while (i < lines.length && !lines[i].startsWith('@')) {
73
+ descriptionLines.push(lines[i]);
74
+ i += 1;
75
+ }
76
+ const description = descriptionLines.join('\n').trim();
77
+
78
+ // Parse @-tags
79
+ const params: Param[] = [];
80
+ let returns = '';
81
+
82
+ while (i < lines.length) {
83
+ const line = lines[i];
84
+ if (line.startsWith('@param')) {
85
+ // @param [opt] desc OR @param name desc
86
+ const paramMatch = line.match(/^@param\s+(\[[\w.[\]]+\]|[\w.[\]]+)\s*(.*)/);
87
+ if (paramMatch) {
88
+ const rawName = paramMatch[1];
89
+ const optional = rawName.startsWith('[');
90
+ const cleanName = rawName.replace(/^\[|\]$/g, '');
91
+ // Collect continuation lines (no @ prefix, indented)
92
+ let desc = paramMatch[2];
93
+ let j = i + 1;
94
+ while (j < lines.length && !lines[j].match(/^@/) && lines[j].startsWith(' ')) {
95
+ desc = `${desc} ${lines[j].trim()}`;
96
+ j += 1;
97
+ }
98
+ params.push({ name: cleanName, optional, description: desc.trim() });
99
+ i = j;
100
+
101
+ // eslint-disable-next-line no-continue
102
+ continue;
103
+ }
104
+ } else if (line.startsWith('@return')) {
105
+ returns = line.replace(/^@returns?\s*/, '').trim();
106
+ }
107
+ i += 1;
108
+ }
109
+
110
+ return {
111
+ name,
112
+ description,
113
+ params,
114
+ returns,
115
+ };
116
+ };
117
+
118
+ /*----------------------------------------*/
119
+ /* ----------- HTML Generation ---------- */
120
+ /*----------------------------------------*/
121
+
122
+ /**
123
+ * Escape html chars
124
+ * @author Gabe Abrams
125
+ * @param text Text to escape
126
+ * @returns Escaped text
127
+ */
128
+ const escapeHtml = (text: string): string => {
129
+ return text
130
+ .replace(/&/g, '&amp;')
131
+ .replace(/</g, '&lt;')
132
+ .replace(/>/g, '&gt;');
133
+ };
134
+
135
+ /**
136
+ * Render a single FunctionDoc as an HTML card
137
+ * @author Gabe Abrams
138
+ * @param doc FunctionDoc to render
139
+ * @returns HTML string for the card
140
+ */
141
+ const renderCard = (doc: FunctionDoc): string => {
142
+ const descHtml = doc.description ? marked.parse(doc.description) : '';
143
+
144
+ const body = doc.params.map((p) => {
145
+ return `
146
+ <tr>
147
+ <td><code>${escapeHtml(p.name)}</code></td>
148
+ <td>${p.optional ? 'Yes' : 'No'}</td>
149
+ <td>${escapeHtml(p.description)}</td>
150
+ </tr>
151
+ `;
152
+ }).join('\n');
153
+
154
+ const paramsHtml = (
155
+ doc.params.length
156
+ ? `<table class="params">
157
+ <thead><tr><th>Parameter</th><th>Optional</th><th>Description</th></tr></thead>
158
+ <tbody>
159
+ ${body}
160
+ </tbody>
161
+ </table>`
162
+ : ''
163
+ );
164
+
165
+ const returnsHtml = doc.returns
166
+ ? `<p class="returns"><span class="label">Returns:</span> ${escapeHtml(doc.returns)}</p>`
167
+ : '';
168
+
169
+ return `
170
+ <div class="card" id="fn-${escapeHtml(doc.name)}">
171
+ <h2><code>ky.${escapeHtml(doc.name)}()</code></h2>
172
+ <div class="description">${descHtml}</div>
173
+ ${paramsHtml}
174
+ ${returnsHtml}
175
+ </div>`;
176
+ };
177
+
178
+ /**
179
+ * Render a list of FunctionDocs as a table of contents
180
+ * @author Gabe Abrams
181
+ * @param docs List of FunctionDocs to include in the TOC
182
+ * @returns HTML string for the TOC
183
+ */
184
+ const renderToc = (docs: FunctionDoc[]): string => {
185
+ const items = (
186
+ docs
187
+ .map((doc) => {
188
+ return `<li><a href="#fn-${escapeHtml(doc.name)}"><code>ky.${escapeHtml(doc.name)}()</code></a></li>`;
189
+ })
190
+ .join('\n ')
191
+ );
192
+ return `<nav class="toc" aria-label="Table of contents">
193
+ <h2>Commands</h2>
194
+ <ul>
195
+ ${items}
196
+ </ul>
197
+ </nav>`;
198
+ };
199
+
200
+ /**
201
+ * Build the full HTML document given a list of FunctionDocs
202
+ * @author Gabe Abrams
203
+ * @param docs List of FunctionDocs to include in the document
204
+ * @returns Full HTML string for the document
205
+ */
206
+ const buildHtml = (docs: FunctionDoc[]): string => {
207
+ const toc = renderToc(docs);
208
+ const cards = docs.map(renderCard).join('\n');
209
+ return `<!DOCTYPE html>
210
+ <html lang="en">
211
+ <head>
212
+ <meta charset="UTF-8" />
213
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
214
+ <title>Ky Functions</title>
215
+ <style>
216
+ *, *::before, *::after { box-sizing: border-box; }
217
+ body {
218
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
219
+ background: #f5f6fa;
220
+ color: #222;
221
+ margin: 0;
222
+ padding: 2rem;
223
+ }
224
+ h1 { font-size: 2rem; margin-bottom: 0.25rem; }
225
+ .subtitle { color: #666; margin-bottom: 1.5rem; }
226
+ .toc {
227
+ background: #fff;
228
+ border-radius: 8px;
229
+ padding: 1.25rem 1.5rem;
230
+ box-shadow: 0 1px 4px rgba(0,0,0,0.10);
231
+ margin-bottom: 2rem;
232
+ }
233
+ .toc h2 { margin: 0 0 0.75rem; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; }
234
+ .toc ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
235
+ .toc a { text-decoration: none; color: #4f7ef8; font-size: 0.9rem; }
236
+ .toc a:hover { text-decoration: underline; }
237
+ .toc code { background: none; font-size: 0.88rem; }
238
+ .grid {
239
+ display: grid;
240
+ grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
241
+ gap: 1.25rem;
242
+ }
243
+ .card {
244
+ background: #fff;
245
+ border-radius: 8px;
246
+ padding: 1.25rem 1.5rem;
247
+ box-shadow: 0 1px 4px rgba(0,0,0,0.10);
248
+ border-left: 4px solid #4f7ef8;
249
+ }
250
+ .card h2 {
251
+ margin: 0 0 0.5rem;
252
+ font-size: 1.1rem;
253
+ color: #1a1a2e;
254
+ }
255
+ .card h2 code {
256
+ background: none;
257
+ font-size: 1.05rem;
258
+ }
259
+ .description { margin-bottom: 0.75rem; line-height: 1.6; }
260
+ .description p { margin: 0 0 0.4rem; }
261
+ .returns { font-size: 0.875rem; color: #444; margin: 0.4rem 0; }
262
+ .label { font-weight: 600; }
263
+ .params {
264
+ width: 100%;
265
+ border-collapse: collapse;
266
+ font-size: 0.85rem;
267
+ margin: 0.5rem 0;
268
+ }
269
+ .params th {
270
+ text-align: left;
271
+ background: #f0f3ff;
272
+ padding: 0.35rem 0.6rem;
273
+ border-bottom: 2px solid #dde3f7;
274
+ }
275
+ .params td {
276
+ padding: 0.3rem 0.6rem;
277
+ border-bottom: 1px solid #eee;
278
+ vertical-align: top;
279
+ }
280
+ .params td code {
281
+ background: #f0f3ff;
282
+ padding: 0.1rem 0.3rem;
283
+ border-radius: 3px;
284
+ font-size: 0.82rem;
285
+ }
286
+ </style>
287
+ </head>
288
+ <body>
289
+ <h1>Ky Functions</h1>
290
+ <p class="subtitle">Ky functions that are available in all Ky projects, in addition to the built-in cypress functions</p>
291
+ ${toc}
292
+ <div class="grid">
293
+ ${cards}
294
+ </div>
295
+ </body>
296
+ </html>`;
297
+ };
298
+
299
+ /*----------------------------------------*/
300
+ /* --------------- Main ----------------- */
301
+ /*----------------------------------------*/
302
+
303
+ (async () => {
304
+ const commandsDir = path.resolve(__dirname, '../src/commands');
305
+ const files = fs.readdirSync(commandsDir)
306
+ .filter((f) => {
307
+ return f.endsWith('.ts') && f !== 'index.ts';
308
+ })
309
+ .sort();
310
+
311
+ const docs: FunctionDoc[] = [];
312
+ for (const file of files) {
313
+ const doc = parseCommandFile(path.join(commandsDir, file));
314
+ if (doc) {
315
+ docs.push(doc);
316
+ }
317
+ }
318
+
319
+ const html = buildHtml(docs);
320
+ const outPath = path.resolve(__dirname, '../docs/commands.html');
321
+ fs.writeFileSync(outPath, html, 'utf8');
322
+ })();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,285 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ // eslint-disable-next-line import/no-extraneous-dependencies
16
+ const fs_1 = __importDefault(require("fs"));
17
+ // eslint-disable-next-line import/no-extraneous-dependencies
18
+ const path_1 = __importDefault(require("path"));
19
+ // eslint-disable-next-line import/no-extraneous-dependencies
20
+ const marked_1 = require("marked");
21
+ /*----------------------------------------*/
22
+ /* --------------- Helpers -------------- */
23
+ /*----------------------------------------*/
24
+ /**
25
+ * Extract the JSDoc block that lives inside `interface Chainable` in a .ts file
26
+ * and parse it into a FunctionDoc object. Returns null if no JSDoc is found.
27
+ * @author Gabe Abrams
28
+ */
29
+ const parseCommandFile = (filePath) => {
30
+ const source = fs_1.default.readFileSync(filePath, 'utf8');
31
+ // Find the JSDoc comment inside the Chainable interface
32
+ const jsdocMatch = source.match(/interface Chainable\s*\{[\s\S]*?(\/\*\*[\s\S]*?\*\/)/);
33
+ if (!jsdocMatch) {
34
+ return null;
35
+ }
36
+ const jsdocBlock = jsdocMatch[1];
37
+ // Strip leading `* ` from each line and collect content lines
38
+ const lines = (jsdocBlock
39
+ .split('\n')
40
+ .slice(1, -1) // drop /** and */
41
+ .map((line) => {
42
+ return line.replace(/^\s*\*\s?/, '');
43
+ }));
44
+ // Extract function name from the line immediately after */
45
+ const afterJsdoc = source.slice(source.indexOf(jsdocMatch[1]) + jsdocMatch[1].length);
46
+ const nameMatch = afterJsdoc.match(/^\s*(\w+)\s*[(<]/m);
47
+ if (!nameMatch) {
48
+ return null;
49
+ }
50
+ const name = nameMatch[1];
51
+ // Parse description (lines before the first @-tag)
52
+ const descriptionLines = [];
53
+ let i = 0;
54
+ while (i < lines.length && !lines[i].startsWith('@')) {
55
+ descriptionLines.push(lines[i]);
56
+ i += 1;
57
+ }
58
+ const description = descriptionLines.join('\n').trim();
59
+ // Parse @-tags
60
+ const params = [];
61
+ let returns = '';
62
+ while (i < lines.length) {
63
+ const line = lines[i];
64
+ if (line.startsWith('@param')) {
65
+ // @param [opt] desc OR @param name desc
66
+ const paramMatch = line.match(/^@param\s+(\[[\w.[\]]+\]|[\w.[\]]+)\s*(.*)/);
67
+ if (paramMatch) {
68
+ const rawName = paramMatch[1];
69
+ const optional = rawName.startsWith('[');
70
+ const cleanName = rawName.replace(/^\[|\]$/g, '');
71
+ // Collect continuation lines (no @ prefix, indented)
72
+ let desc = paramMatch[2];
73
+ let j = i + 1;
74
+ while (j < lines.length && !lines[j].match(/^@/) && lines[j].startsWith(' ')) {
75
+ desc = `${desc} ${lines[j].trim()}`;
76
+ j += 1;
77
+ }
78
+ params.push({ name: cleanName, optional, description: desc.trim() });
79
+ i = j;
80
+ // eslint-disable-next-line no-continue
81
+ continue;
82
+ }
83
+ }
84
+ else if (line.startsWith('@return')) {
85
+ returns = line.replace(/^@returns?\s*/, '').trim();
86
+ }
87
+ i += 1;
88
+ }
89
+ return {
90
+ name,
91
+ description,
92
+ params,
93
+ returns,
94
+ };
95
+ };
96
+ /*----------------------------------------*/
97
+ /* ----------- HTML Generation ---------- */
98
+ /*----------------------------------------*/
99
+ /**
100
+ * Escape html chars
101
+ * @author Gabe Abrams
102
+ * @param text Text to escape
103
+ * @returns Escaped text
104
+ */
105
+ const escapeHtml = (text) => {
106
+ return text
107
+ .replace(/&/g, '&amp;')
108
+ .replace(/</g, '&lt;')
109
+ .replace(/>/g, '&gt;');
110
+ };
111
+ /**
112
+ * Render a single FunctionDoc as an HTML card
113
+ * @author Gabe Abrams
114
+ * @param doc FunctionDoc to render
115
+ * @returns HTML string for the card
116
+ */
117
+ const renderCard = (doc) => {
118
+ const descHtml = doc.description ? marked_1.marked.parse(doc.description) : '';
119
+ const body = doc.params.map((p) => {
120
+ return `
121
+ <tr>
122
+ <td><code>${escapeHtml(p.name)}</code></td>
123
+ <td>${p.optional ? 'Yes' : 'No'}</td>
124
+ <td>${escapeHtml(p.description)}</td>
125
+ </tr>
126
+ `;
127
+ }).join('\n');
128
+ const paramsHtml = (doc.params.length
129
+ ? `<table class="params">
130
+ <thead><tr><th>Parameter</th><th>Optional</th><th>Description</th></tr></thead>
131
+ <tbody>
132
+ ${body}
133
+ </tbody>
134
+ </table>`
135
+ : '');
136
+ const returnsHtml = doc.returns
137
+ ? `<p class="returns"><span class="label">Returns:</span> ${escapeHtml(doc.returns)}</p>`
138
+ : '';
139
+ return `
140
+ <div class="card" id="fn-${escapeHtml(doc.name)}">
141
+ <h2><code>ky.${escapeHtml(doc.name)}()</code></h2>
142
+ <div class="description">${descHtml}</div>
143
+ ${paramsHtml}
144
+ ${returnsHtml}
145
+ </div>`;
146
+ };
147
+ /**
148
+ * Render a list of FunctionDocs as a table of contents
149
+ * @author Gabe Abrams
150
+ * @param docs List of FunctionDocs to include in the TOC
151
+ * @returns HTML string for the TOC
152
+ */
153
+ const renderToc = (docs) => {
154
+ const items = (docs
155
+ .map((doc) => {
156
+ return `<li><a href="#fn-${escapeHtml(doc.name)}"><code>ky.${escapeHtml(doc.name)}()</code></a></li>`;
157
+ })
158
+ .join('\n '));
159
+ return `<nav class="toc" aria-label="Table of contents">
160
+ <h2>Commands</h2>
161
+ <ul>
162
+ ${items}
163
+ </ul>
164
+ </nav>`;
165
+ };
166
+ /**
167
+ * Build the full HTML document given a list of FunctionDocs
168
+ * @author Gabe Abrams
169
+ * @param docs List of FunctionDocs to include in the document
170
+ * @returns Full HTML string for the document
171
+ */
172
+ const buildHtml = (docs) => {
173
+ const toc = renderToc(docs);
174
+ const cards = docs.map(renderCard).join('\n');
175
+ return `<!DOCTYPE html>
176
+ <html lang="en">
177
+ <head>
178
+ <meta charset="UTF-8" />
179
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
180
+ <title>Ky Functions</title>
181
+ <style>
182
+ *, *::before, *::after { box-sizing: border-box; }
183
+ body {
184
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
185
+ background: #f5f6fa;
186
+ color: #222;
187
+ margin: 0;
188
+ padding: 2rem;
189
+ }
190
+ h1 { font-size: 2rem; margin-bottom: 0.25rem; }
191
+ .subtitle { color: #666; margin-bottom: 1.5rem; }
192
+ .toc {
193
+ background: #fff;
194
+ border-radius: 8px;
195
+ padding: 1.25rem 1.5rem;
196
+ box-shadow: 0 1px 4px rgba(0,0,0,0.10);
197
+ margin-bottom: 2rem;
198
+ }
199
+ .toc h2 { margin: 0 0 0.75rem; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; }
200
+ .toc ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
201
+ .toc a { text-decoration: none; color: #4f7ef8; font-size: 0.9rem; }
202
+ .toc a:hover { text-decoration: underline; }
203
+ .toc code { background: none; font-size: 0.88rem; }
204
+ .grid {
205
+ display: grid;
206
+ grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
207
+ gap: 1.25rem;
208
+ }
209
+ .card {
210
+ background: #fff;
211
+ border-radius: 8px;
212
+ padding: 1.25rem 1.5rem;
213
+ box-shadow: 0 1px 4px rgba(0,0,0,0.10);
214
+ border-left: 4px solid #4f7ef8;
215
+ }
216
+ .card h2 {
217
+ margin: 0 0 0.5rem;
218
+ font-size: 1.1rem;
219
+ color: #1a1a2e;
220
+ }
221
+ .card h2 code {
222
+ background: none;
223
+ font-size: 1.05rem;
224
+ }
225
+ .description { margin-bottom: 0.75rem; line-height: 1.6; }
226
+ .description p { margin: 0 0 0.4rem; }
227
+ .returns { font-size: 0.875rem; color: #444; margin: 0.4rem 0; }
228
+ .label { font-weight: 600; }
229
+ .params {
230
+ width: 100%;
231
+ border-collapse: collapse;
232
+ font-size: 0.85rem;
233
+ margin: 0.5rem 0;
234
+ }
235
+ .params th {
236
+ text-align: left;
237
+ background: #f0f3ff;
238
+ padding: 0.35rem 0.6rem;
239
+ border-bottom: 2px solid #dde3f7;
240
+ }
241
+ .params td {
242
+ padding: 0.3rem 0.6rem;
243
+ border-bottom: 1px solid #eee;
244
+ vertical-align: top;
245
+ }
246
+ .params td code {
247
+ background: #f0f3ff;
248
+ padding: 0.1rem 0.3rem;
249
+ border-radius: 3px;
250
+ font-size: 0.82rem;
251
+ }
252
+ </style>
253
+ </head>
254
+ <body>
255
+ <h1>Ky Functions</h1>
256
+ <p class="subtitle">Ky functions that are available in all Ky projects, in addition to the built-in cypress functions</p>
257
+ ${toc}
258
+ <div class="grid">
259
+ ${cards}
260
+ </div>
261
+ </body>
262
+ </html>`;
263
+ };
264
+ /*----------------------------------------*/
265
+ /* --------------- Main ----------------- */
266
+ /*----------------------------------------*/
267
+ (() => __awaiter(void 0, void 0, void 0, function* () {
268
+ const commandsDir = path_1.default.resolve(__dirname, '../src/commands');
269
+ const files = fs_1.default.readdirSync(commandsDir)
270
+ .filter((f) => {
271
+ return f.endsWith('.ts') && f !== 'index.ts';
272
+ })
273
+ .sort();
274
+ const docs = [];
275
+ for (const file of files) {
276
+ const doc = parseCommandFile(path_1.default.join(commandsDir, file));
277
+ if (doc) {
278
+ docs.push(doc);
279
+ }
280
+ }
281
+ const html = buildHtml(docs);
282
+ const outPath = path_1.default.resolve(__dirname, '../docs/commands.html');
283
+ fs_1.default.writeFileSync(outPath, html, 'utf8');
284
+ }))();
285
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../genDocs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6DAA6D;AAC7D,4CAAoB;AACpB,6DAA6D;AAC7D,gDAAwB;AACxB,6DAA6D;AA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GAAG;;MAED,KAAK;;;QAGH,CAAC;AACT,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,CAAC,GAAS,EAAE;IACV,MAAM,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,YAAE,CAAC,WAAW,CAAC,WAAW,CAAC;SACtC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QACZ,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;IAC/C,CAAC,CAAC;SACD,IAAI,EAAE,CAAC;IAEV,MAAM,IAAI,GAAkB,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,gBAAgB,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3D,IAAI,GAAG,EAAE,CAAC;YACR,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;IACjE,YAAE,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC,CAAA,CAAC,EAAE,CAAC"}
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var path_1 = __importDefault(require("path"));
6
+ const path_1 = __importDefault(require("path"));
7
7
  /**
8
8
  * Get the root path of the project
9
9
  * @author Yuen Ler Chow
10
10
  * @returns the root path of the project
11
11
  */
12
- var getRootPath = function () {
13
- var root = path_1.default.join(__dirname, '../../../../');
12
+ const getRootPath = () => {
13
+ const root = path_1.default.join(__dirname, '../../../../');
14
14
  return root;
15
15
  };
16
16
  exports.default = getRootPath;
@@ -1 +1 @@
1
- {"version":3,"file":"getRootPath.js","sourceRoot":"","sources":["../../../postinstall/helpers/getRootPath.ts"],"names":[],"mappings":";;;;;AAAA,8CAAwB;AAExB;;;;GAIG;AACH,IAAM,WAAW,GAAG;IAClB,IAAM,IAAI,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"getRootPath.js","sourceRoot":"","sources":["../../../postinstall/helpers/getRootPath.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB;;;;GAIG;AACH,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,MAAM,IAAI,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
@@ -9,21 +9,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  // Import libs
12
- var fs_1 = __importDefault(require("fs"));
13
- var path_1 = __importDefault(require("path"));
12
+ const fs_1 = __importDefault(require("fs"));
13
+ const path_1 = __importDefault(require("path"));
14
14
  // Import helpers
15
- var getRootPath_1 = __importDefault(require("./helpers/getRootPath"));
15
+ const getRootPath_1 = __importDefault(require("./helpers/getRootPath"));
16
16
  // Get the project directory
17
- var root = (0, getRootPath_1.default)();
17
+ const root = (0, getRootPath_1.default)();
18
18
  // Read the root package.json
19
19
  // eslint-disable-next-line global-require, import/no-dynamic-require
20
- var pkgJson = require(path_1.default.join(root, 'package.json'));
20
+ const pkgJson = require(path_1.default.join(root, 'package.json'));
21
21
  // Ensure scripts field exists
22
22
  if (!pkgJson.scripts) {
23
23
  pkgJson.scripts = {};
24
24
  }
25
25
  // Keep track if something was modified
26
- var modified = false;
26
+ let modified = false;
27
27
  // Add ky:setup script
28
28
  if (!pkgJson.scripts['ky:setup']) {
29
29
  pkgJson.scripts['ky:setup'] = 'npm explore dceky -- npm run ky:setup';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../postinstall/index.ts"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B;;;GAGG;;;;;AAEH,cAAc;AACd,0CAAoB;AACpB,8CAAwB;AAExB,iBAAiB;AACjB,sEAAgD;AAEhD,4BAA4B;AAC5B,IAAM,IAAI,GAAG,IAAA,qBAAW,GAAE,CAAC;AAE3B,6BAA6B;AAC7B,qEAAqE;AACrE,IAAM,OAAO,GAAG,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;AAEzD,8BAA8B;AAC9B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACrB,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;AACvB,CAAC;AAED,uCAAuC;AACvC,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB,sBAAsB;AACtB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACjC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,uCAAuC,CAAC;IACtE,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC;AAED,sBAAsB;AACtB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACjC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,uCAAuC,CAAC;IACtE,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC;AAED,oBAAoB;AACpB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC/B,OAAO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