@contember/create 2.2.0-alpha.1 → 2.2.0-alpha.10

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 (96) hide show
  1. package/CLAUDE.md +22 -0
  2. package/dist/development/run.cjs +7 -7
  3. package/dist/development/run.cjs.map +1 -1
  4. package/dist/development/run.js +8 -8
  5. package/dist/development/run.js.map +1 -1
  6. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +27 -13
  7. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  8. package/dist/development/src/commands/WorkspaceCreateCommand.js +28 -14
  9. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  10. package/dist/development/src/lib/TemplateInstaller.cjs +72 -60
  11. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  12. package/dist/development/src/lib/TemplateInstaller.js +72 -60
  13. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  14. package/dist/production/run.cjs +7 -7
  15. package/dist/production/run.cjs.map +1 -1
  16. package/dist/production/run.js +8 -8
  17. package/dist/production/run.js.map +1 -1
  18. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +27 -13
  19. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  20. package/dist/production/src/commands/WorkspaceCreateCommand.js +28 -14
  21. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  22. package/dist/production/src/lib/TemplateInstaller.cjs +72 -60
  23. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  24. package/dist/production/src/lib/TemplateInstaller.js +72 -60
  25. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  26. package/dist/types/commands/WorkspaceCreateCommand.d.ts +15 -3
  27. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  28. package/dist/types/lib/FileSystem.d.ts.map +1 -1
  29. package/dist/types/lib/TemplateInstaller.d.ts +9 -1
  30. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  31. package/dist/types/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +2 -2
  33. package/resources/templates/default/README.md +3 -1
  34. package/resources/templates/default/admin/app/components/navigation.tsx +95 -8
  35. package/resources/templates/default/admin/app/pages/tenant.tsx +328 -77
  36. package/resources/templates/default/admin/entrypoint/components/login.tsx +1 -1
  37. package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +1 -1
  38. package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +1 -1
  39. package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +1 -1
  40. package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +1 -1
  41. package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +1 -1
  42. package/resources/templates/default/admin/lib/tenant/config/auth-policy-list.tsx +86 -0
  43. package/resources/templates/default/admin/lib/tenant/config/common.tsx +71 -0
  44. package/resources/templates/default/admin/lib/tenant/config/identity-provider-list.tsx +113 -0
  45. package/resources/templates/default/admin/lib/tenant/config/index.ts +5 -0
  46. package/resources/templates/default/admin/lib/tenant/config/mail-template-list.tsx +108 -0
  47. package/resources/templates/default/admin/lib/tenant/config/tenant-config-view.tsx +182 -0
  48. package/resources/templates/default/admin/lib/tenant/dict.ts +450 -4
  49. package/resources/templates/default/admin/lib/tenant/errors.ts +10 -0
  50. package/resources/templates/default/admin/lib/tenant/forms/add-project-member.tsx +57 -0
  51. package/resources/templates/default/admin/lib/tenant/forms/change-my-profile.tsx +40 -0
  52. package/resources/templates/default/admin/lib/tenant/forms/change-profile.tsx +55 -0
  53. package/resources/templates/default/admin/lib/tenant/forms/common.tsx +9 -2
  54. package/resources/templates/default/admin/lib/tenant/forms/create-global-api-key.tsx +69 -0
  55. package/resources/templates/default/admin/lib/tenant/forms/global-roles-control.tsx +113 -0
  56. package/resources/templates/default/admin/lib/tenant/forms/index.ts +11 -0
  57. package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +42 -4
  58. package/resources/templates/default/admin/lib/tenant/forms/login.tsx +4 -10
  59. package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +3 -1
  60. package/resources/templates/default/admin/lib/tenant/forms/mfa-code-fields.tsx +81 -0
  61. package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +4 -10
  62. package/resources/templates/default/admin/lib/tenant/forms/set-person-password.tsx +58 -0
  63. package/resources/templates/default/admin/lib/tenant/forms/set-project-secret.tsx +59 -0
  64. package/resources/templates/default/admin/lib/tenant/forms/sign-up.tsx +73 -0
  65. package/resources/templates/default/admin/lib/tenant/hooks/index.ts +2 -0
  66. package/resources/templates/default/admin/lib/tenant/idp/identity-provider-connections.tsx +124 -0
  67. package/resources/templates/default/admin/lib/tenant/idp/index.ts +1 -0
  68. package/resources/templates/default/admin/lib/tenant/index.ts +7 -0
  69. package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +160 -22
  70. package/resources/templates/default/admin/lib/tenant/listing/auth-log-list.tsx +179 -0
  71. package/resources/templates/default/admin/lib/tenant/listing/global-api-key-list.tsx +149 -0
  72. package/resources/templates/default/admin/lib/tenant/listing/index.ts +7 -0
  73. package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +1 -1
  74. package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +20 -11
  75. package/resources/templates/default/admin/lib/tenant/listing/mfa.tsx +29 -0
  76. package/resources/templates/default/admin/lib/tenant/listing/person-actions.tsx +179 -0
  77. package/resources/templates/default/admin/lib/tenant/listing/person-detail.tsx +141 -0
  78. package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +13 -2
  79. package/resources/templates/default/admin/lib/tenant/listing/persons-list.tsx +128 -0
  80. package/resources/templates/default/admin/lib/tenant/listing/project-secret-list.tsx +82 -0
  81. package/resources/templates/default/admin/lib/tenant/otp/backup-codes.tsx +81 -0
  82. package/resources/templates/default/admin/lib/tenant/otp/email-otp-setup.tsx +133 -0
  83. package/resources/templates/default/admin/lib/tenant/otp/index.ts +2 -0
  84. package/resources/templates/default/admin/lib/tenant/security/index.ts +2 -0
  85. package/resources/templates/default/admin/lib/tenant/security/passwordless-toggle.tsx +63 -0
  86. package/resources/templates/default/admin/lib/tenant/security/session-list.tsx +143 -0
  87. package/resources/templates/default/admin/package.json +1 -0
  88. package/resources/templates/default/docker/object-storage/README.md +13 -0
  89. package/resources/templates/default/docker/object-storage/identities.json +13 -0
  90. package/resources/templates/default/docker-compose.yaml +29 -7
  91. package/src/commands/WorkspaceCreateCommand.ts +42 -14
  92. package/src/lib/TemplateInstaller.ts +87 -69
  93. package/src/run.ts +8 -7
  94. package/tests/cases/unit/create-process.test.ts +66 -0
  95. package/tests/cases/unit/template-installer-cleanup.test.ts +150 -0
  96. package/tests/cases/unit/workspace-create.test.ts +81 -0
