dceky 1.0.0-beta.6 → 1.0.2

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 (199) hide show
  1. package/.eslintrc.js +93 -0
  2. package/README.md +41 -0
  3. package/cypress/e2e/profile-test.cy.ts +10 -0
  4. package/cypress/fixtures/example.json +5 -0
  5. package/cypress/support/commands.ts +37 -0
  6. package/cypress/support/e2e.ts +17 -0
  7. package/cypress.config.ts +9 -0
  8. package/docs/GlobalsAndProfiles.md +23 -0
  9. package/lib/setup/addToGitIgnore.d.ts +6 -0
  10. package/lib/setup/addToGitIgnore.js +46 -0
  11. package/lib/setup/addToGitIgnore.js.map +1 -0
  12. package/lib/setup/checkRequiredFiles.d.ts +6 -0
  13. package/lib/setup/checkRequiredFiles.js +58 -0
  14. package/lib/setup/checkRequiredFiles.js.map +1 -0
  15. package/lib/setup/genCommandImportFile.d.ts +7 -0
  16. package/lib/setup/genCommandImportFile.js +66 -0
  17. package/lib/setup/genCommandImportFile.js.map +1 -0
  18. package/lib/setup/genConfiguration/helpers/resolveDependents.d.ts +13 -0
  19. package/lib/setup/genConfiguration/helpers/resolveDependents.js +50 -0
  20. package/lib/setup/genConfiguration/helpers/resolveDependents.js.map +1 -0
  21. package/lib/setup/genConfiguration/helpers/splitEnv.d.ts +10 -0
  22. package/lib/setup/genConfiguration/helpers/splitEnv.js +27 -0
  23. package/lib/setup/genConfiguration/helpers/splitEnv.js.map +1 -0
  24. package/lib/setup/genConfiguration/index.d.ts +15 -0
  25. package/lib/setup/genConfiguration/index.js +86 -0
  26. package/lib/setup/genConfiguration/index.js.map +1 -0
  27. package/lib/setup/genConfiguration/types/DependentValue.d.ts +11 -0
  28. package/lib/setup/genConfiguration/types/DependentValue.js +3 -0
  29. package/lib/setup/genConfiguration/types/DependentValue.js.map +1 -0
  30. package/lib/setup/genConfiguration/types/GlobalsOrProfile.d.ts +9 -0
  31. package/lib/setup/genConfiguration/types/GlobalsOrProfile.js +3 -0
  32. package/lib/setup/genConfiguration/types/GlobalsOrProfile.js.map +1 -0
  33. package/lib/setup/genConfiguration/types/SplitEnv.d.ts +13 -0
  34. package/lib/setup/genConfiguration/types/SplitEnv.js +3 -0
  35. package/lib/setup/genConfiguration/types/SplitEnv.js.map +1 -0
  36. package/lib/setup/genConfigurationFile.d.ts +2 -0
  37. package/lib/setup/genConfigurationFile.js +63 -0
  38. package/lib/setup/genConfigurationFile.js.map +1 -0
  39. package/lib/setup/genDynamicConfigFile.d.ts +5 -0
  40. package/lib/setup/genDynamicConfigFile.js +28 -0
  41. package/lib/setup/genDynamicConfigFile.js.map +1 -0
  42. package/lib/setup/index.d.ts +1 -0
  43. package/lib/setup/index.js +16 -0
  44. package/lib/setup/index.js.map +1 -0
  45. package/lib/setup/setupCypressDependencies.d.ts +6 -0
  46. package/lib/setup/setupCypressDependencies.js +40 -0
  47. package/lib/setup/setupCypressDependencies.js.map +1 -0
  48. package/lib/src/commands/assertDoesNotHaveClass.d.ts +20 -0
  49. package/lib/src/commands/assertDoesNotHaveClass.js +17 -0
  50. package/lib/src/commands/assertDoesNotHaveClass.js.map +1 -0
  51. package/lib/src/commands/assertHasClass.d.ts +20 -0
  52. package/lib/src/commands/assertHasClass.js +17 -0
  53. package/lib/src/commands/assertHasClass.js.map +1 -0
  54. package/lib/src/commands/assertNumElements.d.ts +19 -0
  55. package/lib/src/commands/assertNumElements.js +17 -0
  56. package/lib/src/commands/assertNumElements.js.map +1 -0
  57. package/lib/src/commands/extractDataFromClass.d.ts +18 -0
  58. package/lib/src/commands/extractDataFromClass.js +25 -0
  59. package/lib/src/commands/extractDataFromClass.js.map +1 -0
  60. package/lib/src/commands/extractDataFromClassByContents.d.ts +19 -0
  61. package/lib/src/commands/extractDataFromClassByContents.js +26 -0
  62. package/lib/src/commands/extractDataFromClassByContents.js.map +1 -0
  63. package/lib/src/commands/getJSON.d.ts +16 -0
  64. package/lib/src/commands/getJSON.js +21 -0
  65. package/lib/src/commands/getJSON.js.map +1 -0
  66. package/lib/src/commands/getNumElements.d.ts +15 -0
  67. package/lib/src/commands/getNumElements.js +19 -0
  68. package/lib/src/commands/getNumElements.js.map +1 -0
  69. package/lib/src/commands/handleHarvardKey.d.ts +15 -0
  70. package/lib/src/commands/handleHarvardKey.js +53 -0
  71. package/lib/src/commands/handleHarvardKey.js.map +1 -0
  72. package/lib/src/commands/launchAs.d.ts +25 -0
  73. package/lib/src/commands/launchAs.js +66 -0
  74. package/lib/src/commands/launchAs.js.map +1 -0
  75. package/lib/src/commands/launchLTIUsingToken.d.ts +21 -0
  76. package/lib/src/commands/launchLTIUsingToken.js +68 -0
  77. package/lib/src/commands/launchLTIUsingToken.js.map +1 -0
  78. package/lib/src/commands/navigateToHref.d.ts +15 -0
  79. package/lib/src/commands/navigateToHref.js +35 -0
  80. package/lib/src/commands/navigateToHref.js.map +1 -0
  81. package/lib/src/commands/runScript.d.ts +15 -0
  82. package/lib/src/commands/runScript.js +20 -0
  83. package/lib/src/commands/runScript.js.map +1 -0
  84. package/lib/src/commands/typeInto.d.ts +24 -0
  85. package/lib/src/commands/typeInto.js +41 -0
  86. package/lib/src/commands/typeInto.js.map +1 -0
  87. package/lib/src/commands/visitCanvasGETEndpoint.d.ts +20 -0
  88. package/lib/src/commands/visitCanvasGETEndpoint.js +26 -0
  89. package/lib/src/commands/visitCanvasGETEndpoint.js.map +1 -0
  90. package/lib/src/commands/waitForElementVisible.d.ts +16 -0
  91. package/lib/src/commands/waitForElementVisible.js +19 -0
  92. package/lib/src/commands/waitForElementVisible.js.map +1 -0
  93. package/lib/src/genConfiguration/helpers/resolveDependents.d.ts +13 -0
  94. package/lib/src/genConfiguration/helpers/resolveDependents.js +50 -0
  95. package/lib/src/genConfiguration/helpers/resolveDependents.js.map +1 -0
  96. package/lib/src/genConfiguration/helpers/splitEnv.d.ts +10 -0
  97. package/lib/src/genConfiguration/helpers/splitEnv.js +27 -0
  98. package/lib/src/genConfiguration/helpers/splitEnv.js.map +1 -0
  99. package/{src/genConfiguration.ts → lib/src/genConfiguration/index.d.ts} +3 -6
  100. package/lib/src/genConfiguration/index.js +88 -0
  101. package/lib/src/genConfiguration/index.js.map +1 -0
  102. package/lib/src/genConfiguration/types/DependentValue.d.ts +11 -0
  103. package/lib/src/genConfiguration/types/DependentValue.js +3 -0
  104. package/lib/src/genConfiguration/types/DependentValue.js.map +1 -0
  105. package/lib/src/genConfiguration/types/GlobalsOrProfile.d.ts +9 -0
  106. package/lib/src/genConfiguration/types/GlobalsOrProfile.js +3 -0
  107. package/lib/src/genConfiguration/types/GlobalsOrProfile.js.map +1 -0
  108. package/lib/src/genConfiguration/types/SplitEnv.d.ts +13 -0
  109. package/lib/src/genConfiguration/types/SplitEnv.js +3 -0
  110. package/lib/src/genConfiguration/types/SplitEnv.js.map +1 -0
  111. package/lib/{index.d.ts → src/index.d.ts} +1 -1
  112. package/lib/{index.js → src/index.js} +6 -3
  113. package/lib/src/index.js.map +1 -0
  114. package/lib/src/init.d.ts +6 -0
  115. package/lib/src/init.js +45 -0
  116. package/lib/src/init.js.map +1 -0
  117. package/lib/start/constants/AVAILABLE_BROWSERS.d.ts +9 -0
  118. package/lib/start/constants/AVAILABLE_BROWSERS.js +27 -0
  119. package/lib/start/constants/AVAILABLE_BROWSERS.js.map +1 -0
  120. package/lib/start/helpers/exec.d.ts +8 -0
  121. package/lib/start/helpers/exec.js +18 -0
  122. package/lib/start/helpers/exec.js.map +1 -0
  123. package/lib/start/helpers/extractArgValue.d.ts +10 -0
  124. package/lib/start/helpers/extractArgValue.js +39 -0
  125. package/lib/start/helpers/extractArgValue.js.map +1 -0
  126. package/lib/start/helpers/findProfilesByNames.d.ts +16 -0
  127. package/lib/start/helpers/findProfilesByNames.js +35 -0
  128. package/lib/start/helpers/findProfilesByNames.js.map +1 -0
  129. package/lib/start/helpers/parseCommaSeparated.d.ts +8 -0
  130. package/lib/start/helpers/parseCommaSeparated.js +23 -0
  131. package/lib/start/helpers/parseCommaSeparated.js.map +1 -0
  132. package/lib/start/helpers/print.d.ts +38 -0
  133. package/lib/start/helpers/print.js +145 -0
  134. package/lib/start/helpers/print.js.map +1 -0
  135. package/lib/start/helpers/prompt.d.ts +8 -0
  136. package/lib/start/helpers/prompt.js +25 -0
  137. package/lib/start/helpers/prompt.js.map +1 -0
  138. package/lib/start/helpers/showChooser.d.ts +21 -0
  139. package/lib/start/helpers/showChooser.js +116 -0
  140. package/lib/start/helpers/showChooser.js.map +1 -0
  141. package/lib/start/helpers/validateBrowsers.d.ts +8 -0
  142. package/lib/start/helpers/validateBrowsers.js +36 -0
  143. package/lib/start/helpers/validateBrowsers.js.map +1 -0
  144. package/lib/start/index.d.ts +7 -0
  145. package/lib/start/index.js +139 -0
  146. package/lib/start/index.js.map +1 -0
  147. package/lib/start/types/ChooserOption.d.ts +10 -0
  148. package/lib/start/types/ChooserOption.js +3 -0
  149. package/lib/start/types/ChooserOption.js.map +1 -0
  150. package/package.json +28 -8
  151. package/setup/addToGitIgnore.ts +47 -0
  152. package/setup/checkRequiredFiles.ts +62 -0
  153. package/setup/genCommandImportFile.ts +75 -0
  154. package/setup/genDynamicConfigFile.ts +28 -0
  155. package/setup/index.ts +11 -0
  156. package/setup/setupCypressDependencies.ts +38 -0
  157. package/src/commands/assertDoesNotHaveClass.ts +51 -0
  158. package/src/commands/assertHasClass.ts +51 -0
  159. package/src/commands/assertNumElements.ts +50 -0
  160. package/src/commands/extractDataFromClass.ts +52 -0
  161. package/src/commands/extractDataFromClassByContents.ts +55 -0
  162. package/src/commands/getJSON.ts +45 -0
  163. package/src/commands/getNumElements.ts +45 -0
  164. package/src/commands/handleHarvardKey.ts +91 -0
  165. package/src/commands/launchAs.ts +120 -0
  166. package/src/commands/launchLTIUsingToken.ts +115 -0
  167. package/src/commands/navigateToHref.ts +60 -0
  168. package/src/commands/runScript.ts +44 -0
  169. package/src/commands/typeInto.ts +88 -0
  170. package/src/commands/visitCanvasGETEndpoint.ts +61 -0
  171. package/src/commands/waitForElementVisible.ts +49 -0
  172. package/src/genConfiguration/helpers/resolveDependents.ts +47 -0
  173. package/src/genConfiguration/helpers/splitEnv.ts +30 -0
  174. package/src/genConfiguration/index.ts +94 -0
  175. package/src/genConfiguration/types/DependentValue.ts +14 -0
  176. package/src/genConfiguration/types/GlobalsOrProfile.ts +12 -0
  177. package/src/genConfiguration/types/SplitEnv.ts +18 -0
  178. package/src/index.ts +7 -4
  179. package/src/init.ts +36 -17
  180. package/start/constants/AVAILABLE_BROWSERS.ts +28 -0
  181. package/start/helpers/exec.ts +17 -0
  182. package/start/helpers/extractArgValue.ts +42 -0
  183. package/start/helpers/findProfilesByNames.ts +39 -0
  184. package/start/helpers/parseCommaSeparated.ts +23 -0
  185. package/start/helpers/print.ts +155 -0
  186. package/start/helpers/prompt.ts +23 -0
  187. package/start/helpers/showChooser.ts +140 -0
  188. package/start/helpers/validateBrowsers.ts +35 -0
  189. package/start/index.ts +163 -0
  190. package/start/types/ChooserOption.ts +11 -0
  191. package/tsconfig.json +3 -4
  192. package/.eslintrc.json +0 -58
  193. package/lib/genConfiguration.d.ts +0 -8
  194. package/lib/genConfiguration.js +0 -13
  195. package/lib/genConfiguration.js.map +0 -1
  196. package/lib/index.js.map +0 -1
  197. package/lib/init.d.ts +0 -13
  198. package/lib/init.js +0 -10
  199. package/lib/init.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ /**
15
+ * Resolve all dependent values using already-merged basics.
16
+ * @author Gardenia Liu
17
+ * @param dependentMaps with dependencies on basics
18
+ * @param basics entries
19
+ * @returns env with all dependent values resolved
20
+ */
21
+ var resolveDependents = function (dependentMaps, basics) {
22
+ var resolved = {};
23
+ // Loop through all of the dependency maps
24
+ dependentMaps.forEach(function (depMap) {
25
+ // Loop through all entries within dependency map
26
+ Object.entries(depMap).forEach(function (_a) {
27
+ var k = _a[0], depVal = _a[1];
28
+ // Get basic selector the value depends on
29
+ var selector = basics[depVal.dependsOn];
30
+ // Create table of values selector can be
31
+ var _b = depVal, dependsOn = _b.dependsOn, table = __rest(_b, ["dependsOn"]);
32
+ // Get the selector's picked value
33
+ var picked = table[selector];
34
+ if (picked !== undefined) {
35
+ resolved[k] = picked;
36
+ }
37
+ else if ('default' in table) {
38
+ resolved[k] = table.default;
39
+ }
40
+ else {
41
+ // eslint-disable-next-line max-len
42
+ console.warn("[cypress.config] Could not resolve ".concat(k, ", dependsOn=").concat(dependsOn, ", selector=").concat(String(selector)));
43
+ process.exit(1);
44
+ }
45
+ });
46
+ });
47
+ return resolved;
48
+ };
49
+ exports.default = resolveDependents;
50
+ //# sourceMappingURL=resolveDependents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveDependents.js","sourceRoot":"","sources":["../../../../src/genConfiguration/helpers/resolveDependents.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAKA;;;;;;GAMG;AACH,IAAM,iBAAiB,GAAG,UACxB,aAAgD,EAChD,MAAwB;IAExB,IAAM,QAAQ,GAAqB,EAAE,CAAC;IAEtC,0CAA0C;IAC1C,aAAa,CAAC,OAAO,CAAC,UAAC,MAAM;QAC3B,iDAAiD;QACjD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAC,EAAW;gBAAV,CAAC,QAAA,EAAE,MAAM,QAAA;YACxC,0CAA0C;YAC1C,IAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAE1C,yCAAyC;YACzC,IAAM,KAA0B,MAAkC,EAA1D,SAAS,eAAA,EAAK,KAAK,cAArB,aAAuB,CAAqC,CAAC;YAEnE,kCAAkC;YAClC,IAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;YAE/B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;YACvB,CAAC;iBAAM,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;gBAC9B,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACN,mCAAmC;gBACnC,OAAO,CAAC,IAAI,CAAC,6CAAsC,CAAC,yBAAe,SAAS,wBAAc,MAAM,CAAC,QAAQ,CAAC,CAAE,CAAC,CAAC;gBAC9G,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type GlobalsOrProfile from '../types/GlobalsOrProfile';
2
+ import type SplitEnv from '../types/SplitEnv';
3
+ /**
4
+ * Split one map into basic and dependent values
5
+ * @author Gardenia Liu
6
+ * @param map to split
7
+ * @returns split basic and dependent values map
8
+ */
9
+ declare const splitEnv: (map: GlobalsOrProfile) => SplitEnv;
10
+ export default splitEnv;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Split one map into basic and dependent values
5
+ * @author Gardenia Liu
6
+ * @param map to split
7
+ * @returns split basic and dependent values map
8
+ */
9
+ var splitEnv = function (map) {
10
+ var basic = {};
11
+ var dependent = {};
12
+ Object.entries(map).forEach(function (_a) {
13
+ var k = _a[0], v = _a[1];
14
+ // If entry has dependsOn relationship, add it to dependent dictionary
15
+ if (typeof v === 'object' && 'dependsOn' in v) {
16
+ dependent[k] = v;
17
+ // Otherwise, add it to basic dictionary
18
+ }
19
+ else {
20
+ basic[k] = v;
21
+ }
22
+ });
23
+ // Returns separated basic and dependent values
24
+ return { basic: basic, dependent: dependent };
25
+ };
26
+ exports.default = splitEnv;
27
+ //# sourceMappingURL=splitEnv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splitEnv.js","sourceRoot":"","sources":["../../../../src/genConfiguration/helpers/splitEnv.ts"],"names":[],"mappings":";;AAKA;;;;;GAKG;AACH,IAAM,QAAQ,GAAG,UAAC,GAAqB;IACrC,IAAM,KAAK,GAAqB,EAAE,CAAC;IACnC,IAAM,SAAS,GAAoC,EAAE,CAAC;IAEtD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,UAAC,EAAM;YAAL,CAAC,QAAA,EAAE,CAAC,QAAA;QAChC,sEAAsE;QACtE,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC;YAC9C,SAAS,CAAC,CAAC,CAAC,GAAG,CAAmB,CAAC;YACrC,wCAAwC;QACxC,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,+CAA+C;IAC/C,OAAO,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -1,11 +1,8 @@
1
1
  /**
2
2
  * Generate Cypress configuration based on global credentials,
3
3
  * variables, resources, and profiles
4
- * @author Yuen Ler Chow
5
- * ...
4
+ * @author Gardenia Liu
5
+ * @author Gabe Abrams
6
6
  */
