@dittowords/cli 4.5.2 → 5.0.0-beta.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.
Files changed (171) hide show
  1. package/README.md +6 -5
  2. package/bin/ditto.js +110 -285
  3. package/package.json +16 -10
  4. package/.github/actions/install-node-dependencies/action.yml +0 -24
  5. package/.github/workflows/required-checks.yml +0 -24
  6. package/.husky/pre-commit +0 -4
  7. package/.prettierignore +0 -0
  8. package/.prettierrc.json +0 -1
  9. package/__mocks__/fs.js +0 -2
  10. package/babel.config.js +0 -6
  11. package/bin/__mocks__/api.js +0 -48
  12. package/bin/__mocks__/api.js.map +0 -1
  13. package/bin/add-project.js +0 -104
  14. package/bin/add-project.js.map +0 -1
  15. package/bin/api.js +0 -54
  16. package/bin/api.js.map +0 -1
  17. package/bin/component-folders.js +0 -59
  18. package/bin/component-folders.js.map +0 -1
  19. package/bin/config.js +0 -242
  20. package/bin/config.js.map +0 -1
  21. package/bin/config.test.js +0 -93
  22. package/bin/config.test.js.map +0 -1
  23. package/bin/consts.js +0 -57
  24. package/bin/consts.js.map +0 -1
  25. package/bin/ditto.js.map +0 -1
  26. package/bin/generate-suggestions.js +0 -183
  27. package/bin/generate-suggestions.js.map +0 -1
  28. package/bin/generate-suggestions.test.js +0 -200
  29. package/bin/generate-suggestions.test.js.map +0 -1
  30. package/bin/http/__mocks__/fetchComponentFolders.js +0 -71
  31. package/bin/http/__mocks__/fetchComponentFolders.js.map +0 -1
  32. package/bin/http/__mocks__/fetchComponents.js +0 -73
  33. package/bin/http/__mocks__/fetchComponents.js.map +0 -1
  34. package/bin/http/__mocks__/fetchVariants.js +0 -71
  35. package/bin/http/__mocks__/fetchVariants.js.map +0 -1
  36. package/bin/http/fetchComponentFolders.js +0 -64
  37. package/bin/http/fetchComponentFolders.js.map +0 -1
  38. package/bin/http/fetchComponents.js +0 -78
  39. package/bin/http/fetchComponents.js.map +0 -1
  40. package/bin/http/fetchVariants.js +0 -87
  41. package/bin/http/fetchVariants.js.map +0 -1
  42. package/bin/http/http.test.js +0 -159
  43. package/bin/http/http.test.js.map +0 -1
  44. package/bin/http/importComponents.js +0 -114
  45. package/bin/http/importComponents.js.map +0 -1
  46. package/bin/importComponents.js +0 -65
  47. package/bin/importComponents.js.map +0 -1
  48. package/bin/init/init.js +0 -126
  49. package/bin/init/init.js.map +0 -1
  50. package/bin/init/project.js +0 -182
  51. package/bin/init/project.js.map +0 -1
  52. package/bin/init/project.test.js +0 -26
  53. package/bin/init/project.test.js.map +0 -1
  54. package/bin/init/token.js +0 -196
  55. package/bin/init/token.js.map +0 -1
  56. package/bin/init/token.test.js +0 -147
  57. package/bin/init/token.test.js.map +0 -1
  58. package/bin/output.js +0 -76
  59. package/bin/output.js.map +0 -1
  60. package/bin/pull-lib.test.js +0 -379
  61. package/bin/pull-lib.test.js.map +0 -1
  62. package/bin/pull.js +0 -562
  63. package/bin/pull.js.map +0 -1
  64. package/bin/pull.test.js +0 -151
  65. package/bin/pull.test.js.map +0 -1
  66. package/bin/remove-project.js +0 -99
  67. package/bin/remove-project.js.map +0 -1
  68. package/bin/replace.js +0 -171
  69. package/bin/replace.js.map +0 -1
  70. package/bin/replace.test.js +0 -197
  71. package/bin/replace.test.js.map +0 -1
  72. package/bin/types.js +0 -21
  73. package/bin/types.js.map +0 -1
  74. package/bin/utils/cleanFileName.js +0 -40
  75. package/bin/utils/cleanFileName.js.map +0 -1
  76. package/bin/utils/cleanFileName.test.js +0 -15
  77. package/bin/utils/cleanFileName.test.js.map +0 -1
  78. package/bin/utils/createSentryContext.js +0 -43
  79. package/bin/utils/createSentryContext.js.map +0 -1
  80. package/bin/utils/determineModuleType.js +0 -79
  81. package/bin/utils/determineModuleType.js.map +0 -1
  82. package/bin/utils/determineModuleType.test.js +0 -60
  83. package/bin/utils/determineModuleType.test.js.map +0 -1
  84. package/bin/utils/generateIOSBundles.js +0 -147
  85. package/bin/utils/generateIOSBundles.js.map +0 -1
  86. package/bin/utils/generateJsDriver.js +0 -178
  87. package/bin/utils/generateJsDriver.js.map +0 -1
  88. package/bin/utils/generateJsDriverTypeFile.js +0 -105
  89. package/bin/utils/generateJsDriverTypeFile.js.map +0 -1
  90. package/bin/utils/generateSwiftDriver.js +0 -93
  91. package/bin/utils/generateSwiftDriver.js.map +0 -1
  92. package/bin/utils/getSelectedProjects.js +0 -67
  93. package/bin/utils/getSelectedProjects.js.map +0 -1
  94. package/bin/utils/processMetaOption.js +0 -40
  95. package/bin/utils/processMetaOption.js.map +0 -1
  96. package/bin/utils/processMetaOption.test.js +0 -45
  97. package/bin/utils/processMetaOption.test.js.map +0 -1
  98. package/bin/utils/projectsToText.js +0 -58
  99. package/bin/utils/projectsToText.js.map +0 -1
  100. package/bin/utils/promptForProject.js +0 -96
  101. package/bin/utils/promptForProject.js.map +0 -1
  102. package/bin/utils/quit.js +0 -73
  103. package/bin/utils/quit.js.map +0 -1
  104. package/bin/utils/sourcesToText.js +0 -57
  105. package/bin/utils/sourcesToText.js.map +0 -1
  106. package/etsc.config.js +0 -13
  107. package/jest.config.ts +0 -16
  108. package/jsconfig.json +0 -5
  109. package/lib/__mocks__/api.ts +0 -12
  110. package/lib/add-project.ts +0 -48
  111. package/lib/api.ts +0 -16
  112. package/lib/component-folders.ts +0 -9
  113. package/lib/config.test.ts +0 -79
  114. package/lib/config.ts +0 -279
  115. package/lib/consts.ts +0 -22
  116. package/lib/ditto.ts +0 -285
  117. package/lib/generate-suggestions.test.ts +0 -169
  118. package/lib/generate-suggestions.ts +0 -166
  119. package/lib/http/__mocks__/fetchComponentFolders.ts +0 -23
  120. package/lib/http/__mocks__/fetchComponents.ts +0 -24
  121. package/lib/http/__mocks__/fetchVariants.ts +0 -21
  122. package/lib/http/fetchComponentFolders.ts +0 -23
  123. package/lib/http/fetchComponents.ts +0 -43
  124. package/lib/http/fetchVariants.ts +0 -42
  125. package/lib/http/http.test.ts +0 -122
  126. package/lib/http/importComponents.ts +0 -79
  127. package/lib/importComponents.ts +0 -24
  128. package/lib/init/init.ts +0 -79
  129. package/lib/init/project.test.ts +0 -26
  130. package/lib/init/project.ts +0 -136
  131. package/lib/init/token.test.ts +0 -99
  132. package/lib/init/token.ts +0 -156
  133. package/lib/output.ts +0 -21
  134. package/lib/pull-lib.test.ts +0 -367
  135. package/lib/pull.test.ts +0 -117
  136. package/lib/pull.ts +0 -629
  137. package/lib/remove-project.ts +0 -44
  138. package/lib/replace.test.ts +0 -157
  139. package/lib/replace.ts +0 -140
  140. package/lib/types.ts +0 -83
  141. package/lib/utils/cleanFileName.test.ts +0 -11
  142. package/lib/utils/cleanFileName.ts +0 -8
  143. package/lib/utils/createSentryContext.ts +0 -20
  144. package/lib/utils/determineModuleType.test.ts +0 -48
  145. package/lib/utils/determineModuleType.ts +0 -55
  146. package/lib/utils/generateIOSBundles.ts +0 -122
  147. package/lib/utils/generateJsDriver.ts +0 -207
  148. package/lib/utils/generateJsDriverTypeFile.ts +0 -75
  149. package/lib/utils/generateSwiftDriver.ts +0 -48
  150. package/lib/utils/getSelectedProjects.ts +0 -36
  151. package/lib/utils/processMetaOption.test.ts +0 -18
  152. package/lib/utils/processMetaOption.ts +0 -16
  153. package/lib/utils/projectsToText.ts +0 -29
  154. package/lib/utils/promptForProject.ts +0 -61
  155. package/lib/utils/quit.ts +0 -7
  156. package/lib/utils/sourcesToText.ts +0 -25
  157. package/pull_request_template.md +0 -20
  158. package/testfiles/en.json +0 -5
  159. package/testfiles/es.json +0 -5
  160. package/testfiles/fr.json +0 -5
  161. package/testfiles/test1.jsx +0 -18
  162. package/testfiles/test2.jsx +0 -9
  163. package/testing/.gitkeep +0 -0
  164. package/testing/fixtures/bad-yaml.yml +0 -6
  165. package/testing/fixtures/ditto-config-no-token +0 -2
  166. package/testing/fixtures/project-config-empty-projects.yml +0 -1
  167. package/testing/fixtures/project-config-no-id.yml +0 -2
  168. package/testing/fixtures/project-config-no-name.yml +0 -2
  169. package/testing/fixtures/project-config-pull.yml +0 -0
  170. package/testing/fixtures/project-config-working.yml +0 -3
  171. package/tsconfig.json +0 -16
