@contember/create 2.0.0-alpha.9 → 2.0.0-beta.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 (146) hide show
  1. package/dist/development/run.cjs +0 -2
  2. package/dist/development/run.cjs.map +1 -1
  3. package/dist/development/run.js +0 -2
  4. package/dist/development/run.js.map +1 -1
  5. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  6. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  7. package/dist/development/src/lib/FileSystem.cjs.map +1 -1
  8. package/dist/development/src/lib/FileSystem.js.map +1 -1
  9. package/dist/development/src/lib/TemplateInstaller.cjs +1 -8
  10. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  11. package/dist/development/src/lib/TemplateInstaller.js +2 -9
  12. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  13. package/dist/development/src/lib/version.cjs.map +1 -1
  14. package/dist/development/src/paths.cjs +3 -1
  15. package/dist/development/src/paths.cjs.map +1 -1
  16. package/dist/development/src/paths.js +4 -2
  17. package/dist/development/src/paths.js.map +1 -1
  18. package/dist/production/run.cjs +0 -2
  19. package/dist/production/run.cjs.map +1 -1
  20. package/dist/production/run.js +0 -2
  21. package/dist/production/run.js.map +1 -1
  22. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  23. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  24. package/dist/production/src/lib/FileSystem.cjs.map +1 -1
  25. package/dist/production/src/lib/FileSystem.js.map +1 -1
  26. package/dist/production/src/lib/TemplateInstaller.cjs +1 -8
  27. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  28. package/dist/production/src/lib/TemplateInstaller.js +2 -9
  29. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  30. package/dist/production/src/lib/version.cjs.map +1 -1
  31. package/dist/production/src/paths.cjs +3 -1
  32. package/dist/production/src/paths.cjs.map +1 -1
  33. package/dist/production/src/paths.js +4 -2
  34. package/dist/production/src/paths.js.map +1 -1
  35. package/dist/types/lib/TemplateInstaller.d.ts +1 -3
  36. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  37. package/dist/types/paths.d.ts.map +1 -1
  38. package/dist/types/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +7 -31
  40. package/resources/templates/template-workspace/.github/scripts/setup-actions-variables.sh +36 -0
  41. package/resources/templates/template-workspace/.github/workflows/deploy.yaml +23 -0
  42. package/resources/templates/template-workspace/admin/lib/binding/binding.tsx +12 -2
  43. package/resources/templates/template-workspace/admin/lib/binding/delete.tsx +34 -23
  44. package/resources/templates/template-workspace/admin/lib/binding/hooks.tsx +5 -6
  45. package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +34 -3
  46. package/resources/templates/template-workspace/admin/lib/binding/navigation-guard-dialog.tsx +39 -0
  47. package/resources/templates/template-workspace/admin/lib/binding/persist.tsx +10 -60
  48. package/resources/templates/template-workspace/admin/lib/block-repeater/block-repeater.tsx +109 -39
  49. package/resources/templates/template-workspace/admin/lib/buttons/link-back-button.tsx +1 -1
  50. package/resources/templates/template-workspace/admin/lib/datagrid/cells.tsx +90 -10
  51. package/resources/templates/template-workspace/admin/lib/datagrid/column-header.tsx +12 -4
  52. package/resources/templates/template-workspace/admin/lib/datagrid/column-leaf.tsx +21 -0
  53. package/resources/templates/template-workspace/admin/lib/datagrid/columns.tsx +367 -36
  54. package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +6 -0
  55. package/resources/templates/template-workspace/admin/lib/datagrid/export.tsx +9 -0
  56. package/resources/templates/template-workspace/admin/lib/datagrid/filters/boolean.tsx +22 -5
  57. package/resources/templates/template-workspace/admin/lib/datagrid/filters/common.tsx +3 -0
  58. package/resources/templates/template-workspace/admin/lib/datagrid/filters/date.tsx +25 -2
  59. package/resources/templates/template-workspace/admin/lib/datagrid/filters/defined.tsx +103 -0
  60. package/resources/templates/template-workspace/admin/lib/datagrid/filters/enum.tsx +83 -27
  61. package/resources/templates/template-workspace/admin/lib/datagrid/filters/index.ts +1 -1
  62. package/resources/templates/template-workspace/admin/lib/datagrid/filters/mobile.tsx +0 -1
  63. package/resources/templates/template-workspace/admin/lib/datagrid/filters/number.tsx +21 -5
  64. package/resources/templates/template-workspace/admin/lib/datagrid/filters/relation.tsx +170 -43
  65. package/resources/templates/template-workspace/admin/lib/datagrid/filters/text.tsx +48 -5
  66. package/resources/templates/template-workspace/admin/lib/datagrid/grid.tsx +97 -25
  67. package/resources/templates/template-workspace/admin/lib/datagrid/index.ts +30 -4
  68. package/resources/templates/template-workspace/admin/lib/datagrid/labels.tsx +31 -0
  69. package/resources/templates/template-workspace/admin/lib/datagrid/layout-switcher.tsx +3 -0
  70. package/resources/templates/template-workspace/admin/lib/datagrid/loader.tsx +44 -2
  71. package/resources/templates/template-workspace/admin/lib/datagrid/pagination.tsx +8 -0
  72. package/resources/templates/template-workspace/admin/lib/datagrid/table.tsx +15 -1
  73. package/resources/templates/template-workspace/admin/lib/datagrid/tiles.tsx +13 -0
  74. package/resources/templates/template-workspace/admin/lib/datagrid/toolbar.tsx +27 -2
  75. package/resources/templates/template-workspace/admin/lib/dict.ts +54 -5
  76. package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +1 -1
  77. package/resources/templates/template-workspace/admin/lib/editor/common/editor-canvas.tsx +2 -2
  78. package/resources/templates/template-workspace/admin/lib/editor/index.ts +1 -0
  79. package/resources/templates/template-workspace/admin/lib/editor/rich-text-view.tsx +17 -0
  80. package/resources/templates/template-workspace/admin/lib/field/formatted-field.tsx +10 -0
  81. package/resources/templates/template-workspace/admin/lib/field/index.ts +1 -0
  82. package/resources/templates/template-workspace/admin/lib/form/container.tsx +43 -45
  83. package/resources/templates/template-workspace/admin/lib/form/index.ts +1 -0
  84. package/resources/templates/template-workspace/admin/lib/form/inputs.tsx +56 -23
  85. package/resources/templates/template-workspace/admin/lib/form/select.tsx +61 -30
  86. package/resources/templates/template-workspace/admin/lib/form/ui.tsx +11 -2
  87. package/resources/templates/template-workspace/admin/lib/form/upload-repeaters.tsx +188 -0
  88. package/resources/templates/template-workspace/admin/lib/form/upload.tsx +57 -242
  89. package/resources/templates/template-workspace/admin/lib/formatting/formatting.ts +23 -0
  90. package/resources/templates/template-workspace/admin/lib/labels/enum-labels.ts +9 -0
  91. package/resources/templates/template-workspace/admin/lib/labels/field-labels.ts +7 -0
  92. package/resources/templates/template-workspace/admin/lib/labels/index.ts +2 -0
  93. package/resources/templates/template-workspace/admin/lib/layout/layout.tsx +3 -3
  94. package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +97 -64
  95. package/resources/templates/template-workspace/admin/lib/select/filter.tsx +3 -2
  96. package/resources/templates/template-workspace/admin/lib/select/index.ts +0 -1
  97. package/resources/templates/template-workspace/admin/lib/select/list.tsx +78 -26
  98. package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +12 -19
  99. package/resources/templates/template-workspace/admin/lib/select/select.tsx +40 -23
  100. package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +23 -18
  101. package/resources/templates/template-workspace/admin/lib/select/ui.tsx +3 -0
  102. package/resources/templates/template-workspace/admin/lib/tenant/forms/invite.tsx +5 -3
  103. package/resources/templates/template-workspace/admin/lib/tenant/forms/memberships-control.tsx +28 -16
  104. package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset.tsx +9 -6
  105. package/resources/templates/template-workspace/admin/lib/tenant/forms/passwordless-signin-init.tsx +31 -0
  106. package/resources/templates/template-workspace/admin/lib/tenant/forms/passwordless-signin.tsx +59 -0
  107. package/resources/templates/template-workspace/admin/lib/tenant/forms/update-project-member.tsx +5 -3
  108. package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInvite.ts +1 -1
  109. package/resources/templates/template-workspace/admin/lib/tenant/listing/member-list.tsx +6 -5
  110. package/resources/templates/template-workspace/admin/lib/tenant/listing/person-list.tsx +2 -1
  111. package/resources/templates/template-workspace/admin/lib/ui/alert-dialog.tsx +2 -1
  112. package/resources/templates/template-workspace/admin/lib/ui/collapsible.tsx +9 -0
  113. package/resources/templates/template-workspace/admin/lib/ui/dialog.tsx +2 -1
  114. package/resources/templates/template-workspace/admin/lib/ui/dropdown.tsx +2 -1
  115. package/resources/templates/template-workspace/admin/lib/ui/input.tsx +14 -10
  116. package/resources/templates/template-workspace/admin/lib/ui/menu.tsx +2 -3
  117. package/resources/templates/template-workspace/admin/lib/ui/popover.tsx +2 -1
  118. package/resources/templates/template-workspace/admin/lib/ui/property-list.tsx +33 -0
  119. package/resources/templates/template-workspace/admin/lib/ui/select.tsx +80 -0
  120. package/resources/templates/template-workspace/admin/lib/ui/sheet.tsx +3 -2
  121. package/resources/templates/template-workspace/admin/lib/ui/textarea.tsx +9 -1
  122. package/resources/templates/template-workspace/admin/lib/upload/view.tsx +160 -165
  123. package/resources/templates/template-workspace/admin/lib/utils/createComponentOpenHooks.tsx +38 -0
  124. package/resources/templates/template-workspace/admin/lib/utils/uic.tsx +3 -3
  125. package/resources/templates/template-workspace/admin/package.json +21 -20
  126. package/resources/templates/template-workspace/package.json +3 -3
  127. package/src/lib/TemplateInstaller.ts +2 -9
  128. package/src/paths.ts +4 -3
  129. package/src/run.ts +0 -2
  130. package/tsconfig.settings.json +0 -4
  131. package/dist/development/src/lib/PackageDownloader.cjs +0 -33
  132. package/dist/development/src/lib/PackageDownloader.cjs.map +0 -1
  133. package/dist/development/src/lib/PackageDownloader.js +0 -33
  134. package/dist/development/src/lib/PackageDownloader.js.map +0 -1
  135. package/dist/production/src/lib/PackageDownloader.cjs +0 -33
  136. package/dist/production/src/lib/PackageDownloader.cjs.map +0 -1
  137. package/dist/production/src/lib/PackageDownloader.js +0 -33
  138. package/dist/production/src/lib/PackageDownloader.js.map +0 -1
  139. package/dist/types/lib/PackageDownloader.d.ts +0 -7
  140. package/dist/types/lib/PackageDownloader.d.ts.map +0 -1
  141. package/resources/templates/template-workspace/admin/.env.production +0 -3
  142. package/resources/templates/template-workspace/admin/lib/select/pagination.tsx +0 -48
  143. package/src/lib/PackageDownloader.ts +0 -33
  144. package/types/download-tarball/index.d.ts +0 -7
  145. package/types/get-package-json-from-registry/index.d.ts +0 -3
  146. package/types/registry-info/index.d.ts +0 -7
