@contember/create 1.4.0-rc.8 → 2.0.0-alpha.12

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 (155) hide show
  1. package/dist/development/run.cjs +27 -0
  2. package/dist/development/run.cjs.map +1 -0
  3. package/dist/development/run.js +26 -0
  4. package/dist/development/run.js.map +1 -0
  5. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +50 -0
  6. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -0
  7. package/dist/development/src/commands/WorkspaceCreateCommand.js +50 -0
  8. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -0
  9. package/dist/development/src/lib/FileSystem.cjs +48 -0
  10. package/dist/development/src/lib/FileSystem.cjs.map +1 -0
  11. package/dist/development/src/lib/FileSystem.js +32 -0
  12. package/dist/development/src/lib/FileSystem.js.map +1 -0
  13. package/dist/development/src/lib/PackageDownloader.cjs +33 -0
  14. package/dist/development/src/lib/PackageDownloader.cjs.map +1 -0
  15. package/dist/development/src/lib/PackageDownloader.js +33 -0
  16. package/dist/development/src/lib/PackageDownloader.js.map +1 -0
  17. package/dist/development/src/lib/TemplateInstaller.cjs +87 -0
  18. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -0
  19. package/dist/development/src/lib/TemplateInstaller.js +87 -0
  20. package/dist/development/src/lib/TemplateInstaller.js.map +1 -0
  21. package/dist/development/src/lib/version.cjs +10 -0
  22. package/dist/development/src/lib/version.cjs.map +1 -0
  23. package/dist/development/src/lib/version.js +10 -0
  24. package/dist/development/src/lib/version.js.map +1 -0
  25. package/dist/development/src/paths.cjs +10 -0
  26. package/dist/development/src/paths.cjs.map +1 -0
  27. package/dist/development/src/paths.js +9 -0
  28. package/dist/development/src/paths.js.map +1 -0
  29. package/dist/production/run.cjs +27 -0
  30. package/dist/production/run.cjs.map +1 -0
  31. package/dist/production/run.js +26 -0
  32. package/dist/production/run.js.map +1 -0
  33. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +50 -0
  34. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -0
  35. package/dist/production/src/commands/WorkspaceCreateCommand.js +50 -0
  36. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -0
  37. package/dist/production/src/lib/FileSystem.cjs +48 -0
  38. package/dist/production/src/lib/FileSystem.cjs.map +1 -0
  39. package/dist/production/src/lib/FileSystem.js +32 -0
  40. package/dist/production/src/lib/FileSystem.js.map +1 -0
  41. package/dist/production/src/lib/PackageDownloader.cjs +33 -0
  42. package/dist/production/src/lib/PackageDownloader.cjs.map +1 -0
  43. package/dist/production/src/lib/PackageDownloader.js +33 -0
  44. package/dist/production/src/lib/PackageDownloader.js.map +1 -0
  45. package/dist/production/src/lib/TemplateInstaller.cjs +87 -0
  46. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -0
  47. package/dist/production/src/lib/TemplateInstaller.js +87 -0
  48. package/dist/production/src/lib/TemplateInstaller.js.map +1 -0
  49. package/dist/production/src/lib/version.cjs +10 -0
  50. package/dist/production/src/lib/version.cjs.map +1 -0
  51. package/dist/production/src/lib/version.js +10 -0
  52. package/dist/production/src/lib/version.js.map +1 -0
  53. package/dist/production/src/paths.cjs +10 -0
  54. package/dist/production/src/paths.cjs.map +1 -0
  55. package/dist/production/src/paths.js +9 -0
  56. package/dist/production/src/paths.js.map +1 -0
  57. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -0
  58. package/dist/{src → types}/lib/FileSystem.d.ts +0 -1
  59. package/dist/types/lib/FileSystem.d.ts.map +1 -0
  60. package/dist/{src → types}/lib/PackageDownloader.d.ts.map +1 -1
  61. package/dist/{src → types}/lib/TemplateInstaller.d.ts.map +1 -1
  62. package/dist/types/lib/version.d.ts +2 -0
  63. package/dist/types/lib/version.d.ts.map +1 -0
  64. package/dist/{src/lib/pathUtils.d.ts → types/paths.d.ts} +1 -1
  65. package/dist/types/paths.d.ts.map +1 -0
  66. package/dist/types/tsconfig.tsbuildinfo +1 -0
  67. package/package.json +27 -6
  68. package/resources/templates/template-workspace/admin/app/index.html +1 -1
  69. package/resources/templates/template-workspace/admin/lib/binding/delete.tsx +1 -1
  70. package/resources/templates/template-workspace/admin/lib/block-repeater/block-repeater.tsx +2 -2
  71. package/resources/templates/template-workspace/admin/lib/datagrid/column-header.tsx +64 -40
  72. package/resources/templates/template-workspace/admin/lib/datagrid/columns.tsx +166 -33
  73. package/resources/templates/template-workspace/admin/lib/datagrid/filters/boolean.tsx +23 -17
  74. package/resources/templates/template-workspace/admin/lib/datagrid/filters/date.tsx +44 -35
  75. package/resources/templates/template-workspace/admin/lib/datagrid/filters/enum.tsx +22 -14
  76. package/resources/templates/template-workspace/admin/lib/datagrid/filters/mobile.tsx +4 -4
  77. package/resources/templates/template-workspace/admin/lib/datagrid/filters/number.tsx +31 -24
  78. package/resources/templates/template-workspace/admin/lib/datagrid/filters/relation.tsx +51 -32
  79. package/resources/templates/template-workspace/admin/lib/datagrid/grid.tsx +2 -10
  80. package/resources/templates/template-workspace/admin/lib/datagrid/table.tsx +17 -10
  81. package/resources/templates/template-workspace/admin/lib/datagrid/tiles.tsx +4 -2
  82. package/resources/templates/template-workspace/admin/lib/datagrid/toolbar.tsx +8 -2
  83. package/resources/templates/template-workspace/admin/lib/datagrid/ui.tsx +4 -4
  84. package/resources/templates/template-workspace/admin/lib/dict.ts +65 -72
  85. package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +2 -2
  86. package/resources/templates/template-workspace/admin/lib/editor/common/editor-canvas.tsx +2 -2
  87. package/resources/templates/template-workspace/admin/lib/editor/common/editor-editable-canvas.tsx +1 -1
  88. package/resources/templates/template-workspace/admin/lib/editor/common/editor-inline-toolbar.tsx +2 -5
  89. package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableElementRenderer.tsx +2 -2
  90. package/resources/templates/template-workspace/admin/lib/editor/editor-block.tsx +1 -1
  91. package/resources/templates/template-workspace/admin/lib/editor/rich-text.tsx +5 -5
  92. package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +3 -3
  93. package/resources/templates/template-workspace/admin/lib/form/container.tsx +5 -4
  94. package/resources/templates/template-workspace/admin/lib/form/inputs.tsx +15 -12
  95. package/resources/templates/template-workspace/admin/lib/form/select.tsx +23 -10
  96. package/resources/templates/template-workspace/admin/lib/form/ui.tsx +9 -0
  97. package/resources/templates/template-workspace/admin/lib/form/upload.tsx +119 -36
  98. package/resources/templates/template-workspace/admin/lib/formatting/formatting.ts +6 -8
  99. package/resources/templates/template-workspace/admin/lib/layout/layout.tsx +3 -2
  100. package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +16 -8
  101. package/resources/templates/template-workspace/admin/lib/select/create-new.tsx +1 -1
  102. package/resources/templates/template-workspace/admin/lib/select/highlight.tsx +9 -9
  103. package/resources/templates/template-workspace/admin/lib/select/select.tsx +15 -3
  104. package/resources/templates/template-workspace/admin/lib/tenant/forms/common.tsx +1 -1
  105. package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInvite.ts +3 -3
  106. package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInviteUser.tsx +19 -19
  107. package/resources/templates/template-workspace/admin/lib/tenant/listing/member-list.tsx +1 -1
  108. package/resources/templates/template-workspace/admin/lib/ui/dropdown.tsx +7 -7
  109. package/resources/templates/template-workspace/admin/lib/ui/input.tsx +4 -6
  110. package/resources/templates/template-workspace/admin/lib/ui/scroll-area.tsx +24 -24
  111. package/resources/templates/template-workspace/admin/lib/ui/select.tsx +79 -0
  112. package/resources/templates/template-workspace/admin/lib/ui/sheet.tsx +0 -2
  113. package/resources/templates/template-workspace/admin/lib/upload/dropzone.tsx +13 -2
  114. package/resources/templates/template-workspace/admin/lib/upload/ui.tsx +1 -11
  115. package/resources/templates/template-workspace/admin/lib/upload/upload-progress.tsx +1 -1
  116. package/resources/templates/template-workspace/admin/lib/upload/view.tsx +39 -26
  117. package/resources/templates/template-workspace/admin/lib/utils/uic.tsx +6 -6
  118. package/resources/templates/template-workspace/admin/package.json +18 -18
  119. package/resources/templates/template-workspace/api/package.json +0 -3
  120. package/resources/templates/template-workspace/client/package.json +0 -3
  121. package/resources/templates/template-workspace/package.json +1 -1
  122. package/src/commands/WorkspaceCreateCommand.ts +3 -2
  123. package/src/lib/version.ts +7 -0
  124. package/src/{lib/pathUtils.ts → paths.ts} +3 -1
  125. package/src/run.ts +1 -1
  126. package/src/tsconfig.json +1 -1
  127. package/dist/src/commands/WorkspaceCreateCommand.d.ts.map +0 -1
  128. package/dist/src/commands/WorkspaceCreateCommand.js +0 -54
  129. package/dist/src/commands/WorkspaceCreateCommand.js.map +0 -1
  130. package/dist/src/commands/index.js +0 -18
  131. package/dist/src/commands/index.js.map +0 -1
  132. package/dist/src/lib/FileSystem.d.ts.map +0 -1
  133. package/dist/src/lib/FileSystem.js +0 -54
  134. package/dist/src/lib/FileSystem.js.map +0 -1
  135. package/dist/src/lib/PackageDownloader.js +0 -32
  136. package/dist/src/lib/PackageDownloader.js.map +0 -1
  137. package/dist/src/lib/TemplateInstaller.js +0 -75
  138. package/dist/src/lib/TemplateInstaller.js.map +0 -1
  139. package/dist/src/lib/pathUtils.d.ts.map +0 -1
  140. package/dist/src/lib/pathUtils.js +0 -7
  141. package/dist/src/lib/pathUtils.js.map +0 -1
  142. package/dist/src/run.js +0 -25
  143. package/dist/src/run.js.map +0 -1
  144. package/dist/src/tsconfig.tsbuildinfo +0 -1
  145. package/resources/templates/template-workspace/admin/lib/utils/dict-format.tsx +0 -3
  146. package/resources/templates/template-workspace/admin/lib/utils/format-image-resize-url.ts +0 -17
  147. package/resources/templates/template-workspace/admin/lib/utils/formatting.ts +0 -60
  148. package/resources/templates/template-workspace/admin/vite.config.ts +0 -39
  149. /package/dist/{src → types}/commands/WorkspaceCreateCommand.d.ts +0 -0
  150. /package/dist/{src → types}/commands/index.d.ts +0 -0
  151. /package/dist/{src → types}/commands/index.d.ts.map +0 -0
  152. /package/dist/{src → types}/lib/PackageDownloader.d.ts +0 -0
  153. /package/dist/{src → types}/lib/TemplateInstaller.d.ts +0 -0
  154. /package/dist/{src → types}/run.d.ts +0 -0
  155. /package/dist/{src → types}/run.d.ts.map +0 -0
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ const cliCommon = require("@contember/cli-common");
4
+ const WorkspaceCreateCommand = require("./src/commands/WorkspaceCreateCommand.cjs");
5
+ const TemplateInstaller = require("./src/lib/TemplateInstaller.cjs");
6
+ const paths = require("./src/paths.cjs");
7
+ const PackageDownloader = require("./src/lib/PackageDownloader.cjs");
8
+ const FileSystem = require("./src/lib/FileSystem.cjs");
9
+ (async () => {
10
+ const commandManager = new cliCommon.CommandManager({
11
+ ["workspace"]: () => new WorkspaceCreateCommand.WorkspaceCreateCommand(new TemplateInstaller.TemplateInstaller(
12
+ paths.resourcesDir,
13
+ new PackageDownloader.PackageDownloader(new FileSystem.FileSystem()),
14
+ new FileSystem.FileSystem()
15
+ ))
16
+ });
17
+ const nodeVersion = process.version.match(/^v?(\d+)\..+$/);
18
+ if (nodeVersion && Number(nodeVersion[1]) < 18) {
19
+ throw `Node >= 18 is required`;
20
+ }
21
+ const app = new cliCommon.Application(commandManager, `Contember installer`);
22
+ await app.runCommand("workspace", process.argv.slice(2));
23
+ })().catch((e) => {
24
+ console.log(e);
25
+ process.exit(1);
26
+ });
27
+ //# sourceMappingURL=run.cjs.map
@@ -0,0 +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;"}
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ import { CommandManager, Application } from "@contember/cli-common";
3
+ import { WorkspaceCreateCommand } from "./src/commands/WorkspaceCreateCommand.js";
4
+ import { TemplateInstaller } from "./src/lib/TemplateInstaller.js";
5
+ import { resourcesDir } from "./src/paths.js";
6
+ import { PackageDownloader } from "./src/lib/PackageDownloader.js";
7
+ import { FileSystem } from "./src/lib/FileSystem.js";
8
+ (async () => {
9
+ const commandManager = new CommandManager({
10
+ ["workspace"]: () => new WorkspaceCreateCommand(new TemplateInstaller(
11
+ resourcesDir,
12
+ new PackageDownloader(new FileSystem()),
13
+ new FileSystem()
14
+ ))
15
+ });
16
+ const nodeVersion = process.version.match(/^v?(\d+)\..+$/);
17
+ if (nodeVersion && Number(nodeVersion[1]) < 18) {
18
+ throw `Node >= 18 is required`;
19
+ }
20
+ const app = new Application(commandManager, `Contember installer`);
21
+ await app.runCommand("workspace", process.argv.slice(2));
22
+ })().catch((e) => {
23
+ console.log(e);
24
+ process.exit(1);
25
+ });
26
+ //# sourceMappingURL=run.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const cliCommon = require("@contember/cli-common");
4
+ const node_path = require("node:path");
5
+ const chalk = require("chalk");
6
+ const version = require("../lib/version.cjs");
7
+ class WorkspaceCreateCommand extends cliCommon.Command {
8
+ constructor(templateInstaller) {
9
+ super();
10
+ this.templateInstaller = templateInstaller;
11
+ }
12
+ configure(configuration) {
13
+ configuration.description("Creates a new Contember workspace");
14
+ configuration.argument("workspaceName");
15
+ }
16
+ async execute(input) {
17
+ const workspaceName = input.getArgument("workspaceName");
18
+ const workspaceDirectory = node_path.join(process.cwd(), workspaceName);
19
+ await this.templateInstaller.installTemplate("@contember/template-workspace", workspaceDirectory, {
20
+ version: await version.getPackageVersion(),
21
+ projectName: workspaceName
22
+ });
23
+ console.log(createDocs(workspaceDirectory, workspaceName));
24
+ }
25
+ }
26
+ const createDocs = (workspaceDirectory, workspaceName) => `
27
+ Contember workspace was successfully created inside the directory ${workspaceDirectory}
28
+
29
+ You can now enter this directory:
30
+ $ ${chalk.greenBright(`cd ${workspaceName}`)}
31
+
32
+ Install NPM dependencies:
33
+ $ ${chalk.greenBright(`yarn install`)}
34
+
35
+ And start the Contember stack:
36
+ $ ${chalk.greenBright("yarn start")}
37
+
38
+ The following services will be accessible:
39
+
40
+ - Contember Admin at http://localhost:1480
41
+ - Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)
42
+ - Adminer database management tool at http://localhost:1485
43
+ - Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)
44
+ - MailHog testing SMTP at http://localhost:1484
45
+ - PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)
46
+
47
+ If you have any issues or questions, just ask here: https://github.com/contember/engine/discussions
48
+ `;
49
+ exports.WorkspaceCreateCommand = WorkspaceCreateCommand;
50
+ //# sourceMappingURL=WorkspaceCreateCommand.cjs.map
@@ -0,0 +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;;"}
@@ -0,0 +1,50 @@
1
+ import { Command } from "@contember/cli-common";
2
+ import { join } from "node:path";
3
+ import chalk from "chalk";
4
+ import { getPackageVersion } from "../lib/version.js";
5
+ class WorkspaceCreateCommand extends Command {
6
+ constructor(templateInstaller) {
7
+ super();
8
+ this.templateInstaller = templateInstaller;
9
+ }
10
+ configure(configuration) {
11
+ configuration.description("Creates a new Contember workspace");
12
+ configuration.argument("workspaceName");
13
+ }
14
+ async execute(input) {
15
+ const workspaceName = input.getArgument("workspaceName");
16
+ const workspaceDirectory = join(process.cwd(), workspaceName);
17
+ await this.templateInstaller.installTemplate("@contember/template-workspace", workspaceDirectory, {
18
+ version: await getPackageVersion(),
19
+ projectName: workspaceName
20
+ });
21
+ console.log(createDocs(workspaceDirectory, workspaceName));
22
+ }
23
+ }
24
+ const createDocs = (workspaceDirectory, workspaceName) => `
25
+ Contember workspace was successfully created inside the directory ${workspaceDirectory}
26
+
27
+ You can now enter this directory:
28
+ $ ${chalk.greenBright(`cd ${workspaceName}`)}
29
+
30
+ Install NPM dependencies:
31
+ $ ${chalk.greenBright(`yarn install`)}
32
+
33
+ And start the Contember stack:
34
+ $ ${chalk.greenBright("yarn start")}
35
+
36
+ The following services will be accessible:
37
+
38
+ - Contember Admin at http://localhost:1480
39
+ - Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)
40
+ - Adminer database management tool at http://localhost:1485
41
+ - Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)
42
+ - MailHog testing SMTP at http://localhost:1484
43
+ - PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)
44
+
45
+ If you have any issues or questions, just ask here: https://github.com/contember/engine/discussions
46
+ `;
47
+ export {
48
+ WorkspaceCreateCommand
49
+ };
50
+ //# sourceMappingURL=WorkspaceCreateCommand.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const fs = require("node:fs/promises");
4
+ const fsExtra = require("fs-extra");
5
+ const os = require("node:os");
6
+ function _interopNamespaceDefault(e) {
7
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
+ if (e) {
9
+ for (const k in e) {
10
+ if (k !== "default") {
11
+ const d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+ const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
23
+ var __defProp = Object.defineProperty;
24
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
25
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
26
+ class FileSystem {
27
+ constructor() {
28
+ __publicField(this, "readFile", fs__namespace.readFile);
29
+ __publicField(this, "writeFile", fs__namespace.writeFile);
30
+ __publicField(this, "rename", fs__namespace.rename);
31
+ __publicField(this, "readDir", fs__namespace.readdir);
32
+ __publicField(this, "copy", fsExtra.copy);
33
+ __publicField(this, "unlink", fs__namespace.unlink);
34
+ __publicField(this, "pathExists", async (path) => {
35
+ try {
36
+ await fs.access(path);
37
+ return true;
38
+ } catch {
39
+ return false;
40
+ }
41
+ });
42
+ __publicField(this, "createTempDir", async () => {
43
+ return await fs__namespace.mkdtemp(os.tmpdir());
44
+ });
45
+ }
46
+ }
47
+ exports.FileSystem = FileSystem;
48
+ //# sourceMappingURL=FileSystem.cjs.map
@@ -0,0 +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;;"}
@@ -0,0 +1,32 @@
1
+ import * as fs from "node:fs/promises";
2
+ import { access } from "node:fs/promises";
3
+ import { copy } from "fs-extra";
4
+ import { tmpdir } from "node:os";
5
+ var __defProp = Object.defineProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
+ class FileSystem {
9
+ constructor() {
10
+ __publicField(this, "readFile", fs.readFile);
11
+ __publicField(this, "writeFile", fs.writeFile);
12
+ __publicField(this, "rename", fs.rename);
13
+ __publicField(this, "readDir", fs.readdir);
14
+ __publicField(this, "copy", copy);
15
+ __publicField(this, "unlink", fs.unlink);
16
+ __publicField(this, "pathExists", async (path) => {
17
+ try {
18
+ await access(path);
19
+ return true;
20
+ } catch {
21
+ return false;
22
+ }
23
+ });
24
+ __publicField(this, "createTempDir", async () => {
25
+ return await fs.mkdtemp(tmpdir());
26
+ });
27
+ }
28
+ }
29
+ export {
30
+ FileSystem
31
+ };
32
+ //# sourceMappingURL=FileSystem.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const npa = require("npm-package-arg");
4
+ const getRegistryInfo = require("registry-info");
5
+ const getPackageJson = require("get-package-json-from-registry");
6
+ const node_path = require("node:path");
7
+ const downloadTarball = require("download-tarball");
8
+ var __defProp = Object.defineProperty;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
11
+ class PackageDownloader {
12
+ constructor(fs) {
13
+ this.fs = fs;
14
+ __publicField(this, "downloadPackage", async (pkgName) => {
15
+ const { scope } = npa(pkgName);
16
+ const { authorization } = getRegistryInfo(scope);
17
+ const headers = authorization ? { authorization } : {};
18
+ const pkg = await getPackageJson(pkgName);
19
+ const {
20
+ dist: { tarball }
21
+ } = pkg;
22
+ const tmpDir = await this.fs.createTempDir();
23
+ await downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir });
24
+ const dirContent = await this.fs.readDir(tmpDir);
25
+ if (dirContent.length !== 1 || dirContent[0] !== "package") {
26
+ throw "Invalid NPM package";
27
+ }
28
+ return node_path.join(tmpDir, "package");
29
+ });
30
+ }
31
+ }
32
+ exports.PackageDownloader = PackageDownloader;
33
+ //# sourceMappingURL=PackageDownloader.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackageDownloader.cjs","sources":["../../../../../packages/create/src/lib/PackageDownloader.ts"],"sourcesContent":["import npa from 'npm-package-arg'\nimport getRegistryInfo from 'registry-info'\nimport getPackageJson from 'get-package-json-from-registry'\nimport { join } from 'node:path'\nimport downloadTarball from 'download-tarball'\nimport { FileSystem } from './FileSystem'\n\nexport class PackageDownloader {\n\n\tconstructor(\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\tdownloadPackage = async (pkgName: string): Promise<string> => {\n\t\tconst { scope } = npa(pkgName)\n\t\tconst { authorization } = getRegistryInfo(scope)\n\t\tconst headers = authorization ? { authorization } : {}\n\n\t\tconst pkg = await getPackageJson(pkgName)\n\t\tconst {\n\t\t\tdist: { tarball },\n\t\t} = pkg\n\n\t\tconst tmpDir = await this.fs.createTempDir()\n\t\tawait downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir })\n\t\tconst dirContent = await this.fs.readDir(tmpDir)\n\t\tif (dirContent.length !== 1 || dirContent[0] !== 'package') {\n\t\t\tthrow 'Invalid NPM package'\n\t\t}\n\t\treturn join(tmpDir, 'package')\n\t}\n}\n"],"names":["join"],"mappings":";;;;;;;;;;AAOO,MAAM,kBAAkB;AAAA,EAE9B,YACkB,IAChB;AADgB,SAAA,KAAA;AAIlB,kBAAA,MAAA,mBAAkB,OAAO,YAAqC;AAC7D,YAAM,EAAE,MAAA,IAAU,IAAI,OAAO;AAC7B,YAAM,EAAE,cAAA,IAAkB,gBAAgB,KAAK;AAC/C,YAAM,UAAU,gBAAgB,EAAE,cAAA,IAAkB,CAAA;AAE9C,YAAA,MAAM,MAAM,eAAe,OAAO;AAClC,YAAA;AAAA,QACL,MAAM,EAAE,QAAQ;AAAA,MACb,IAAA;AAEJ,YAAM,SAAS,MAAM,KAAK,GAAG,cAAc;AACrC,YAAA,gBAAgB,EAAE,KAAK,SAAS,SAAS,EAAE,WAAW,KAAK,OAAA,CAAQ;AACzE,YAAM,aAAa,MAAM,KAAK,GAAG,QAAQ,MAAM;AAC/C,UAAI,WAAW,WAAW,KAAK,WAAW,CAAC,MAAM,WAAW;AACrD,cAAA;AAAA,MACP;AACO,aAAAA,UAAA,KAAK,QAAQ,SAAS;AAAA,IAAA,CAC9B;AAAA,EAnBA;AAoBD;;"}
@@ -0,0 +1,33 @@
1
+ import npa from "npm-package-arg";
2
+ import getRegistryInfo from "registry-info";
3
+ import getPackageJson from "get-package-json-from-registry";
4
+ import { join } from "node:path";
5
+ import downloadTarball from "download-tarball";
6
+ var __defProp = Object.defineProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
9
+ class PackageDownloader {
10
+ constructor(fs) {
11
+ this.fs = fs;
12
+ __publicField(this, "downloadPackage", async (pkgName) => {
13
+ const { scope } = npa(pkgName);
14
+ const { authorization } = getRegistryInfo(scope);
15
+ const headers = authorization ? { authorization } : {};
16
+ const pkg = await getPackageJson(pkgName);
17
+ const {
18
+ dist: { tarball }
19
+ } = pkg;
20
+ const tmpDir = await this.fs.createTempDir();
21
+ await downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir });
22
+ const dirContent = await this.fs.readDir(tmpDir);
23
+ if (dirContent.length !== 1 || dirContent[0] !== "package") {
24
+ throw "Invalid NPM package";
25
+ }
26
+ return join(tmpDir, "package");
27
+ });
28
+ }
29
+ }
30
+ export {
31
+ PackageDownloader
32
+ };
33
+ //# sourceMappingURL=PackageDownloader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackageDownloader.js","sources":["../../../../../packages/create/src/lib/PackageDownloader.ts"],"sourcesContent":["import npa from 'npm-package-arg'\nimport getRegistryInfo from 'registry-info'\nimport getPackageJson from 'get-package-json-from-registry'\nimport { join } from 'node:path'\nimport downloadTarball from 'download-tarball'\nimport { FileSystem } from './FileSystem'\n\nexport class PackageDownloader {\n\n\tconstructor(\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\tdownloadPackage = async (pkgName: string): Promise<string> => {\n\t\tconst { scope } = npa(pkgName)\n\t\tconst { authorization } = getRegistryInfo(scope)\n\t\tconst headers = authorization ? { authorization } : {}\n\n\t\tconst pkg = await getPackageJson(pkgName)\n\t\tconst {\n\t\t\tdist: { tarball },\n\t\t} = pkg\n\n\t\tconst tmpDir = await this.fs.createTempDir()\n\t\tawait downloadTarball({ url: tarball, gotOpts: { headers }, dir: tmpDir })\n\t\tconst dirContent = await this.fs.readDir(tmpDir)\n\t\tif (dirContent.length !== 1 || dirContent[0] !== 'package') {\n\t\t\tthrow 'Invalid NPM package'\n\t\t}\n\t\treturn join(tmpDir, 'package')\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAOO,MAAM,kBAAkB;AAAA,EAE9B,YACkB,IAChB;AADgB,SAAA,KAAA;AAIlB,kBAAA,MAAA,mBAAkB,OAAO,YAAqC;AAC7D,YAAM,EAAE,MAAA,IAAU,IAAI,OAAO;AAC7B,YAAM,EAAE,cAAA,IAAkB,gBAAgB,KAAK;AAC/C,YAAM,UAAU,gBAAgB,EAAE,cAAA,IAAkB,CAAA;AAE9C,YAAA,MAAM,MAAM,eAAe,OAAO;AAClC,YAAA;AAAA,QACL,MAAM,EAAE,QAAQ;AAAA,MACb,IAAA;AAEJ,YAAM,SAAS,MAAM,KAAK,GAAG,cAAc;AACrC,YAAA,gBAAgB,EAAE,KAAK,SAAS,SAAS,EAAE,WAAW,KAAK,OAAA,CAAQ;AACzE,YAAM,aAAa,MAAM,KAAK,GAAG,QAAQ,MAAM;AAC/C,UAAI,WAAW,WAAW,KAAK,WAAW,CAAC,MAAM,WAAW;AACrD,cAAA;AAAA,MACP;AACO,aAAA,KAAK,QAAQ,SAAS;AAAA,IAAA,CAC9B;AAAA,EAnBA;AAoBD;"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const node_path = require("node:path");
4
+ const jsyaml = require("js-yaml");
5
+ var __defProp = Object.defineProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
+ class TemplateInstaller {
9
+ constructor(resourceDir, packageDownloader, fs) {
10
+ this.resourceDir = resourceDir;
11
+ this.packageDownloader = packageDownloader;
12
+ this.fs = fs;
13
+ __publicField(this, "localTemplates", {
14
+ ["@contember/template-workspace"]: node_path.join(this.resourceDir, "templates/template-workspace")
15
+ });
16
+ __publicField(this, "installTemplate", async (template, targetDir, variables = {}) => {
17
+ let removeTemplate = () => {
18
+ };
19
+ if (this.localTemplates[template]) {
20
+ template = this.localTemplates[template];
21
+ }
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
+ const templateConfigFile = node_path.join(template, "contember.template.yaml");
29
+ if (!await this.fs.pathExists(templateConfigFile)) {
30
+ throw `${template} is not a Contember template`;
31
+ }
32
+ const config = await this.readYaml(templateConfigFile);
33
+ const nodeModulesDir = node_path.join(template, "node_modules");
34
+ const skippedFiles = /* @__PURE__ */ new Set([...(config.remove || []).map((it) => node_path.join(template, it)), templateConfigFile]);
35
+ if (await this.fs.pathExists(targetDir)) {
36
+ throw `${targetDir} already exists`;
37
+ }
38
+ await this.fs.copy(template, targetDir, {
39
+ filter: (src) => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src)
40
+ });
41
+ await removeTemplate();
42
+ if (config.patchPackageJson) {
43
+ await this.replaceFileContent(node_path.join(targetDir, "package.json"), (content) => {
44
+ const {
45
+ name,
46
+ version,
47
+ "scripts-template": scripts,
48
+ scripts: _nullScripts,
49
+ license,
50
+ ...json
51
+ } = JSON.parse(content);
52
+ return JSON.stringify({ scripts, ...json }, null, " ");
53
+ });
54
+ }
55
+ for (const [source, target] of Object.entries(config.rename || {})) {
56
+ await this.fs.rename(node_path.join(targetDir, source), node_path.join(targetDir, target));
57
+ }
58
+ for (const [source, target] of Object.entries(config.copy || {})) {
59
+ await this.fs.copy(node_path.join(targetDir, source), node_path.join(targetDir, target));
60
+ }
61
+ for (const file of config.replaceVariables || []) {
62
+ const path = node_path.join(targetDir, file);
63
+ if (!await this.fs.pathExists(path)) {
64
+ continue;
65
+ }
66
+ await this.replaceFileContent(
67
+ path,
68
+ (content) => Object.entries(variables).reduce(
69
+ (content2, [key, value]) => content2.replace(new RegExp(`{${key}}`, "g"), value),
70
+ content
71
+ )
72
+ );
73
+ }
74
+ });
75
+ __publicField(this, "replaceFileContent", async (path, replacer) => {
76
+ const content = await this.fs.readFile(path, { encoding: "utf8" });
77
+ const newContent = replacer(content);
78
+ await this.fs.writeFile(path, newContent, { encoding: "utf8" });
79
+ });
80
+ __publicField(this, "readYaml", async (path) => {
81
+ const content = await this.fs.readFile(path, { encoding: "utf8" });
82
+ return jsyaml.load(content);
83
+ });
84
+ }
85
+ }
86
+ exports.TemplateInstaller = TemplateInstaller;
87
+ //# sourceMappingURL=TemplateInstaller.cjs.map
@@ -0,0 +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":"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"}
@@ -0,0 +1,87 @@
1
+ import { join, isAbsolute } from "node:path";
2
+ import jsyaml__default from "js-yaml";
3
+ var __defProp = Object.defineProperty;
4
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ class TemplateInstaller {
7
+ constructor(resourceDir, packageDownloader, fs) {
8
+ this.resourceDir = resourceDir;
9
+ this.packageDownloader = packageDownloader;
10
+ this.fs = fs;
11
+ __publicField(this, "localTemplates", {
12
+ ["@contember/template-workspace"]: join(this.resourceDir, "templates/template-workspace")
13
+ });
14
+ __publicField(this, "installTemplate", async (template, targetDir, variables = {}) => {
15
+ let removeTemplate = () => {
16
+ };
17
+ if (this.localTemplates[template]) {
18
+ template = this.localTemplates[template];
19
+ }
20
+ if (!isAbsolute(template)) {
21
+ template = await this.packageDownloader.downloadPackage(template);
22
+ removeTemplate = async () => {
23
+ await this.fs.unlink(template);
24
+ };
25
+ }
26
+ const templateConfigFile = join(template, "contember.template.yaml");
27
+ if (!await this.fs.pathExists(templateConfigFile)) {
28
+ throw `${template} is not a Contember template`;
29
+ }
30
+ const config = await this.readYaml(templateConfigFile);
31
+ const nodeModulesDir = join(template, "node_modules");
32
+ const skippedFiles = /* @__PURE__ */ new Set([...(config.remove || []).map((it) => join(template, it)), templateConfigFile]);
33
+ if (await this.fs.pathExists(targetDir)) {
34
+ throw `${targetDir} already exists`;
35
+ }
36
+ await this.fs.copy(template, targetDir, {
37
+ filter: (src) => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src)
38
+ });
39
+ await removeTemplate();
40
+ if (config.patchPackageJson) {
41
+ await this.replaceFileContent(join(targetDir, "package.json"), (content) => {
42
+ const {
43
+ name,
44
+ version,
45
+ "scripts-template": scripts,
46
+ scripts: _nullScripts,
47
+ license,
48
+ ...json
49
+ } = JSON.parse(content);
50
+ return JSON.stringify({ scripts, ...json }, null, " ");
51
+ });
52
+ }
53
+ for (const [source, target] of Object.entries(config.rename || {})) {
54
+ await this.fs.rename(join(targetDir, source), join(targetDir, target));
55
+ }
56
+ for (const [source, target] of Object.entries(config.copy || {})) {
57
+ await this.fs.copy(join(targetDir, source), join(targetDir, target));
58
+ }
59
+ for (const file of config.replaceVariables || []) {
60
+ const path = join(targetDir, file);
61
+ if (!await this.fs.pathExists(path)) {
62
+ continue;
63
+ }
64
+ await this.replaceFileContent(
65
+ path,
66
+ (content) => Object.entries(variables).reduce(
67
+ (content2, [key, value]) => content2.replace(new RegExp(`{${key}}`, "g"), value),
68
+ content
69
+ )
70
+ );
71
+ }
72
+ });
73
+ __publicField(this, "replaceFileContent", async (path, replacer) => {
74
+ const content = await this.fs.readFile(path, { encoding: "utf8" });
75
+ const newContent = replacer(content);
76
+ await this.fs.writeFile(path, newContent, { encoding: "utf8" });
77
+ });
78
+ __publicField(this, "readYaml", async (path) => {
79
+ const content = await this.fs.readFile(path, { encoding: "utf8" });
80
+ return jsyaml__default.load(content);
81
+ });
82
+ }
83
+ }
84
+ export {
85
+ TemplateInstaller
86
+ };
87
+ //# sourceMappingURL=TemplateInstaller.js.map
@@ -0,0 +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":"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"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const node_path = require("node:path");
4
+ const fs = require("node:fs/promises");
5
+ const paths = require("../paths.cjs");
6
+ const getPackageVersion = async () => {
7
+ return JSON.parse(await fs.readFile(node_path.join(paths.packageRoot, "package.json"), "utf-8")).version;
8
+ };
9
+ exports.getPackageVersion = getPackageVersion;
10
+ //# sourceMappingURL=version.cjs.map
@@ -0,0 +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;;"}
@@ -0,0 +1,10 @@
1
+ import { join } from "node:path";
2
+ import fs__default from "node:fs/promises";
3
+ import { packageRoot } from "../paths.js";
4
+ const getPackageVersion = async () => {
5
+ return JSON.parse(await fs__default.readFile(join(packageRoot, "package.json"), "utf-8")).version;
6
+ };
7
+ export {
8
+ getPackageVersion
9
+ };
10
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sources":["../../../../../packages/create/src/lib/version.ts"],"sourcesContent":["import { join } from 'node:path'\nimport fs from 'node:fs/promises'\nimport { packageRoot } from '../paths'\n\nexport const getPackageVersion = async () => {\n\treturn JSON.parse(await fs.readFile(join(packageRoot, 'package.json'), 'utf-8')).version\n}\n"],"names":["fs"],"mappings":";;;AAIO,MAAM,oBAAoB,YAAY;AACrC,SAAA,KAAK,MAAM,MAAMA,YAAG,SAAS,KAAK,aAAa,cAAc,GAAG,OAAO,CAAC,EAAE;AAClF;"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const node_path = require("node:path");
4
+ const node_url = require("node:url");
5
+ 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 resourcesDir = node_path.join(packageRoot, "./resources");
8
+ exports.packageRoot = packageRoot;
9
+ exports.resourcesDir = resourcesDir;
10
+ //# sourceMappingURL=paths.cjs.map
@@ -0,0 +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;;;"}
@@ -0,0 +1,9 @@
1
+ import { join, dirname } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ const packageRoot = process.env.CONTEMBER_CLI_PACKAGE_ROOT || join(dirname(fileURLToPath(import.meta.url)), "../../");
4
+ const resourcesDir = join(packageRoot, "./resources");
5
+ export {
6
+ packageRoot,
7
+ resourcesDir
8
+ };
9
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +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;"}