7
- const genConfiguration = () => {
8
- return {};
9
- };
10
-
7
+ declare const genConfiguration: () => Cypress.ConfigOptions<any>;
11
8
  export default genConfiguration;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /* eslint-disable no-console */
18
+ /* eslint-disable global-require */
19
+ /* eslint-disable import/no-dynamic-require */
20
+ var path_1 = __importDefault(require("path"));
21
+ // Import cypress
22
+ var cypress_1 = require("cypress");
23
+ // Import external libraries
24
+ var deepmerge_1 = __importDefault(require("deepmerge"));
25
+ // Import helpers
26
+ var splitEnv_1 = __importDefault(require("./helpers/splitEnv"));
27
+ var resolveDependents_1 = __importDefault(require("./helpers/resolveDependents"));
28
+ // Determine project directory
29
+ var CWD = path_1.default.join(__dirname, '../..');
30
+ /**
31
+ * Generate Cypress configuration based on global credentials,
32
+ * variables, resources, and profiles
33
+ * @author Gardenia Liu
34
+ * @author Gabe Abrams
35
+ */
36
+ var genConfiguration = function () {
37
+ var _a, _b;
38
+ // Define paths
39
+ var GLOBALS_PATH = path_1.default.join(CWD, '/cypress/globals');
40
+ var PROFILES_PATH = path_1.default.join(CWD, '/cypress/profiles');
41
+ // Import global env var objects
42
+ var GlobalCredentials = require(path_1.default.join(GLOBALS_PATH, '/GlobalCredentials'));
43
+ var GlobalResources = require(path_1.default.join(GLOBALS_PATH, '/GlobalResources'));
44
+ var GlobalValues = require(path_1.default.join(GLOBALS_PATH, '/GlobalValues'));
45
+ // Determine profile file name (default is stage)
46
+ var profileName = process.env.CYPRESS_PROFILE || 'stage';
47
+ // Load in chosen profile configuration
48
+ var profileModules = {};
49
+ try {
50
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
51
+ var mod = require(path_1.default.join(PROFILES_PATH, "/".concat(profileName, ".Profile")));
52
+ profileModules = ((_b = (_a = mod === null || mod === void 0 ? void 0 : mod.default) !== null && _a !== void 0 ? _a : mod) !== null && _b !== void 0 ? _b : {});
53
+ }
54
+ catch (e) {
55
+ console.warn("[cypress.config] Could not load profile '".concat(profileName, ".Profile'"), e);
56
+ process.exit(1);
57
+ }
58
+ // NOTE: Order matters (later overrides earlier)
59
+ var sources = [GlobalCredentials, GlobalResources, GlobalValues, profileModules];
60
+ // Split all sources into basic and dependent
61
+ var splits = sources.map(function (source) {
62
+ return (0, splitEnv_1.default)(source);
63
+ });
64
+ // Extract basic and dependent values from splits
65
+ var basicValues = splits.map(function (s) {
66
+ return s.basic;
67
+ });
68
+ var dependentValues = splits.map(function (s) {
69
+ return s.dependent;
70
+ });
71
+ // Merge all of the basics
72
+ var basics = deepmerge_1.default.all(basicValues);
73
+ // Resolve dependencies
74
+ var dependents = (0, resolveDependents_1.default)(dependentValues, basics);
75
+ // Add basics, depends, and profileName into the final env
76
+ var finalEnv = __assign(__assign(__assign({}, basics), dependents), { profileName: profileName });
77
+ var baseUrl = finalEnv.baseURL;
78
+ // Return the configuration object
79
+ return (0, cypress_1.defineConfig)({
80
+ e2e: {
81
+ experimentalOriginDependencies: true,
82
+ baseUrl: baseUrl,
83
+ env: finalEnv,
84
+ },
85
+ });
86
+ };
87
+ exports.default = genConfiguration;
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/genConfiguration/index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Value for a dependent entry
3
+ * @author Gardenia Liu
4
+ */
5
+ type DependentValue = {
6
+ dependsOn: string;
7
+ } & {
8
+ [k: string]: any;
9
+ default?: any;
10
+ };
11
+ export default DependentValue;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=DependentValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DependentValue.js","sourceRoot":"","sources":["../../../../src/genConfiguration/types/DependentValue.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Object containing global variables, profile values, etc.
3
+ * @author Gardenia Liu
4
+ */
5
+ type GlobalsOrProfile = {
6
+ baseURL?: string;
7
+ [k: string]: any;
8
+ };
9
+ export default GlobalsOrProfile;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=GlobalsOrProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlobalsOrProfile.js","sourceRoot":"","sources":["../../../../src/genConfiguration/types/GlobalsOrProfile.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type GlobalsOrProfile from './GlobalsOrProfile';
2
+ import type DependentValue from './DependentValue';
3
+ /**
4
+ * Env type where basic and dependent entries are separated
5
+ * @author Gardenia Liu
6
+ */
7
+ type SplitEnv = {
8
+ basic: GlobalsOrProfile;
9
+ dependent: {
10
+ [k: string]: DependentValue;
11
+ };
12
+ };
13
+ export default SplitEnv;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=SplitEnv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplitEnv.js","sourceRoot":"","sources":["../../../../src/genConfiguration/types/SplitEnv.ts"],"names":[],"mappings":""}
@@ -1,3 +1,3 @@
1
1
  import init from './init';