@@ -0,0 +1,81 @@
1
+ import { describe, expect, test } from 'bun:test'
2
+ import { Output, OutputStream } from '@contember/cli-common'
3
+ import { TemplateInstaller } from '../../../src/lib/TemplateInstaller.js'
4
+ import { WorkspaceCreateCommand, WorkspaceCreateRuntime } from '../../../src/commands/WorkspaceCreateCommand.js'
5
+
6
+ class CapturingStream implements OutputStream {
7
+ public chunks: string[] = []
8
+ public readonly isTty = false
9
+
10
+ public write(text: string): void {
11
+ this.chunks.push(text)
12
+ }
13
+
14
+ public get text(): string {
15
+ return this.chunks.join('')
16
+ }
17
+ }
18
+
19
+ const createOutput = () => {
20
+ const stdout = new CapturingStream()
21
+ const stderr = new CapturingStream()
22
+ return { output: new Output({ stdout, stderr }), stdout, stderr }
23
+ }
24
+
25
+ const createCommand = () => {
26
+ const installs: { template: string; targetDir: string; variables: Record<string, string> }[] = []
27
+ const installer: Pick<TemplateInstaller, 'installTemplate'> = {
28
+ installTemplate: async (template, targetDir, variables = {}) => {
29
+ installs.push({ template, targetDir, variables })
30
+ },
31
+ }
32
+ const runtime: WorkspaceCreateRuntime = {
33
+ cwd: () => '/work',
34
+ getPackageVersion: async () => '2.2.0-test',
35
+ detectPackageManager: () => 'bun',
36
+ }
37
+ return { command: new WorkspaceCreateCommand(installer, runtime), installs }
38
+ }
39
+
40
+ describe('WorkspaceCreateCommand output', () => {
41
+ test('--json returns stable created-project data', async () => {
42
+ const { command, installs } = createCommand()
43
+ const { output, stdout, stderr } = createOutput()
44
+
45
+ await command.run(['demo', '--template', 'custom', '--json'], output)
46
+
47
+ expect(JSON.parse(stdout.text)).toEqual({
48
+ projectName: 'demo',
49
+ projectDirectory: '/work/demo',
50
+ template: 'custom',
51
+ packageManager: 'bun',
52
+ })
53
+ expect(stderr.text).toBe('')
54
+ expect(installs).toEqual([{
55
+ template: 'custom',
56
+ targetDir: '/work/demo',
57
+ variables: { version: '2.2.0-test', projectName: 'demo', packageManager: 'bun' },
58
+ }])
59
+ })
60
+
61
+ test('--quiet returns only the created directory', async () => {
62
+ const { command } = createCommand()
63
+ const { output, stdout, stderr } = createOutput()
64
+
65
+ await command.run(['demo', '--quiet'], output)
66
+
67
+ expect(stdout.text).toBe('/work/demo\n')
68
+ expect(stderr.text).toBe('')
69
+ })
70
+
71
+ test('human instructions sanitize project-controlled terminal sequences', async () => {
72
+ const { command } = createCommand()
73
+ const { output, stdout } = createOutput()
74
+
75
+ await command.run(['demo\u001b[31m', '--no-color'], output)
76
+
77
+ expect(stdout.text).toContain('Contember project successfully created in /work/demo[31m')
78
+ expect(stdout.text).not.toContain('\u001b')
79
+ expect(stdout.text).toContain('bun install')
80
+ })
81
+ })