@@ -1,114 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3f4cd1f2-8b06-52cf-a0d0-da365fac1649")}catch(e){}}();
3
-
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
- var __getProtoOf = Object.getPrototypeOf;
10
- var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __export = (target, all) => {
25
- for (var name in all)
26
- __defProp(target, name, { get: all[name], enumerable: true });
27
- };
28
- var __copyProps = (to, from, except, desc) => {
29
- if (from && typeof from === "object" || typeof from === "function") {
30
- for (let key of __getOwnPropNames(from))
31
- if (!__hasOwnProp.call(to, key) && key !== except)
32
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
- }
34
- return to;
35
- };
36
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
- // If the importer is in node compatibility mode or this is not an ESM
38
- // file that has been converted to a CommonJS file using a Babel-
39
- // compatible transform (i.e. "__esModule" has not been set), then set
40
- // "default" to the CommonJS "module.exports" for node compatibility.
41
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
- mod
43
- ));
44
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
- var __async = (__this, __arguments, generator) => {
46
- return new Promise((resolve, reject) => {
47
- var fulfilled = (value) => {
48
- try {
49
- step(generator.next(value));
50
- } catch (e) {
51
- reject(e);
52
- }
53
- };
54
- var rejected = (value) => {
55
- try {
56
- step(generator.throw(value));
57
- } catch (e) {
58
- reject(e);
59
- }
60
- };
61
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
62
- step((generator = generator.apply(__this, __arguments)).next());
63
- });
64
- };
65
- var importComponents_exports = {};
66
- __export(importComponents_exports, {
67
- importComponents: () => importComponents
68
- });
69
- module.exports = __toCommonJS(importComponents_exports);
70
- var import_api = require("../api");
71
- var import_form_data = __toESM(require("form-data"));
72
- var import_fs = __toESM(require("fs"));
73
- function importComponents(path, options) {
74
- return __async(this, null, function* () {
75
- var _a, _b, _c, _d, _e, _f, _g, _h;
76
- const api = (0, import_api.createApiClient)();
77
- if (!import_fs.default.existsSync(path)) {
78
- console.error("Failed to import file: couldn't find file at path " + path);
79
- return {
80
- componentsInserted: 0,
81
- firstImportedId: "null"
82
- };
83
- }
84
- const form = new import_form_data.default();
85
- form.append("import", import_fs.default.createReadStream(path));
86
- const requestOptions = {
87
- method: "POST",
88
- url: "/v1/components/file",
89
- params: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, ((_a = options.csvColumnMapping) == null ? void 0 : _a.name) ? { name: `[${options.csvColumnMapping.name}]` } : {}), ((_b = options.csvColumnMapping) == null ? void 0 : _b.text) ? { text: options.csvColumnMapping.text } : {}), ((_c = options.csvColumnMapping) == null ? void 0 : _c.notes) ? { notes: options.csvColumnMapping.notes } : {}), ((_d = options.csvColumnMapping) == null ? void 0 : _d.status) ? { status: options.csvColumnMapping.status } : {}), ((_e = options.csvColumnMapping) == null ? void 0 : _e.tags) ? { tags: options.csvColumnMapping.tags } : {}), ((_f = options.csvColumnMapping) == null ? void 0 : _f.componentId) ? { componentId: options.csvColumnMapping.componentId } : {}),
90
- headers: {
91
- "content-type": "multipart/form-data"
92
- },
93
- data: form
94
- };
95
- try {
96
- const { data } = yield api(requestOptions);
97
- return data;
98
- } catch (e) {
99
- console.error("Failed to import file.");
100
- console.error(((_h = (_g = e.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || e.message);
101
- return {
102
- componentsInserted: 0,
103
- firstImportedId: "null"
104
- };
105
- }
106
- });
107
- }
108
- // Annotate the CommonJS export names for ESM import in node:
109
- 0 && (module.exports = {
110
- importComponents
111
- });
112
- //# sourceMappingURL=importComponents.js.map
113
-
114
- //# debugId=3f4cd1f2-8b06-52cf-a0d0-da365fac1649
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/http/importComponents.ts"],"sourcesContent":["import { createApiClient } from \"../api\";\nimport FormData from \"form-data\";\nimport fs from \"fs\";\n\nexport interface ImportComponentResponse {\n componentsInserted: number;\n firstImportedId: string;\n}\n\nexport interface CsvColumnMapping {\n text: number;\n name: string;\n notes?: number;\n tags?: number;\n status?: number;\n componentId?: number;\n}\n\nexport async function importComponents(\n path: string,\n options: {\n csvColumnMapping?: CsvColumnMapping;\n }\n): Promise<ImportComponentResponse> {\n const api = createApiClient();\n\n if (!fs.existsSync(path)) {\n console.error(\"Failed to import file: couldn't find file at path \" + path);\n return {\n componentsInserted: 0,\n firstImportedId: \"null\",\n };\n }\n\n const form = new FormData();\n form.append(\"import\", fs.createReadStream(path));\n\n const requestOptions = {\n method: \"POST\",\n url: \"/v1/components/file\",\n params: {\n ...(options.csvColumnMapping?.name\n ? { name: `[${options.csvColumnMapping.name}]` }\n : {}),\n ...(options.csvColumnMapping?.text\n ? { text: options.csvColumnMapping.text }\n : {}),\n ...(options.csvColumnMapping?.notes\n ? { notes: options.csvColumnMapping.notes }\n : {}),\n ...(options.csvColumnMapping?.status\n ? { status: options.csvColumnMapping.status }\n : {}),\n ...(options.csvColumnMapping?.tags\n ? { tags: options.csvColumnMapping.tags }\n : {}),\n ...(options.csvColumnMapping?.componentId\n ? { componentId: options.csvColumnMapping.componentId }\n : {}),\n },\n headers: {\n \"content-type\": \"multipart/form-data\",\n },\n data: form,\n };\n\n try {\n const { data } = await api(requestOptions);\n\n return data;\n } catch (e: any) {\n console.error(\"Failed to import file.\");\n console.error(e.response?.data?.message || e.message);\n return {\n componentsInserted: 0,\n firstImportedId: \"null\",\n };\n }\n}\n"],"names":["fs","FormData"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAgC;AAChC,uBAAqB;AACrB,gBAAe;AAgBf,SAAsB,iBACpB,MACA,SAGkC;AAAA;AAvBpC;AAwBE,UAAM,UAAM,4BAAgB;AAE5B,QAAI,CAAC,UAAAA,QAAG,WAAW,IAAI,GAAG;AACxB,cAAQ,MAAM,uDAAuD,IAAI;AACzE,aAAO;AAAA,QACL,oBAAoB;AAAA,QACpB,iBAAiB;AAAA,MACnB;AAAA,IACF;AAEA,UAAM,OAAO,IAAI,iBAAAC,QAAS;AAC1B,SAAK,OAAO,UAAU,UAAAD,QAAG,iBAAiB,IAAI,CAAC;AAE/C,UAAM,iBAAiB;AAAA,MACrB,QAAQ;AAAA,MACR,KAAK;AAAA,MACL,QAAQ,gGACF,aAAQ,qBAAR,mBAA0B,QAC1B,EAAE,MAAM,IAAI,QAAQ,iBAAiB,IAAI,IAAI,IAC7C,CAAC,MACD,aAAQ,qBAAR,mBAA0B,QAC1B,EAAE,MAAM,QAAQ,iBAAiB,KAAK,IACtC,CAAC,MACD,aAAQ,qBAAR,mBAA0B,SAC1B,EAAE,OAAO,QAAQ,iBAAiB,MAAM,IACxC,CAAC,MACD,aAAQ,qBAAR,mBAA0B,UAC1B,EAAE,QAAQ,QAAQ,iBAAiB,OAAO,IAC1C,CAAC,MACD,aAAQ,qBAAR,mBAA0B,QAC1B,EAAE,MAAM,QAAQ,iBAAiB,KAAK,IACtC,CAAC,MACD,aAAQ,qBAAR,mBAA0B,eAC1B,EAAE,aAAa,QAAQ,iBAAiB,YAAY,IACpD,CAAC;AAAA,MAEP,SAAS;AAAA,QACP,gBAAgB;AAAA,MAClB;AAAA,MACA,MAAM;AAAA,IACR;AAEA,QAAI;AACF,YAAM,EAAE,KAAK,IAAI,MAAM,IAAI,cAAc;AAEzC,aAAO;AAAA,IACT,SAAS,GAAQ;AACf,cAAQ,MAAM,wBAAwB;AACtC,cAAQ,QAAM,aAAE,aAAF,mBAAY,SAAZ,mBAAkB,YAAW,EAAE,OAAO;AACpD,aAAO;AAAA,QACL,oBAAoB;AAAA,QACpB,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAAA","debug_id":"3f4cd1f2-8b06-52cf-a0d0-da365fac1649"}
@@ -1,65 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3ae73857-3895-5816-b3a1-348da7b6ec1b")}catch(e){}}();
3
-
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var __async = (__this, __arguments, generator) => {
22
- return new Promise((resolve, reject) => {
23
- var fulfilled = (value) => {
24
- try {
25
- step(generator.next(value));
26
- } catch (e) {
27
- reject(e);
28
- }
29
- };
30
- var rejected = (value) => {
31
- try {
32
- step(generator.throw(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
- step((generator = generator.apply(__this, __arguments)).next());
39
- });
40
- };
41
- var importComponents_exports = {};
42
- __export(importComponents_exports, {
43
- importComponents: () => importComponents
44
- });
45
- module.exports = __toCommonJS(importComponents_exports);
46
- var import_importComponents = require("./http/importComponents");
47
- function importComponents(filePath, options) {
48
- return __async(this, null, function* () {
49
- var _a, _b;
50
- if (filePath.endsWith(".csv") && (!((_a = options.csvColumnMapping) == null ? void 0 : _a.name) || !((_b = options.csvColumnMapping) == null ? void 0 : _b.text))) {
51
- throw new Error(
52
- ".csv files require the --component-name and --text flags."
53
- );
54
- }
55
- const importResult = yield (0, import_importComponents.importComponents)(filePath, options);
56
- console.log(JSON.stringify(importResult));
57
- });
58
- }
59
- // Annotate the CommonJS export names for ESM import in node:
60
- 0 && (module.exports = {
61
- importComponents
62
- });
63
- //# sourceMappingURL=importComponents.js.map
64
-
65
- //# debugId=3ae73857-3895-5816-b3a1-348da7b6ec1b
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../lib/importComponents.ts"],"sourcesContent":["import {\n CsvColumnMapping,\n importComponents as importComponentsHttp,\n} from \"./http/importComponents\";\n\nasync function importComponents(\n filePath: string,\n options: {\n csvColumnMapping?: CsvColumnMapping;\n }\n) {\n if (\n filePath.endsWith(\".csv\") &&\n (!options.csvColumnMapping?.name || !options.csvColumnMapping?.text)\n ) {\n throw new Error(\n \".csv files require the --component-name and --text flags.\"\n );\n }\n const importResult = await importComponentsHttp(filePath, options);\n console.log(JSON.stringify(importResult));\n}\n\nexport { importComponents };\n"],"names":["importComponentsHttp"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAGO;AAEP,SAAe,iBACb,UACA,SAGA;AAAA;AAVF;AAWE,QACE,SAAS,SAAS,MAAM,MACvB,GAAC,aAAQ,qBAAR,mBAA0B,SAAQ,GAAC,aAAQ,qBAAR,mBAA0B,QAC/D;AACA,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,UAAM,eAAe,UAAM,wBAAAA,kBAAqB,UAAU,OAAO;AACjE,YAAQ,IAAI,KAAK,UAAU,YAAY,CAAC;AAAA,EAC1C;AAAA","debug_id":"3ae73857-3895-5816-b3a1-348da7b6ec1b"}
package/bin/init/init.js DELETED
@@ -1,126 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9c7bfd1b-8918-5922-88bc-bed63d7093dc")}catch(e){}}();
3
-
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
- var __async = (__this, __arguments, generator) => {
32
- return new Promise((resolve, reject) => {
33
- var fulfilled = (value) => {
34
- try {
35
- step(generator.next(value));
36
- } catch (e) {
37
- reject(e);
38
- }
39
- };
40
- var rejected = (value) => {
41
- try {
42
- step(generator.throw(value));
43
- } catch (e) {
44
- reject(e);
45
- }
46
- };
47
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
48
- step((generator = generator.apply(__this, __arguments)).next());
49
- });
50
- };
51
- var init_exports = {};
52
- __export(init_exports, {
53
- default: () => init_default,
54
- init: () => init,
55
- needsTokenOrSource: () => needsTokenOrSource
56
- });
57
- module.exports = __toCommonJS(init_exports);
58
- var import_boxen = __toESM(require("boxen"));
59
- var import_chalk = __toESM(require("chalk"));
60
- var import_project = require("./project");
61
- var import_token = require("./token");
62
- var import_config = __toESM(require("../config"));
63
- var import_output = __toESM(require("../output"));
64
- var import_sourcesToText = __toESM(require("../utils/sourcesToText"));
65
- var import_quit = require("../utils/quit");
66
- const needsTokenOrSource = () => (0, import_token.needsToken)() || (0, import_project.needsSource)();
67
- function welcome() {
68
- const msg = import_chalk.default.white(`${import_chalk.default.bold(
69
- "Welcome to the",
70
- import_chalk.default.magentaBright("Ditto CLI")
71
- )}.
72
-
73
- We're glad to have you here.`);
74
- console.log((0, import_boxen.default)(msg, { padding: 1 }));
75
- }
76
- const init = () => __async(void 0, null, function* () {
77
- welcome();
78
- if ((0, import_token.needsToken)()) {
79
- yield (0, import_token.collectAndSaveToken)();
80
- }
81
- const {
82
- hasSourceData,
83
- validProjects,
84
- shouldFetchComponentLibrary,
85
- hasTopLevelComponentsField,
86
- hasTopLevelProjectsField
87
- } = import_config.default.parseSourceInformation();
88
- if (hasTopLevelProjectsField) {
89
- return yield (0, import_quit.quit)(`${import_output.default.errorText(
90
- `Support for ${import_output.default.warnText(
91
- "projects"
92
- )} as a top-level field has been removed; please configure ${import_output.default.warnText(
93
- "sources.projects"
94
- )} instead.`
95
- )}
96
- See ${import_output.default.url("https://github.com/dittowords/cli")} for more information.`);
97
- }
98
- if (hasTopLevelComponentsField) {
99
- return yield (0, import_quit.quit)(
100
- `${import_output.default.errorText(
101
- "Support for `components` as a top-level field has been removed; please configure `sources.components` instead."
102
- )}
103
- See ${import_output.default.url("https://github.com/dittowords/cli")} for more information.`
104
- );
105
- }
106
- if (!hasSourceData) {
107
- console.log(
108
- `Looks like there are no Ditto sources selected for your current directory: ${import_output.default.info(
109
- process.cwd()
110
- )}.`
111
- );
112
- yield (0, import_project.collectAndSaveSource)({ initialize: true, components: true });
113
- return;
114
- }
115
- const message = "You're currently set up to sync text from " + (0, import_sourcesToText.default)(validProjects, shouldFetchComponentLibrary);
116
- console.log(message);
117
- });
118
- var init_default = { init };
119
- // Annotate the CommonJS export names for ESM import in node:
120
- 0 && (module.exports = {
121
- init,
122
- needsTokenOrSource
123
- });
124
- //# sourceMappingURL=init.js.map
125
-
126
- //# debugId=9c7bfd1b-8918-5922-88bc-bed63d7093dc
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/init/init.ts"],"sourcesContent":["// Related to initializing a user/environment to ditto.\n// expected to be run once per project.\nimport boxen from \"boxen\";\nimport chalk from \"chalk\";\nimport projectsToText from \"../utils/projectsToText\";\n\nimport { needsSource, collectAndSaveSource } from \"./project\";\nimport { needsToken, collectAndSaveToken } from \"./token\";\n\nimport config from \"../config\";\nimport output from \"../output\";\nimport sourcesToText from \"../utils/sourcesToText\";\nimport { quit } from \"../utils/quit\";\n\nexport const needsTokenOrSource = () => needsToken() || needsSource();\n\nfunction welcome() {\n const msg = chalk.white(`${chalk.bold(\n \"Welcome to the\",\n chalk.magentaBright(\"Ditto CLI\")\n )}.\n\nWe're glad to have you here.`);\n console.log(boxen(msg, { padding: 1 }));\n}\n\nexport const init = async () => {\n welcome();\n\n if (needsToken()) {\n await collectAndSaveToken();\n }\n\n const {\n hasSourceData,\n validProjects,\n shouldFetchComponentLibrary,\n hasTopLevelComponentsField,\n hasTopLevelProjectsField,\n } = config.parseSourceInformation();\n\n if (hasTopLevelProjectsField) {\n return await quit(`${output.errorText(\n `Support for ${output.warnText(\n \"projects\"\n )} as a top-level field has been removed; please configure ${output.warnText(\n \"sources.projects\"\n )} instead.`\n )}\nSee ${output.url(\"https://github.com/dittowords/cli\")} for more information.`);\n }\n\n if (hasTopLevelComponentsField) {\n return await quit(\n `${output.errorText(\n \"Support for `components` as a top-level field has been removed; please configure `sources.components` instead.\"\n )}\nSee ${output.url(\"https://github.com/dittowords/cli\")} for more information.`\n );\n }\n\n if (!hasSourceData) {\n console.log(\n `Looks like there are no Ditto sources selected for your current directory: ${output.info(\n process.cwd()\n )}.`\n );\n await collectAndSaveSource({ initialize: true, components: true });\n return;\n }\n\n const message =\n \"You're currently set up to sync text from \" +\n sourcesToText(validProjects, shouldFetchComponentLibrary);\n\n console.log(message);\n};\n\nexport default { init };\n"],"names":["chalk","boxen","config","output","sourcesToText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAkB;AAClB,mBAAkB;AAGlB,qBAAkD;AAClD,mBAAgD;AAEhD,oBAAmB;AACnB,oBAAmB;AACnB,2BAA0B;AAC1B,kBAAqB;AAEd,MAAM,qBAAqB,UAAM,yBAAW,SAAK,4BAAY;AAEpE,SAAS,UAAU;AACjB,QAAM,MAAM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efined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4a617eb1-bb93-51b1-9173-f83b057146e6")}catch(e){}}();
3
-
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
- var __async = (__this, __arguments, generator) => {
32
- return new Promise((resolve, reject) => {
33
- var fulfilled = (value) => {
34
- try {
35
- step(generator.next(value));
36
- } catch (e) {
37
- reject(e);
38
- }
39
- };
40
- var rejected = (value) => {
41
- try {
42
- step(generator.throw(value));
43
- } catch (e) {
44
- reject(e);
45
- }
46
- };
47
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
48
- step((generator = generator.apply(__this, __arguments)).next());
49
- });
50
- };
51
- var project_exports = {};
52
- __export(project_exports, {
53
- _testing: () => _testing,
54
- collectAndSaveSource: () => collectAndSaveSource,
55
- default: () => project_default,
56
- needsSource: () => needsSource
57
- });
58
- module.exports = __toCommonJS(project_exports);
59
- var import_ora = __toESM(require("ora"));
60
- var import_api = require("../api");
61
- var import_config = __toESM(require("../config"));
62
- var import_consts = __toESM(require("../consts"));
63
- var import_output = __toESM(require("../output"));
64
- var import_token = require("./token");
65
- var import_getSelectedProjects = require("../utils/getSelectedProjects");
66
- var import_promptForProject = __toESM(require("../utils/promptForProject"));
67
- var import_quit = require("../utils/quit");
68
- function saveProject(file, name, id) {
69
- if (id === "components") {
70
- import_config.default.writeProjectConfigData(file, {
71
- sources: { components: true }
72
- });
73
- return;
74
- }
75
- const projects = [...(0, import_getSelectedProjects.getSelectedProjects)(file), { name, id }];
76
- import_config.default.writeProjectConfigData(file, { sources: { projects } });
77
- }
78
- const needsSource = () => {
79
- return !import_config.default.parseSourceInformation().hasSourceData;
80
- };
81
- function askForAnotherToken() {
82
- return __async(this, null, function* () {
83
- import_config.default.deleteToken(import_consts.default.CONFIG_FILE, import_consts.default.API_HOST);
84
- const message = "Looks like the API key you have saved no longer works. Please enter another one.";
85
- yield (0, import_token.collectAndSaveToken)(message);
86
- });
87
- }
88
- function listProjects(token, projectsAlreadySelected) {
89
- return __async(this, null, function* () {
90
- const api = (0, import_api.createApiClient)();
91
- const spinner = (0, import_ora.default)("Fetching sources in your workspace...");
92
- spinner.start();
93
- let response;
94
- try {
95
- response = yield api.get("/v1/projects");
96
- } catch (e) {
97
- spinner.stop();
98
- throw e;
99
- }
100
- const projectsAlreadySelectedSet = projectsAlreadySelected.reduce(
101
- (set, project) => set.add(project.id.toString()),
102
- /* @__PURE__ */ new Set()
103
- );
104
- const result = response.data.filter(
105
- ({ id }) => (
106
- // covers an edge case where v0 of the API includes the component library
107
- // in the response from the `/project-names` endpoint
108
- id !== "ditto_component_library" && !projectsAlreadySelectedSet.has(id.toString())
109
- )
110
- );
111
- spinner.stop();
112
- return result;
113
- });
114
- }
115
- function collectSource(token, includeComponents) {
116
- return __async(this, null, function* () {
117
- const projectsAlreadySelected = (0, import_getSelectedProjects.getSelectedProjects)();
118
- const componentSourceSelected = (0, import_getSelectedProjects.getIsUsingComponents)();
119
- let sources = yield listProjects(token, projectsAlreadySelected);
120
- if (includeComponents && !componentSourceSelected) {
121
- sources = [
122
- { id: "ditto_component_library", name: "Ditto Component Library" },
123
- ...sources
124
- ];
125
- }
126
- if (!(sources == null ? void 0 : sources.length)) {
127
- console.log("You're currently syncing all projects in your workspace.");
128
- console.log(
129
- import_output.default.warnText(
130
- "Not seeing a project that you were expecting? Verify that developer mode is enabled on that project. More info: https://www.dittowords.com/docs/ditto-developer-mode"
131
- )
132
- );
133
- return null;
134
- }
135
- return (0, import_promptForProject.default)({
136
- projects: sources,
137
- message: "Choose the source you'd like to sync text from"
138
- });
139
- });
140
- }
141
- const collectAndSaveSource = (..._0) => __async(void 0, [..._0], function* ({ components = false } = {
142
- components: false
143
- }) {
144
- try {
145
- const token = import_config.default.getToken(import_consts.default.CONFIG_FILE, import_consts.default.API_HOST);
146
- const project = yield collectSource(token, components);
147
- if (!project) {
148
- yield (0, import_quit.quit)(null, 0);
149
- return;
150
- }
151
- console.log(
152
- `
153
- Thanks for adding ${import_output.default.info(
154
- project.name
155
- )} to your selected sources.
156
- We saved your updated configuration to: ${import_output.default.info(
157
- import_consts.default.PROJECT_CONFIG_FILE
158
- )}
159
- `
160
- );
161
- saveProject(import_consts.default.PROJECT_CONFIG_FILE, project.name, project.id);
162
- } catch (e) {
163
- console.log(e);
164
- if (e.response && e.response.status === 404) {
165
- yield askForAnotherToken();
166
- yield collectAndSaveSource({ components });
167
- } else {
168
- yield (0, import_quit.quit)(null, 2);
169
- }
170
- }
171
- });
172
- const _testing = { saveProject, needsSource };
173
- var project_default = { needsSource, collectAndSaveSource };
174
- // Annotate the CommonJS export names for ESM import in node:
175
- 0 && (module.exports = {
176
- _testing,
177
- collectAndSaveSource,
178
- needsSource
179
- });
180
- //# sourceMappingURL=project.js.map
181
-
182
- //# debugId=4a617eb1-bb93-51b1-9173-f83b057146e6
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/init/project.ts"],"sourcesContent":["import ora from \"ora\";\n\nimport { createApiClient } from \"../api\";\nimport config from \"../config\";\nimport consts from \"../consts\";\nimport output from \"../output\";\nimport { collectAndSaveToken } from \"./token\";\nimport {\n getSelectedProjects,\n getIsUsingComponents,\n} from \"../utils/getSelectedProjects\";\nimport promptForProject from \"../utils/promptForProject\";\nimport { AxiosResponse } from \"axios\";\nimport { Project, Token } from \"../types\";\nimport { quit } from \"../utils/quit\";\n\nfunction saveProject(file: string, name: string, id: string) {\n if (id === \"components\") {\n config.writeProjectConfigData(file, {\n sources: { components: true },\n });\n return;\n }\n\n const projects = [...getSelectedProjects(file), { name, id }];\n config.writeProjectConfigData(file, { sources: { projects } });\n}\n\nexport const needsSource = () => {\n return !config.parseSourceInformation().hasSourceData;\n};\n\nasync function askForAnotherToken() {\n config.deleteToken(consts.CONFIG_FILE, consts.API_HOST);\n const message =\n \"Looks like the API key you have saved no longer works. Please enter another one.\";\n await collectAndSaveToken(message);\n}\n\nasync function listProjects(token: Token, projectsAlreadySelected: Project[]) {\n const api = createApiClient();\n const spinner = ora(\"Fetching sources in your workspace...\");\n spinner.start();\n\n let response: AxiosResponse<{ id: string; name: string }[]>;\n try {\n response = await api.get(\"/v1/projects\");\n } catch (e) {\n spinner.stop();\n throw e;\n }\n\n const projectsAlreadySelectedSet = projectsAlreadySelected.reduce(\n (set, project) => set.add(project.id.toString()),\n new Set<string>()\n );\n\n const result = response.data.filter(\n ({ id }) =>\n // covers an edge case where v0 of the API includes the component library\n // in the response from the `/project-names` endpoint\n id !== \"ditto_component_library\" &&\n !projectsAlreadySelectedSet.has(id.toString())\n );\n\n spinner.stop();\n\n return result;\n}\n\nasync function collectSource(token: Token, includeComponents: boolean) {\n const projectsAlreadySelected = getSelectedProjects();\n const componentSourceSelected = getIsUsingComponents();\n\n let sources = await listProjects(token, projectsAlreadySelected);\n if (includeComponents && !componentSourceSelected) {\n sources = [\n { id: \"ditto_component_library\", name: \"Ditto Component Library\" },\n ...sources,\n ];\n }\n\n if (!sources?.length) {\n console.log(\"You're currently syncing all projects in your workspace.\");\n console.log(\n output.warnText(\n \"Not seeing a project that you were expecting? Verify that developer mode is enabled on that project. More info: https://www.dittowords.com/docs/ditto-developer-mode\"\n )\n );\n return null;\n }\n\n return promptForProject({\n projects: sources,\n message: \"Choose the source you'd like to sync text from\",\n });\n}\n\nexport const collectAndSaveSource = async (\n { components = false }: { initialize?: boolean; components?: boolean } = {\n components: false,\n }\n) => {\n try {\n const token = config.getToken(consts.CONFIG_FILE, consts.API_HOST);\n const project = await collectSource(token, components);\n if (!project) {\n await quit(null, 0);\n return;\n }\n\n console.log(\n \"\\n\" +\n `Thanks for adding ${output.info(\n project.name\n )} to your selected sources.\\n` +\n `We saved your updated configuration to: ${output.info(\n consts.PROJECT_CONFIG_FILE\n )}\\n`\n );\n\n saveProject(consts.PROJECT_CONFIG_FILE, project.name, project.id);\n } catch (e: any) {\n console.log(e);\n if (e.response && e.response.status === 404) {\n await askForAnotherToken();\n await collectAndSaveSource({ components });\n } else {\n await quit(null, 2);\n }\n }\n};\n\nexport const _testing = { saveProject, needsSource };\n\nexport default { needsSource, collectAndSaveSource };\n"],"names":["config","consts","ora","output","promptForProject"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAgB;AAEhB,iBAAgC;AAChC,oBAAmB;AACnB,oBAAmB;AACnB,oBAAmB;AACnB,mBAAoC;AACpC,iCAGO;AACP,8BAA6B;AAG7B,kBAAqB;AAErB,SAAS,YAAY,MAAc,MAAc,IAAY;AAC3D,MAAI,OAAO,cAAc;AACvB,kBAA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f83b057146e6"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4aaa4928-24d6-5124-b02e-08fd3c766537")}catch(e){}}();
3
-
4
- var import_project = require("./project");
5
- const fs = require("fs");
6
- const yaml = require("js-yaml");
7
- const fakeProjectDir = "/";
8
- jest.mock("fs");
9
- describe("saveProject", () => {
10
- const configFile = "/ditto/config.yml";
11
- const projectName = "My Amazing Project";
12
- const projectId = "5f284259ce1d451b2eb2e23c";
13
- beforeEach(() => {
14
- import_project._testing.saveProject(configFile, projectName, projectId);
15
- });
16
- it("creates a config file with config data", () => {
17
- const fileContents = fs.readFileSync(configFile, "utf8");
18
- const data = yaml.load(fileContents);
19
- expect(data.sources.projects).toBeDefined();
20
- expect(data.sources.projects[0].name).toEqual(projectName);
21
- expect(data.sources.projects[0].id).toEqual(projectId);
22
- });
23
- });
24
- //# sourceMappingURL=project.test.js.map
25
-
26
- //# debugId=4aaa4928-24d6-5124-b02e-08fd3c766537
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/init/project.test.ts"],"sourcesContent":["const fs = require(\"fs\");\nconst yaml = require(\"js-yaml\");\n\nimport { _testing } from \"./project\";\n\nconst fakeProjectDir = \"/\";\n\njest.mock(\"fs\");\n\ndescribe(\"saveProject\", () => {\n const configFile = \"/ditto/config.yml\";\n const projectName = \"My Amazing Project\";\n const projectId = \"5f284259ce1d451b2eb2e23c\";\n\n beforeEach(() => {\n _testing.saveProject(configFile, projectName, projectId);\n });\n\n it(\"creates a config file with config data\", () => {\n const fileContents = fs.readFileSync(configFile, \"utf8\");\n const data = yaml.load(fileContents);\n expect(data.sources.projects).toBeDefined();\n expect(data.sources.projects[0].name).toEqual(projectName);\n expect(data.sources.projects[0].id).toEqual(projectId);\n });\n});\n"],"names":[],"mappings":";;;AAGA,qBAAyB;AAHzB,MAAM,KAAK,QAAQ,IAAI;AACvB,MAAM,OAAO,QAAQ,SAAS;AAI9B,MAAM,iBAAiB;AAEvB,KAAK,KAAK,IAAI;AAEd,SAAS,eAAe,MAAM;AAC5B,QAAM,aAAa;AACnB,QAAM,cAAc;AACpB,QAAM,YAAY;AAElB,aAAW,MAAM;AACf,4BAAS,YAAY,YAAY,aAAa,SAAS;AAAA,EACzD,CAAC;AAED,KAAG,0CAA0C,MAAM;AACjD,UAAM,eAAe,GAAG,aAAa,YAAY,MAAM;AACvD,UAAM,OAAO,KAAK,KAAK,YAAY;AACnC,WAAO,KAAK,QAAQ,QAAQ,EAAE,YAAY;AAC1C,WAAO,KAAK,QAAQ,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,WAAW;AACzD,WAAO,KAAK,QAAQ,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,SAAS;AAAA,EACvD,CAAC;AACH,CAAC","debug_id":"4aaa4928-24d6-5124-b02e-08fd3c766537"}