@contember/create 2.1.0-beta.1 → 2.2.0-alpha.1

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 (223) hide show
  1. package/dist/development/run.cjs.map +1 -1
  2. package/dist/development/run.js.map +1 -1
  3. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +2 -2
  4. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  5. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  6. package/dist/development/src/lib/FileSystem.cjs +1 -2
  7. package/dist/development/src/lib/FileSystem.cjs.map +1 -1
  8. package/dist/development/src/lib/FileSystem.js +1 -2
  9. package/dist/development/src/lib/FileSystem.js.map +1 -1
  10. package/dist/development/src/lib/TemplateInstaller.cjs +16 -16
  11. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  12. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  13. package/dist/development/src/lib/packageManagerDetector.cjs +6 -6
  14. package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -1
  15. package/dist/development/src/lib/version.cjs +2 -2
  16. package/dist/development/src/lib/version.cjs.map +1 -1
  17. package/dist/development/src/lib/version.js.map +1 -1
  18. package/dist/development/src/paths.cjs +3 -3
  19. package/dist/development/src/paths.cjs.map +1 -1
  20. package/dist/production/run.cjs.map +1 -1
  21. package/dist/production/run.js.map +1 -1
  22. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +2 -2
  23. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  24. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  25. package/dist/production/src/lib/FileSystem.cjs +1 -2
  26. package/dist/production/src/lib/FileSystem.cjs.map +1 -1
  27. package/dist/production/src/lib/FileSystem.js +1 -2
  28. package/dist/production/src/lib/FileSystem.js.map +1 -1
  29. package/dist/production/src/lib/TemplateInstaller.cjs +16 -16
  30. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  31. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  32. package/dist/production/src/lib/packageManagerDetector.cjs +6 -6
  33. package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -1
  34. package/dist/production/src/lib/version.cjs +2 -2
  35. package/dist/production/src/lib/version.cjs.map +1 -1
  36. package/dist/production/src/lib/version.js.map +1 -1
  37. package/dist/production/src/paths.cjs +3 -3
  38. package/dist/production/src/paths.cjs.map +1 -1
  39. package/dist/types/commands/WorkspaceCreateCommand.d.ts +1 -1
  40. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  41. package/dist/types/commands/index.d.ts +1 -1
  42. package/dist/types/commands/index.d.ts.map +1 -1
  43. package/dist/types/lib/FileSystem.d.ts +3 -2
  44. package/dist/types/lib/FileSystem.d.ts.map +1 -1
  45. package/dist/types/lib/TemplateInstaller.d.ts +1 -1
  46. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  47. package/dist/types/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +3 -4
  49. package/resources/templates/default/admin/lib/binding/binding.tsx +19 -4
  50. package/resources/templates/default/admin/lib/binding/delete.tsx +37 -3
  51. package/resources/templates/default/admin/lib/binding/hooks.tsx +65 -3
  52. package/resources/templates/default/admin/lib/binding/identity.tsx +17 -4
  53. package/resources/templates/default/admin/lib/binding/index.ts +5 -5
  54. package/resources/templates/default/admin/lib/binding/navigation-guard-dialog.tsx +15 -3
  55. package/resources/templates/default/admin/lib/binding/persist.tsx +27 -5
  56. package/resources/templates/default/admin/lib/block-repeater/block-repeater.tsx +15 -11
  57. package/resources/templates/default/admin/lib/block-repeater/index.ts +1 -1
  58. package/resources/templates/default/admin/lib/board/board.tsx +2 -2
  59. package/resources/templates/default/admin/lib/board/index.ts +1 -1
  60. package/resources/templates/default/admin/lib/buttons/back-button.tsx +22 -2
  61. package/resources/templates/default/admin/lib/buttons/index.ts +2 -2
  62. package/resources/templates/default/admin/lib/buttons/link-back-button.tsx +11 -2
  63. package/resources/templates/default/admin/lib/datagrid/cells.tsx +3 -3
  64. package/resources/templates/default/admin/lib/datagrid/column-header.tsx +4 -4
  65. package/resources/templates/default/admin/lib/datagrid/columns.tsx +28 -14
  66. package/resources/templates/default/admin/lib/datagrid/elements.tsx +2 -2
  67. package/resources/templates/default/admin/lib/datagrid/empty.tsx +1 -1
  68. package/resources/templates/default/admin/lib/datagrid/export.tsx +2 -2
  69. package/resources/templates/default/admin/lib/datagrid/filters/boolean.tsx +13 -13
  70. package/resources/templates/default/admin/lib/datagrid/filters/common.tsx +2 -2
  71. package/resources/templates/default/admin/lib/datagrid/filters/date.tsx +37 -16
  72. package/resources/templates/default/admin/lib/datagrid/filters/defined.tsx +13 -12
  73. package/resources/templates/default/admin/lib/datagrid/filters/enum.tsx +56 -22
  74. package/resources/templates/default/admin/lib/datagrid/filters/index.ts +7 -7
  75. package/resources/templates/default/admin/lib/datagrid/filters/mobile.tsx +18 -0
  76. package/resources/templates/default/admin/lib/datagrid/filters/number.tsx +10 -13
  77. package/resources/templates/default/admin/lib/datagrid/filters/relation.tsx +8 -8
  78. package/resources/templates/default/admin/lib/datagrid/filters/text.tsx +9 -9
  79. package/resources/templates/default/admin/lib/datagrid/grid.tsx +31 -23
  80. package/resources/templates/default/admin/lib/datagrid/index.ts +12 -12
  81. package/resources/templates/default/admin/lib/datagrid/labels.tsx +22 -4
  82. package/resources/templates/default/admin/lib/datagrid/layout-switcher.tsx +10 -4
  83. package/resources/templates/default/admin/lib/datagrid/loader.tsx +4 -4
  84. package/resources/templates/default/admin/lib/datagrid/pagination.tsx +16 -6
  85. package/resources/templates/default/admin/lib/datagrid/table.tsx +8 -6
  86. package/resources/templates/default/admin/lib/datagrid/tiles.tsx +6 -5
  87. package/resources/templates/default/admin/lib/datagrid/toolbar.tsx +15 -19
  88. package/resources/templates/default/admin/lib/datagrid/ui.tsx +3 -3
  89. package/resources/templates/default/admin/lib/dev/index.ts +2 -2
  90. package/resources/templates/default/admin/lib/dev/login-panel.tsx +12 -3
  91. package/resources/templates/default/admin/lib/dev/todo.tsx +12 -0
  92. package/resources/templates/default/admin/lib/dict.ts +0 -261
  93. package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +85 -4
  94. package/resources/templates/default/admin/lib/dimensions/index.ts +1 -1
  95. package/resources/templates/default/admin/lib/editor/block-editor.tsx +72 -3
  96. package/resources/templates/default/admin/lib/editor/common/baseEditorPlugins.tsx +54 -11
  97. package/resources/templates/default/admin/lib/editor/common/buttons.tsx +1 -1
  98. package/resources/templates/default/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
  99. package/resources/templates/default/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
  100. package/resources/templates/default/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +1 -1
  101. package/resources/templates/default/admin/lib/editor/common/elements/ListItemRenderer.tsx +1 -1
  102. package/resources/templates/default/admin/lib/editor/common/elements/OrderedListRenderer.tsx +1 -1
  103. package/resources/templates/default/admin/lib/editor/common/elements/TableElementRenderer.tsx +1 -1
  104. package/resources/templates/default/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +1 -1
  105. package/resources/templates/default/admin/lib/editor/common/index.ts +6 -6
  106. package/resources/templates/default/admin/lib/editor/editor-block.tsx +54 -3
  107. package/resources/templates/default/admin/lib/editor/index.ts +6 -6
  108. package/resources/templates/default/admin/lib/editor/plugins.tsx +46 -2
  109. package/resources/templates/default/admin/lib/editor/rich-text-view.tsx +44 -0
  110. package/resources/templates/default/admin/lib/editor/rich-text.tsx +31 -3
  111. package/resources/templates/default/admin/lib/editor/sortable-block.tsx +34 -2
  112. package/resources/templates/default/admin/lib/errors/index.ts +1 -1
  113. package/resources/templates/default/admin/lib/errors/use-error-formatter.ts +22 -1
  114. package/resources/templates/default/admin/lib/field/formatted-field.tsx +16 -1
  115. package/resources/templates/default/admin/lib/field/index.ts +2 -1
  116. package/resources/templates/default/admin/lib/field/list-field.tsx +56 -0
  117. package/resources/templates/default/admin/lib/form/container.tsx +33 -3
  118. package/resources/templates/default/admin/lib/form/index.ts +6 -5
  119. package/resources/templates/default/admin/lib/form/inputs.tsx +105 -6
  120. package/resources/templates/default/admin/lib/form/labels.tsx +1 -1
  121. package/resources/templates/default/admin/lib/form/select.tsx +162 -5
  122. package/resources/templates/default/admin/lib/form/ui.tsx +2 -2
  123. package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +159 -5
  124. package/resources/templates/default/admin/lib/form/upload.tsx +116 -3
  125. package/resources/templates/default/admin/lib/formatting/formatting.ts +106 -1
  126. package/resources/templates/default/admin/lib/formatting/index.ts +1 -1
  127. package/resources/templates/default/admin/lib/images/formatImageResizeUrl.ts +19 -0
  128. package/resources/templates/default/admin/lib/images/index.ts +1 -1
  129. package/resources/templates/default/admin/lib/index.ts +54 -0
  130. package/resources/templates/default/admin/lib/labels/index.ts +2 -2
  131. package/resources/templates/default/admin/lib/layout/index.ts +3 -3
  132. package/resources/templates/default/admin/lib/layout/layout-boxed.tsx +5 -5
  133. package/resources/templates/default/admin/lib/layout/layout.tsx +3 -3
  134. package/resources/templates/default/admin/lib/outdated-application-dialog/index.ts +1 -1
  135. package/resources/templates/default/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +2 -2
  136. package/resources/templates/default/admin/lib/repeater/index.ts +1 -1
  137. package/resources/templates/default/admin/lib/repeater/repeater.tsx +26 -9
  138. package/resources/templates/default/admin/lib/select/create-new.tsx +19 -3
  139. package/resources/templates/default/admin/lib/select/filter.tsx +8 -2
  140. package/resources/templates/default/admin/lib/select/highlight.tsx +16 -0
  141. package/resources/templates/default/admin/lib/select/index.ts +6 -6
  142. package/resources/templates/default/admin/lib/select/list.tsx +30 -6
  143. package/resources/templates/default/admin/lib/select/multi-select.tsx +41 -4
  144. package/resources/templates/default/admin/lib/select/select.tsx +44 -6
  145. package/resources/templates/default/admin/lib/select/sortable-select.tsx +15 -6
  146. package/resources/templates/default/admin/lib/select/ui.tsx +100 -4
  147. package/resources/templates/default/admin/lib/tenant/dict.ts +324 -0
  148. package/resources/templates/default/admin/lib/tenant/forms/change-my-password.tsx +4 -4
  149. package/resources/templates/default/admin/lib/tenant/forms/common.tsx +3 -3
  150. package/resources/templates/default/admin/lib/tenant/forms/confirm-email-change.tsx +38 -0
  151. package/resources/templates/default/admin/lib/tenant/forms/create-api-key.tsx +5 -5
  152. package/resources/templates/default/admin/lib/tenant/forms/index.ts +12 -8
  153. package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +5 -5
  154. package/resources/templates/default/admin/lib/tenant/forms/login.tsx +4 -4
  155. package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +4 -4
  156. package/resources/templates/default/admin/lib/tenant/forms/password-reset-request.tsx +4 -4
  157. package/resources/templates/default/admin/lib/tenant/forms/password-reset.tsx +4 -4
  158. package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin-init.tsx +4 -4
  159. package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +4 -4
  160. package/resources/templates/default/admin/lib/tenant/forms/request-email-verification.tsx +35 -0
  161. package/resources/templates/default/admin/lib/tenant/forms/update-project-member.tsx +14 -5
  162. package/resources/templates/default/admin/lib/tenant/forms/verify-email.tsx +38 -0
  163. package/resources/templates/default/admin/lib/tenant/hooks/useInvite.ts +41 -0
  164. package/resources/templates/default/admin/lib/tenant/hooks/useInviteUser.tsx +32 -3
  165. package/resources/templates/default/admin/lib/tenant/index.ts +3 -3
  166. package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +3 -3
  167. package/resources/templates/default/admin/lib/tenant/listing/index.ts +4 -4
  168. package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +3 -3
  169. package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +8 -8
  170. package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +4 -4
  171. package/resources/templates/default/admin/lib/tenant/otp/index.ts +1 -1
  172. package/resources/templates/default/admin/lib/tenant/otp/otp-setup.tsx +6 -6
  173. package/resources/templates/default/admin/lib/toast/index.ts +2 -2
  174. package/resources/templates/default/admin/lib/toast/toast.tsx +3 -3
  175. package/resources/templates/default/admin/lib/ui/alert-dialog.tsx +114 -3
  176. package/resources/templates/default/admin/lib/ui/avatar.tsx +1 -1
  177. package/resources/templates/default/admin/lib/ui/button.tsx +1 -1
  178. package/resources/templates/default/admin/lib/ui/card.tsx +1 -1
  179. package/resources/templates/default/admin/lib/ui/collapsible.tsx +1 -1
  180. package/resources/templates/default/admin/lib/ui/dialog.tsx +2 -2
  181. package/resources/templates/default/admin/lib/ui/dimension.tsx +1 -1
  182. package/resources/templates/default/admin/lib/ui/divider.tsx +1 -1
  183. package/resources/templates/default/admin/lib/ui/dropdown.tsx +3 -3
  184. package/resources/templates/default/admin/lib/ui/input.tsx +1 -1
  185. package/resources/templates/default/admin/lib/ui/label.tsx +1 -1
  186. package/resources/templates/default/admin/lib/ui/loader.tsx +2 -2
  187. package/resources/templates/default/admin/lib/ui/menu.tsx +2 -2
  188. package/resources/templates/default/admin/lib/ui/overlay.tsx +1 -1
  189. package/resources/templates/default/admin/lib/ui/popover.tsx +2 -2
  190. package/resources/templates/default/admin/lib/ui/progress.tsx +1 -1
  191. package/resources/templates/default/admin/lib/ui/property-list.tsx +1 -1
  192. package/resources/templates/default/admin/lib/ui/scroll-area.tsx +1 -1
  193. package/resources/templates/default/admin/lib/ui/select.tsx +44 -2
  194. package/resources/templates/default/admin/lib/ui/separator.tsx +1 -1
  195. package/resources/templates/default/admin/lib/ui/sheet.tsx +2 -2
  196. package/resources/templates/default/admin/lib/ui/sidebar.tsx +8 -8
  197. package/resources/templates/default/admin/lib/ui/skeleton.tsx +1 -1
  198. package/resources/templates/default/admin/lib/ui/sortable.tsx +1 -1
  199. package/resources/templates/default/admin/lib/ui/switch.tsx +1 -1
  200. package/resources/templates/default/admin/lib/ui/table.tsx +1 -1
  201. package/resources/templates/default/admin/lib/ui/textarea.tsx +1 -1
  202. package/resources/templates/default/admin/lib/ui/toggle-group.tsx +2 -2
  203. package/resources/templates/default/admin/lib/ui/toggle.tsx +1 -1
  204. package/resources/templates/default/admin/lib/ui/tooltip.tsx +2 -2
  205. package/resources/templates/default/admin/lib/upload/dropzone.tsx +20 -3
  206. package/resources/templates/default/admin/lib/upload/index.ts +3 -3
  207. package/resources/templates/default/admin/lib/upload/repeater.tsx +5 -1
  208. package/resources/templates/default/admin/lib/upload/ui.tsx +2 -2
  209. package/resources/templates/default/admin/lib/upload/upload-progress.tsx +6 -6
  210. package/resources/templates/default/admin/lib/upload/view.tsx +4 -4
  211. package/resources/templates/default/admin/lib/utils/cn.ts +18 -0
  212. package/resources/templates/default/admin/lib/utils/createComponentOpenHooks.tsx +33 -0
  213. package/resources/templates/default/admin/lib/utils/index.ts +2 -2
  214. package/resources/templates/default/admin/lib/utils/uic.tsx +59 -0
  215. package/resources/templates/default/admin/lib/utils/use-mobile.ts +19 -0
  216. package/resources/templates/default/scripts/assemble-ui-lib.mjs +132 -0
  217. package/resources/templates/default/scripts/update-ui-lib.sh +101 -185
  218. package/src/commands/WorkspaceCreateCommand.ts +3 -3
  219. package/src/commands/index.ts +1 -1
  220. package/src/lib/FileSystem.ts +2 -2
  221. package/src/lib/TemplateInstaller.ts +1 -1
  222. package/src/lib/version.ts +1 -1
  223. package/src/run.ts +4 -4
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const node_path = require("node:path");
3
+ const path = require("node:path");
4
4
  const jsyaml = require("js-yaml");
