create-web-0to1 0.1.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 +68 -0
- package/internal/engine/create-feature-crud-script.ts +134 -0
- package/internal/engine/create-feature-crud.template.mjs +601 -0
- package/internal/engine/create-feature-script.ts +142 -0
- package/internal/engine/generator-engine.ts +546 -0
- package/internal/engine/standalone-feature-preset.ts +34 -0
- package/internal/meta/preset-plan.ts +41 -0
- package/internal/meta/runtime-copy-plan.ts +220 -0
- package/internal/meta/runtime-layout.ts +262 -0
- package/internal/meta/scaffold-manifest.ts +169 -0
- package/internal/meta/standalone-dependency-manifest.ts +75 -0
- package/package.json +45 -0
- package/scripts/create-app.mjs +1612 -0
- package/source/core/auth/auth-events.ts +13 -0
- package/source/core/error/app-error.ts +85 -0
- package/source/core/error/handle-app-error.client.ts +35 -0
- package/source/core/lib/dayjs.ts +25 -0
- package/source/core/query/query-client.ts +126 -0
- package/source/core/request/request-core.ts +210 -0
- package/source/core/routes/route-paths.ts +4 -0
- package/source/core/ui/button.tsx +24 -0
- package/source/core/ui/modal-store.ts +32 -0
- package/source/core/ui/text-input-field.tsx +36 -0
- package/source/core/utils/build-query-string.ts +30 -0
- package/source/core/utils/format/date.ts +41 -0
- package/source/core/utils/format/index.ts +3 -0
- package/source/core/utils/format/number.ts +13 -0
- package/source/core/utils/format/text.ts +15 -0
- package/source/core/utils/schema-utils.ts +27 -0
- package/source/wrappers/monorepo/core/internal.ts +21 -0
- package/source/wrappers/monorepo/core/src/index.ts +4 -0
- package/source/wrappers/monorepo/core-next/src/auth.client.ts +1 -0
- package/source/wrappers/monorepo/core-next/src/auth.server.ts +94 -0
- package/source/wrappers/monorepo/core-next/src/bootstrap.client.tsx +21 -0
- package/source/wrappers/monorepo/core-next/src/bootstrap.tsx +18 -0
- package/source/wrappers/monorepo/core-next/src/index.ts +1 -0
- package/source/wrappers/monorepo/core-react/src/app-providers.tsx +36 -0
- package/source/wrappers/monorepo/core-react/src/auth.ts +42 -0
- package/source/wrappers/monorepo/core-react/src/hydration.tsx +21 -0
- package/source/wrappers/monorepo/core-react/src/index.ts +7 -0
- package/source/wrappers/monorepo/core-react/src/provider.tsx +49 -0
- package/source/wrappers/monorepo/core-react/src/query-client.ts +48 -0
- package/source/wrappers/monorepo/core-react/src/query-error-handler.ts +62 -0
- package/source/wrappers/monorepo/core-react/src/query-keys.ts +22 -0
- package/source/wrappers/monorepo/request/core-fetch.ts +27 -0
- package/source/wrappers/monorepo/request/core-request.ts +93 -0
- package/source/wrappers/next/auth/auth-error-listener.tsx +34 -0
- package/source/wrappers/next/error/handle-app-error.server.ts +41 -0
- package/source/wrappers/next/query/hydration.tsx +20 -0
- package/source/wrappers/next/query/providers.tsx +35 -0
- package/source/wrappers/next/request/request.client.ts +24 -0
- package/source/wrappers/next/request/request.server.ts +64 -0
- package/source/wrappers/next/request/request.ts +52 -0
- package/source/wrappers/next/ui/global-modal.tsx +29 -0
- package/source/wrappers/react/auth/auth-error-listener.tsx +34 -0
- package/source/wrappers/react/query/providers.tsx +31 -0
- package/source/wrappers/react/request/request.client.ts +24 -0
- package/source/wrappers/react/request/request.ts +51 -0
- package/source/wrappers/react/ui/global-modal.tsx +27 -0
- package/templates/monorepo/.dockerignore +38 -0
- package/templates/monorepo/README.md +292 -0
- package/templates/monorepo/_gitignore +38 -0
- package/templates/monorepo/_npmrc +1 -0
- package/templates/monorepo/apps/project/Dockerfile +32 -0
- package/templates/monorepo/apps/project/eslint.config.mjs +4 -0
- package/templates/monorepo/apps/project/index.html +14 -0
- package/templates/monorepo/apps/project/index.ts +15 -0
- package/templates/monorepo/apps/project/package.json +21 -0
- package/templates/monorepo/apps/project/tsconfig.json +9 -0
- package/templates/monorepo/apps/project/vite.config.ts +6 -0
- package/templates/monorepo/apps/web/Dockerfile +43 -0
- package/templates/monorepo/apps/web/README.md +111 -0
- package/templates/monorepo/apps/web/_gitignore +36 -0
- package/templates/monorepo/apps/web/app/favicon.ico +0 -0
- package/templates/monorepo/apps/web/app/global-error.tsx +12 -0
- package/templates/monorepo/apps/web/app/globals.css +0 -0
- package/templates/monorepo/apps/web/app/layout.tsx +28 -0
- package/templates/monorepo/apps/web/app/page.tsx +7 -0
- package/templates/monorepo/apps/web/app/providers.tsx +25 -0
- package/templates/monorepo/apps/web/eslint.config.js +4 -0
- package/templates/monorepo/apps/web/next-env.d.ts +6 -0
- package/templates/monorepo/apps/web/next.config.js +4 -0
- package/templates/monorepo/apps/web/package.json +31 -0
- package/templates/monorepo/apps/web/public/file-text.svg +3 -0
- package/templates/monorepo/apps/web/public/globe.svg +10 -0
- package/templates/monorepo/apps/web/public/next.svg +1 -0
- package/templates/monorepo/apps/web/public/turborepo-dark.svg +19 -0
- package/templates/monorepo/apps/web/public/turborepo-light.svg +19 -0
- package/templates/monorepo/apps/web/public/vercel.svg +10 -0
- package/templates/monorepo/apps/web/public/window.svg +3 -0
- package/templates/monorepo/apps/web/tsconfig.json +20 -0
- package/templates/monorepo/package.json +24 -0
- package/templates/monorepo/packages/core/eslint.config.mjs +4 -0
- package/templates/monorepo/packages/core/package.json +32 -0
- package/templates/monorepo/packages/core/tsconfig.json +8 -0
- package/templates/monorepo/packages/core-next/eslint.config.mjs +13 -0
- package/templates/monorepo/packages/core-next/package.json +43 -0
- package/templates/monorepo/packages/core-next/tsconfig.json +8 -0
- package/templates/monorepo/packages/core-react/eslint.config.mjs +4 -0
- package/templates/monorepo/packages/core-react/package.json +34 -0
- package/templates/monorepo/packages/core-react/tsconfig.json +8 -0
- package/templates/monorepo/packages/eslint-config/README.md +3 -0
- package/templates/monorepo/packages/eslint-config/base.js +57 -0
- package/templates/monorepo/packages/eslint-config/next.js +22 -0
- package/templates/monorepo/packages/eslint-config/package.json +25 -0
- package/templates/monorepo/packages/eslint-config/react-internal.js +33 -0
- package/templates/monorepo/packages/typescript-config/base.json +19 -0
- package/templates/monorepo/packages/typescript-config/nextjs.json +12 -0
- package/templates/monorepo/packages/typescript-config/package.json +9 -0
- package/templates/monorepo/packages/typescript-config/react-library.json +7 -0
- package/templates/monorepo/packages/ui/eslint.config.mjs +4 -0
- package/templates/monorepo/packages/ui/package.json +26 -0
- package/templates/monorepo/packages/ui/src/button.tsx +20 -0
- package/templates/monorepo/packages/ui/src/card.tsx +27 -0
- package/templates/monorepo/packages/ui/src/code.tsx +11 -0
- package/templates/monorepo/packages/ui/tsconfig.json +8 -0
- package/templates/monorepo/pnpm-workspace.yaml +9 -0
- package/templates/monorepo/turbo/generators/config.js +1336 -0
- package/templates/monorepo/turbo/generators/templates/next-app/Dockerfile.tpl +30 -0
- package/templates/monorepo/turbo/generators/templates/next-app/README.md.tpl +118 -0
- package/templates/monorepo/turbo/generators/templates/next-app/app/global-error.tsx.tpl +12 -0
- package/templates/monorepo/turbo/generators/templates/next-app/app/globals.css.tpl +1 -0
- package/templates/monorepo/turbo/generators/templates/next-app/app/layout.tsx.tpl +29 -0
- package/templates/monorepo/turbo/generators/templates/next-app/app/page.tsx.tpl +7 -0
- package/templates/monorepo/turbo/generators/templates/next-app/app/providers.tsx.tpl +25 -0
- package/templates/monorepo/turbo/generators/templates/next-app/eslint.config.js.tpl +4 -0
- package/templates/monorepo/turbo/generators/templates/next-app/next.config.js.tpl +6 -0
- package/templates/monorepo/turbo/generators/templates/next-app/tsconfig.json.tpl +18 -0
- package/templates/monorepo/turbo/generators/templates/vite-app/Dockerfile.tpl +22 -0
- package/templates/monorepo/turbo/generators/templates/vite-app/README.plain.md.tpl +90 -0
- package/templates/monorepo/turbo/generators/templates/vite-app/README.react.md.tpl +107 -0
- package/templates/monorepo/turbo/generators/templates/vite-app/eslint.config.mjs.tpl +4 -0
- package/templates/monorepo/turbo/generators/templates/vite-app/index.html.tpl +12 -0
- package/templates/monorepo/turbo/generators/templates/vite-app/index.ts.tpl +22 -0
- package/templates/monorepo/turbo/generators/templates/vite-app/tsconfig.json.tpl +9 -0
- package/templates/monorepo/turbo/generators/templates/vite-app/vite.config.ts.tpl +6 -0
- package/templates/monorepo/turbo.json +28 -0
- package/templates/next/.env.example +2 -0
- package/templates/next/.prettierignore +9 -0
- package/templates/next/.prettierrc.json +9 -0
- package/templates/next/README.md +246 -0
- package/templates/next/_gitignore +44 -0
- package/templates/next/eslint.config.mjs +51 -0
- package/templates/next/next.config.ts +7 -0
- package/templates/next/package.json +24 -0
- package/templates/next/postcss.config.mjs +7 -0
- package/templates/next/scripts/create-feature-crud.mjs +5 -0
- package/templates/next/scripts/create-feature.mjs +5 -0
- package/templates/next/src/app/error.tsx +33 -0
- package/templates/next/src/app/globals.css +35 -0
- package/templates/next/src/app/layout.tsx +39 -0
- package/templates/next/src/app/login/page.tsx +17 -0
- package/templates/next/src/app/page.tsx +32 -0
- package/templates/next/src/app/providers.tsx +20 -0
- package/templates/next/tsconfig.json +34 -0
- package/templates/react/.env.example +1 -0
- package/templates/react/.prettierignore +10 -0
- package/templates/react/.prettierrc.json +9 -0
- package/templates/react/README.md +250 -0
- package/templates/react/_gitignore +31 -0
- package/templates/react/eslint.config.mjs +64 -0
- package/templates/react/package.json +19 -0
- package/templates/react/scripts/create-feature-crud.mjs +5 -0
- package/templates/react/scripts/create-feature.mjs +5 -0
- package/templates/react/src/app/app.tsx +15 -0
- package/templates/react/src/app/error-boundary.tsx +59 -0
- package/templates/react/src/app/frame.tsx +32 -0
- package/templates/react/src/app/globals.css +43 -0
- package/templates/react/src/app/not-found-page.tsx +23 -0
- package/templates/react/src/app/providers.tsx +16 -0
- package/templates/react/src/app/router.tsx +62 -0
- package/templates/react/src/main.tsx +12 -0
- package/templates/react/src/pages/index/page.tsx +36 -0
- package/templates/react/src/pages/login/page.tsx +18 -0
- package/templates/react/tsconfig.app.json +30 -0
- package/templates/react/tsconfig.json +4 -0
- package/templates/react/tsconfig.node.json +24 -0
- package/templates/react/vite.config.ts +14 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/00-/354/240/204/353/260/230/354/240/201/354/235/270-/355/217/264/353/215/224/352/265/254/354/241/260.md +150 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/01-/352/265/254/354/241/260/354/231/200-/353/235/274/354/232/260/355/214/205.md +186 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/02-/354/204/234/353/262/204/354/231/200-/355/201/264/353/235/274/354/235/264/354/226/270/355/212/270.md +86 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/03-/354/203/201/355/203/234/352/264/200/353/246/254.md +84 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/04-API/354/231/200-/353/215/260/354/235/264/355/204/260.md +199 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/05-/354/227/220/353/237/254/354/231/200-UI-/354/203/201/355/203/234.md +159 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/06-/355/217/274.md +116 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/07-/354/212/244/355/203/200/354/235/274/353/247/201/352/263/274-/354/240/221/352/267/274/354/204/261.md +73 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/08-/353/204/244/354/235/264/353/260/215-/354/204/244/354/240/225-/355/217/254/353/247/267/355/214/205.md +98 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/09-/353/235/274/354/232/260/355/212/270-/354/240/225/354/235/230.md +169 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/10-/354/273/244/353/260/213-/354/273/250/353/262/244/354/205/230.md +64 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/11-/352/270/260/355/203/200-/354/233/220/354/271/231.md +187 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/12-/354/213/244/353/254/264-/353/215/260/354/235/264/355/204/260-/355/214/250/355/204/264.md +302 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/13-/354/204/261/353/212/245-/354/233/220/354/271/231.md +175 -0
- package/templates/shared/docs//352/260/234/353/260/234/354/233/220/354/271/231/README.md +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# create-web-0to1
|
|
2
|
+
|
|
3
|
+
`React`, `Next.js`, `monorepo` preset을 하나의 인터랙티브 wizard로 생성하는 0to1 통합 생성기입니다.
|
|
4
|
+
|
|
5
|
+
## 사용법
|
|
6
|
+
|
|
7
|
+
가장 일반적인 실행 방식은 아래입니다.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm create web-0to1@latest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
또는
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx create-web-0to1@latest
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
실행 후 wizard에서 아래 preset 중 하나를 고르시면 됩니다.
|
|
20
|
+
|
|
21
|
+
- `React standalone`
|
|
22
|
+
- `Next standalone`
|
|
23
|
+
- `Monorepo workspace`
|
|
24
|
+
|
|
25
|
+
실행 방식은 아래처럼 최대한 단순하게 유지했습니다.
|
|
26
|
+
|
|
27
|
+
- standalone: `자동 scaffold 후 생성` 또는 `scaffolded dir에 적용`
|
|
28
|
+
- monorepo: `바로 생성`
|
|
29
|
+
|
|
30
|
+
standalone preset에서는 wizard 안에서 아래 옵션도 같이 고를 수 있습니다.
|
|
31
|
+
|
|
32
|
+
- `Tailwind 포함` / `No Style`
|
|
33
|
+
- `commitlint + husky` 설정 여부
|
|
34
|
+
- `docs/개발원칙` 포함 여부
|
|
35
|
+
|
|
36
|
+
## 요구 사항
|
|
37
|
+
|
|
38
|
+
- `Node.js >= 22.18`
|
|
39
|
+
- upstream scaffold 실행용 네트워크 연결
|
|
40
|
+
|
|
41
|
+
## 로컬 개발
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install
|
|
45
|
+
npm run create
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
검증:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run check
|
|
52
|
+
npm run smoke
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 문서 위치
|
|
56
|
+
|
|
57
|
+
- 운영/인수인계: [docs/HANDOFF.md](./docs/HANDOFF.md)
|
|
58
|
+
- 단계별 작업 로그: [docs/steps/STEP31_COMPLETION_GATE.md](./docs/steps/STEP31_COMPLETION_GATE.md)부터 확인하시면 됩니다.
|
|
59
|
+
|
|
60
|
+
## publish 메모
|
|
61
|
+
|
|
62
|
+
이 패키지는 npm publish 후 아래 형태로 실행되도록 맞춰져 있습니다.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm create web-0to1@latest
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`npm create <name>`는 내부적으로 `create-<name>` 패키지를 실행하므로, 패키지 이름은 `create-web-0to1`, bin 이름도 동일하게 설정되어 있습니다.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
standaloneFeaturePresetConfigs,
|
|
6
|
+
type StandaloneFeaturePreset,
|
|
7
|
+
} from './standalone-feature-preset.ts';
|
|
8
|
+
|
|
9
|
+
type StandaloneFeatureCrudPreset = StandaloneFeaturePreset;
|
|
10
|
+
|
|
11
|
+
let createFeatureCrudTemplatePromise: Promise<string> | null = null;
|
|
12
|
+
|
|
13
|
+
function getCreateFeatureCrudTemplate(workspaceRoot: string) {
|
|
14
|
+
if (createFeatureCrudTemplatePromise === null) {
|
|
15
|
+
// 큰 CRUD 스크립트는 plain template file로 두는 편이
|
|
16
|
+
// escaped template literal보다 diff와 유지보수가 훨씬 쉽습니다.
|
|
17
|
+
createFeatureCrudTemplatePromise = readFile(
|
|
18
|
+
path.join(
|
|
19
|
+
workspaceRoot,
|
|
20
|
+
'internal',
|
|
21
|
+
'engine',
|
|
22
|
+
'create-feature-crud.template.mjs',
|
|
23
|
+
),
|
|
24
|
+
'utf8',
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return createFeatureCrudTemplatePromise;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const createFeatureCrudScriptConfigs = {
|
|
32
|
+
react: {
|
|
33
|
+
listImports: `import { useQuery } from '@tanstack/react-query';
|
|
34
|
+
import { useState } from 'react';
|
|
35
|
+
import { Link } from 'react-router-dom';`,
|
|
36
|
+
listLinkProp: 'to',
|
|
37
|
+
formImports: `import { zodResolver } from '@hookform/resolvers/zod';
|
|
38
|
+
import { useForm } from 'react-hook-form';
|
|
39
|
+
import { useNavigate } from 'react-router-dom';`,
|
|
40
|
+
formNavigationHook: 'const navigate = useNavigate();',
|
|
41
|
+
formSuccessNavigation: 'navigate(successPath);',
|
|
42
|
+
formDescriptionBlockNoStyle: ` <div>
|
|
43
|
+
<label htmlFor="description">설명 *</label>
|
|
44
|
+
<textarea id="description" aria-invalid={errors.description ? true : undefined} placeholder="\${entityLabel} 설명" {...register('description')} />
|
|
45
|
+
{errors.description ? <p role="alert">{errors.description.message}</p> : null}
|
|
46
|
+
</div>`,
|
|
47
|
+
createFormSectionImports: `import { \${entityNamePascal}Form } from '@/features/\${featureName}/components/\${entityName}-form';
|
|
48
|
+
import { useCreate\${entityNamePascal}Form } from '@/features/\${featureName}/hooks/use-create-\${entityName}-form';`,
|
|
49
|
+
hookImports: `import { useMutation, useQueryClient } from '@tanstack/react-query';`,
|
|
50
|
+
},
|
|
51
|
+
next: {
|
|
52
|
+
listImports: `'use client';
|
|
53
|
+
|
|
54
|
+
import { useQuery } from '@tanstack/react-query';
|
|
55
|
+
import Link from 'next/link';
|
|
56
|
+
import { useState } from 'react';`,
|
|
57
|
+
listLinkProp: 'href',
|
|
58
|
+
formImports: `'use client';
|
|
59
|
+
|
|
60
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
61
|
+
import { useRouter } from 'next/navigation';
|
|
62
|
+
import { useForm } from 'react-hook-form';`,
|
|
63
|
+
formNavigationHook: 'const router = useRouter();',
|
|
64
|
+
formSuccessNavigation: 'router.push(successPath);',
|
|
65
|
+
formDescriptionBlockNoStyle: ` <div>
|
|
66
|
+
<label htmlFor="description">
|
|
67
|
+
설명
|
|
68
|
+
<span aria-hidden="true"> *</span>
|
|
69
|
+
</label>
|
|
70
|
+
<textarea
|
|
71
|
+
id="description"
|
|
72
|
+
aria-invalid={errors.description ? true : undefined}
|
|
73
|
+
placeholder="\${entityLabel} 설명"
|
|
74
|
+
{...register('description')}
|
|
75
|
+
/>
|
|
76
|
+
{errors.description ? <p role="alert">{errors.description.message}</p> : null}
|
|
77
|
+
</div>`,
|
|
78
|
+
createFormSectionImports: `'use client';
|
|
79
|
+
|
|
80
|
+
import { \${entityNamePascal}Form } from '@/features/\${featureName}/components/\${entityName}-form';
|
|
81
|
+
import { useCreate\${entityNamePascal}Form } from '@/features/\${featureName}/hooks/use-create-\${entityName}-form';`,
|
|
82
|
+
hookImports: `'use client';
|
|
83
|
+
|
|
84
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';`,
|
|
85
|
+
},
|
|
86
|
+
} as const satisfies Record<
|
|
87
|
+
StandaloneFeatureCrudPreset,
|
|
88
|
+
{
|
|
89
|
+
listImports: string;
|
|
90
|
+
listLinkProp: string;
|
|
91
|
+
formImports: string;
|
|
92
|
+
formNavigationHook: string;
|
|
93
|
+
formSuccessNavigation: string;
|
|
94
|
+
formDescriptionBlockNoStyle: string;
|
|
95
|
+
createFormSectionImports: string;
|
|
96
|
+
hookImports: string;
|
|
97
|
+
}
|
|
98
|
+
>;
|
|
99
|
+
|
|
100
|
+
export async function buildStandaloneCreateFeatureCrudScript(
|
|
101
|
+
preset: StandaloneFeatureCrudPreset,
|
|
102
|
+
workspaceRoot: string,
|
|
103
|
+
) {
|
|
104
|
+
const templateText = await getCreateFeatureCrudTemplate(workspaceRoot);
|
|
105
|
+
const baseConfig = standaloneFeaturePresetConfigs[preset];
|
|
106
|
+
const config = createFeatureCrudScriptConfigs[preset];
|
|
107
|
+
|
|
108
|
+
return templateText
|
|
109
|
+
.replaceAll('__ROUTE_ROOT_CONST__', baseConfig.routeRootConst)
|
|
110
|
+
.replaceAll('__ROUTE_ROOT_NAME__', baseConfig.routeRootName)
|
|
111
|
+
.replaceAll('__PACKAGE_JSON_KEY__', baseConfig.packageJsonKey)
|
|
112
|
+
.replaceAll('__LIST_IMPORTS__', config.listImports)
|
|
113
|
+
.replaceAll('__LIST_LINK_PROP__', config.listLinkProp)
|
|
114
|
+
.replaceAll('__FORM_IMPORTS__', config.formImports)
|
|
115
|
+
.replaceAll('__FORM_NAVIGATION_HOOK__', config.formNavigationHook)
|
|
116
|
+
.replaceAll('__FORM_SUCCESS_NAVIGATION__', config.formSuccessNavigation)
|
|
117
|
+
.replaceAll(
|
|
118
|
+
'__FORM_DESCRIPTION_BLOCK_NO_STYLE__',
|
|
119
|
+
config.formDescriptionBlockNoStyle,
|
|
120
|
+
)
|
|
121
|
+
.replaceAll(
|
|
122
|
+
'__CREATE_FORM_SECTION_IMPORTS__',
|
|
123
|
+
config.createFormSectionImports,
|
|
124
|
+
)
|
|
125
|
+
.replaceAll('__HOOK_IMPORTS__', config.hookImports)
|
|
126
|
+
.replaceAll(
|
|
127
|
+
'__OUTPUT_SUMMARY_LINE__',
|
|
128
|
+
preset === 'next'
|
|
129
|
+
? `console.log(\`생성 대상: feature 파일, ${baseConfig.routeOutputLabel}\`);`
|
|
130
|
+
: `console.log('생성 대상: feature 파일, ${baseConfig.routeOutputLabel}');`,
|
|
131
|
+
)
|
|
132
|
+
.replaceAll('__OPTIONAL_ROUTE_HINT__', baseConfig.optionalRouteHint)
|
|
133
|
+
.replaceAll('__ENV_HINT__', baseConfig.envHint);
|
|
134
|
+
}
|