Skip to content
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

feat: update nodecli #134

Merged
merged 9 commits into from
Feb 21, 2024
Merged

feat: update nodecli #134

merged 9 commits into from
Feb 21, 2024

Conversation

damienbutt
Copy link
Contributor

No description provided.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

PR Type: Enhancement

PR Summary: This pull request introduces a significant update to the nodecli template, focusing on enhancing the CLI tool's functionality, improving the development workflow, and ensuring compatibility with the latest Node.js versions. It adds new dependencies to support these features, updates the GitHub Actions workflow to include more comprehensive CI checks, and introduces a new command (hello) to the CLI. Additionally, it incorporates testing with Vitest and updates to package.json to reflect these changes.

Decision: Comment

📝 Type: 'Enhancement' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
📝 Complexity: the changes are too large or complex for Sourcery to approve.
  • Unsupported files: the diff contains files that Sourcery does not currently support during reviews.

General suggestions:

  • Consider adding more detailed comments or documentation within the code, especially for the new features and commands introduced, to ensure maintainability and ease of understanding for new contributors.
  • Review the added dependencies to ensure they are all necessary and used within the project, to avoid bloating the project with unused packages.
  • Given the significant changes, it might be beneficial to include a minor version bump in the package.json to reflect the new features and improvements made.
templates/nodecli/src/app.js: The code change significantly increases complexity by introducing multiple dependencies and intricate logic, suggesting a need for simplification to maintain ease of understanding and upkeep.

While the added functionality introduces some exciting features, it significantly increases the complexity of the codebase. The original single-line console.log statement was straightforward, but the new version introduces multiple external dependencies (figlet, chalk, commander, StringBuilder), significantly more lines of code, complex logic for handling command-line arguments, error handling, and asynchronous code. This complexity can make the code harder to maintain and understand, especially for new contributors or when revisiting this code after some time.

Consider simplifying the implementation to balance between the new functionality and maintaining code simplicity. For example, reducing the number of external dependencies and streamlining the command-line interface logic could help. Here's a suggested approach that retains some of the enhancements while aiming for simplicity:

#!/usr/bin/env node

import chalk from "chalk";
import { Command } from "commander";
import packageJson from "./package.json"; // Assuming static import is sufficient for package details.

const program = new Command();

program
    .name(packageJson.name)
    .description(packageJson.description)
    .version(packageJson.version, "-v, --version")
    .action(() => {
        console.log(`Welcome to ${chalk.bold(packageJson.name)} v${packageJson.version}`);
    });

program.parse(process.argv);

if (!process.argv.slice(2).length) {
    program.outputHelp();
}

This version aims to keep the code more maintainable by reducing the number of moving parts while still introducing some of the intended enhancements like styled output and basic CLI structure.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@damienbutt damienbutt merged commit a5abfb2 into master Feb 21, 2024
10 checks passed
@damienbutt damienbutt deleted the feat/update-nodecli branch February 21, 2024 21:53
Copy link

🎉 This PR is included in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant