Skip to content

feat: Add package type selection for CLI or Framework#8

Open
SinghCod3r wants to merge 1 commit intoMr-emeka:mainfrom
SinghCod3r:main
Open

feat: Add package type selection for CLI or Framework#8
SinghCod3r wants to merge 1 commit intoMr-emeka:mainfrom
SinghCod3r:main

Conversation

@SinghCod3r
Copy link
Copy Markdown

Closes #6

Description

This pull request introduces a new feature that allows users to select the type of package they want to create: either a standard Framework/Library or a CLI tool.

This enhancement makes the tool more versatile and streamlines the setup process for command-line applications.

Changes Implemented

  • Added New Prompt: A new list prompt has been added to index.ts that asks the user to choose the package type.
  • Conditional package.json Configuration:
    • If the user selects "CLI tool", a bin field is automatically added to the generated package.json. This field points to the compiled output (dist/index.js), making the package executable.
  • Conditional Shebang:
    • For a "CLI tool", the shebang #!/usr/bin/env node is prepended to the src/index.ts file, which is necessary for it to run as a command-line script.

How to Test

  1. Run the package creation script.
  2. At the new prompt, select the "CLI tool" option.
  3. Once the package is created, inspect the new project:
    • ✅ The package.json file should contain a bin field.
    • ✅ The src/index.ts file should start with #!/usr/bin/env node.

@Mr-emeka
Copy link
Copy Markdown
Owner

Hello @SinghCod3r 👋, thanks for this PR — the inclusion of the CLI / Framework option looks great. However, this PR should only introduce that feature.

I’d like us to retain the existing argument structure as it is, so we don’t break consistency with other commands. Could you please revert the argument changes and keep the focus only on the new option?

@SinghCod3r
Copy link
Copy Markdown
Author

Hello @Mr-emeka,

Thank you for the review and the clear feedback!

I've updated the pull request as you requested. The unrelated argument changes have been removed, and the PR now contains a single, clean commit focused only on the new package type selection feature.

It should be ready for another look. Thanks again!

Mr-emeka
Mr-emeka previously approved these changes Aug 30, 2025
Comment thread index.ts
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
printHelp();
process.exit(0);
#!/usr/-bin/env node
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#!/user/bin/env node - correct

@Mr-emeka Mr-emeka self-requested a review August 30, 2025 12:09
@Mr-emeka Mr-emeka dismissed their stale review August 30, 2025 12:09

need changes to be updated

@Mr-emeka
Copy link
Copy Markdown
Owner

Mr-emeka commented Aug 30, 2025

Hello @SinghCod3r , thanks a lot for your effort here 🙏

However, I think this PR introduces too many unnecessary structural changes.
The intent was only to add:

  • --cli option (so users can scaffold a CLI package).

The existing flow (npx blazing-create-npm-package <packagename>) should remain the default and must not break.

We don’t need to switch to Inquirer prompts or modify the project structure logic (git init, pnpm install, etc.) — those can be added in a future enhancement if we decide.

Can you please rework this PR to:

  • Keep the existing parseArgsscaffoldProjectinstallDependencies structure.
  • Only introduce the new option (--cli) with minimal changes.
  • Ensure that running npx blazing-create-npm-package <packagename> still works exactly as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add package type selection

2 participants