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

[cli] Install packages as well when using generate command #8

Open
4 tasks
sooraj1002 opened this issue Jan 1, 2024 · 5 comments
Open
4 tasks

[cli] Install packages as well when using generate command #8

sooraj1002 opened this issue Jan 1, 2024 · 5 comments
Assignees

Comments

@sooraj1002
Copy link
Collaborator

sooraj1002 commented Jan 1, 2024

Description

Presently, the cli while setting up a service using the generate command instead of setting it up during the bootstrapping phase does not install the external/extra dependencies if any. This should not be the case, those should be added alongside the service setup.

Potential fix

  1. Detect the lock file in the package root, if the package root contains only yarn.lock or pnpm.lock use yarn or pnpm respectively, incase there is no lock file of multiple lock files default to npm.
  2. Read, parse and update the package.json to add the dependency with the particular version that is required and print a message for the user to install the new dependencies using a package manager of their choice.

Objective

The goal of this issue is to update the package.json when user runs the generate command and prompt user on which package manager he needs to install the packages or use the registry generated here #20 to know which package manager the user has chosen while bootstraping the project.

Goals

  • Identify the package manager (package.json/yarn.lock/pnpm.lock/bun.lockb)
  • Update the specified package.json with necessary packages name
  • Install the packages
  • Write test for this function
Before generate command After generate command

Complexity : Medium

Product Name

Stencil-Cli

Organisation Name

SamagraX

Domain

Command Line Interface

Tech Skills Needed

TypeScript, Cli

@techsavvyash techsavvyash changed the title Install packages as well when using generate command [cli] Install packages as well when using generate command Jan 4, 2024
@techsavvyash techsavvyash added the bug Something isn't working label Jan 4, 2024
@Savio629
Copy link
Collaborator

@sooraj1002
So instead of installing it directly, we will have to store it in dependencies and then prompt user for package manager of his choice to install the dependencies?
Can't we just install it when the specific module is being generated?

@sooraj1002
Copy link
Collaborator Author

  • It would be better to update the package.json manually, so that in case of any failures, user can manually just run an install
  • When the user already has a yarn.lock or pnpm.lock file, we can directly assume thats the package manager we have to use
  • if we dont have those lock files, then we can ask the user. and in case of bootstrapping a new project, just use the package manager selected

@techsavvyash can you also confirm this once?

@techsavvyash
Copy link
Member

Yes, this is the correct approach, incase a direct install fails, it will not update the package.json making it very difficult for the end user to figure out what all dependencies are required giving a very bad UX, we must first update the package.json manually, which should be easy work, then we should check for the existence of lock files, incase of conflict, just prompt the user for the package manager and use that.
Additionally the registry feature that @Savio629 added can be used to store the package manager of user's choice as well removing the need to check for package manager over and over again.

@Savio629
Copy link
Collaborator

Savio629 commented May 11, 2024

Description

Presently, the cli while setting up a service using the generate command instead of setting it up during the bootstrapping phase does not install the external/extra dependencies if any. This should not be the case, those should be added alongside the service setup.

Objective

The goal of this issue is to update the package.json when user runs the generate command and prompt user on which package manager he needs to install the packages or use the registry generated here #20 to know which package manager the user has chosen while bootstraping the project.

Goals

  • Identify the package manager (package.json/yarn.lock/pnpm.lock/bun.lockb)
  • Update the specified package.json with necessary packages name
  • Install the packages
  • Write test for this function
Before generate command After generate command

Complexity : Medium

Product Name

Stencil-Cli

Organisation Name

SamagraX

Domain

Command Line Interface

Tech Skills Needed

TypeScript, Cli

@Savio629 Savio629 removed their assignment May 11, 2024
@shivankurchavan
Copy link

shivankurchavan commented Jun 20, 2024

please assign me : )

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

No branches or pull requests

4 participants