asyncapi / glee

Glee β€” The AsyncAPI framework that will make you smile again :)
88 stars 62 forks source link

[FEATURE] Enable Custom 'package.json' Templates for Streamlined Glee Project Initialization #845

Open techmannih opened 2 months ago

techmannih commented 2 months ago

Why do we need this improvement?

I propose adding support for customizable package.json templates in Glee projects. This enhancement will allow users to specify and use their own package.json configurations during project creation, significantly streamlining the setup process and improving the overall user experience.

How will this change help?

Current Behavior:

Currently, Glee generates a package.json file with default settings when a new project is created. Users then need to manually edit this file to adjust dependencies, scripts, and other settings to match their specific project requirements. Below is an example of the default package.json provided:

{
  "name": "glee-hello-world",
  "version": "0.1.0",
  "description": "Hello world app to improve Glee onboarding",
  "type": "module",
  "engines": {
    "node": ">=14.15.1"
  },
  "scripts": {
    "dev": "glee dev",
    "start": "glee start"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/asyncapi/glee-hello-world.git"
  },
  "keywords": [
    "glee"
  ],
  "author": "Fran Mendez",
  "license": "Apache-2.0",
  "bugs": {
    "url": "https://github.com/asyncapi/glee-hello-world/issues"
  },
  "homepage": "https://github.com/asyncapi/glee-hello-world#readme",
  "dependencies": {
    "@asyncapi/glee": "^0.37.7"
  },
  "devDependencies": {
    "@types/node": "^20.5.9"
  }
}

Proposed Enhancement:

Introduce a feature to specify a custom package.json template during project creation. This can be achieved via a command-line option or configuration file, allowing users to predefine their project setup and avoid manual modifications. Below is an example of how users might set up their custom package.json:

{
  "name": "my-custom-project",
  "version": "0.1.0",
  "description": "Custom setup for Glee project",
  "type": "module",
  "engines": {
     "node": ">=14.15.1"
  },
  "scripts": {
    "dev": "glee dev",
    "start": "glee start"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/your-repo/my-custom-project.git"
  },
  "keywords": [
    "glee"
  ],
  "author": "",
 "license": "Apache-2.0",
  "bugs": {
    "url": "https://github.com/your-repo/my-custom-project/issues"
  },
  "homepage": "https://github.com/your-repo/my-custom-project#readme",
  "dependencies": {
    "@asyncapi/glee": "^0.37.7"
  },
  "devDependencies": {
    "@types/node": "^20.5.9"
  }
}

Benefits:

Streamlined Setup: Avoids the need to manually edit a default package.json, making the project creation process faster and more user-friendly. Enhanced Customization: Users can start with a package.json file that meets their specific needs, reducing the need for post-creation adjustments. Improved Consistency: Ensures uniform configuration across multiple projects or teams by using predefined templates. Increased Efficiency: Automates the inclusion of standard dependencies, scripts, and settings, saving time and effort.

Screenshots

No response

How could it be implemented/designed?

Template Handling: Allow users to specify and apply a custom package.json template when creating a project, or use a default template if none is provided.

Placeholder Replacement: Support dynamic placeholders in the template (e.g., {projectName}, {version}) and replace them with user-provided values.

🚧 Breaking changes

Yes

πŸ‘€ Have you checked for similar open issues?

🏒 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

Yes I am willing to submit a PR!

techmannih commented 2 months ago

@Souvikns @KhudaDad414 please assign me this issue

techmannih commented 2 months ago

@AceTheCreator , please assign this issue

AceTheCreator commented 2 months ago

@techmannih we don't assign issues, please kindly go ahead and work on it :)

techmannih commented 2 months ago

Okay, got it. Thanks!