@matizze/prumo-cli 0.0.0-stage → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +120 -2
  2. package/dist/api.d.ts +10 -0
  3. package/dist/api.js +9 -0
  4. package/dist/args.d.ts +11 -0
  5. package/dist/args.js +61 -0
  6. package/dist/bin.d.ts +2 -0
  7. package/dist/bin.js +11 -0
  8. package/dist/codemod/add-route.d.ts +66 -0
  9. package/dist/codemod/add-route.js +435 -0
  10. package/dist/codemod/edit.d.ts +35 -0
  11. package/dist/codemod/edit.js +51 -0
  12. package/dist/codemod/index.d.ts +8 -0
  13. package/dist/codemod/index.js +8 -0
  14. package/dist/codemod/merge-barrel.d.ts +9 -0
  15. package/dist/codemod/merge-barrel.js +49 -0
  16. package/dist/codemod/messages.d.ts +11 -0
  17. package/dist/codemod/messages.js +46 -0
  18. package/dist/codemod/names.d.ts +62 -0
  19. package/dist/codemod/names.js +204 -0
  20. package/dist/codemod/plan.d.ts +45 -0
  21. package/dist/codemod/plan.js +147 -0
  22. package/dist/codemod/register-domain.d.ts +51 -0
  23. package/dist/codemod/register-domain.js +237 -0
  24. package/dist/codemod/register-messages.d.ts +11 -0
  25. package/dist/codemod/register-messages.js +112 -0
  26. package/dist/codemod/route-elements.d.ts +25 -0
  27. package/dist/codemod/route-elements.js +72 -0
  28. package/dist/commands/check.d.ts +16 -0
  29. package/dist/commands/check.js +47 -0
  30. package/dist/commands/doctor.d.ts +20 -0
  31. package/dist/commands/doctor.js +104 -0
  32. package/dist/commands/make-component.d.ts +33 -0
  33. package/dist/commands/make-component.js +85 -0
  34. package/dist/commands/make-domain.d.ts +30 -0
  35. package/dist/commands/make-domain.js +83 -0
  36. package/dist/commands/make-page.d.ts +30 -0
  37. package/dist/commands/make-page.js +73 -0
  38. package/dist/commands/new.d.ts +33 -0
  39. package/dist/commands/new.js +179 -0
  40. package/dist/commands/shared.d.ts +43 -0
  41. package/dist/commands/shared.js +83 -0
  42. package/dist/describe.d.ts +63 -0
  43. package/dist/describe.js +134 -0
  44. package/dist/doctor/checks.d.ts +35 -0
  45. package/dist/doctor/checks.js +283 -0
  46. package/dist/doctor/ranges.d.ts +16 -0
  47. package/dist/doctor/ranges.js +27 -0
  48. package/dist/doctor/versions.d.ts +33 -0
  49. package/dist/doctor/versions.js +44 -0
  50. package/dist/errors.d.ts +12 -0
  51. package/dist/errors.js +19 -0
  52. package/dist/generate/app.d.ts +27 -0
  53. package/dist/generate/app.js +136 -0
  54. package/dist/generate/component.d.ts +36 -0
  55. package/dist/generate/component.js +48 -0
  56. package/dist/generate/domain.d.ts +31 -0
  57. package/dist/generate/domain.js +63 -0
  58. package/dist/generate/page.d.ts +45 -0
  59. package/dist/generate/page.js +100 -0
  60. package/dist/help.d.ts +19 -0
  61. package/dist/help.js +97 -0
  62. package/dist/in-process.d.ts +26 -0
  63. package/dist/in-process.js +23 -0
  64. package/dist/index.d.ts +9 -0
  65. package/dist/index.js +9 -0
  66. package/dist/new/name.d.ts +7 -0
  67. package/dist/new/name.js +24 -0
  68. package/dist/new/packages.d.ts +6 -0
  69. package/dist/new/packages.js +40 -0
  70. package/dist/new/versions.d.ts +7 -0
  71. package/dist/new/versions.js +13 -0
  72. package/dist/process.d.ts +22 -0
  73. package/dist/process.js +45 -0
  74. package/dist/project.d.ts +22 -0
  75. package/dist/project.js +42 -0
  76. package/dist/root.d.ts +3 -0
  77. package/dist/root.js +24 -0
  78. package/dist/run.d.ts +13 -0
  79. package/dist/run.js +72 -0
  80. package/dist/runtime.d.ts +19 -0
  81. package/dist/runtime.js +1 -0
  82. package/dist/templates.d.ts +26 -0
  83. package/dist/templates.js +46 -0
  84. package/package.json +45 -3
  85. package/templates/app/AGENTS.md.tpl +50 -0
  86. package/templates/app/README.md.tpl +15 -0
  87. package/templates/app/eslint.config.js.tpl +19 -0
  88. package/templates/app/gitignore.tpl +22 -0
  89. package/templates/app/index.html.tpl +12 -0
  90. package/templates/app/mcp.json.tpl +8 -0
  91. package/templates/app/src/App.tsx.tpl +8 -0
  92. package/templates/app/src/i18n.ts.tpl +12 -0
  93. package/templates/app/src/main.tsx.tpl +12 -0
  94. package/templates/app/src/messages/index.ts.tpl +1 -0
  95. package/templates/app/src/providers/app.tsx.tpl +23 -0
  96. package/templates/app/src/providers/repository/index.ts.tpl +5 -0
  97. package/templates/app/src/queries-index.ts.tpl +1 -0
  98. package/templates/app/src/repositories/index.ts.tpl +18 -0
  99. package/templates/app/src/repositories/options.ts.tpl +8 -0
  100. package/templates/app/src/schemas-index.ts.tpl +1 -0
  101. package/templates/app/src/test/render.tsx.tpl +31 -0
  102. package/templates/app/src/test/setup.ts.tpl +4 -0
  103. package/templates/app/typescript.json.tpl +24 -0
  104. package/templates/app/vite.config.ts.tpl +16 -0
  105. package/templates/component/component-test.tsx.tpl +9 -0
  106. package/templates/component/component.tsx.tpl +11 -0
  107. package/templates/domain/queries.ts.tpl +62 -0
  108. package/templates/domain/repository-contract-test.ts.tpl +75 -0
  109. package/templates/domain/repository-contract.ts.tpl +13 -0
  110. package/templates/domain/repository-fixtures.ts.tpl +8 -0
  111. package/templates/domain/repository-index.ts.tpl +12 -0
  112. package/templates/domain/repository-mock.ts.tpl +69 -0
  113. package/templates/domain/schema.ts.tpl +23 -0
  114. package/templates/page/index-domain-test.tsx.tpl +11 -0
  115. package/templates/page/index-test.tsx.tpl +10 -0
  116. package/templates/page/index.tsx.tpl +7 -0
  117. package/templates/page/messages-domain.en.json.tpl +5 -0
  118. package/templates/page/messages-domain.pt-BR.json.tpl +5 -0
  119. package/templates/page/messages.en.json.tpl +3 -0
  120. package/templates/page/messages.pt-BR.json.tpl +3 -0
  121. package/templates/page/model-domain.ts.tpl +17 -0
  122. package/templates/page/model.ts.tpl +8 -0
  123. package/templates/page/view-domain.tsx.tpl +20 -0
  124. package/templates/page/view.tsx.tpl +9 -0
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod'
2
+ import type { PageQuery, Sort } from '@matizze/prumo-core/data'
3
+
4
+ export const {{singular.camel}}Schema = z.object({
5
+ id: z.string(),
6
+ name: z.string(),
7
+ createdAt: z.string(),
8
+ })
9
+
10
+ export type {{singular.pascal}}Schema = z.infer<typeof {{singular.camel}}Schema>
11
+
12
+ /** O que se envia para criar ou editar: o `id` e a data são do repositório. */
13
+ export const {{singular.camel}}InputSchema = {{singular.camel}}Schema.pick({ name: true })
14
+
15
+ export type {{singular.pascal}}Input = z.infer<typeof {{singular.camel}}InputSchema>
16
+
17
+ export type {{singular.pascal}}SortKey = 'name' | 'createdAt'
18
+
19
+ export interface {{singular.pascal}}ListQuery extends PageQuery {
20
+ /** Busca pelo nome, sem diferenciar maiúsculas e acentos. */
21
+ search?: string
22
+ sort?: Sort<{{singular.pascal}}SortKey>
23
+ }
@@ -0,0 +1,11 @@
1
+ import { screen } from '@testing-library/react'
2
+ import { expect, it } from 'vitest'
3
+ import { renderWithProviders } from '@/test/render'
4
+ import {{page.pascal}}Page from '.'
5
+
6
+ it('mostra o título e, depois de carregar, a lista do domínio', async () => {
7
+ renderWithProviders(<{{page.pascal}}Page />, { path: '/{{page.kebab}}' })
8
+
9
+ expect(screen.getByRole('heading', { name: '{{page.title}}' })).toBeDefined()
10
+ expect(await screen.findByRole('list')).toBeDefined()
11
+ })
@@ -0,0 +1,10 @@
1
+ import { screen } from '@testing-library/react'
2
+ import { expect, it } from 'vitest'
3
+ import { renderWithProviders } from '@/test/render'
4
+ import {{page.pascal}}Page from '.'
5
+
6
+ it('mostra o título da tela', () => {
7
+ renderWithProviders(<{{page.pascal}}Page />, { path: '/{{page.kebab}}' })
8
+
9
+ expect(screen.getByRole('heading', { name: '{{page.title}}' })).toBeDefined()
10
+ })
@@ -0,0 +1,7 @@
1
+ import { use{{page.pascal}}Model } from './model'
2
+ import { {{page.pascal}}View } from './view'
3
+
4
+ export default function {{page.pascal}}Page() {
5
+ const model = use{{page.pascal}}Model()
6
+ return <{{page.pascal}}View {...model} />
7
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "title": "{{page.title}}",
3
+ "loading": "Loading…",
4
+ "failed": "Could not load the list."
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "title": "{{page.title}}",
3
+ "loading": "Carregando…",
4
+ "failed": "Não foi possível carregar a lista."
5
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "title": "{{page.title}}"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "title": "{{page.title}}"
3
+ }
@@ -0,0 +1,17 @@
1
+ import { useTranslations } from '@/i18n'
2
+ import { use{{domain.pascal}}List } from '@/queries/{{domain.kebab}}'
3
+
4
+ export function use{{page.pascal}}Model() {
5
+ const t = useTranslations('{{page.camel}}')
6
+ const list = use{{domain.pascal}}List()
7
+ return {
8
+ title: t('title'),
9
+ loadingText: t('loading'),
10
+ failedText: t('failed'),
11
+ items: list.data?.items ?? [],
12
+ loading: list.isPending,
13
+ failed: list.isError,
14
+ }
15
+ }
16
+
17
+ export type {{page.pascal}}Model = ReturnType<typeof use{{page.pascal}}Model>
@@ -0,0 +1,8 @@
1
+ import { useTranslations } from '@/i18n'
2
+
3
+ export function use{{page.pascal}}Model() {
4
+ const t = useTranslations('{{page.camel}}')
5
+ return { title: t('title') }
6
+ }
7
+
8
+ export type {{page.pascal}}Model = ReturnType<typeof use{{page.pascal}}Model>
@@ -0,0 +1,20 @@
1
+ import type { {{page.pascal}}Model } from './model'
2
+
3
+ export function {{page.pascal}}View(m: {{page.pascal}}Model) {
4
+ return (
5
+ <main>
6
+ <h1>{m.title}</h1>
7
+ {m.loading ? (
8
+ <p>{m.loadingText}</p>
9
+ ) : m.failed ? (
10
+ <p role="alert">{m.failedText}</p>
11
+ ) : (
12
+ <ul>
13
+ {m.items.map((i) => (
14
+ <li key={i.id}>{i.name}</li>
15
+ ))}
16
+ </ul>
17
+ )}
18
+ </main>
19
+ )
20
+ }
@@ -0,0 +1,9 @@
1
+ import type { {{page.pascal}}Model } from './model'
2
+
3
+ export function {{page.pascal}}View(m: {{page.pascal}}Model) {
4
+ return (
5
+ <main>
6
+ <h1>{m.title}</h1>
7
+ </main>
8
+ )
9
+ }