5
5
  const degit = require("degit");
6
6
  var __defProp = Object.defineProperty;
@@ -33,14 +33,14 @@ class TemplateInstaller {
33
33
  throw new Error(`Failed to clone template from repository: ${error}`);
34
34
  }
35
35
  }
36
- const templateConfigFile = node_path.join(template, "contember.template.yaml");
36
+ const templateConfigFile = path.join(template, "contember.template.yaml");
37
37
  if (!await this.fs.pathExists(templateConfigFile)) {
38
38
  removeTemplate();
39
39
  throw new Error(`${template} is not a Contember template`);
40
40
  }
41
41
  const config = await this.readYaml(templateConfigFile);
42
- const nodeModulesDir = node_path.join(template, "node_modules");
43
- const skippedFiles = /* @__PURE__ */ new Set([...(config.remove || []).map((it) => node_path.join(template, it)), templateConfigFile]);
42
+ const nodeModulesDir = path.join(template, "node_modules");
43
+ const skippedFiles = /* @__PURE__ */ new Set([...(config.remove || []).map((it) => path.join(template, it)), templateConfigFile]);
44
44
  if (await this.fs.pathExists(targetDir)) {
45
45
  throw `${targetDir} already exists`;
46
46
  }
@@ -49,7 +49,7 @@ class TemplateInstaller {
49
49
  });