2
2
  import genConfiguration from './genConfiguration';
3
- export { genConfiguration, init, };
3
+ export { init, genConfiguration, };
@@ -3,11 +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
- exports.init = exports.genConfiguration = void 0;
6
+ exports.genConfiguration = exports.init = void 0;
7
+ // Import helpers
7
8
  var init_1 = __importDefault(require("./init"));
8
9
  exports.init = init_1.default;
9
10
  var genConfiguration_1 = __importDefault(require("./genConfiguration"));
10
11
  exports.genConfiguration = genConfiguration_1.default;
11
- // Automatically initialize upon importing the library
12
- (0, init_1.default)();
12
+ // Automatically initialize upon importing the library, only run in Cypress context
13
+ if (typeof Cypress !== 'undefined') {
14
+ (0, init_1.default)();
15
+ }
13
16
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iBAAiB;AACjB,gDAA0B;AAUxB,eAVK,cAAI,CAUL;AATN,wEAAkD;AAUhD,2BAVK,0BAAgB,CAUL;AARlB,mFAAmF;AACnF,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;IACnC,IAAA,cAAI,GAAE,CAAC;AACT,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Initialize custom commands
3
+ * @author Gabe Abrams
4
+ */
5
+ declare const init: () => void;
6
+ export default init;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ // Import all commands
7
+ var assertDoesNotHaveClass_1 = __importDefault(require("./commands/assertDoesNotHaveClass"));
8
+ var assertHasClass_1 = __importDefault(require("./commands/assertHasClass"));
9
+ var assertNumElements_1 = __importDefault(require("./commands/assertNumElements"));
10
+ var extractDataFromClass_1 = __importDefault(require("./commands/extractDataFromClass"));
11
+ var extractDataFromClassByContents_1 = __importDefault(require("./commands/extractDataFromClassByContents"));
12
+ var getJSON_1 = __importDefault(require("./commands/getJSON"));
13
+ var getNumElements_1 = __importDefault(require("./commands/getNumElements"));
14
+ var handleHarvardKey_1 = __importDefault(require("./commands/handleHarvardKey"));
15
+ var launchAs_1 = __importDefault(require("./commands/launchAs"));
16
+ var launchLTIUsingToken_1 = __importDefault(require("./commands/launchLTIUsingToken"));
17
+ var navigateToHref_1 = __importDefault(require("./commands/navigateToHref"));
18
+ var runScript_1 = __importDefault(require("./commands/runScript"));
19
+ var typeInto_1 = __importDefault(require("./commands/typeInto"));
20
+ var visitCanvasGETEndpoint_1 = __importDefault(require("./commands/visitCanvasGETEndpoint"));
21
+ var waitForElementVisible_1 = __importDefault(require("./commands/waitForElementVisible"));
22
+ /**
23
+ * Initialize custom commands
24
+ * @author Gabe Abrams
25
+ */
26
+ var init = function () {
27
+ // Execute each command adder
28
+ (0, assertDoesNotHaveClass_1.default)();
29
+ (0, assertHasClass_1.default)();
30
+ (0, assertNumElements_1.default)();
31
+ (0, getNumElements_1.default)();
32
+ (0, handleHarvardKey_1.default)();
33
+ (0, launchAs_1.default)();
34
+ (0, launchLTIUsingToken_1.default)();
35
+ (0, navigateToHref_1.default)();
36
+ (0, runScript_1.default)();
37
+ (0, typeInto_1.default)();
38
+ (0, visitCanvasGETEndpoint_1.default)();
39
+ (0, waitForElementVisible_1.default)();
40
+ (0, extractDataFromClass_1.default)();
41
+ (0, extractDataFromClassByContents_1.default)();
42
+ (0, getJSON_1.default)();
43
+ };
44
+ exports.default = init;
45
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":";;;;;AAAA,sBAAsB;AACtB,6FAAuE;AACvE,6EAAuD;AACvD,mFAA6D;AAC7D,yFAAmE;AACnE,6GAAuF;AACvF,+DAAyC;AACzC,6EAAuD;AACvD,iFAA2D;AAC3D,iEAA2C;AAC3C,uFAAiE;AACjE,6EAAuD;AACvD,mEAA6C;AAC7C,iEAA2C;AAC3C,6FAAuE;AACvE,2FAAqE;AAErE;;;GAGG;AACH,IAAM,IAAI,GAAG;IACX,6BAA6B;IAC7B,IAAA,gCAAsB,GAAE,CAAC;IACzB,IAAA,wBAAc,GAAE,CAAC;IACjB,IAAA,2BAAiB,GAAE,CAAC;IACpB,IAAA,wBAAc,GAAE,CAAC;IACjB,IAAA,0BAAgB,GAAE,CAAC;IACnB,IAAA,kBAAQ,GAAE,CAAC;IACX,IAAA,6BAAmB,GAAE,CAAC;IACtB,IAAA,wBAAc,GAAE,CAAC;IACjB,IAAA,mBAAS,GAAE,CAAC;IACZ,IAAA,kBAAQ,GAAE,CAAC;IACX,IAAA,gCAAsB,GAAE,CAAC;IACzB,IAAA,+BAAqB,GAAE,CAAC;IACxB,IAAA,8BAAoB,GAAE,CAAC;IACvB,IAAA,wCAA8B,GAAE,CAAC;IACjC,IAAA,iBAAO,GAAE,CAAC;AACZ,CAAC,CAAC;AAEF,kBAAe,IAAI,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Available browsers for Cypress tests
3
+ * @author Yuen Ler Chow
4
+ */
5
+ declare const AVAILABLE_BROWSERS: {
6
+ name: string;
7
+ tag: string;
8
+ }[];
9
+ export default AVAILABLE_BROWSERS;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Available browsers for Cypress tests
5
+ * @author Yuen Ler Chow
6
+ */
7
+ var AVAILABLE_BROWSERS = [
8
+ {
9
+ name: 'chrome',
10
+ tag: 'C',
11
+ },
12
+ {
13
+ name: 'firefox',
14
+ tag: 'F',
15
+ },
16
+ {
17
+ name: 'edge',
18
+ tag: 'E',
19
+ },
20
+ {
21
+ name: 'safari',
22
+ tag: 'S',
23
+ },
24
+ ];
25
+ // Export only the browser names in lowercase
26
+ exports.default = AVAILABLE_BROWSERS;
27
+ //# sourceMappingURL=AVAILABLE_BROWSERS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AVAILABLE_BROWSERS.js","sourceRoot":"","sources":["../../../start/constants/AVAILABLE_BROWSERS.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH,IAAM,kBAAkB,GAGlB;IACJ;QACE,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,GAAG;KACT;IACD;QACE,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,GAAG;KACT;IACD;QACE,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,GAAG;KACT;IACD;QACE,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,GAAG;KACT;CACF,CAAC;AAEF,6CAA6C;AAC7C,kBAAe,kBAAkB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Execute a command
3
+ * @author Gabe Abrams
4
+ * @param command the command to execute
5
+ * @param printToStdOut if true, print to standard out instead of returning
6
+ */
7
+ declare const exec: (command: string, printToStdOut?: boolean) => string;
8
+ export default exec;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var child_process_1 = require("child_process");
4
+ /**
5
+ * Execute a command
6
+ * @author Gabe Abrams
7
+ * @param command the command to execute
8
+ * @param printToStdOut if true, print to standard out instead of returning
9
+ */
10
+ var exec = function (command, printToStdOut) {
11
+ if (printToStdOut) {
12
+ (0, child_process_1.execSync)(command, { stdio: 'inherit' });
13
+ return '';
14
+ }
15
+ return (0, child_process_1.execSync)(command).toString();
16
+ };
17
+ exports.default = exec;
18
+ //# sourceMappingURL=exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../../start/helpers/exec.ts"],"names":[],"mappings":";;AAAA,+CAAyC;AAEzC;;;;;GAKG;AACH,IAAM,IAAI,GAAG,UAAC,OAAe,EAAE,aAAuB;IACpD,IAAI,aAAa,EAAE,CAAC;QAClB,IAAA,wBAAQ,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACxC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,IAAA,wBAAQ,EAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACtC,CAAC,CAAC;AAEF,kBAAe,IAAI,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Extract CLI argument value or check if flag exists
3
+ * @author Gardenia Liu
4
+ * @author Yuen Ler Chow
5
+ * @param args array of CLI arguments
6
+ * @param argName the argument name to look for (e.g., '--profile' or '--headless')
7
+ * @returns the argument value if found, empty string if flag exists without value, undefined otherwise
8
+ */
9
+ declare const extractArgValue: (args: string[], argName: string) => string | undefined;
10
+ export default extractArgValue;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Extract CLI argument value or check if flag exists
5
+ * @author Gardenia Liu
6
+ * @author Yuen Ler Chow
7
+ * @param args array of CLI arguments
8
+ * @param argName the argument name to look for (e.g., '--profile' or '--headless')
9
+ * @returns the argument value if found, empty string if flag exists without value, undefined otherwise
10
+ */
11
+ var extractArgValue = function (args, argName) {
12
+ var matchedValue;
13
+ args.some(function (rawArg, index) {
14
+ var normalizedArg = rawArg.toLowerCase();
15
+ // Case 1: flag and value combined, e.g. "--profile=stage"
16
+ if (normalizedArg.startsWith("".concat(argName, "="))) {
17
+ var _a = rawArg.split('='), value = _a[1];
18
+ matchedValue = value;
19
+ return true; // stop scanning
20
+ }
21
+ // Case 2: flag by itself, possibly followed by a separate value
22
+ if (normalizedArg === argName) {
23
+ var nextArg = args[index + 1];
24
+ // If the next token exists and isn't another flag, treat it as the value
25
+ if (nextArg && !nextArg.startsWith('--')) {
26
+ matchedValue = nextArg;
27
+ }
28
+ else {
29
+ // Flag exists but no value given (boolean-style flag) (e.g. "--headless")
30
+ matchedValue = '';
31
+ }
32
+ return true; // stop scanning
33
+ }
34
+ return false;
35
+ });
36
+ return matchedValue;
37
+ };
38
+ exports.default = extractArgValue;
39
+ //# sourceMappingURL=extractArgValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractArgValue.js","sourceRoot":"","sources":["../../../start/helpers/extractArgValue.ts"],"names":[],"mappings":";;AAAA;;;;;;;GAOG;AACH,IAAM,eAAe,GAAG,UAAC,IAAc,EAAE,OAAe;IACtD,IAAI,YAAgC,CAAC;IACrC,IAAI,CAAC,IAAI,CAAC,UAAC,MAAM,EAAE,KAAK;QACtB,IAAM,aAAa,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QAE3C,0DAA0D;QAC1D,IAAI,aAAa,CAAC,UAAU,CAAC,UAAG,OAAO,MAAG,CAAC,EAAE,CAAC;YACtC,IAAA,KAAY,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAA1B,KAAK,QAAqB,CAAC;YACpC,YAAY,GAAG,KAAK,CAAC;YACrB,OAAO,IAAI,CAAC,CAAC,gBAAgB;QAC/B,CAAC;QAED,gEAAgE;QAChE,IAAI,aAAa,KAAK,OAAO,EAAE,CAAC;YAC9B,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAEhC,yEAAyE;YACzE,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzC,YAAY,GAAG,OAAO,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,0EAA0E;gBAC1E,YAAY,GAAG,EAAE,CAAC;YACpB,CAAC;YAED,OAAO,IAAI,CAAC,CAAC,gBAAgB;QAC/B,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Find profiles by names
3
+ * @author Gardenia Liu
4
+ * @author Yuen Ler Chow
5
+ * @param names array of profile names to find
6
+ * @param profiles array of available profiles
7
+ * @returns array of found profiles
8
+ */
9
+ declare const findProfilesByNames: (names: string[], profiles: Array<{
10
+ file: string;
11
+ profileName: string;
12
+ }>) => Array<{
13
+ file: string;
14
+ profileName: string;
15
+ }>;
16
+ export default findProfilesByNames;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Find profiles by names
5
+ * @author Gardenia Liu
6
+ * @author Yuen Ler Chow
7
+ * @param names array of profile names to find
8
+ * @param profiles array of available profiles
9
+ * @returns array of found profiles
10
+ */
11
+ var findProfilesByNames = function (names, profiles) {
12
+ var found = [];
13
+ var notFound = [];
14
+ names.forEach(function (name) {
15
+ var target = name.toLowerCase();
16
+ // Find matching profile (case-insensitive)
17
+ var match = profiles.find(function (p) {
18
+ return p.profileName.toLowerCase() === target;
19
+ });
20
+ if (match) {
21
+ found.push(match);
22
+ }
23
+ else {
24
+ notFound.push(name);
25
+ }
26
+ });
27
+ if (notFound.length > 0) {
28
+ // eslint-disable-next-line no-console
29
+ console.error("Profile(s) not found: ".concat(notFound.join(', '), ". Available profiles: ").concat(profiles.map(function (p) { return p.profileName; }).join(', ')));
30
+ process.exit(1);
31
+ }
32
+ return found;
33
+ };
34
+ exports.default = findProfilesByNames;
35
+ //# sourceMappingURL=findProfilesByNames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findProfilesByNames.js","sourceRoot":"","sources":["../../../start/helpers/findProfilesByNames.ts"],"names":[],"mappings":";;AAAA;;;;;;;GAOG;AACH,IAAM,mBAAmB,GAAG,UAC1B,KAAe,EACf,QAAsD;IAEtD,IAAM,KAAK,GAAiD,EAAE,CAAC;IAC/D,IAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI;QACjB,IAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAElC,2CAA2C;QAC3C,IAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAC,CAAC;YAC5B,OAAO,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC;QAChD,CAAC,CAAC,CAAC;QACH,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,gCAAyB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mCAAyB,QAAQ,CAAC,GAAG,CAAC,UAAC,CAAC,IAAO,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,CAAC,CAAC;QAChJ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,kBAAe,mBAAmB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Parse comma-separated values into an array
3
+ * @author Yuen Ler Chow
4
+ * @param commaSeparatedString the comma-separated string to parse
5
+ * @returns array of trimmed, non-empty values
6
+ */
7
+ declare const parseCommaSeparated: (commaSeparatedString?: string) => string[];
8
+ export default parseCommaSeparated;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Parse comma-separated values into an array
5
+ * @author Yuen Ler Chow
6
+ * @param commaSeparatedString the comma-separated string to parse
7
+ * @returns array of trimmed, non-empty values
8
+ */
9
+ var parseCommaSeparated = function (commaSeparatedString) {
10
+ if (!commaSeparatedString) {
11
+ return [];
12
+ }
13
+ return (commaSeparatedString
14
+ .split(',')
15
+ .map(function (value) {
16
+ return value.trim();
17
+ })
18
+ .filter(function (value) {
19
+ return value.length > 0;
20
+ }));
21
+ };
22
+ exports.default = parseCommaSeparated;
23
+ //# sourceMappingURL=parseCommaSeparated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseCommaSeparated.js","sourceRoot":"","sources":["../../../start/helpers/parseCommaSeparated.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,IAAM,mBAAmB,GAAG,UAAC,oBAA6B;IACxD,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,CACL,oBAAoB;SACjB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,UAAC,KAAK;QACT,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC,CAAC;SACD,MAAM,CAAC,UAAC,KAAK;QACZ,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,CAAC,CAAC,CACL,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,mBAAmB,CAAC"}
@@ -0,0 +1,38 @@
1
+ declare const print: {
2
+ /**
3
+ * Print a title
4
+ * @author Gabe Abrams
5
+ * @param str text to print
6
+ */
7
+ title: (str: string) => void;
8
+ /**
9
+ * Print a sub title (subheading)
10
+ * @author Gabe Abrams
11
+ * @param str text to print
12
+ */
13
+ subtitle: (str: string) => void;
14
+ /**
15
+ * Print centered text
16
+ * @author Gabe Abrams
17
+ * @param str text to print
18
+ */
19
+ centered: (str: string) => void;
20
+ /**
21
+ * Print a fatal error message
22
+ * @author Gabe Abrams
23
+ * @param err error message
24
+ */
25
+ fatalError: (err: string) => never;
26
+ /**
27
+ * Save a copy of the prompt instance
28
+ * @author Gabe Abrams
29
+ * @param promptInstance instance of prompt-sync
30
+ */
31
+ savePrompt: (promptInstance: any) => void;
32
+ /**
33
+ * Ask the user to press enter before continuing
34
+ * @author Gabe Abrams
35
+ */
36
+ enterToContinue: () => void;
37
+ };
38
+ export default print;