create-carlonicora-app 1.4.0 → 1.7.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 +24 -6
- package/dist/compare/constants.d.ts +9 -0
- package/dist/compare/constants.d.ts.map +1 -0
- package/dist/compare/constants.js +167 -0
- package/dist/compare/constants.js.map +1 -0
- package/dist/compare/diff-categorizer.d.ts +17 -0
- package/dist/compare/diff-categorizer.d.ts.map +1 -0
- package/dist/compare/diff-categorizer.js +128 -0
- package/dist/compare/diff-categorizer.js.map +1 -0
- package/dist/compare/file-collector.d.ts +27 -0
- package/dist/compare/file-collector.d.ts.map +1 -0
- package/dist/compare/file-collector.js +128 -0
- package/dist/compare/file-collector.js.map +1 -0
- package/dist/compare/file-comparator.d.ts +21 -0
- package/dist/compare/file-comparator.d.ts.map +1 -0
- package/dist/compare/file-comparator.js +237 -0
- package/dist/compare/file-comparator.js.map +1 -0
- package/dist/compare/index.d.ts +17 -0
- package/dist/compare/index.d.ts.map +1 -0
- package/dist/compare/index.js +139 -0
- package/dist/compare/index.js.map +1 -0
- package/dist/compare/report-generator.d.ts +14 -0
- package/dist/compare/report-generator.d.ts.map +1 -0
- package/dist/compare/report-generator.js +243 -0
- package/dist/compare/report-generator.js.map +1 -0
- package/dist/compare/types.d.ts +42 -0
- package/dist/compare/types.d.ts.map +1 -0
- package/dist/compare/types.js +2 -0
- package/dist/compare/types.js.map +1 -0
- package/dist/git.d.ts +1 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +19 -0
- package/dist/git.js.map +1 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +6 -1
- package/dist/scaffold.js.map +1 -1
- package/dist/utils/files.d.ts.map +1 -1
- package/dist/utils/files.js +1 -0
- package/dist/utils/files.js.map +1 -1
- package/package.json +3 -1
- package/template/.github/workflows/dev.yml +4 -0
- package/template/.github/workflows/pull-request.yml +5 -1
- package/template/.husky/pre-push +1 -0
- package/template/.vscode/settings.json +66 -0
- package/template/AGENTS.md +173 -0
- package/template/CLAUDE.md +94 -0
- package/template/CONTRIBUTING.md +73 -0
- package/template/DOCKER.md +113 -0
- package/template/Dockerfile +51 -2
- package/template/EXTEND-USER.md +274 -0
- package/template/apps/api/CLAUDE.md +107 -0
- package/template/apps/api/eslint.config.mjs +7 -0
- package/template/apps/api/nest-cli.json +5 -0
- package/template/apps/api/package.json +65 -65
- package/template/apps/api/src/main.ts +2 -0
- package/template/apps/api/src/openapi/openapi.config.ts +20 -0
- package/template/apps/api/tsconfig.json +1 -0
- package/template/apps/api/vitest.config.ts +41 -0
- package/template/apps/api/vitest.setup.ts +22 -0
- package/template/apps/web/CLAUDE.md +163 -0
- package/template/apps/web/components.json +5 -2
- package/template/apps/web/eslint.config.mjs +16 -1
- package/template/apps/web/mdx-components.tsx +26 -0
- package/template/apps/web/messages/en.json +613 -185
- package/template/apps/web/next.config.js +97 -2
- package/template/apps/web/package.json +54 -63
- package/template/apps/web/public/manifest.json +74 -0
- package/template/apps/web/src/app/[locale]/(admin)/administration/companies/[id]/page.tsx +3 -3
- package/template/apps/web/src/app/[locale]/(admin)/administration/companies/page.tsx +2 -2
- package/template/apps/web/src/app/[locale]/(admin)/administration/waitlist/page.tsx +28 -0
- package/template/apps/web/src/app/[locale]/(admin)/layout.tsx +14 -9
- package/template/apps/web/src/app/[locale]/(auth)/auth/consent/page.tsx +114 -0
- package/template/apps/web/src/app/[locale]/(auth)/layout.tsx +7 -3
- package/template/apps/web/src/app/[locale]/(auth)/oauth/authorize/OAuthAuthorizeClient.tsx +37 -0
- package/template/apps/web/src/app/[locale]/(auth)/oauth/authorize/page.tsx +56 -0
- package/template/apps/web/src/app/[locale]/(auth)/oauth/error/page.tsx +97 -0
- package/template/apps/web/src/app/[locale]/(auth)/oauth/success/page.tsx +110 -0
- package/template/apps/web/src/app/[locale]/(main)/(foundations)/roles/[id]/page.tsx +1 -1
- package/template/apps/web/src/app/[locale]/(main)/(foundations)/users/[id]/error.tsx +22 -3
- package/template/apps/web/src/app/[locale]/(main)/(foundations)/users/[id]/page.tsx +2 -2
- package/template/apps/web/src/app/[locale]/(main)/(foundations)/users/page.tsx +1 -1
- package/template/apps/web/src/app/[locale]/(main)/error.tsx +69 -14
- package/template/apps/web/src/app/[locale]/(main)/layout.tsx +18 -9
- package/template/apps/web/src/app/[locale]/(main)/page.tsx +1 -1
- package/template/apps/web/src/app/[locale]/layout.tsx +56 -8
- package/template/apps/web/src/app/[locale]/offline/page.tsx +30 -0
- package/template/apps/web/src/app/globals.css +64 -1
- package/template/apps/web/src/config/Bootstrapper.ts +62 -0
- package/template/apps/web/src/config/env.ts +18 -1
- package/template/apps/web/src/config/middleware-env.ts +5 -0
- package/template/apps/web/src/config/waitlist.config.ts +33 -0
- package/template/apps/web/src/features/common/components/badges/VisibilityBadge.tsx +32 -0
- package/template/apps/web/src/features/common/components/banners/TrialExpiringBanner.tsx +36 -0
- package/template/apps/web/src/features/common/components/containers/AccountContainer.tsx +72 -0
- package/template/apps/web/src/features/common/components/containers/SettingsContainer.tsx +210 -0
- package/template/apps/web/src/features/common/components/details/LayoutDetails.tsx +5 -1
- package/template/apps/web/src/features/common/components/dialogs/DeleteAccountDialog.tsx +74 -0
- package/template/apps/web/src/features/common/components/navigations/CommonSidebar.tsx +66 -110
- package/template/apps/web/src/features/common/components/navigations/CreationDropDown.tsx +9 -9
- package/template/apps/web/src/features/common/components/navigations/UserSidebarFooter.tsx +44 -25
- package/template/apps/web/src/features/common/components/navigations/VersionDisplay.tsx +4 -1
- package/template/apps/web/src/features/common/components/navigations/sidebar.items.tsx +39 -0
- package/template/apps/web/src/features/common/components/wrappers/TrialBlockingWrapper.tsx +26 -0
- package/template/apps/web/src/features/common/contexts/AccountContext.tsx +63 -0
- package/template/apps/web/src/features/common/contexts/HeaderContentContext.tsx +25 -0
- package/template/apps/web/src/features/common/contexts/SettingsContext.tsx +73 -0
- package/template/apps/web/src/features/onboarding/components/OnboardingProviderWrapper.tsx +21 -0
- package/template/apps/web/src/features/onboarding/components/OnboardingTrigger.tsx +42 -0
- package/template/apps/web/src/features/onboarding/components/index.ts +2 -0
- package/template/apps/web/src/features/onboarding/config/index.ts +1 -0
- package/template/apps/web/src/features/onboarding/config/tours.config.ts +114 -0
- package/template/apps/web/src/features/onboarding/hooks/index.ts +2 -0
- package/template/apps/web/src/features/onboarding/hooks/useOnboardingLabels.ts +21 -0
- package/template/apps/web/src/features/onboarding/hooks/useOnboardingRouteChange.ts +18 -0
- package/template/apps/web/src/features/onboarding/index.ts +3 -0
- package/template/apps/web/src/features/pwa/components/InstallPrompt.tsx +57 -0
- package/template/apps/web/src/features/pwa/components/OfflineIndicator.tsx +21 -0
- package/template/apps/web/src/features/pwa/components/PWAProvider.tsx +33 -0
- package/template/apps/web/src/features/pwa/components/UpdateNotification.tsx +26 -0
- package/template/apps/web/src/features/pwa/components/index.ts +4 -0
- package/template/apps/web/src/hooks/usePWA.ts +183 -0
- package/template/apps/web/src/i18n/useDateFnsLocale.ts +3 -3
- package/template/apps/web/src/instrumentation.ts +19 -0
- package/template/apps/web/src/proxy.ts +0 -28
- package/template/apps/web/src/server-actions/auth-cookies.ts +2 -16
- package/template/apps/web/src/types/file-system-access.d.ts +44 -0
- package/template/apps/web/src/utils/clipboard.ts +76 -0
- package/template/apps/web/src/utils/cn.ts +6 -0
- package/template/apps/web/src/utils/dateFormatters.ts +15 -0
- package/template/apps/web/src/utils/metadata.ts +4 -4
- package/template/apps/web/vitest.config.ts +37 -0
- package/template/apps/web/vitest.setup.ts +131 -0
- package/template/docker-compose.api.yml +37 -0
- package/template/docker-compose.web.yml +54 -0
- package/template/docker-compose.worker.yml +38 -0
- package/template/docker-compose.yml +38 -15
- package/template/docs/architecture/00-core-principles.md +91 -0
- package/template/docs/architecture/INDEX.md +94 -0
- package/template/docs/architecture/anti-patterns.md +204 -0
- package/template/docs/architecture/backend/01-entity-basics.md +219 -0
- package/template/docs/architecture/backend/02-dtos.md +338 -0
- package/template/docs/architecture/backend/03-repositories.md +234 -0
- package/template/docs/architecture/backend/04-services.md +197 -0
- package/template/docs/architecture/backend/05-controllers.md +291 -0
- package/template/docs/architecture/backend/template.md +535 -0
- package/template/docs/architecture/frontend/01-models.md +273 -0
- package/template/docs/architecture/frontend/02-interfaces.md +178 -0
- package/template/docs/architecture/frontend/03-services.md +351 -0
- package/template/docs/architecture/frontend/template.md +568 -0
- package/template/env.example +131 -6
- package/template/gitattributes +3 -0
- package/template/gitignore +4 -1
- package/template/package.json +31 -12
- package/template/packages/shared/package.json +2 -1
- package/template/scripts/apply-production-versions.js +0 -3
- package/template/scripts/find-duplicate-translations.js +141 -0
- package/template/scripts/update.sh +19 -0
- package/template/scripts/validate-translations.js +567 -0
- package/template/versions.production.json +2 -2
package/README.md
CHANGED
|
@@ -85,18 +85,36 @@ pnpm build
|
|
|
85
85
|
pnpm sync-template
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
###
|
|
88
|
+
### Running from local folder
|
|
89
89
|
|
|
90
90
|
```bash
|
|
91
|
-
#
|
|
91
|
+
# Clone and build
|
|
92
|
+
git clone https://github.com/carlonicora/create-carlonicora-app.git
|
|
93
|
+
cd create-carlonicora-app
|
|
94
|
+
pnpm install
|
|
92
95
|
pnpm build
|
|
93
96
|
|
|
94
|
-
#
|
|
95
|
-
|
|
97
|
+
# Go to the parent directory and run the CLI from there
|
|
98
|
+
cd ..
|
|
99
|
+
node create-carlonicora-app/bin/cli.js my-project
|
|
96
100
|
|
|
97
|
-
# Or link globally
|
|
101
|
+
# Or link globally for convenience
|
|
102
|
+
cd create-carlonicora-app
|
|
98
103
|
npm link
|
|
99
|
-
|
|
104
|
+
cd ..
|
|
105
|
+
create-carlonicora-app my-project
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> **Note:** The project is created in your current working directory. Run the CLI from the directory where you want the project to be created.
|
|
109
|
+
|
|
110
|
+
#### Options
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
node create-carlonicora-app/bin/cli.js [project-name] [options]
|
|
114
|
+
|
|
115
|
+
Options:
|
|
116
|
+
--skip-git Skip git initialization and submodules
|
|
117
|
+
--skip-install Skip dependency installation
|
|
100
118
|
```
|
|
101
119
|
|
|
102
120
|
## License
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const IGNORE_PATTERNS: string[];
|
|
2
|
+
export declare const ANYWHERE_IGNORE_PATTERNS: string[];
|
|
3
|
+
export declare const BINARY_EXTENSIONS: Set<string>;
|
|
4
|
+
export declare const CONFIG_FILE_PATTERNS: string[];
|
|
5
|
+
export declare const CODE_PATHS: string[];
|
|
6
|
+
export declare const DOTFILE_RENAMES: Record<string, string>;
|
|
7
|
+
export declare const VERSION_FILES: string[];
|
|
8
|
+
export declare const MAX_DIFF_FILE_SIZE: number;
|
|
9
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/compare/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe,UAyD3B,CAAC;AAGF,eAAO,MAAM,wBAAwB,UAUpC,CAAC;AAGF,eAAO,MAAM,iBAAiB,aAoC5B,CAAC;AAGH,eAAO,MAAM,oBAAoB,UAqChC,CAAC;AAIF,eAAO,MAAM,UAAU,UAAqD,CAAC;AAG7E,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASlD,CAAC;AAGF,eAAO,MAAM,aAAa,UAA+C,CAAC;AAG1E,eAAO,MAAM,kBAAkB,QAAc,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Patterns to ignore during comparison (relative to root)
|
|
2
|
+
export const IGNORE_PATTERNS = [
|
|
3
|
+
'node_modules',
|
|
4
|
+
'.git',
|
|
5
|
+
'.turbo',
|
|
6
|
+
'dist',
|
|
7
|
+
'.next',
|
|
8
|
+
'pnpm-lock.yaml',
|
|
9
|
+
'.env',
|
|
10
|
+
'.env.local',
|
|
11
|
+
'.env.e2e',
|
|
12
|
+
'.DS_Store',
|
|
13
|
+
'.claude',
|
|
14
|
+
'.beads',
|
|
15
|
+
'.vscode',
|
|
16
|
+
'.idea',
|
|
17
|
+
'coverage',
|
|
18
|
+
'*.log',
|
|
19
|
+
'test-results',
|
|
20
|
+
'playwright-report',
|
|
21
|
+
'.tsbuildinfo',
|
|
22
|
+
'REST.http',
|
|
23
|
+
'.worktrees',
|
|
24
|
+
// Target-specific directories that are project additions (not compared)
|
|
25
|
+
'docs',
|
|
26
|
+
'structure',
|
|
27
|
+
'reports',
|
|
28
|
+
'infrastructure',
|
|
29
|
+
'openspec',
|
|
30
|
+
'models',
|
|
31
|
+
'__tests__',
|
|
32
|
+
// Application source code (project-specific, not template)
|
|
33
|
+
'apps/api/src',
|
|
34
|
+
'apps/api/.cache',
|
|
35
|
+
'apps/api/templates',
|
|
36
|
+
'apps/api/scripts',
|
|
37
|
+
'apps/api/config',
|
|
38
|
+
'apps/web/public',
|
|
39
|
+
'apps/web/messages',
|
|
40
|
+
'apps/web/__tests__',
|
|
41
|
+
'apps/web/src/app/[locale]/(main)/(features)',
|
|
42
|
+
'apps/web/src/app/[locale]/(marketing)',
|
|
43
|
+
'apps/web/src/app/[locale]/(blocked)',
|
|
44
|
+
'apps/web/src/app/[locale]/(persons)',
|
|
45
|
+
'apps/web/src/components',
|
|
46
|
+
'.husky/_',
|
|
47
|
+
'.ruff_cache',
|
|
48
|
+
'.DS_Store',
|
|
49
|
+
'Dockerfile.backup',
|
|
50
|
+
// Note: apps/web/src/features/* is excluded EXCEPT features/common (handled in file-collector)
|
|
51
|
+
// Library packages (git submodules in template, full implementations in target)
|
|
52
|
+
'packages/nestjs-neo4jsonapi',
|
|
53
|
+
'packages/nextjs-jsonapi',
|
|
54
|
+
// Shared package source (project-specific implementations)
|
|
55
|
+
'packages/shared/src',
|
|
56
|
+
// Documentation files (project-specific, never sync to template)
|
|
57
|
+
'CHANGELOG.md',
|
|
58
|
+
'README.md',
|
|
59
|
+
];
|
|
60
|
+
// Patterns that should be ignored anywhere in the path
|
|
61
|
+
export const ANYWHERE_IGNORE_PATTERNS = [
|
|
62
|
+
'node_modules',
|
|
63
|
+
'dist',
|
|
64
|
+
'.turbo',
|
|
65
|
+
'.next',
|
|
66
|
+
'coverage',
|
|
67
|
+
'test-results',
|
|
68
|
+
'playwright-report',
|
|
69
|
+
'.DS_Store',
|
|
70
|
+
'.ruff_cache',
|
|
71
|
+
];
|
|
72
|
+
// Binary file extensions that should not be processed for text comparison
|
|
73
|
+
export const BINARY_EXTENSIONS = new Set([
|
|
74
|
+
// Images
|
|
75
|
+
'.png',
|
|
76
|
+
'.jpg',
|
|
77
|
+
'.jpeg',
|
|
78
|
+
'.gif',
|
|
79
|
+
'.webp',
|
|
80
|
+
'.ico',
|
|
81
|
+
'.svg',
|
|
82
|
+
'.bmp',
|
|
83
|
+
'.tiff',
|
|
84
|
+
// Fonts
|
|
85
|
+
'.woff',
|
|
86
|
+
'.woff2',
|
|
87
|
+
'.ttf',
|
|
88
|
+
'.eot',
|
|
89
|
+
'.otf',
|
|
90
|
+
// Archives
|
|
91
|
+
'.tar',
|
|
92
|
+
'.zip',
|
|
93
|
+
'.gz',
|
|
94
|
+
'.rar',
|
|
95
|
+
'.7z',
|
|
96
|
+
// Documents
|
|
97
|
+
'.pdf',
|
|
98
|
+
// Lock files
|
|
99
|
+
'.lock',
|
|
100
|
+
// Other binary formats
|
|
101
|
+
'.exe',
|
|
102
|
+
'.dll',
|
|
103
|
+
'.so',
|
|
104
|
+
'.dylib',
|
|
105
|
+
// ML models
|
|
106
|
+
'.onnx',
|
|
107
|
+
'.bin',
|
|
108
|
+
'.safetensors',
|
|
109
|
+
]);
|
|
110
|
+
// Files that are configuration files (for categorization)
|
|
111
|
+
export const CONFIG_FILE_PATTERNS = [
|
|
112
|
+
'package.json',
|
|
113
|
+
'tsconfig.json',
|
|
114
|
+
'tsconfig.base.json',
|
|
115
|
+
'tsconfig.build.json',
|
|
116
|
+
'turbo.json',
|
|
117
|
+
'vitest.config.ts',
|
|
118
|
+
'vitest.setup.ts',
|
|
119
|
+
'eslint.config.mjs',
|
|
120
|
+
'playwright.config.ts',
|
|
121
|
+
'next.config.js',
|
|
122
|
+
'nest-cli.json',
|
|
123
|
+
'jest.config.js',
|
|
124
|
+
'.prettierrc',
|
|
125
|
+
'prettierrc',
|
|
126
|
+
'.prettierignore',
|
|
127
|
+
'prettierignore',
|
|
128
|
+
'.releaserc',
|
|
129
|
+
'releaserc',
|
|
130
|
+
'.npmrc',
|
|
131
|
+
'npmrc',
|
|
132
|
+
'.gitignore',
|
|
133
|
+
'gitignore',
|
|
134
|
+
'.gitmodules',
|
|
135
|
+
'gitmodules',
|
|
136
|
+
'docker-compose.yml',
|
|
137
|
+
'docker-compose.api.yml',
|
|
138
|
+
'docker-compose.web.yml',
|
|
139
|
+
'docker-compose.worker.yml',
|
|
140
|
+
'Dockerfile',
|
|
141
|
+
'components.json',
|
|
142
|
+
'postcss.config.mjs',
|
|
143
|
+
'pnpm-workspace.yaml',
|
|
144
|
+
'.swcrc',
|
|
145
|
+
'swcrc',
|
|
146
|
+
'next-env.d.ts',
|
|
147
|
+
'global.d.ts',
|
|
148
|
+
];
|
|
149
|
+
// Paths that contain application code (for categorization)
|
|
150
|
+
// Note: apps/api/src, apps/web/src/features/* (except common), and packages/shared/src are excluded
|
|
151
|
+
export const CODE_PATHS = ['apps/web/src/', 'apps/web/src/features/common/'];
|
|
152
|
+
// Dotfile rename mapping (template stores without dot, target has dot)
|
|
153
|
+
export const DOTFILE_RENAMES = {
|
|
154
|
+
gitignore: '.gitignore',
|
|
155
|
+
gitmodules: '.gitmodules',
|
|
156
|
+
prettierrc: '.prettierrc',
|
|
157
|
+
prettierignore: '.prettierignore',
|
|
158
|
+
npmrc: '.npmrc',
|
|
159
|
+
releaserc: '.releaserc',
|
|
160
|
+
swcrc: '.swcrc',
|
|
161
|
+
'env.example': '.env.example',
|
|
162
|
+
};
|
|
163
|
+
// Files that should be compared for version drift
|
|
164
|
+
export const VERSION_FILES = ['package.json', 'versions.production.json'];
|
|
165
|
+
// Maximum file size to show full diff (1MB)
|
|
166
|
+
export const MAX_DIFF_FILE_SIZE = 1024 * 1024;
|
|
167
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/compare/constants.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,cAAc;IACd,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,gBAAgB;IAChB,MAAM;IACN,YAAY;IACZ,UAAU;IACV,WAAW;IACX,SAAS;IACT,QAAQ;IACR,SAAS;IACT,OAAO;IACP,UAAU;IACV,OAAO;IACP,cAAc;IACd,mBAAmB;IACnB,cAAc;IACd,WAAW;IACX,YAAY;IACZ,wEAAwE;IACxE,MAAM;IACN,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,UAAU;IACV,QAAQ;IACR,WAAW;IACX,2DAA2D;IAC3D,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,oBAAoB;IACpB,6CAA6C;IAC7C,uCAAuC;IACvC,qCAAqC;IACrC,qCAAqC;IACrC,yBAAyB;IACzB,UAAU;IACV,aAAa;IACb,WAAW;IACX,mBAAmB;IACnB,+FAA+F;IAC/F,gFAAgF;IAChF,6BAA6B;IAC7B,yBAAyB;IACzB,2DAA2D;IAC3D,qBAAqB;IACrB,iEAAiE;IACjE,cAAc;IACd,WAAW;CACZ,CAAC;AAEF,uDAAuD;AACvD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc;IACd,MAAM;IACN,QAAQ;IACR,OAAO;IACP,UAAU;IACV,cAAc;IACd,mBAAmB;IACnB,WAAW;IACX,aAAa;CACd,C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AE,aAAa;IACzB,cAAc,EAAE,iBAAiB;IACjC,KAAK,EAAE,QAAQ;IACf,SAAS,EAAE,YAAY;IACvB,KAAK,EAAE,QAAQ;IACf,aAAa,EAAE,cAAc;CAC9B,CAAC;AAEF,kDAAkD;AAClD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,0BAA0B,CAAC,CAAC;AAE1E,4CAA4C;AAC5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FileDiff, DiffCategory } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Categorize a file diff based on its path and content changes
|
|
4
|
+
*/
|
|
5
|
+
export declare function categorizeDiff(diff: FileDiff): DiffCategory;
|
|
6
|
+
/**
|
|
7
|
+
* Categorize an addition (file in target but not in template)
|
|
8
|
+
*/
|
|
9
|
+
export declare function categorizeAddition(relativePath: string): {
|
|
10
|
+
category: string;
|
|
11
|
+
group: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Apply categorization to all diffs
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyCategories(diffs: FileDiff[]): FileDiff[];
|
|
17
|
+
//# sourceMappingURL=diff-categorizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-categorizer.d.ts","sourceRoot":"","sources":["../../src/compare/diff-categorizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAmCzD;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,YAAY,CAwB3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAmFA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAK7D"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { CONFIG_FILE_PATTERNS, CODE_PATHS } from './constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a file path matches any of the config file patterns
|
|
4
|
+
*/
|
|
5
|
+
function isConfigFile(relativePath) {
|
|
6
|
+
const fileName = relativePath.split('/').pop() || '';
|
|
7
|
+
for (const pattern of CONFIG_FILE_PATTERNS) {
|
|
8
|
+
if (fileName === pattern)
|
|
9
|
+
return true;
|
|
10
|
+
if (pattern.includes('*')) {
|
|
11
|
+
const regex = new RegExp('^' + pattern.replace(/\*/g, '.*') + '$');
|
|
12
|
+
if (regex.test(fileName))
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Check if a file path is within a code path
|
|
20
|
+
*/
|
|
21
|
+
function isCodePath(relativePath) {
|
|
22
|
+
const normalizedPath = relativePath.replace(/\\/g, '/');
|
|
23
|
+
for (const codePath of CODE_PATHS) {
|
|
24
|
+
if (normalizedPath.startsWith(codePath)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Categorize a file diff based on its path and content changes
|
|
32
|
+
*/
|
|
33
|
+
export function categorizeDiff(diff) {
|
|
34
|
+
const { relativePath, category } = diff;
|
|
35
|
+
// Keep certain categories as-is
|
|
36
|
+
if (category === 'identical' ||
|
|
37
|
+
category === 'addition' ||
|
|
38
|
+
category === 'missing-from-target' ||
|
|
39
|
+
category === 'version-drift') {
|
|
40
|
+
return category;
|
|
41
|
+
}
|
|
42
|
+
// For modified files, categorize based on path
|
|
43
|
+
if (isCodePath(relativePath)) {
|
|
44
|
+
return 'custom-code';
|
|
45
|
+
}
|
|
46
|
+
if (isConfigFile(relativePath)) {
|
|
47
|
+
return 'config-drift';
|
|
48
|
+
}
|
|
49
|
+
// Default to config-drift for other files
|
|
50
|
+
return 'config-drift';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Categorize an addition (file in target but not in template)
|
|
54
|
+
*/
|
|
55
|
+
export function categorizeAddition(relativePath) {
|
|
56
|
+
const normalizedPath = relativePath.replace(/\\/g, '/');
|
|
57
|
+
// Feature modules
|
|
58
|
+
if (normalizedPath.startsWith('apps/api/src/features/')) {
|
|
59
|
+
const featureName = normalizedPath.split('/')[4] || 'unknown';
|
|
60
|
+
return { category: 'Feature Module (API)', group: featureName };
|
|
61
|
+
}
|
|
62
|
+
if (normalizedPath.startsWith('apps/web/src/features/')) {
|
|
63
|
+
const featureName = normalizedPath.split('/')[4] || 'unknown';
|
|
64
|
+
return { category: 'Feature Module (Web)', group: featureName };
|
|
65
|
+
}
|
|
66
|
+
// Documentation
|
|
67
|
+
if (normalizedPath.startsWith('docs/') ||
|
|
68
|
+
normalizedPath.endsWith('.md') ||
|
|
69
|
+
normalizedPath === 'AGENTS.md' ||
|
|
70
|
+
normalizedPath === 'CONTRIBUTING.md' ||
|
|
71
|
+
normalizedPath === 'AI-ARCHITECTURE-GUIDE.md') {
|
|
72
|
+
return { category: 'Documentation', group: 'docs' };
|
|
73
|
+
}
|
|
74
|
+
// Configuration/Infrastructure
|
|
75
|
+
if (normalizedPath.startsWith('infrastructure/') ||
|
|
76
|
+
normalizedPath.startsWith('openspec/')) {
|
|
77
|
+
return { category: 'Infrastructure', group: normalizedPath.split('/')[0] };
|
|
78
|
+
}
|
|
79
|
+
// Structure/Schema definitions
|
|
80
|
+
if (normalizedPath.startsWith('structure/')) {
|
|
81
|
+
return { category: 'Data Structures', group: 'structure' };
|
|
82
|
+
}
|
|
83
|
+
// Tests
|
|
84
|
+
if (normalizedPath.includes('__tests__/') ||
|
|
85
|
+
normalizedPath.includes('.test.') ||
|
|
86
|
+
normalizedPath.includes('.spec.')) {
|
|
87
|
+
return { category: 'Tests', group: 'tests' };
|
|
88
|
+
}
|
|
89
|
+
// Scripts
|
|
90
|
+
if (normalizedPath.startsWith('scripts/')) {
|
|
91
|
+
return { category: 'Scripts', group: 'scripts' };
|
|
92
|
+
}
|
|
93
|
+
// API source additions
|
|
94
|
+
if (normalizedPath.startsWith('apps/api/src/')) {
|
|
95
|
+
return { category: 'API Source', group: 'apps/api' };
|
|
96
|
+
}
|
|
97
|
+
// Web source additions
|
|
98
|
+
if (normalizedPath.startsWith('apps/web/src/')) {
|
|
99
|
+
return { category: 'Web Source', group: 'apps/web' };
|
|
100
|
+
}
|
|
101
|
+
// Shared package additions
|
|
102
|
+
if (normalizedPath.startsWith('packages/shared/')) {
|
|
103
|
+
return { category: 'Shared Package', group: 'packages/shared' };
|
|
104
|
+
}
|
|
105
|
+
// Library packages (full implementations)
|
|
106
|
+
if (normalizedPath.startsWith('packages/nestjs-neo4jsonapi/')) {
|
|
107
|
+
return { category: 'Library Package', group: 'nestjs-neo4jsonapi' };
|
|
108
|
+
}
|
|
109
|
+
if (normalizedPath.startsWith('packages/nextjs-jsonapi/')) {
|
|
110
|
+
return { category: 'Library Package', group: 'nextjs-jsonapi' };
|
|
111
|
+
}
|
|
112
|
+
// Root files
|
|
113
|
+
if (!normalizedPath.includes('/')) {
|
|
114
|
+
return { category: 'Root Files', group: 'root' };
|
|
115
|
+
}
|
|
116
|
+
// Default
|
|
117
|
+
return { category: 'Other', group: 'other' };
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Apply categorization to all diffs
|
|
121
|
+
*/
|
|
122
|
+
export function applyCategories(diffs) {
|
|
123
|
+
return diffs.map((diff) => ({
|
|
124
|
+
...diff,
|
|
125
|
+
category: categorizeDiff(diff),
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=diff-categorizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-categorizer.js","sourceRoot":"","sources":["../../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EAAE,CAAC;IAClE,CAAC;IAED,0CAA0C;IAC1C,IAAI,cAAc,CAAC,UAAU,CAAC,8BAA8B,CAAC,EAAE,CAAC;QAC9D,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;IACtE,CAAC;IAED,IAAI,cAAc,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE,CAAC;QAC1D,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAClE,CAAC;IAED,aAAa;IACb,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IACnD,CAAC;IAED,UAAU;IACV,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1B,GAAG,IAAI;QACP,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC;KAC/B,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FileEntry } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a path should be ignored based on patterns
|
|
4
|
+
*/
|
|
5
|
+
export declare function shouldIgnore(relativePath: string, additionalIgnorePatterns?: string[]): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Normalize a template path to how it would appear in the target
|
|
8
|
+
* Handles dotfile renames (e.g., 'gitignore' -> '.gitignore')
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeTemplatePath(templateRelativePath: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Parse .gitignore file and return patterns
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseGitignore(projectPath: string): Promise<string[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Collect all files from a directory
|
|
17
|
+
*/
|
|
18
|
+
export declare function collectFiles(basePath: string, options?: {
|
|
19
|
+
normalizeTemplatedDotfiles?: boolean;
|
|
20
|
+
additionalIgnorePatterns?: string[];
|
|
21
|
+
}): Promise<Map<string, FileEntry>>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the original template path from a normalized path
|
|
24
|
+
* This is the reverse of normalizeTemplatePath
|
|
25
|
+
*/
|
|
26
|
+
export declare function getOriginalTemplatePath(normalizedPath: string): string;
|
|
27
|
+
//# sourceMappingURL=file-collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-collector.d.ts","sourceRoot":"","sources":["../../src/compare/file-collector.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAO5C;;GAEG;AACH,wBAAgB,YAAY,CAC1B,YAAY,EAAE,MAAM,EACpB,wBAAwB,GAAE,MAAM,EAAO,GACtC,OAAO,CAgCT;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,oBAAoB,EAAE,MAAM,GAAG,MAAM,CAW1E;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAgB3E;AAyCD;;GAEG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IACP,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,GACL,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAUjC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAatE"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { IGNORE_PATTERNS, ANYWHERE_IGNORE_PATTERNS, DOTFILE_RENAMES, } from './constants.js';
|
|
4
|
+
/**
|
|
5
|
+
* Check if a path should be ignored based on patterns
|
|
6
|
+
*/
|
|
7
|
+
export function shouldIgnore(relativePath, additionalIgnorePatterns = []) {
|
|
8
|
+
const normalizedPath = relativePath.replace(/\\/g, '/');
|
|
9
|
+
const pathParts = normalizedPath.split('/');
|
|
10
|
+
// Check patterns that apply anywhere in the path
|
|
11
|
+
for (const pattern of ANYWHERE_IGNORE_PATTERNS) {
|
|
12
|
+
if (pathParts.includes(pattern))
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
// Special case: apps/web/src/features/* is ignored EXCEPT features/common
|
|
16
|
+
if (normalizedPath.startsWith('apps/web/src/features/')) {
|
|
17
|
+
if (!normalizedPath.startsWith('apps/web/src/features/common/') &&
|
|
18
|
+
normalizedPath !== 'apps/web/src/features/common') {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// Check standard ignore patterns
|
|
23
|
+
const allPatterns = [...IGNORE_PATTERNS, ...additionalIgnorePatterns];
|
|
24
|
+
for (const pattern of allPatterns) {
|
|
25
|
+
if (normalizedPath === pattern)
|
|
26
|
+
return true;
|
|
27
|
+
if (normalizedPath.startsWith(pattern + '/'))
|
|
28
|
+
return true;
|
|
29
|
+
if (pattern.endsWith('/') && normalizedPath.startsWith(pattern))
|
|
30
|
+
return true;
|
|
31
|
+
if (pattern.startsWith('*.')) {
|
|
32
|
+
const ext = pattern.slice(1);
|
|
33
|
+
if (normalizedPath.endsWith(ext))
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
if (pattern === '.tsbuildinfo' && normalizedPath.endsWith('.tsbuildinfo'))
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Normalize a template path to how it would appear in the target
|
|
43
|
+
* Handles dotfile renames (e.g., 'gitignore' -> '.gitignore')
|
|
44
|
+
*/
|
|
45
|
+
export function normalizeTemplatePath(templateRelativePath) {
|
|
46
|
+
const parts = templateRelativePath.split('/');
|
|
47
|
+
const fileName = parts[parts.length - 1];
|
|
48
|
+
// Check if the filename needs renaming
|
|
49
|
+
if (DOTFILE_RENAMES[fileName]) {
|
|
50
|
+
parts[parts.length - 1] = DOTFILE_RENAMES[fileName];
|
|
51
|
+
return parts.join('/');
|
|
52
|
+
}
|
|
53
|
+
return templateRelativePath;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parse .gitignore file and return patterns
|
|
57
|
+
*/
|
|
58
|
+
export async function parseGitignore(projectPath) {
|
|
59
|
+
const gitignorePath = path.join(projectPath, '.gitignore');
|
|
60
|
+
try {
|
|
61
|
+
if (await fs.pathExists(gitignorePath)) {
|
|
62
|
+
const content = await fs.readFile(gitignorePath, 'utf-8');
|
|
63
|
+
return content
|
|
64
|
+
.split('\n')
|
|
65
|
+
.map((line) => line.trim())
|
|
66
|
+
.filter((line) => line && !line.startsWith('#'));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Ignore errors reading .gitignore
|
|
71
|
+
}
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Recursively collect all files from a directory
|
|
76
|
+
*/
|
|
77
|
+
async function collectFilesRecursive(basePath, currentPath, files, options) {
|
|
78
|
+
const entries = await fs.readdir(currentPath, { withFileTypes: true });
|
|
79
|
+
for (const entry of entries) {
|
|
80
|
+
const absolutePath = path.join(currentPath, entry.name);
|
|
81
|
+
let relativePath = path.relative(basePath, absolutePath);
|
|
82
|
+
// Skip ignored paths
|
|
83
|
+
if (shouldIgnore(relativePath, options.additionalIgnorePatterns)) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (entry.isDirectory()) {
|
|
87
|
+
await collectFilesRecursive(basePath, absolutePath, files, options);
|
|
88
|
+
}
|
|
89
|
+
else if (entry.isFile()) {
|
|
90
|
+
// Normalize path for template files if needed
|
|
91
|
+
if (options.normalizeTemplatedDotfiles) {
|
|
92
|
+
relativePath = normalizeTemplatePath(relativePath);
|
|
93
|
+
}
|
|
94
|
+
files.set(relativePath, {
|
|
95
|
+
relativePath,
|
|
96
|
+
absolutePath,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Collect all files from a directory
|
|
103
|
+
*/
|
|
104
|
+
export async function collectFiles(basePath, options = {}) {
|
|
105
|
+
const files = new Map();
|
|
106
|
+
if (!(await fs.pathExists(basePath))) {
|
|
107
|
+
throw new Error(`Directory does not exist: ${basePath}`);
|
|
108
|
+
}
|
|
109
|
+
await collectFilesRecursive(basePath, basePath, files, options);
|
|
110
|
+
return files;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get the original template path from a normalized path
|
|
114
|
+
* This is the reverse of normalizeTemplatePath
|
|
115
|
+
*/
|
|
116
|
+
export function getOriginalTemplatePath(normalizedPath) {
|
|
117
|
+
const parts = normalizedPath.split('/');
|
|
118
|
+
const fileName = parts[parts.length - 1];
|
|
119
|
+
// Check if the filename is a renamed dotfile
|
|
120
|
+
for (const [original, renamed] of Object.entries(DOTFILE_RENAMES)) {
|
|
121
|
+
if (fileName === renamed) {
|
|
122
|
+
parts[parts.length - 1] = original;
|
|
123
|
+
return parts.join('/');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return normalizedPath;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=file-collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-collector.js","sourceRoot":"","sources":["../../src/compare/file-collector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAA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AC,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,6BAA6B,QAAQ,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAEhE,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,cAAsB;IAC5D,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEzC,6CAA6C;IAC7C,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QAClE,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzB,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;YACnC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FileEntry, FileDiff, VersionDiff } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a file is binary based on extension
|
|
4
|
+
*/
|
|
5
|
+
export declare function isBinaryFile(filePath: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Replace {{name}} placeholders with the project name
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolvePlaceholders(content: string, projectName: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Detect version drift in package.json files
|
|
12
|
+
*/
|
|
13
|
+
export declare function detectVersionDrift(templateContent: string, targetContent: string): {
|
|
14
|
+
isVersionDriftOnly: boolean;
|
|
15
|
+
versionDiffs: VersionDiff[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Compare two files and generate a FileDiff
|
|
19
|
+
*/
|
|
20
|
+
export declare function compareFiles(templateEntry: FileEntry | undefined, targetEntry: FileEntry | undefined, projectName: string): Promise<FileDiff>;
|
|
21
|
+
//# sourceMappingURL=file-comparator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-comparator.d.ts","sourceRoot":"","sources":["../../src/compare/file-comparator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGnE;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGtD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,MAAM,CAER;AA4ED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,GACpB;IAAE,kBAAkB,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,WAAW,EAAE,CAAA;CAAE,CA4E9D;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,aAAa,EAAE,SAAS,GAAG,SAAS,EACpC,WAAW,EAAE,SAAS,GAAG,SAAS,EAClC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,QAAQ,CAAC,CA0GnB"}
|