50
50
  removeTemplate();
51
51
  if (config.patchPackageJson) {
52
- await this.replaceFileContent(node_path.join(targetDir, "package.json"), (content) => {
52
+ await this.replaceFileContent(path.join(targetDir, "package.json"), (content) => {
53
53
  const {
54
54
  name,
55
55
  version,
@@ -62,33 +62,33 @@ class TemplateInstaller {
62
62
  });
63
63
  }
64
64
  for (const [source, target] of Object.entries(config.rename || {})) {
65
- await this.fs.rename(node_path.join(targetDir, source), node_path.join(targetDir, target));
65
+ await this.fs.rename(path.join(targetDir, source), path.join(targetDir, target));
66
66
  }
67
67
  for (const [source, target] of Object.entries(config.copy || {})) {
68
- await this.fs.copy(node_path.join(targetDir, source), node_path.join(targetDir, target));
68
+ await this.fs.copy(path.join(targetDir, source), path.join(targetDir, target));
69
69
  }
70
70
  for (const file of config.replaceVariables || []) {
71
- const path = node_path.join(targetDir, file);
72
- if (!await this.fs.pathExists(path)) {
71
+ const path$1 = path.join(targetDir, file);
72
+ if (!await this.fs.pathExists(path$1)) {
73
73
  continue;
74
74
  }
75
- await this.replaceFileContent(path, (content) => Object.entries(variables).reduce(
75
+ await this.replaceFileContent(path$1, (content) => Object.entries(variables).reduce(
76
76
  (content2, [key, value]) => content2.replace(new RegExp(`{${key}}`, "g"), value),
77
77
  content
78
78
  ));
79
79
  }
80
80
  });
81
- __publicField(this, "replaceFileContent", async (path, replacer) => {
82
- const content = await this.fs.readFile(path, { encoding: "utf8" });
81
+ __publicField(this, "replaceFileContent", async (path2, replacer) => {
82
+ const content = await this.fs.readFile(path2, { encoding: "utf8" });
83
83
  const newContent = replacer(content);
84
- await this.fs.writeFile(path, newContent, { encoding: "utf8" });
84
+ await this.fs.writeFile(path2, newContent, { encoding: "utf8" });
85
85
  });
86
- __publicField(this, "readYaml", async (path) => {
87
- const content = await this.fs.readFile(path, { encoding: "utf8" });
86
+ __publicField(this, "readYaml", async (path2) => {
87
+ const content = await this.fs.readFile(path2, { encoding: "utf8" });
88
88
  return jsyaml.load(content);
89
89
  });
90
90
  this.localTemplates = {
91
- ["default"]: node_path.join(this.resourceDir, "templates/default")
91
+ ["default"]: path.join(this.resourceDir, "templates/default")
92
92
  };
93
93
  }
94
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\nimport degit from 'degit'\n\nexport class TemplateInstaller {\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {}\n\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t} else {\n\t\t\tconst tmpDir = await this.fs.createTempDir()\n\n\t\t\ttry {\n\t\t\t\tconst emitter = degit(template, { cache: false, force: true, verbose: true })\n\t\t\t\tawait emitter.clone(tmpDir)\n\n\t\t\t\tremoveTemplate = () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.fs.remove(tmpDir, { recursive: true, force: true })\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(`Failed to clean up template: ${error}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttemplate = tmpDir\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Failed to clone template from repository: ${error}`)\n\t\t\t}\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tremoveTemplate()\n\t\t\tthrow new Error(`${template} is not a Contember template`)\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`{${key}}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t))\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["join","content"],"mappings":";;;;;;;;AAKO,MAAM,kBAAkB;AAAA,EAG9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AAJlB,kBAAA,MAAQ,gBAAA;AAWR,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAAC;AAE5B,UAAI,KAAK,eAAe,QAAQ,GAAG;AAClC,mBAAW,KAAK,eAAe,QAAQ;AAAA,MACxC,OAAO;AACN,cAAM,SAAS,MAAM,KAAK,GAAG,cAAA;AAE7B,YAAI;AACH,gBAAM,UAAU,MAAM,UAAU,EAAE,OAAO,OAAO,OAAO,MAAM,SAAS,MAAM;AAC5E,gBAAM,QAAQ,MAAM,MAAM;AAE1B,2BAAiB,MAAM;AACtB,gBAAI;AACH,mBAAK,GAAG,OAAO,QAAQ,EAAE,WAAW,MAAM,OAAO,MAAM;AAAA,YACxD,SAAS,OAAO;AACf,sBAAQ,MAAM,gCAAgC,KAAK,EAAE;AAAA,YACtD;AAAA,UACD;AAEA,qBAAW;AA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AA,MACtE;AACA,iBAAW,CAAC,QAAQ,MAAM,KAAK,OAAO,QAAQ,OAAO,QAAQ,CAAA,CAAE,GAAG;AACjE,cAAM,KAAK,GAAG,KAAKA,eAAK,WAAW,MAAM,GAAGA,UAAAA,KAAK,WAAW,MAAM,CAAC;AAAA,MACpE;AAEA,iBAAW,QAAQ,OAAO,oBAAoB,CAAA,GAAI;AACjD,cAAM,OAAOA,UAAAA,KAAK,WAAW,IAAI;AACjC,YAAI,CAAE,MAAM,KAAK,GAAG,WAAW,IAAI,GAAI;AACtC;AAAA,QACD;AACA,cAAM,KAAK,mBAAmB,MAAM,aACnC,OAAO,QAAQ,SAAS,EAAE;AAAA,UACzB,CAACC,UAAS,CAAC,KAAK,KAAK,MAAMA,SAAQ,QAAQ,IAAI,OAAO,IAAI,GAAG,KAAK,GAAG,GAAG,KAAK;AAAA,UAC7E;AAAA,QAAA,CACA;AAAA,MACH;AAAA,IACD,CAAA;AAEA,kBAAA,MAAQ,sBAAqB,OAAO,MAAc,aAAyD;AAC1G,YAAM,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AACjE,YAAM,aAAa,SAAS,OAAO;AACnC,YAAM,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAC/D,CAAA;AAEA,kBAAA,MAAQ,YAAW,OAAoB,SAA6B;AACnE,YAAM,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AACjE,aAAO,OAAO,KAAK,OAAO;AAAA,IAC3B,CAAA;AArGC,SAAK,iBAAiB;AAAA,MACrB,CAAC,SAAS,GAAGD,UAAAA,KAAK,KAAK,aAAa,mBAAmB;AAAA,IAAA;AAAA,EAEzD;AAmGD;;"}
1
+ {"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem.js'\nimport jsyaml from 'js-yaml'\nimport degit from 'degit'\n\nexport class TemplateInstaller {\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {}\n\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t} else {\n\t\t\tconst tmpDir = await this.fs.createTempDir()\n\n\t\t\ttry {\n\t\t\t\tconst emitter = degit(template, { cache: false, force: true, verbose: true })\n\t\t\t\tawait emitter.clone(tmpDir)\n\n\t\t\t\tremoveTemplate = () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.fs.remove(tmpDir, { recursive: true, force: true })\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(`Failed to clean up template: ${error}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttemplate = tmpDir\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Failed to clone template from repository: ${error}`)\n\t\t\t}\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tremoveTemplate()\n\t\t\tthrow new Error(`${template} is not a Contember template`)\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`{${key}}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t))\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["join","path","content"],"mappings":";;;;;;;;AAKO,MAAM,kBAAkB;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,kBAAA,MAAQ,sBAAqB,OAAOD,OAAc,aAAyD;AAC1G,YAAM,UAAU,MAAM,KAAK,GAAG,SAASA,OAAM,EAAE,UAAU,QAAQ;AACjE,YAAM,aAAa,SAAS,OAAO;AACnC,YAAM,KAAK,GAAG,UAAUA,OAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAC/D,CAAA;AAEA,kBAAA,MAAQ,YAAW,OAAoBA,UAA6B;AACnE,YAAM,UAAU,MAAM,KAAK,GAAG,SAASA,OAAM,EAAE,UAAU,QAAQ;AACjE,aAAO,OAAO,KAAK,OAAO;AAAA,IAC3B,CAAA;AArGC,SAAK,iBAAiB;AAAA,MACrB,CAAC,SAAS,GAAGD,KAAAA,KAAK,KAAK,aAAa,mBAAmB;AAAA,IAAA;AAAA,EAEzD;AAmGD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\nimport degit from 'degit'\n\nexport class TemplateInstaller {\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {}\n\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t} else {\n\t\t\tconst tmpDir = await this.fs.createTempDir()\n\n\t\t\ttry {\n\t\t\t\tconst emitter = degit(template, { cache: false, force: true, verbose: true })\n\t\t\t\tawait emitter.clone(tmpDir)\n\n\t\t\t\tremoveTemplate = () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.fs.remove(tmpDir, { recursive: true, force: true })\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(`Failed to clean up template: ${error}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttemplate = tmpDir\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Failed to clone template from repository: ${error}`)\n\t\t\t}\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tremoveTemplate()\n\t\t\tthrow new Error(`${template} is not a Contember template`)\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`{${key}}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t))\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["content","jsyaml"],"mappings":";;;;;;AAKO,MAAM,kBAAkB;AAAA,EAG9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AAJlB,kBAAA,MAAQ,gBAAA;AAWR,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAAC;AAE5B,UAAI,KAAK,eAAe,QAAQ,GAAG;AAClC,mBAAW,KAAK,eAAe,QAAQ;AAAA,MACxC,OAAO;AACN,cAAM,SAAS,MAAM,KAAK,GAAG,cAAA;AAE7B,YAAI;AACH,gBAAM,UAAU,MAAM,UAAU,EAAE,OAAO,OAAO,OAAO,MAAM,SAAS,MAAM;AAC5E,gBAAM,QAAQ,MAAM,MAAM;AAE1B,2BAAiB,MAAM;AACtB,gBAAI;AACH,mBAAK,GAAG,OAAO,QAAQ,EAAE,WAAW,MAAM,OAAO,MAAM;AAAA,YACxD,SAAS,OAAO;AACf,sBAAQ,MAAM,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,MAAM,CAAC;AAAA,MACtE;AACA,iBAAW,CAAC,QAAQ,MAAM,KAAK,OAAO,QAAQ,OAAO,QAAQ,CAAA,CAAE,GAAG;AACjE,cAAM,KAAK,GAAG,KAAK,KAAK,WAAW,MAAM,GAAG,KAAK,WAAW,MAAM,CAAC;AAAA,MACpE;AAEA,iBAAW,QAAQ,OAAO,oBAAoB,CAAA,GAAI;AACjD,cAAM,OAAO,KAAK,WAAW,IAAI;AACjC,YAAI,CAAE,MAAM,KAAK,GAAG,WAAW,IAAI,GAAI;AACtC;AAAA,QACD;AACA,cAAM,KAAK,mBAAmB,MAAM,aACnC,OAAO,QAAQ,SAAS,EAAE;AAAA,UACzB,CAACA,UAAS,CAAC,KAAK,KAAK,MAAMA,SAAQ,QAAQ,IAAI,OAAO,IAAI,GAAG,KAAK,GAAG,GAAG,KAAK;AAAA,UAC7E;AAAA,QAAA,CACA;AAAA,MACH;AAAA,IACD,CAAA;AAEA,kBAAA,MAAQ,sBAAqB,OAAO,MAAc,aAAyD;AAC1G,YAAM,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AACjE,YAAM,aAAa,SAAS,OAAO;AACnC,YAAM,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAC/D,CAAA;AAEA,kBAAA,MAAQ,YAAW,OAAoB,SAA6B;AACnE,YAAM,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AACjE,aAAOC,gBAAO,KAAK,OAAO;AAAA,IAC3B,CAAA;AArGC,SAAK,iBAAiB;AAAA,MACrB,CAAC,SAAS,GAAG,KAAK,KAAK,aAAa,mBAAmB;AAAA,IAAA;AAAA,EAEzD;AAmGD;"}
1
+ {"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem.js'\nimport jsyaml from 'js-yaml'\nimport degit from 'degit'\n\nexport class TemplateInstaller {\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {}\n\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t} else {\n\t\t\tconst tmpDir = await this.fs.createTempDir()\n\n\t\t\ttry {\n\t\t\t\tconst emitter = degit(template, { cache: false, force: true, verbose: true })\n\t\t\t\tawait emitter.clone(tmpDir)\n\n\t\t\t\tremoveTemplate = () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.fs.remove(tmpDir, { recursive: true, force: true })\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(`Failed to clean up template: ${error}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttemplate = tmpDir\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Failed to clone template from repository: ${error}`)\n\t\t\t}\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tremoveTemplate()\n\t\t\tthrow new Error(`${template} is not a Contember template`)\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`{${key}}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t))\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["content","jsyaml"],"mappings":";;;;;;AAKO,MAAM,kBAAkB;AAAA,EAG9B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AG,SAAS,MAAM,EAAE,UAAU,QAAQ;AACjE,YAAM,aAAa,SAAS,OAAO;AACnC,YAAM,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAC/D,CAAA;AAEA,kBAAA,MAAQ,YAAW,OAAoB,SAA6B;AACnE,YAAM,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AACjE,aAAOC,gBAAO,KAAK,OAAO;AAAA,IAC3B,CAAA;AArGC,SAAK,iBAAiB;AAAA,MACrB,CAAC,SAAS,GAAG,KAAK,KAAK,aAAa,mBAAmB;AAAA,IAAA;AAAA,EAEzD;AAmGD;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const node_fs = require("node:fs");
4
- const node_path = require("node:path");
4
+ const path = require("node:path");
5
5
  const detectPackageManager = () => {
6
6
  const userAgent = process.env.npm_config_user_agent;
7
7
  if (userAgent) {
@@ -11,11 +11,11 @@ const detectPackageManager = () => {
11
11
  if (userAgent.startsWith("bun/")) return "bun";
12
12
  }
13
13
  const cwd = process.cwd();
14
- if (node_fs.existsSync(node_path.join(cwd, "yarn.lock"))) return "yarn";
15
- if (node_fs.existsSync(node_path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
16
- if (node_fs.existsSync(node_path.join(cwd, "package-lock.json"))) return "npm";
17
- if (node_fs.existsSync(node_path.join(cwd, "bun.lockb"))) return "bun";
18
- if (node_fs.existsSync(node_path.join(cwd, "bun.lock"))) return "bun";
14
+ if (node_fs.existsSync(path.join(cwd, "yarn.lock"))) return "yarn";
15
+ if (node_fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
16
+ if (node_fs.existsSync(path.join(cwd, "package-lock.json"))) return "npm";
17
+ if (node_fs.existsSync(path.join(cwd, "bun.lockb"))) return "bun";
18
+ if (node_fs.existsSync(path.join(cwd, "bun.lock"))) return "bun";
19
19
  return "npm";
20
20
  };
21
21
  exports.detectPackageManager = detectPackageManager;
@@ -1 +1 @@
1
- {"version":3,"file":"packageManagerDetector.cjs","sources":["../../../../../packages/create/src/lib/packageManagerDetector.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\nexport const detectPackageManager = (): PackageManager => {\n\tconst userAgent = process.env.npm_config_user_agent\n\n\tif (userAgent) {\n\t\tif (userAgent.startsWith('yarn/')) return 'yarn'\n\t\tif (userAgent.startsWith('pnpm/')) return 'pnpm'\n\t\tif (userAgent.startsWith('npm/')) return 'npm'\n\t\tif (userAgent.startsWith('bun/')) return 'bun'\n\t}\n\n\tconst cwd = process.cwd()\n\tif (existsSync(join(cwd, 'yarn.lock'))) return 'yarn'\n\tif (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n\tif (existsSync(join(cwd, 'package-lock.json'))) return 'npm'\n\tif (existsSync(join(cwd, 'bun.lockb'))) return 'bun'\n\tif (existsSync(join(cwd, 'bun.lock'))) return 'bun'\n\n\treturn 'npm'\n}\n"],"names":["existsSync","join"],"mappings":";;;;AAKO,MAAM,uBAAuB,MAAsB;AACzD,QAAM,YAAY,QAAQ,IAAI;AAE9B,MAAI,WAAW;AACd,QAAI,UAAU,WAAW,OAAO,EAAG,QAAO;AAC1C,QAAI,UAAU,WAAW,OAAO,EAAG,QAAO;AAC1C,QAAI,UAAU,WAAW,MAAM,EAAG,QAAO;AACzC,QAAI,UAAU,WAAW,MAAM,EAAG,QAAO;AAAA,EAC1C;AAEA,QAAM,MAAM,QAAQ,IAAA;AACpB,MAAIA,QAAAA,WAAWC,UAAAA,KAAK,KAAK,WAAW,CAAC,EAAG,QAAO;AAC/C,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,gBAAgB,CAAC,EAAG,QAAO;AACpD,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,mBAAmB,CAAC,EAAG,QAAO;AACvD,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,WAAW,CAAC,EAAG,QAAO;AAC/C,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,UAAU,CAAC,EAAG,QAAO;AAE9C,SAAO;AACR;;"}
1
+ {"version":3,"file":"packageManagerDetector.cjs","sources":["../../../../../packages/create/src/lib/packageManagerDetector.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\nexport const detectPackageManager = (): PackageManager => {\n\tconst userAgent = process.env.npm_config_user_agent\n\n\tif (userAgent) {\n\t\tif (userAgent.startsWith('yarn/')) return 'yarn'\n\t\tif (userAgent.startsWith('pnpm/')) return 'pnpm'\n\t\tif (userAgent.startsWith('npm/')) return 'npm'\n\t\tif (userAgent.startsWith('bun/')) return 'bun'\n\t}\n\n\tconst cwd = process.cwd()\n\tif (existsSync(join(cwd, 'yarn.lock'))) return 'yarn'\n\tif (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n\tif (existsSync(join(cwd, 'package-lock.json'))) return 'npm'\n\tif (existsSync(join(cwd, 'bun.lockb'))) return 'bun'\n\tif (existsSync(join(cwd, 'bun.lock'))) return 'bun'\n\n\treturn 'npm'\n}\n"],"names":["existsSync","join"],"mappings":";;;;AAKO,MAAM,uBAAuB,MAAsB;AACzD,QAAM,YAAY,QAAQ,IAAI;AAE9B,MAAI,WAAW;AACd,QAAI,UAAU,WAAW,OAAO,EAAG,QAAO;AAC1C,QAAI,UAAU,WAAW,OAAO,EAAG,QAAO;AAC1C,QAAI,UAAU,WAAW,MAAM,EAAG,QAAO;AACzC,QAAI,UAAU,WAAW,MAAM,EAAG,QAAO;AAAA,EAC1C;AAEA,QAAM,MAAM,QAAQ,IAAA;AACpB,MAAIA,QAAAA,WAAWC,KAAAA,KAAK,KAAK,WAAW,CAAC,EAAG,QAAO;AAC/C,MAAID,QAAAA,WAAWC,KAAAA,KAAK,KAAK,gBAAgB,CAAC,EAAG,QAAO;AACpD,MAAID,QAAAA,WAAWC,KAAAA,KAAK,KAAK,mBAAmB,CAAC,EAAG,QAAO;AACvD,MAAID,QAAAA,WAAWC,KAAAA,KAAK,KAAK,WAAW,CAAC,EAAG,QAAO;AAC/C,MAAID,QAAAA,WAAWC,KAAAA,KAAK,KAAK,UAAU,CAAC,EAAG,QAAO;AAE9C,SAAO;AACR;;"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const node_path = require("node:path");
3
+ const path = require("node:path");
4
4
  const fs = require("node:fs/promises");
5
5
  const paths = require("../paths.cjs");
6
6
  const getPackageVersion = async () => {
7
- return JSON.parse(await fs.readFile(node_path.join(paths.packageRoot, "package.json"), "utf-8")).version;
7
+ return JSON.parse(await fs.readFile(path.join(paths.packageRoot, "package.json"), "utf-8")).version;
8
8
  };
9
9
  exports.getPackageVersion = getPackageVersion;
10
10
  //# sourceMappingURL=version.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.cjs","sources":["../../../../../packages/create/src/lib/version.ts"],"sourcesContent":["import { join } from 'node:path'\nimport fs from 'node:fs/promises'\nimport { packageRoot } from '../paths'\n\nexport const getPackageVersion = async () => {\n\treturn JSON.parse(await fs.readFile(join(packageRoot, 'package.json'), 'utf-8')).version\n}\n"],"names":["join","packageRoot"],"mappings":";;;;;AAIO,MAAM,oBAAoB,YAAY;AAC5C,SAAO,KAAK,MAAM,MAAM,GAAG,SAASA,eAAKC,MAAAA,aAAa,cAAc,GAAG,OAAO,CAAC,EAAE;AAClF;;"}
1
+ {"version":3,"file":"version.cjs","sources":["../../../../../packages/create/src/lib/version.ts"],"sourcesContent":["import { join } from 'node:path'\nimport fs from 'node:fs/promises'\nimport { packageRoot } from '../paths.js'\n\nexport const getPackageVersion = async () => {\n\treturn JSON.parse(await fs.readFile(join(packageRoot, 'package.json'), 'utf-8')).version\n}\n"],"names":["join","packageRoot"],"mappings":";;;;;AAIO,MAAM,oBAAoB,YAAY;AAC5C,SAAO,KAAK,MAAM,MAAM,GAAG,SAASA,UAAKC,MAAAA,aAAa,cAAc,GAAG,OAAO,CAAC,EAAE;AAClF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../../../../../packages/create/src/lib/version.ts"],"sourcesContent":["import { join } from 'node:path'\nimport fs from 'node:fs/promises'\nimport { packageRoot } from '../paths'\n\nexport const getPackageVersion = async () => {\n\treturn JSON.parse(await fs.readFile(join(packageRoot, 'package.json'), 'utf-8')).version\n}\n"],"names":["fs"],"mappings":";;;AAIO,MAAM,oBAAoB,YAAY;AAC5C,SAAO,KAAK,MAAM,MAAMA,YAAG,SAAS,KAAK,aAAa,cAAc,GAAG,OAAO,CAAC,EAAE;AAClF;"}
1
+ {"version":3,"file":"version.js","sources":["../../../../../packages/create/src/lib/version.ts"],"sourcesContent":["import { join } from 'node:path'\nimport fs from 'node:fs/promises'\nimport { packageRoot } from '../paths.js'\n\nexport const getPackageVersion = async () => {\n\treturn JSON.parse(await fs.readFile(join(packageRoot, 'package.json'), 'utf-8')).version\n}\n"],"names":["fs"],"mappings":";;;AAIO,MAAM,oBAAoB,YAAY;AAC5C,SAAO,KAAK,MAAM,MAAMA,YAAG,SAAS,KAAK,aAAa,cAAc,GAAG,OAAO,CAAC,EAAE;AAClF;"}
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const cliCommon = require("@contember/cli-common");
4
- const node_path = require("node:path");
4
+ const path = require("node:path");
5
5
  const node_url = require("node:url");
6
6
  var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
7
- const currentFilePath = node_path.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("create/src/paths.cjs", document.baseURI).href));
7
+ const currentFilePath = path.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("create/src/paths.cjs", document.baseURI).href));
8
8
  const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || cliCommon.findPackageRoot(currentFilePath);
9
- const resourcesDir = node_path.join(packageRoot, "./resources");
9
+ const resourcesDir = path.join(packageRoot, "./resources");
10
10
  exports.packageRoot = packageRoot;
11
11
  exports.resourcesDir = resourcesDir;
12
12
  //# sourceMappingURL=paths.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.cjs","sources":["../../../../packages/create/src/paths.ts"],"sourcesContent":["import { findPackageRoot } from '@contember/cli-common'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst currentFilePath = dirname(fileURLToPath(import.meta.url))\nexport const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || findPackageRoot(currentFilePath)\nexport const resourcesDir = join(packageRoot, './resources')\n"],"names":["dirname","fileURLToPath","findPackageRoot","join"],"mappings":";;;;;;AAIA,MAAM,kBAAkBA,UAAAA,QAAQC,uBAAc,OAAA,aAAA,cAAA,QAAA,KAAA,EAAA,cAAA,UAAA,EAAA,OAAA,0BAAA,uBAAA,QAAA,YAAA,MAAA,YAAA,uBAAA,OAAA,IAAA,IAAA,wBAAA,SAAA,OAAA,EAAA,IAAe,CAAC;AACvD,MAAM,cAAc,QAAQ,IAAI,8BAA8BC,UAAAA,gBAAgB,eAAe;AAC7F,MAAM,eAAeC,UAAAA,KAAK,aAAa,aAAa;;;"}
1
+ {"version":3,"file":"paths.cjs","sources":["../../../../packages/create/src/paths.ts"],"sourcesContent":["import { findPackageRoot } from '@contember/cli-common'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst currentFilePath = dirname(fileURLToPath(import.meta.url))\nexport const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || findPackageRoot(currentFilePath)\nexport const resourcesDir = join(packageRoot, './resources')\n"],"names":["dirname","fileURLToPath","findPackageRoot","join"],"mappings":";;;;;;AAIA,MAAM,kBAAkBA,KAAAA,QAAQC,uBAAc,OAAA,aAAA,cAAA,QAAA,KAAA,EAAA,cAAA,UAAA,EAAA,OAAA,0BAAA,uBAAA,QAAA,YAAA,MAAA,YAAA,uBAAA,OAAA,IAAA,IAAA,wBAAA,SAAA,OAAA,EAAA,IAAe,CAAC;AACvD,MAAM,cAAc,QAAQ,IAAI,8BAA8BC,UAAAA,gBAAgB,eAAe;AAC7F,MAAM,eAAeC,KAAAA,KAAK,aAAa,aAAa;;;"}
@@ -1,5 +1,5 @@
1
1
  import { Command, CommandConfiguration, Input } from '@contember/cli-common';
2
- import { TemplateInstaller } from '../lib/TemplateInstaller';
2
+ import { TemplateInstaller } from '../lib/TemplateInstaller.js';
3
3
  type Args = {
4
4
  projectName: string;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceCreateCommand.d.ts","sourceRoot":"","sources":["../../../src/commands/WorkspaceCreateCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAG5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAI5D,KAAK,IAAI,GAAG;IACX,WAAW,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,KAAK,OAAO,GAAG;IACd,QAAQ,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAEhE,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,iBAAiB;IAKtD,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAM7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAcnE"}
1
+ {"version":3,"file":"WorkspaceCreateCommand.d.ts","sourceRoot":"","sources":["../../../src/commands/WorkspaceCreateCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAG5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAI/D,KAAK,IAAI,GAAG;IACX,WAAW,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,KAAK,OAAO,GAAG;IACd,QAAQ,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IAEhE,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAAjB,iBAAiB,EAAE,iBAAiB;IAKtD,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI;cAM7D,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAcnE"}
@@ -1,2 +1,2 @@
1
- export * from './WorkspaceCreateCommand';
1
+ export * from './WorkspaceCreateCommand.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA"}
@@ -1,11 +1,12 @@
1
1
  import * as fs from 'node:fs/promises';
2
- import { copy } from 'fs-extra';
3
2
  export declare class FileSystem {
4
3
  readFile: typeof fs.readFile;
5
4
  writeFile: typeof fs.writeFile;
6
5
  rename: typeof fs.rename;
7
6
  readDir: typeof fs.readdir;
8
- copy: typeof copy;
7
+ copy: (source: string, destination: string, options?: {
8
+ filter?: (source: string, destination: string) => boolean;
9
+ }) => Promise<void>;
9
10
  unlink: typeof fs.unlink;
10
11
  remove: typeof fs.rm;
11
12
  pathExists: (path: string) => Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../../src/lib/FileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAG/B,qBAAa,UAAU;IACtB,QAAQ,qBAAc;IACtB,SAAS,sBAAe;IACxB,MAAM,mBAAY;IAClB,OAAO,oBAAa;IACpB,IAAI,cAAO;IACX,MAAM,mBAAY;IAClB,MAAM,eAAQ;IACd,UAAU,GAAU,MAAM,MAAM,sBAO/B;IACD,aAAa,wBAEZ;CACD"}
1
+ {"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../../src/lib/FileSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAItC,qBAAa,UAAU;IACtB,QAAQ,qBAAc;IACtB,SAAS,sBAAe;IACxB,MAAM,mBAAY;IAClB,OAAO,oBAAa;IACpB,IAAI,GAAI,QAAQ,MAAM,EAAE,aAAa,MAAM,EAAE,UAAU;QAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAA;KAAE,mBACxD;IAC5D,MAAM,mBAAY;IAClB,MAAM,eAAQ;IACd,UAAU,GAAU,MAAM,MAAM,sBAO/B;IACD,aAAa,wBAEZ;CACD"}
@@ -1,4 +1,4 @@
1
- import { FileSystem } from './FileSystem';
1
+ import { FileSystem } from './FileSystem.js';
2
2
  export declare class TemplateInstaller {
3
3
  private readonly resourceDir;
4
4
  private readonly fs;
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateInstaller.d.ts","sourceRoot":"","sources":["../../../src/lib/TemplateInstaller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzC,qBAAa,iBAAiB;IAI5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,EAAE;IAJpB,OAAO,CAAC,cAAc,CAAwB;gBAG5B,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,UAAU;IAOhC,eAAe,GACd,UAAU,MAAM,EAChB,WAAW,MAAM,EACjB,YAAW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,mBAkFtC;IAED,OAAO,CAAC,kBAAkB,CAIzB;IAED,OAAO,CAAC,QAAQ,CAGf;CACD"}
1
+ {"version":3,"file":"TemplateInstaller.d.ts","sourceRoot":"","sources":["../../../src/lib/TemplateInstaller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAI5C,qBAAa,iBAAiB;IAI5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,EAAE;IAJpB,OAAO,CAAC,cAAc,CAAwB;gBAG5B,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,UAAU;IAOhC,eAAe,GACd,UAAU,MAAM,EAChB,WAAW,MAAM,EACjB,YAAW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,mBAkFtC;IAED,OAAO,CAAC,kBAAkB,CAIzB;IAED,OAAO,CAAC,QAAQ,CAGf;CACD"}