Issue240 - #13
Merged
Merged
Conversation
- Added a depth argument to the git clone command for a shallow clone to enhance performance.
Remove CLI entry point from create-gen-app package to make it a pure library API. The CLI implementation and tests are now housed in the create-gen-app-test package for integration testing purposes. Changes: - Remove src/cli.ts and __tests__/cli.test.ts from create-gen-app - Remove bin field and minimist dependencies from create-gen-app/package.json - Update README.md to clarify that the published package is API-only - Port CLI code to create-gen-app-test/src/cli.ts - Add CLI tests to create-gen-app-test/src/__tests__/cli.test.ts - Add minimist and inquirerer dependencies to create-gen-app-test - Update CLI imports to use create-gen-app library APIs This separation ensures create-gen-app remains focused on its core template generation functionality while maintaining CLI testing capabilities in the dedicated test harness package.
…rootDir error Move integration-helpers.ts from create-gen-app/test-utils to create-gen-app-test/src/test-utils to resolve TS6059 error where files outside rootDir cannot be imported during build. Changes: - Copy integration-helpers.ts to create-gen-app-test/src/test-utils/ - Update cli.test.ts import path to use local test-utils - Update cached-template.test.ts.snap to reflect latest template structure This ensures all source files are within the package's rootDir boundary, fixing the CI build error: "File is not under 'rootDir'".
Relocate the development helper script from create-gen-app to create-gen-app-test to keep the main package API-only. The dev script now lives alongside other CLI tooling in the test harness package. Changes: - Move dev/index.ts and dev/README.md to create-gen-app-test/dev/ - Update dev script imports to use create-gen-app workspace package - Remove dev script from create-gen-app/package.json - Add dev script to create-gen-app-test/package.json - Update create-gen-app README to remove dev/README reference This ensures create-gen-app remains focused on its core library functionality while development tooling is consolidated in the test package.
Add built-in template caching to avoid repeated git clones from GitHub. Templates are cached locally using appstash, significantly speeding up subsequent runs when using the same repository and branch. Changes: - Add cache.ts helper with getCachedRepo/cloneToCache/prepareTemplateDirectory - Extend CreateGenOptions with optional cache configuration (toolName, baseDir, enabled) - Update cloneRepo to support cache-aware cloning - Integrate caching into createGen pipeline with cache-first logic - Add cache.test.ts with isolated temp baseDir to avoid touching user's home - Update README with caching documentation and usage examples - Add appstash dependency to package.json The cache is enabled by default and stores repositories under ~/.<toolName>/cache/repos. Tests use temporary directories (via baseDir) to prevent pollution of the developer's home directory, following the pattern from appstash tests.
Fix test assertions to align with camelCase variable extraction (e.g., projectName instead of PROJECT_NAME). Also fix cache test spy issue. Changes: - Update extractVariables tests to expect camelCase variable names - Fix promptUser tests to use correct answer key names (fullName, moduleDesc) - Update cloneRepo tests to allow --depth 1 flag in git clone commands - Fix replaceVariables tests to use camelCase answer keys - Replace execSync spy in cache.test.ts with console.log assertion to avoid "Cannot redefine property" error All tests now correctly validate the camelCase variable naming convention used throughout the codebase.
pyramation
reviewed
Nov 25, 2025
| MODULENAME: `Test Module ${suffix}`, | ||
| MODULEDESC: `Integration test module ${suffix}`, | ||
| REPONAME: `integration-${safeSuffix}`, | ||
| USERNAME: `tester-${safeSuffix}`, |
Contributor
There was a problem hiding this comment.
why are these ALL CAPS?
pyramation
reviewed
Nov 25, 2025
| import { CacheOptions } from "./types"; | ||
| import { cloneRepo, normalizeGitUrl } from "./clone"; | ||
|
|
||
| const DEFAULT_TOOL = "pgpm"; |
Contributor
There was a problem hiding this comment.
this should be configured in a constructor or similar
pyramation
reviewed
Nov 25, 2025
| 'Unknown Author'; | ||
| getAnswer(answers, [ | ||
| "USERFULLNAME", | ||
| "AUTHOR", |
pyramation
reviewed
Nov 25, 2025
| /** | ||
| * Options that control template caching behavior | ||
| */ | ||
| export interface CacheOptions { |
Contributor
There was a problem hiding this comment.
I was actually envisioning some of this in another package, but I think we may be able to make it work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors
create-gen-appto be a pure API library by moving all CLI tooling tocreate-gen-app-test, and adds built-in template caching usingappstashto improve performance.Changes
Architecture Refactoring
Separate CLI from library: Moved CLI implementation (
src/cli.ts) and tests fromcreate-gen-apptocreate-gen-app-testpackagecreate-gen-appis now API-only, suitable for programmatic usecreate-gen-app-testfor integration testingbinfield andminimistdependency fromcreate-gen-appMove dev helper script: Relocated
dev/index.tsanddev/README.mdtocreate-gen-app-test/dev/Fix TypeScript build errors: Moved
integration-helpers.tstocreate-gen-app-test/src/test-utils/to resolverootDirboundary issuesNew Features
Template caching with appstash: Added built-in caching to avoid repeated
git cloneoperations~/.<toolName>/cache/reposusingappstashCreateGenOptions.cache(toolName, baseDir, enabled)Git clone optimizations:
--depth 1for shallow clones (already implemented)--single-branchwhen branch is specifiedBug Fixes
PROJECT_NAMEtoprojectNameformatcloneRepotests to allow--depth 1flagexecSyncspy in cache tests with console.log assertionsTesting
create-gen-app-testpackageBreaking Changes
create-gen-appno longer provides CLI binaries (create-gen-app/cga)create-gen-app-testpackage (internal use)Migration Guide
For programmatic usage, continue using
createGen()API as before. For CLI access, use thecreate-gen-app-testpackage internally (not published).Related Issues
https://github.com/hyperweb-io/projects-issues/issues/240