@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.
- package/README.md +120 -2
- package/dist/api.d.ts +10 -0
- package/dist/api.js +9 -0
- package/dist/args.d.ts +11 -0
- package/dist/args.js +61 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +11 -0
- package/dist/codemod/add-route.d.ts +66 -0
- package/dist/codemod/add-route.js +435 -0
- package/dist/codemod/edit.d.ts +35 -0
- package/dist/codemod/edit.js +51 -0
- package/dist/codemod/index.d.ts +8 -0
- package/dist/codemod/index.js +8 -0
- package/dist/codemod/merge-barrel.d.ts +9 -0
- package/dist/codemod/merge-barrel.js +49 -0
- package/dist/codemod/messages.d.ts +11 -0
- package/dist/codemod/messages.js +46 -0
- package/dist/codemod/names.d.ts +62 -0
- package/dist/codemod/names.js +204 -0
- package/dist/codemod/plan.d.ts +45 -0
- package/dist/codemod/plan.js +147 -0
- package/dist/codemod/register-domain.d.ts +51 -0
- package/dist/codemod/register-domain.js +237 -0
- package/dist/codemod/register-messages.d.ts +11 -0
- package/dist/codemod/register-messages.js +112 -0
- package/dist/codemod/route-elements.d.ts +25 -0
- package/dist/codemod/route-elements.js +72 -0
- package/dist/commands/check.d.ts +16 -0
- package/dist/commands/check.js +47 -0
- package/dist/commands/doctor.d.ts +20 -0
- package/dist/commands/doctor.js +104 -0
- package/dist/commands/make-component.d.ts +33 -0
- package/dist/commands/make-component.js +85 -0
- package/dist/commands/make-domain.d.ts +30 -0
- package/dist/commands/make-domain.js +83 -0
- package/dist/commands/make-page.d.ts +30 -0
- package/dist/commands/make-page.js +73 -0
- package/dist/commands/new.d.ts +33 -0
- package/dist/commands/new.js +179 -0
- package/dist/commands/shared.d.ts +43 -0
- package/dist/commands/shared.js +83 -0
- package/dist/describe.d.ts +63 -0
- package/dist/describe.js +134 -0
- package/dist/doctor/checks.d.ts +35 -0
- package/dist/doctor/checks.js +283 -0
- package/dist/doctor/ranges.d.ts +16 -0
- package/dist/doctor/ranges.js +27 -0
- package/dist/doctor/versions.d.ts +33 -0
- package/dist/doctor/versions.js +44 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.js +19 -0
- package/dist/generate/app.d.ts +27 -0
- package/dist/generate/app.js +136 -0
- package/dist/generate/component.d.ts +36 -0
- package/dist/generate/component.js +48 -0
- package/dist/generate/domain.d.ts +31 -0
- package/dist/generate/domain.js +63 -0
- package/dist/generate/page.d.ts +45 -0
- package/dist/generate/page.js +100 -0
- package/dist/help.d.ts +19 -0
- package/dist/help.js +97 -0
- package/dist/in-process.d.ts +26 -0
- package/dist/in-process.js +23 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/new/name.d.ts +7 -0
- package/dist/new/name.js +24 -0
- package/dist/new/packages.d.ts +6 -0
- package/dist/new/packages.js +40 -0
- package/dist/new/versions.d.ts +7 -0
- package/dist/new/versions.js +13 -0
- package/dist/process.d.ts +22 -0
- package/dist/process.js +45 -0
- package/dist/project.d.ts +22 -0
- package/dist/project.js +42 -0
- package/dist/root.d.ts +3 -0
- package/dist/root.js +24 -0
- package/dist/run.d.ts +13 -0
- package/dist/run.js +72 -0
- package/dist/runtime.d.ts +19 -0
- package/dist/runtime.js +1 -0
- package/dist/templates.d.ts +26 -0
- package/dist/templates.js +46 -0
- package/package.json +45 -3
- package/templates/app/AGENTS.md.tpl +50 -0
- package/templates/app/README.md.tpl +15 -0
- package/templates/app/eslint.config.js.tpl +19 -0
- package/templates/app/gitignore.tpl +22 -0
- package/templates/app/index.html.tpl +12 -0
- package/templates/app/mcp.json.tpl +8 -0
- package/templates/app/src/App.tsx.tpl +8 -0
- package/templates/app/src/i18n.ts.tpl +12 -0
- package/templates/app/src/main.tsx.tpl +12 -0
- package/templates/app/src/messages/index.ts.tpl +1 -0
- package/templates/app/src/providers/app.tsx.tpl +23 -0
- package/templates/app/src/providers/repository/index.ts.tpl +5 -0
- package/templates/app/src/queries-index.ts.tpl +1 -0
- package/templates/app/src/repositories/index.ts.tpl +18 -0
- package/templates/app/src/repositories/options.ts.tpl +8 -0
- package/templates/app/src/schemas-index.ts.tpl +1 -0
- package/templates/app/src/test/render.tsx.tpl +31 -0
- package/templates/app/src/test/setup.ts.tpl +4 -0
- package/templates/app/typescript.json.tpl +24 -0
- package/templates/app/vite.config.ts.tpl +16 -0
- package/templates/component/component-test.tsx.tpl +9 -0
- package/templates/component/component.tsx.tpl +11 -0
- package/templates/domain/queries.ts.tpl +62 -0
- package/templates/domain/repository-contract-test.ts.tpl +75 -0
- package/templates/domain/repository-contract.ts.tpl +13 -0
- package/templates/domain/repository-fixtures.ts.tpl +8 -0
- package/templates/domain/repository-index.ts.tpl +12 -0
- package/templates/domain/repository-mock.ts.tpl +69 -0
- package/templates/domain/schema.ts.tpl +23 -0
- package/templates/page/index-domain-test.tsx.tpl +11 -0
- package/templates/page/index-test.tsx.tpl +10 -0
- package/templates/page/index.tsx.tpl +7 -0
- package/templates/page/messages-domain.en.json.tpl +5 -0
- package/templates/page/messages-domain.pt-BR.json.tpl +5 -0
- package/templates/page/messages.en.json.tpl +3 -0
- package/templates/page/messages.pt-BR.json.tpl +3 -0
- package/templates/page/model-domain.ts.tpl +17 -0
- package/templates/page/model.ts.tpl +8 -0
- package/templates/page/view-domain.tsx.tpl +20 -0
- 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,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,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
|
+
}
|