Skip to content

Commit

Permalink
feat(project ci): allow installing dev dependencies with flag
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Feb 21, 2024
1 parent ac48b72 commit 3de95b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/project/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ var projectCI = &cobra.Command{

logging.FromContext(cmd.Context()).Infof("Installing dependencies using Composer")

composer := phpexec.ComposerCommand(cmd.Context(), "install", "--no-dev", "--no-interaction", "--no-progress", "--optimize-autoloader", "--classmap-authoritative")
composerFlags := []string{"install", "--no-interaction", "--no-progress", "--optimize-autoloader", "--classmap-authoritative"}

if withDev, _ := cmd.Flags().GetBool("with-dev-dependencies"); !withDev {
composerFlags = append(composerFlags, "--no-dev")
}

composer := phpexec.ComposerCommand(cmd.Context(), composerFlags...)
composer.Dir = args[0]
composer.Stdin = os.Stdin
composer.Stdout = os.Stdout
Expand Down Expand Up @@ -168,6 +174,7 @@ var projectCI = &cobra.Command{

func init() {
projectRootCmd.AddCommand(projectCI)
projectCI.PersistentFlags().Bool("with-dev-dependencies", false, "Install dev dependencies")
}

func commandWithRoot(cmd *exec.Cmd, root string) *exec.Cmd {
Expand Down
4 changes: 4 additions & 0 deletions wiki/docs/commands/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ Arguments:

- project path

Flags:

- `--with-dev-dependencies` - Install dev dependencies

What that command does:

- Installs all composer dependencies
Expand Down

0 comments on commit 3de95b9

Please sign in to comment.