-
Notifications
You must be signed in to change notification settings - Fork 0
feat: ship create-gen-app CLI, real integration tests, and license automation #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sdqede
wants to merge
11
commits into
main
Choose a base branch
from
feat/create-gen-app-cli
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
…mpts Fix two critical input handling bugs that prevented proper user interaction: 1. Duplicate character input: Characters were being registered twice due to multiple Inquirerer instances not being properly closed, causing event listeners to accumulate. 2. No input response: TerminalKeypress was setting raw mode in constructor, which blocked readline from receiving input for text/number/confirm questions. Changes: - Add prompter.close() in promptUser() to properly cleanup Inquirerer instances - Add inquirerer.close() in dev script after template selection prompt - Refactor TerminalKeypress to only enable raw mode when needed (resume()) - Ensure raw mode is disabled (cooked mode restored) in destroy() for readline compatibility This ensures: - text/number/confirm questions use readline with cooked mode (normal input) - checkbox/list/autocomplete questions use raw mode for custom key handling - Each prompt properly cleans up before the next one starts - No event listener leaks or stdin conflicts between prompts Fixes input duplication and unresponsive keyboard issues in create-gen-app dev workflow.
- guard `promptUser` teardown so mocked `Inquirerer` instances without `close()` don’t crash tests while real prompts still release their resources - exclude `<rootDir>/test-output/` from Jest runs so generated template fixtures (e.g. ones importing `pgsql-test`) no longer break the suite This keeps interactive prompts stable and restores `yarn workspace create-gen-app test`.
- support fromBranch/fromPath in createGen and cloneRepo - enhance dev script with CLI flags - update tests and docs, add minimist dependency
- allow .questions ignore entries to filter both paths and file contents - introduce default ignored tokens (__tests__, __snapshots__) - normalize question names and update unit tests accordingly
- treat variables as ____VAR____ throughout extraction, prompts, and README - add automatic normalization for question names using ____VAR____ or legacy __VAR__ - extend ignore logic to cover content tokens by default - update unit tests for new placeholder format
Update test fixtures to use ____VAR____ format instead of __
…scovery - Add bin entries for `create-gen-app` and `cga` commands in package.json - Implement CLI script with default repo (launchql/pgpm-boilerplates) and path (.) - Support --repo, --branch, --path, --template, --output, --force, --no-tty flags - Add --version/-v flag to display package version - Auto-discover templates when multiple exist, auto-select when only one - Forward extra CLI args as variable overrides (e.g., --PACKAGE_NAME=value) - Add comprehensive CLI tests covering all flag combinations and edge cases - Update README with CLI usage examples and command reference This enables users to run `npm install -g create-gen-app` and use `cga` or `create-gen-app` commands directly, with sensible defaults for the LaunchQL template repository.
- Replace mocked `createGen` and CLI tests with true integration coverage - Tests now clone `launchql/pgpm-boilerplates` from GitHub and validate actual filesystem output - Introduce `test-utils/integration-helpers.ts` to centralize test constants, temporary workspace management, and deterministic answer maps - Update `create-gen-flow.test.ts` and `cli.test.ts` to utilize these integration helpers and perform end-to-end validation - Remove reliance on `jest.mock` for `cloneRepo` and `Inquirerer` in these suites This ensures tests validate the full pipeline (clone → extract → prompt → replace) against real GitHub repositories, meeting Dan's requirement for tests that "do this for us" with the default template repository.
- Add built-in license templates (MIT, Apache-2.0, ISC) in `src/licenses.ts` - Automatically generate or overwrite LICENSE file based on user's selection - Replace placeholders (year, author name, email) with user-provided values - Show friendly warning when template doesn't support selected license type - Update `replaceVariables` to call `ensureLicenseFile()` after file replacement - Add unit tests for license template rendering - Update integration tests to validate LICENSE file generation in real GitHub flows - Document license generation feature in README This ensures generated projects always have proper LICENSE files matching the user's selection, whether the template originally included one or not.
- Introduce new license templates for GPL-3.0, BSD-3-Clause, Unlicense, and MPL-2.0 in `src/licenses.ts` - Expand the functionality of the license generation feature to support a wider range of open-source licenses This enhancement allows users to select from more licensing options when generating projects, ensuring compliance with various open-source requirements.
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
create-gen-appandcga) with sensible defaults (launchql/pgpm-boilerplates + dot), repo/branch/path/template/output/force/no-tty/--version flags, and argv overrides so users cannpm install -g create-gen-appand scaffold directly.questionsoverrides, ignore support (paths + content), question-name normalization, raw-mode cleanup, CLI dev script, README docs.questionsreferences a license not supported by the embedded templates, ensure.questions.*files are removed post-generation, strengthen README usage docsTesting
yarn workspace create-gen-app test(runs the true integration suites; requires git + network access)Manual CLI smoke test
🛠️ Local CLI Testing Workflow
🏗️ Build the workspace package
cd /Users/easonsmith/Desktop/hw/templating-playground/inquirerer yarn workspace create-gen-app build🔧 Make executable
🔗 Link globally
cd packages/create-gen-app/dist npm link🧪 Test the CLI
🧹 Cleanup