@@ -4,13 +4,11 @@ const cliCommon = require("@contember/cli-common");
4
4
  const WorkspaceCreateCommand = require("./src/commands/WorkspaceCreateCommand.cjs");
5
5
  const TemplateInstaller = require("./src/lib/TemplateInstaller.cjs");
6
6
  const paths = require("./src/paths.cjs");
7
- const PackageDownloader = require("./src/lib/PackageDownloader.cjs");
8
7
  const FileSystem = require("./src/lib/FileSystem.cjs");
9
8
  (async () => {
10
9
  const commandManager = new cliCommon.CommandManager({
11
10
  ["workspace"]: () => new WorkspaceCreateCommand.WorkspaceCreateCommand(new TemplateInstaller.TemplateInstaller(
12
11
  paths.resourcesDir,
13
- new PackageDownloader.PackageDownloader(new FileSystem.FileSystem()),
14
12
  new FileSystem.FileSystem()
15
13
  ))
16
14
  });
@@ -1 +1 @@
1
- {"version":3,"file":"run.cjs","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { PackageDownloader } from './lib/PackageDownloader'\nimport { FileSystem } from './lib/FileSystem'\n\n(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () => new WorkspaceCreateCommand(new TemplateInstaller(\n\t\t\tresourcesDir,\n\t\t\tnew PackageDownloader(new FileSystem()),\n\t\t\tnew FileSystem(),\n\t\t)),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\t// eslint-disable-next-line no-console\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":["CommandManager","WorkspaceCreateCommand","TemplateInstaller","resourcesDir","PackageDownloader","FileSystem","Application"],"mappings":";;;;;;;;CAQC,YAAY;AACN,QAAA,iBAAiB,IAAIA,yBAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MAAM,IAAIC,8CAAuB,IAAIC,kBAAA;AAAA,MACnDC,MAAA;AAAA,MACA,IAAIC,kBAAA,kBAAkB,IAAIC,WAAAA,YAAY;AAAA,MACtC,IAAIA,sBAAW;AAAA,IAAA,CACf;AAAA,EAAA,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EACP;AACA,QAAM,MAAM,IAAIC,UAAY,YAAA,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAK,MAAA;AAEf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
1
+ {"version":3,"file":"run.cjs","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { FileSystem } from './lib/FileSystem'\n\n(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () => new WorkspaceCreateCommand(new TemplateInstaller(\n\t\t\tresourcesDir,\n\t\t\tnew FileSystem(),\n\t\t)),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\t// eslint-disable-next-line no-console\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":["CommandManager","WorkspaceCreateCommand","TemplateInstaller","resourcesDir","FileSystem","Application"],"mappings":";;;;;;;CAOC,YAAY;AACN,QAAA,iBAAiB,IAAIA,yBAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MAAM,IAAIC,8CAAuB,IAAIC,kBAAA;AAAA,MACnDC,MAAA;AAAA,MACA,IAAIC,WAAW,WAAA;AAAA,IACf,CAAA;AAAA,EAAA,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EAAA;AAEP,QAAM,MAAM,IAAIC,UAAAA,YAAY,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAK,MAAA;AAEf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
@@ -3,13 +3,11 @@ import { CommandManager, Application } from "@contember/cli-common";
3
3
  import { WorkspaceCreateCommand } from "./src/commands/WorkspaceCreateCommand.js";
4
4
  import { TemplateInstaller } from "./src/lib/TemplateInstaller.js";
5
5
  import { resourcesDir } from "./src/paths.js";
6
- import { PackageDownloader } from "./src/lib/PackageDownloader.js";
7
6
  import { FileSystem } from "./src/lib/FileSystem.js";
8
7
  (async () => {
9
8
  const commandManager = new CommandManager({
10
9
  ["workspace"]: () => new WorkspaceCreateCommand(new TemplateInstaller(
11
10
  resourcesDir,
12
- new PackageDownloader(new FileSystem()),
13
11
  new FileSystem()
14
12
  ))
15
13
  });
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { PackageDownloader } from './lib/PackageDownloader'\nimport { FileSystem } from './lib/FileSystem'\n\n(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () => new WorkspaceCreateCommand(new TemplateInstaller(\n\t\t\tresourcesDir,\n\t\t\tnew PackageDownloader(new FileSystem()),\n\t\t\tnew FileSystem(),\n\t\t)),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\t// eslint-disable-next-line no-console\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":[],"mappings":";;;;;;;CAQC,YAAY;AACN,QAAA,iBAAiB,IAAI,eAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MAAM,IAAI,uBAAuB,IAAI;AAAA,MACnD;AAAA,MACA,IAAI,kBAAkB,IAAI,YAAY;AAAA,MACtC,IAAI,WAAW;AAAA,IAAA,CACf;AAAA,EAAA,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EACP;AACA,QAAM,MAAM,IAAI,YAAY,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAK,MAAA;AAEf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
1
+ {"version":3,"file":"run.js","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { FileSystem } from './lib/FileSystem'\n\n(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () => new WorkspaceCreateCommand(new TemplateInstaller(\n\t\t\tresourcesDir,\n\t\t\tnew FileSystem(),\n\t\t)),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\t// eslint-disable-next-line no-console\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":[],"mappings":";;;;;;CAOC,YAAY;AACN,QAAA,iBAAiB,IAAI,eAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MAAM,IAAI,uBAAuB,IAAI;AAAA,MACnD;AAAA,MACA,IAAI,WAAW;AAAA,IACf,CAAA;AAAA,EAAA,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EAAA;AAEP,QAAM,MAAM,IAAI,YAAY,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAK,MAAA;AAEf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":["Command","join","getPackageVersion"],"mappings":";;;;;;AAaO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK;AAFW,SAAA,oBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EACvC;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqBC,UAAAA,KAAK,QAAQ,OAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAMC,QAAAA,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAC1D;AACD;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;"}
1
+ {"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":["Command","join","getPackageVersion"],"mappings":";;;;;;AAaO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EAAA;AAAA,EAGvC,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqBC,UAAA,KAAK,QAAQ,IAAA,GAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAMC,QAAAA,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAAA;AAE3D;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":[],"mappings":";;;;AAaO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK;AAFW,SAAA,oBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EACvC;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqB,KAAK,QAAQ,OAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAM,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAC1D;AACD;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":[],"mappings":";;;;AAaO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EAAA;AAAA,EAGvC,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqB,KAAK,QAAQ,IAAA,GAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAM,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAAA;AAE3D;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.cjs","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":["fs","copy","access","tmpdir"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAWA,cAAG,QAAA;AACd,kBAAA,MAAA,aAAYA,cAAG,SAAA;AACf,kBAAA,MAAA,UAASA,cAAG,MAAA;AACZ,kBAAA,MAAA,WAAUA,cAAG,OAAA;AACN,kBAAA,MAAA,QAAAC,QAAAA,IAAA;AACP,kBAAA,MAAA,UAASD,cAAG,MAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAME,GAAAA,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MACR;AAAA,IAAA,CACD;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAMF,cAAG,QAAQG,GAAAA,OAAQ,CAAA;AAAA,IAAA,CACjC;AAAA,EAAA;AACD;;"}
1
+ {"version":3,"file":"FileSystem.cjs","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":["fs","copy","access","tmpdir"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAWA,cAAG,QAAA;AACd,kBAAA,MAAA,aAAYA,cAAG,SAAA;AACf,kBAAA,MAAA,UAASA,cAAG,MAAA;AACZ,kBAAA,MAAA,WAAUA,cAAG,OAAA;AACN,kBAAA,MAAA,QAAAC,YAAA;AACP,kBAAA,MAAA,UAASD,cAAG,MAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAME,GAAAA,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MAAA;AAAA,IACR,CACD;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAMF,cAAG,QAAQG,GAAAA,QAAQ;AAAA,IAAA,CACjC;AAAA,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.js","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAW,GAAG,QAAA;AACd,kBAAA,MAAA,aAAY,GAAG,SAAA;AACf,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,WAAU,GAAG,OAAA;AACN,kBAAA,MAAA,QAAA,IAAA;AACP,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAM,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MACR;AAAA,IAAA,CACD;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAM,GAAG,QAAQ,OAAQ,CAAA;AAAA,IAAA,CACjC;AAAA,EAAA;AACD;"}
1
+ {"version":3,"file":"FileSystem.js","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAW,GAAG,QAAA;AACd,kBAAA,MAAA,aAAY,GAAG,SAAA;AACf,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,WAAU,GAAG,OAAA;AACN,kBAAA,MAAA,QAAA,IAAA;AACP,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAM,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MAAA;AAAA,IACR,CACD;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAM,GAAG,QAAQ,QAAQ;AAAA,IAAA,CACjC;AAAA,EAAA;AACD;"}
@@ -6,9 +6,8 @@ var __defProp = Object.defineProperty;
6
6
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
7
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
8
  class TemplateInstaller {
9
- constructor(resourceDir, packageDownloader, fs) {
9
+ constructor(resourceDir, fs) {
10
10
  this.resourceDir = resourceDir;
11
- this.packageDownloader = packageDownloader;
12
11
  this.fs = fs;
13
12
  __publicField(this, "localTemplates", {
14
13
  ["@contember/template-workspace"]: node_path.join(this.resourceDir, "templates/template-workspace")
@@ -19,12 +18,6 @@ class TemplateInstaller {
19
18
  if (this.localTemplates[template]) {
20
19
  template = this.localTemplates[template];
21
20
  }
22
- if (!node_path.isAbsolute(template)) {
23
- template = await this.packageDownloader.downloadPackage(template);
24
- removeTemplate = async () => {
25
- await this.fs.unlink(template);
26
- };
27
- }
28
21
  const templateConfigFile = node_path.join(template, "contember.template.yaml");
29
22
  if (!await this.fs.pathExists(templateConfigFile)) {
30
23
  throw `${template} is not a Contember template`;
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { isAbsolute, join } from 'node:path'\nimport { PackageDownloader } from './PackageDownloader'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly packageDownloader: PackageDownloader,\n\t\tprivate readonly fs: FileSystem,\n\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\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\t\tif (!isAbsolute(template)) {\n\t\t\ttemplate = await this.packageDownloader.downloadPackage(template)\n\t\t\tremoveTemplate = async () => {\n\t\t\t\tawait this.fs.unlink(template)\n\t\t\t}\n\t\t}\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${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\t\tawait removeTemplate()\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\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","isAbsolute","content"],"mappings":";;;;;;;AAMO,MAAM,kBAAkB;AAAA,EAM9B,YACkB,aACA,mBACA,IAChB;AAHgB,SAAA,cAAA;AACA,SAAA,oBAAA;AACA,SAAA,KAAA;AAPlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CAAC,+BAA+B,GAAGA,UAAK,KAAA,KAAK,aAAa,8BAA8B;AAAA,IAAA,CACzF;AASA,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAAA;AAEvB,UAAA,KAAK,eAAe,QAAQ,GAAG;AACvB,mBAAA,KAAK,eAAe,QAAQ;AAAA,MACxC;AACI,UAAA,CAACC,UAAAA,WAAW,QAAQ,GAAG;AAC1B,mBAAW,MAAM,KAAK,kBAAkB,gBAAgB,QAAQ;AAChE,yBAAiB,YAAY;AACtB,gBAAA,KAAK,GAAG,OAAO,QAAQ;AAAA,QAAA;AAAA,MAE/B;AACM,YAAA,qBAAqBD,UAAAA,KAAK,UAAU,yBAAyB;AACnE,UAAI,CAAE,MAAM,KAAK,GAAG,WAAW,kBAAkB,GAAI;AACpD,cAAM,GAAG,QAAQ;AAAA,MAClB;AACA,YAAM,SAAU,MAAM,KAAK,SAAS,kBAAkB;AAQhD,YAAA,iBAAiBA,UAAAA,KAAK,UAAU,cAAc;AACpD,YAAM,eAAmB,oBAAA,IAAI,CAAC,IAAI,OAAO,UAAU,CAAI,GAAA,IAAI,QAAMA,UAAAA,KAAK,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AS,CAAC,KAAK,KAAK,MAAMA,SAAQ,QAAQ,IAAI,OAAO,IAAK,GAAG,KAAM,GAAG,GAAG,KAAK;AAAA,YAC/E;AAAA,UACD;AAAA,QAAA;AAAA,MAEF;AAAA,IAAA,CACD;AAEQ,kBAAA,MAAA,sBAAqB,OAAO,MAAc,aAAyD;AACpG,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,OAAA,CAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,OAAA,CAAQ;AAC1D,aAAA,OAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAAA,EAnFA;AAoFD;;"}
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'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\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\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${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\t\tawait removeTemplate()\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\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,EAM9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AANlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CAAC,+BAA+B,GAAGA,UAAAA,KAAK,KAAK,aAAa,8BAA8B;AAAA,IAAA,CACzF;AAQA,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAC3B;AACI,UAAA,KAAK,eAAe,QAAQ,GAAG;AACvB,mBAAA,KAAK,eAAe,QAAQ;AAAA,MAAA;AAGlC,YAAA,qBAAqBA,UAAAA,KAAK,UAAU,yBAAyB;AACnE,UAAI,CAAE,MAAM,KAAK,GAAG,WAAW,kBAAkB,GAAI;AACpD,cAAM,GAAG,QAAQ;AAAA,MAAA;AAElB,YAAM,SAAU,MAAM,KAAK,SAAS,kBAAkB;AAQhD,YAAA,iBAAiBA,UAAAA,KAAK,UAAU,cAAc;AACpD,YAAM,eAAmB,oBAAA,IAAI,CAAC,IAAI,OAAO,UAAU,CAAI,GAAA,IAAI,QAAMA,UAAAA,KAAK,UAAU,EAAE,CAAC,GAAG,kBAAkB,CAAC;AACzG,UAAI,MAAM,KAAK,GAAG,WAAW,SAAS,GAAG;AACxC,cAAM,GAAG,SAAS;AAAA,MAAA;AAEnB,YAAM,KAAK,GAAG,KAAK,UAAU,WAAW;AAAA,QACvC,QAAQ,CAAO,QAAA,CAAC,IAAI,WAAW,cAAc,KAAK,CAAC,aAAa,IAAI,GAAG;AAAA,MAAA,CACvE;AAC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UAAU,QAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAA,OAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAAA,EAAA;AACD;;"}
@@ -1,12 +1,11 @@
1
- import { join, isAbsolute } from "node:path";
1
+ import { join } from "node:path";
2
2
  import jsyaml__default from "js-yaml";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
5
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
6
  class TemplateInstaller {
7
- constructor(resourceDir, packageDownloader, fs) {
7
+ constructor(resourceDir, fs) {
8
8
  this.resourceDir = resourceDir;
9
- this.packageDownloader = packageDownloader;
10
9
  this.fs = fs;
11
10
  __publicField(this, "localTemplates", {
12
11
  ["@contember/template-workspace"]: join(this.resourceDir, "templates/template-workspace")
@@ -17,12 +16,6 @@ class TemplateInstaller {
17
16
  if (this.localTemplates[template]) {
18
17
  template = this.localTemplates[template];
19
18
  }
20
- if (!isAbsolute(template)) {
21
- template = await this.packageDownloader.downloadPackage(template);
22
- removeTemplate = async () => {
23
- await this.fs.unlink(template);
24
- };
25
- }
26
19
  const templateConfigFile = join(template, "contember.template.yaml");
27
20
  if (!await this.fs.pathExists(templateConfigFile)) {
28
21
  throw `${template} is not a Contember template`;
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { isAbsolute, join } from 'node:path'\nimport { PackageDownloader } from './PackageDownloader'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly packageDownloader: PackageDownloader,\n\t\tprivate readonly fs: FileSystem,\n\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\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\t\tif (!isAbsolute(template)) {\n\t\t\ttemplate = await this.packageDownloader.downloadPackage(template)\n\t\t\tremoveTemplate = async () => {\n\t\t\t\tawait this.fs.unlink(template)\n\t\t\t}\n\t\t}\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${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\t\tawait removeTemplate()\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\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":";;;;;AAMO,MAAM,kBAAkB;AAAA,EAM9B,YACkB,aACA,mBACA,IAChB;AAHgB,SAAA,cAAA;AACA,SAAA,oBAAA;AACA,SAAA,KAAA;AAPlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CAAC,+BAA+B,GAAG,KAAK,KAAK,aAAa,8BAA8B;AAAA,IAAA,CACzF;AASA,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI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port { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\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\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${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\t\tawait removeTemplate()\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\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,EAM9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AANlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CAAC,+BAA+B,GAAG,KAAK,KAAK,aAAa,8BAA8B;AAAA,IAAA,CACzF;AAQA,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAC3B;AACI,UAAA,KAAK,eAAe,QAAQ,GAAG;AACvB,mBAAA,KAAK,eAAe,QAAQ;AAAA,MAAA;AAGlC,YAAA,qBAAqB,KAAK,UAAU,yBAAyB;AACnE,UAAI,CAAE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BAAoB,CAAA,GAAI;AAC3C,cAAA,OAAO,KAAK,WAAW,IAAI;AACjC,YAAI,CAAE,MAAM,KAAK,GAAG,WAAW,IAAI,GAAI;AACtC;AAAA,QAAA;AAED,cAAM,KAAK;AAAA,UAAmB;AAAA,UAAM,CACnC,YAAA,OAAO,QAAQ,SAAS,EAAE;AAAA,YACzB,CAACA,UAAS,CAAC,KAAK,KAAK,MAAMA,SAAQ,QAAQ,IAAI,OAAO,IAAK,GAAG,KAAM,GAAG,GAAG,KAAK;AAAA,YAC/E;AAAA,UAAA;AAAA,QAEF;AAAA,MAAA;AAAA,IACD,CACD;AAEQ,kBAAA,MAAA,sBAAqB,OAAO,MAAc,aAAyD;AACpG,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAAC,gBAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAAA,EAAA;AACD;"}
@@ -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;AACrC,SAAA,KAAK,MAAM,MAAM,GAAG,SAASA,UAAAA,KAAKC,MAAA,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'\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;AACrC,SAAA,KAAK,MAAM,MAAM,GAAG,SAASA,eAAKC,MAAAA,aAAa,cAAc,GAAG,OAAO,CAAC,EAAE;AAClF;;"}
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const cliCommon = require("@contember/cli-common");
3
4
  const node_path = require("node:path");
4
5
  const node_url = require("node:url");
5
6
  var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
6
- const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || node_path.join(node_path.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.src || new URL("create/src/paths.cjs", document.baseURI).href)), "../../");
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));
8
+ const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || cliCommon.findPackageRoot(currentFilePath);
7
9
  const resourcesDir = node_path.join(packageRoot, "./resources");
8
10
  exports.packageRoot = packageRoot;
9
11
  exports.resourcesDir = resourcesDir;
@@ -1 +1 @@
1
- {"version":3,"file":"paths.cjs","sources":["../../../../packages/create/src/paths.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { dirname } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nexport const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || join(dirname(fileURLToPath(import.meta.url)), '../../')\nexport const resourcesDir = join(packageRoot, './resources')\n"],"names":["join","dirname","fileURLToPath"],"mappings":";;;;;AAIa,MAAA,cAAc,QAAQ,IAAI,8BAA8BA,UAAAA,KAAKC,UAAQ,QAAAC,uBAAc,OAAA,aAAA,cAAA,QAAA,KAAA,EAAA,cAAA,UAAA,EAAA,OAAA,0BAAA,uBAAA,OAAA,IAAA,IAAA,wBAAA,SAAA,OAAA,EAAA,IAAe,CAAC,GAAG,QAAQ;AAC9G,MAAA,eAAeF,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,UAAA,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,0BAAgB,eAAe;AACvF,MAAA,eAAeC,UAAAA,KAAK,aAAa,aAAa;;;"}
@@ -1,6 +1,8 @@
1
- import { join, dirname } from "node:path";
1
+ import { findPackageRoot } from "@contember/cli-common";
2
+ import { dirname, join } from "node:path";
2
3
  import { fileURLToPath } from "node:url";
3
- const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || join(dirname(fileURLToPath(import.meta.url)), "../../");
4
+ const currentFilePath = dirname(fileURLToPath(import.meta.url));
5
+ const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || findPackageRoot(currentFilePath);
4
6
  const resourcesDir = join(packageRoot, "./resources");
5
7
  export {
6
8
  packageRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sources":["../../../../packages/create/src/paths.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { dirname } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nexport const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || join(dirname(fileURLToPath(import.meta.url)), '../../')\nexport const resourcesDir = join(packageRoot, './resources')\n"],"names":[],"mappings":";;AAIa,MAAA,cAAc,QAAQ,IAAI,8BAA8B,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,QAAQ;AAC9G,MAAA,eAAe,KAAK,aAAa,aAAa;"}
1
+ {"version":3,"file":"paths.js","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":[],"mappings":";;;AAIA,MAAM,kBAAkB,QAAQ,cAAc,YAAY,GAAG,CAAC;AACvD,MAAM,cAAc,QAAQ,IAAI,8BAA8B,gBAAgB,eAAe;AACvF,MAAA,eAAe,KAAK,aAAa,aAAa;"}
@@ -4,13 +4,11 @@ const cliCommon = require("@contember/cli-common");
4
4
  const WorkspaceCreateCommand = require("./src/commands/WorkspaceCreateCommand.cjs");
5
5
  const TemplateInstaller = require("./src/lib/TemplateInstaller.cjs");
6
6
  const paths = require("./src/paths.cjs");
7
- const PackageDownloader = require("./src/lib/PackageDownloader.cjs");
8
7
  const FileSystem = require("./src/lib/FileSystem.cjs");
9
8
  (async () => {
10
9
  const commandManager = new cliCommon.CommandManager({
11
10
  ["workspace"]: () => new WorkspaceCreateCommand.WorkspaceCreateCommand(new TemplateInstaller.TemplateInstaller(
12
11
  paths.resourcesDir,
13
- new PackageDownloader.PackageDownloader(new FileSystem.FileSystem()),
14
12
  new FileSystem.FileSystem()
15
13
  ))
16
14
  });
@@ -1 +1 @@
1
- {"version":3,"file":"run.cjs","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { PackageDownloader } from './lib/PackageDownloader'\nimport { FileSystem } from './lib/FileSystem'\n\n(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () => new WorkspaceCreateCommand(new TemplateInstaller(\n\t\t\tresourcesDir,\n\t\t\tnew PackageDownloader(new FileSystem()),\n\t\t\tnew FileSystem(),\n\t\t)),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\t// eslint-disable-next-line no-console\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":["CommandManager","WorkspaceCreateCommand","TemplateInstaller","resourcesDir","PackageDownloader","FileSystem","Application"],"mappings":";;;;;;;;CAQC,YAAY;AACN,QAAA,iBAAiB,IAAIA,yBAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MAAM,IAAIC,8CAAuB,IAAIC,kBAAA;AAAA,MACnDC,MAAA;AAAA,MACA,IAAIC,kBAAA,kBAAkB,IAAIC,WAAAA,YAAY;AAAA,MACtC,IAAIA,sBAAW;AAAA,IAAA,CACf;AAAA,EAAA,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EACP;AACA,QAAM,MAAM,IAAIC,UAAY,YAAA,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAK,MAAA;AAEf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
1
+ {"version":3,"file":"run.cjs","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { FileSystem } from './lib/FileSystem'\n\n(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () => new WorkspaceCreateCommand(new TemplateInstaller(\n\t\t\tresourcesDir,\n\t\t\tnew FileSystem(),\n\t\t)),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\t// eslint-disable-next-line no-console\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":["CommandManager","WorkspaceCreateCommand","TemplateInstaller","resourcesDir","FileSystem","Application"],"mappings":";;;;;;;CAOC,YAAY;AACN,QAAA,iBAAiB,IAAIA,yBAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MAAM,IAAIC,8CAAuB,IAAIC,kBAAA;AAAA,MACnDC,MAAA;AAAA,MACA,IAAIC,WAAW,WAAA;AAAA,IACf,CAAA;AAAA,EAAA,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EAAA;AAEP,QAAM,MAAM,IAAIC,UAAAA,YAAY,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAK,MAAA;AAEf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
@@ -3,13 +3,11 @@ import { CommandManager, Application } from "@contember/cli-common";
3
3
  import { WorkspaceCreateCommand } from "./src/commands/WorkspaceCreateCommand.js";
4
4
  import { TemplateInstaller } from "./src/lib/TemplateInstaller.js";
5
5
  import { resourcesDir } from "./src/paths.js";
6
- import { PackageDownloader } from "./src/lib/PackageDownloader.js";
7
6
  import { FileSystem } from "./src/lib/FileSystem.js";
8
7
  (async () => {
9
8
  const commandManager = new CommandManager({
10
9
  ["workspace"]: () => new WorkspaceCreateCommand(new TemplateInstaller(
11
10
  resourcesDir,
12
- new PackageDownloader(new FileSystem()),
13
11
  new FileSystem()
14
12
  ))
15
13
  });
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { PackageDownloader } from './lib/PackageDownloader'\nimport { FileSystem } from './lib/FileSystem'\n\n(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () => new WorkspaceCreateCommand(new TemplateInstaller(\n\t\t\tresourcesDir,\n\t\t\tnew PackageDownloader(new FileSystem()),\n\t\t\tnew FileSystem(),\n\t\t)),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\t// eslint-disable-next-line no-console\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":[],"mappings":";;;;;;;CAQC,YAAY;AACN,QAAA,iBAAiB,IAAI,eAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MAAM,IAAI,uBAAuB,IAAI;AAAA,MACnD;AAAA,MACA,IAAI,kBAAkB,IAAI,YAAY;AAAA,MACtC,IAAI,WAAW;AAAA,IAAA,CACf;AAAA,EAAA,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EACP;AACA,QAAM,MAAM,IAAI,YAAY,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAK,MAAA;AAEf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
1
+ {"version":3,"file":"run.js","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { FileSystem } from './lib/FileSystem'\n\n(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () => new WorkspaceCreateCommand(new TemplateInstaller(\n\t\t\tresourcesDir,\n\t\t\tnew FileSystem(),\n\t\t)),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\t// eslint-disable-next-line no-console\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":[],"mappings":";;;;;;CAOC,YAAY;AACN,QAAA,iBAAiB,IAAI,eAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MAAM,IAAI,uBAAuB,IAAI;AAAA,MACnD;AAAA,MACA,IAAI,WAAW;AAAA,IACf,CAAA;AAAA,EAAA,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AACzC,UAAA;AAAA,EAAA;AAEP,QAAM,MAAM,IAAI,YAAY,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAK,MAAA;AAEf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":["Command","join","getPackageVersion"],"mappings":";;;;;;AAaO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK;AAFW,SAAA,oBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EACvC;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqBC,UAAAA,KAAK,QAAQ,OAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAMC,QAAAA,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAC1D;AACD;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;"}
1
+ {"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":["Command","join","getPackageVersion"],"mappings":";;;;;;AAaO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EAAA;AAAA,EAGvC,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqBC,UAAA,KAAK,QAAQ,IAAA,GAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAMC,QAAAA,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAAA;AAE3D;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":[],"mappings":";;;;AAaO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK;AAFW,SAAA,oBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EACvC;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqB,KAAK,QAAQ,OAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAM,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAC1D;AACD;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":[],"mappings":";;;;AAaO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EAAA;AAAA,EAGvC,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqB,KAAK,QAAQ,IAAA,GAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAM,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAAA;AAE3D;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.cjs","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":["fs","copy","access","tmpdir"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAWA,cAAG,QAAA;AACd,kBAAA,MAAA,aAAYA,cAAG,SAAA;AACf,kBAAA,MAAA,UAASA,cAAG,MAAA;AACZ,kBAAA,MAAA,WAAUA,cAAG,OAAA;AACN,kBAAA,MAAA,QAAAC,QAAAA,IAAA;AACP,kBAAA,MAAA,UAASD,cAAG,MAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAME,GAAAA,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MACR;AAAA,IAAA,CACD;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAMF,cAAG,QAAQG,GAAAA,OAAQ,CAAA;AAAA,IAAA,CACjC;AAAA,EAAA;AACD;;"}
1
+ {"version":3,"file":"FileSystem.cjs","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":["fs","copy","access","tmpdir"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAWA,cAAG,QAAA;AACd,kBAAA,MAAA,aAAYA,cAAG,SAAA;AACf,kBAAA,MAAA,UAASA,cAAG,MAAA;AACZ,kBAAA,MAAA,WAAUA,cAAG,OAAA;AACN,kBAAA,MAAA,QAAAC,YAAA;AACP,kBAAA,MAAA,UAASD,cAAG,MAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAME,GAAAA,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MAAA;AAAA,IACR,CACD;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAMF,cAAG,QAAQG,GAAAA,QAAQ;AAAA,IAAA,CACjC;AAAA,EAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.js","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAW,GAAG,QAAA;AACd,kBAAA,MAAA,aAAY,GAAG,SAAA;AACf,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,WAAU,GAAG,OAAA;AACN,kBAAA,MAAA,QAAA,IAAA;AACP,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAM,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MACR;AAAA,IAAA,CACD;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAM,GAAG,QAAQ,OAAQ,CAAA;AAAA,IAAA,CACjC;AAAA,EAAA;AACD;"}
1
+ {"version":3,"file":"FileSystem.js","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAW,GAAG,QAAA;AACd,kBAAA,MAAA,aAAY,GAAG,SAAA;AACf,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,WAAU,GAAG,OAAA;AACN,kBAAA,MAAA,QAAA,IAAA;AACP,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AAChC,UAAA;AACH,cAAM,OAAO,IAAI;AACV,eAAA;AAAA,MAAA,QACA;AACA,eAAA;AAAA,MAAA;AAAA,IACR,CACD;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAM,GAAG,QAAQ,QAAQ;AAAA,IAAA,CACjC;AAAA,EAAA;AACD;"}
@@ -6,9 +6,8 @@ var __defProp = Object.defineProperty;
6
6
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
7
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
8
  class TemplateInstaller {
9
- constructor(resourceDir, packageDownloader, fs) {
9
+ constructor(resourceDir, fs) {
10
10
  this.resourceDir = resourceDir;
11
- this.packageDownloader = packageDownloader;
12
11
  this.fs = fs;
13
12
  __publicField(this, "localTemplates", {
14
13
  ["@contember/template-workspace"]: node_path.join(this.resourceDir, "templates/template-workspace")
@@ -19,12 +18,6 @@ class TemplateInstaller {
19
18
  if (this.localTemplates[template]) {
20
19
  template = this.localTemplates[template];
21
20
  }
22
- if (!node_path.isAbsolute(template)) {
23
- template = await this.packageDownloader.downloadPackage(template);
24
- removeTemplate = async () => {
25
- await this.fs.unlink(template);
26
- };
27
- }
28
21
  const templateConfigFile = node_path.join(template, "contember.template.yaml");
29
22
  if (!await this.fs.pathExists(templateConfigFile)) {
30
23
  throw `${template} is not a Contember template`;
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { isAbsolute, join } from 'node:path'\nimport { PackageDownloader } from './PackageDownloader'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly packageDownloader: PackageDownloader,\n\t\tprivate readonly fs: FileSystem,\n\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\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\t\tif (!isAbsolute(template)) {\n\t\t\ttemplate = await this.packageDownloader.downloadPackage(template)\n\t\t\tremoveTemplate = async () => {\n\t\t\t\tawait this.fs.unlink(template)\n\t\t\t}\n\t\t}\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${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\t\tawait removeTemplate()\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\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","isAbsolute","content"],"mappings":";;;;;;;AAMO,MAAM,kBAAkB;AAAA,EAM9B,YACkB,aACA,mBACA,IAChB;AAHgB,SAAA,cAAA;AACA,SAAA,oBAAA;AACA,SAAA,KAAA;AAPlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CA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M,EAAE,UAAU,OAAA,CAAQ;AAC1D,aAAA,OAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAAA,EAnFA;AAoFD;;"}
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'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\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\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${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\t\tawait removeTemplate()\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\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,EAM9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AANlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CAAC,+BAA+B,GAAGA,UAAAA,KAAK,KAAK,aAAa,8BAA8B;AAAA,IAAA,CACzF;AAQA,kBAAA,MAAA,mBAAkB,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A,UAAA,KAAK,WAAW,MAAM,CAAC;AAAA,MAAA;AAE3D,iBAAA,CAAC,QAAQ,MAAM,KAAK,OAAO,QAAQ,OAAO,QAAQ,CAAA,CAAE,GAAG;AAC3D,cAAA,KAAK,GAAG,KAAKA,eAAK,WAAW,MAAM,GAAGA,UAAA,KAAK,WAAW,MAAM,CAAC;AAAA,MAAA;AAGpE,iBAAW,QAAQ,OAAO,oBAAoB,CAAA,GAAI;AAC3C,cAAA,OAAOA,UAAAA,KAAK,WAAW,IAAI;AACjC,YAAI,CAAE,MAAM,KAAK,GAAG,WAAW,IAAI,GAAI;AACtC;AAAA,QAAA;AAED,cAAM,KAAK;AAAA,UAAmB;AAAA,UAAM,CACnC,YAAA,OAAO,QAAQ,SAAS,EAAE;AAAA,YACzB,CAACC,UAAS,CAAC,KAAK,KAAK,MAAMA,SAAQ,QAAQ,IAAI,OAAO,IAAK,GAAG,KAAM,GAAG,GAAG,KAAK;AAAA,YAC/E;AAAA,UAAA;AAAA,QAEF;AAAA,MAAA;AAAA,IACD,CACD;AAEQ,kBAAA,MAAA,sBAAqB,OAAO,MAAc,aAAyD;AACpG,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAA,OAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAAA,EAAA;AACD;;"}
@@ -1,12 +1,11 @@
1
- import { join, isAbsolute } from "node:path";
1
+ import { join } from "node:path";
2
2
  import jsyaml__default from "js-yaml";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
5
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
6
  class TemplateInstaller {
7
- constructor(resourceDir, packageDownloader, fs) {
7
+ constructor(resourceDir, fs) {
8
8
  this.resourceDir = resourceDir;
9
- this.packageDownloader = packageDownloader;
10
9
  this.fs = fs;
11
10
  __publicField(this, "localTemplates", {
12
11
  ["@contember/template-workspace"]: join(this.resourceDir, "templates/template-workspace")
@@ -17,12 +16,6 @@ class TemplateInstaller {
17
16
  if (this.localTemplates[template]) {
18
17
  template = this.localTemplates[template];
19
18
  }
20
- if (!isAbsolute(template)) {
21
- template = await this.packageDownloader.downloadPackage(template);
22
- removeTemplate = async () => {
23
- await this.fs.unlink(template);
24
- };
25
- }
26
19
  const templateConfigFile = join(template, "contember.template.yaml");
27
20
  if (!await this.fs.pathExists(templateConfigFile)) {
28
21
  throw `${template} is not a Contember template`;
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { isAbsolute, join } from 'node:path'\nimport { PackageDownloader } from './PackageDownloader'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly packageDownloader: PackageDownloader,\n\t\tprivate readonly fs: FileSystem,\n\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\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\t\tif (!isAbsolute(template)) {\n\t\t\ttemplate = await this.packageDownloader.downloadPackage(template)\n\t\t\tremoveTemplate = async () => {\n\t\t\t\tawait this.fs.unlink(template)\n\t\t\t}\n\t\t}\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${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\t\tawait removeTemplate()\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\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":";;;;;AAMO,MAAM,kBAAkB;AAAA,EAM9B,YACkB,aACA,mBACA,IAChB;AAHgB,SAAA,cAAA;AACA,SAAA,oBAAA;AACA,SAAA,KAAA;AAPlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CAAC,+BAA+B,GAAG,KAAK,KAAK,aAAa,8BAA8B;AAAA,IAAA,CACzF;AASA,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAAA;AAEvB,UAAA,KAAK,eAAe,QAAQ,GAAG;AACvB,mBAAA,KAAK,eAAe,QAAQ;AAAA,MACxC;AACI,UAAA,CAAC,WAAW,QAAQ,GAAG;AAC1B,mBAAW,MAAM,KAAK,kBAAkB,gBAAgB,QAAQ;AAChE,yBAAiB,YAAY;AACtB,gBAAA,KAAK,GAAG,OAAO,QAAQ;AAAA,QAAA;AAAA,MAE/B;AACM,YAAA,qBAAqB,KAAK,UAAU,yBAAyB;AACnE,UAAI,CAAE,MAAM,KAAK,GAAG,WAAW,kBAAkB,GAAI;AACpD,cAAM,GAAG,QAAQ;AAAA,MAClB;AACA,YAAM,SAAU,MAAM,KAAK,SAAS,kBAAkB;AAQhD,YAAA,iBAAiB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mB;AAAA,UAAM,CACnC,YAAA,OAAO,QAAQ,SAAS,EAAE;AAAA,YACzB,CAACA,UAAS,CAAC,KAAK,KAAK,MAAMA,SAAQ,QAAQ,IAAI,OAAO,IAAK,GAAG,KAAM,GAAG,GAAG,KAAK;AAAA,YAC/E;AAAA,UACD;AAAA,QAAA;AAAA,MAEF;AAAA,IAAA,CACD;AAEQ,kBAAA,MAAA,sBAAqB,OAAO,MAAc,aAAyD;AACpG,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,OAAA,CAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,OAAA,CAAQ;AAC1D,aAAAC,gBAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAAA,EAnFA;AAoFD;"}
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'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\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\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${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\t\tawait removeTemplate()\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\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,EAM9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AANlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CAAC,+BAA+B,GAAG,KAAK,KAAK,aAAa,8BAA8B;AAAA,IAAA,CACzF;AAQA,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAC3B;AACI,UAAA,KAAK,eAAe,QAAQ,GAAG;AACvB,mBAAA,KAAK,eAAe,QAAQ;AAAA,MAAA;AAGlC,YAAA,qBAAqB,KAAK,UAAU,yBAAyB;AACnE,UAAI,CAAE,MAAM,KAAK,GAAG,WAAW,kBAAkB,GAAI;AACpD,cAAM,GAAG,QAAQ;AAAA,MAAA;AAElB,YAAM,SAAU,MAAM,KAAK,SAAS,kBAAkB;AAQhD,YAAA,iBAAiB,KAAK,UAAU,cAAc;AACpD,YAAM,eAAmB,oBAAA,IAAI,CAAC,IAAI,OAAO,UAAU,CAAI,GAAA,IAAI,QAAM,KAAK,UAAU,EAAE,CAAC,GAAG,kBAAkB,CAAC;AACzG,UAAI,MAAM,KAAK,GAAG,WAAW,SAAS,GAAG;AACxC,cAAM,GAAG,SAAS;AAAA,MAAA;AAEnB,YAAM,KAAK,GAAG,KAAK,UAAU,WAAW;AAAA,QACvC,QAAQ,CAAO,QAAA,CAAC,IAAI,WAAW,cAAc,KAAK,CAA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M,EAAE,UAAU,QAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAAC,gBAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAAA,EAAA;AACD;"}
@@ -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;AACrC,SAAA,KAAK,MAAM,MAAM,GAAG,SAASA,UAAAA,KAAKC,MAAA,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'\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;AACrC,SAAA,KAAK,MAAM,MAAM,GAAG,SAASA,eAAKC,MAAAA,aAAa,cAAc,GAAG,OAAO,CAAC,EAAE;AAClF;;"}
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const cliCommon = require("@contember/cli-common");
3
4
  const node_path = require("node:path");
4
5
  const node_url = require("node:url");
5
6
  var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
6
- const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || node_path.join(node_path.dirname(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.src || new URL("create/src/paths.cjs", document.baseURI).href)), "../../");
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));
8
+ const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || cliCommon.findPackageRoot(currentFilePath);
7
9
  const resourcesDir = node_path.join(packageRoot, "./resources");
8
10
  exports.packageRoot = packageRoot;
9
11
  exports.resourcesDir = resourcesDir;
@@ -1 +1 @@
1
- {"version":3,"file":"paths.cjs","sources":["../../../../packages/create/src/paths.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { dirname } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nexport const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || join(dirname(fileURLToPath(import.meta.url)), '../../')\nexport const resourcesDir = join(packageRoot, './resources')\n"],"names":["join","dirname","fileURLToPath"],"mappings":";;;;;AAIa,MAAA,cAAc,QAAQ,IAAI,8BAA8BA,UAAAA,KAAKC,UAAQ,QAAAC,uBAAc,OAAA,aAAA,cAAA,QAAA,KAAA,EAAA,cAAA,UAAA,EAAA,OAAA,0BAAA,uBAAA,OAAA,IAAA,IAAA,wBAAA,SAAA,OAAA,EAAA,IAAe,CAAC,GAAG,QAAQ;AAC9G,MAAA,eAAeF,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,UAAA,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,0BAAgB,eAAe;AACvF,MAAA,eAAeC,UAAAA,KAAK,aAAa,aAAa;;;"}
@@ -1,6 +1,8 @@
1
- import { join, dirname } from "node:path";
1
+ import { findPackageRoot } from "@contember/cli-common";
2
+ import { dirname, join } from "node:path";
2
3
  import { fileURLToPath } from "node:url";
3
- const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || join(dirname(fileURLToPath(import.meta.url)), "../../");
4
+ const currentFilePath = dirname(fileURLToPath(import.meta.url));
5
+ const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || findPackageRoot(currentFilePath);
4
6
  const resourcesDir = join(packageRoot, "./resources");
5
7
  export {
6
8
  packageRoot,
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sources":["../../../../packages/create/src/paths.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { dirname } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nexport const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || join(dirname(fileURLToPath(import.meta.url)), '../../')\nexport const resourcesDir = join(packageRoot, './resources')\n"],"names":[],"mappings":";;AAIa,MAAA,cAAc,QAAQ,IAAI,8BAA8B,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,QAAQ;AAC9G,MAAA,eAAe,KAAK,aAAa,aAAa;"}
1
+ {"version":3,"file":"paths.js","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":[],"mappings":";;;AAIA,MAAM,kBAAkB,QAAQ,cAAc,YAAY,GAAG,CAAC;AACvD,MAAM,cAAc,QAAQ,IAAI,8BAA8B,gBAAgB,eAAe;AACvF,MAAA,eAAe,KAAK,aAAa,aAAa;"}
@@ -1,11 +1,9 @@
1
- import { PackageDownloader } from './PackageDownloader';
2
1
  import { FileSystem } from './FileSystem';
3
2
  export declare class TemplateInstaller {
4
3
  private readonly resourceDir;
5
- private readonly packageDownloader;
6
4
  private readonly fs;
7
5
  private localTemplates;
8
- constructor(resourceDir: string, packageDownloader: PackageDownloader, fs: FileSystem);
6
+ constructor(resourceDir: string, fs: FileSystem);
9
7
  installTemplate: (template: string, targetDir: string, variables?: Record<string, string>) => Promise<void>;
10
8
  private replaceFileContent;
11
9
  private readYaml;