forked from aziontech/azion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aziontech#489 from aziontech/minor-fixes-2
feat: azion root command becomes an alias for azion init
- Loading branch information
Showing
25 changed files
with
203 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package init | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/AlecAivazis/survey/v2" | ||
|
@@ -68,47 +69,50 @@ func askForInput(msg string, defaultIn string) (string, error) { | |
} | ||
|
||
func (cmd *InitCmd) selectVulcanTemplates(info *InitInfo) error { | ||
logger.FInfo(cmd.Io.Out, msg.InitGettingTemplates) | ||
logger.FInfo(cmd.Io.Out, msg.InitGettingVulcan) | ||
|
||
err := cmd.CommandRunInteractive(cmd.F, "npx --yes [email protected] init --name "+info.Name) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
output, _, err := cmd.CommandRunner("npx --yes [email protected] presets ls", []string{"CLEAN_OUTPUT_MODE=true"}) | ||
if err != nil { | ||
return err | ||
} | ||
if info.Template == "" || info.Mode == "" { | ||
output, _, err := cmd.CommandRunner("npx --yes [email protected] presets ls", []string{"CLEAN_OUTPUT_MODE=true"}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
newLineSplit := strings.Split(output, "\n") | ||
newLineSplit[len(newLineSplit)-1] = "static (azion)" | ||
newLineSplit := strings.Split(output, "\n") | ||
newLineSplit[len(newLineSplit)-1] = "static (azion)" | ||
|
||
answer := "" | ||
template := "" | ||
mode := "" | ||
prompt := &survey.Select{ | ||
Message: "Choose a mode:", | ||
Options: newLineSplit, | ||
} | ||
err = survey.AskOne(prompt, &answer) | ||
if err != nil { | ||
return err | ||
} | ||
answer := "" | ||
template := "" | ||
mode := "" | ||
prompt := &survey.Select{ | ||
Message: "Choose a mode:", | ||
Options: newLineSplit, | ||
} | ||
err = survey.AskOne(prompt, &answer) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
modeSplit := strings.Split(answer, " ") | ||
template = modeSplit[0] | ||
mode = strings.Replace(strings.Replace(modeSplit[1], "(", "", -1), ")", "", -1) | ||
modeSplit := strings.Split(answer, " ") | ||
template = modeSplit[0] | ||
mode = strings.Replace(strings.Replace(modeSplit[1], "(", "", -1), ")", "", -1) | ||
|
||
info.Template = template | ||
info.Mode = mode | ||
info.Template = template | ||
info.Mode = mode | ||
|
||
} | ||
|
||
return nil | ||
} | ||
|
||
func yarnInstall(cmd *InitCmd) error { | ||
func depsInstall(cmd *InitCmd, packageManager string) error { | ||
logger.FInfo(cmd.Io.Out, msg.InitInstallDeps) | ||
|
||
err := cmd.CommandRunInteractive(cmd.F, "yarn install") | ||
command := fmt.Sprintf("%s install", packageManager) | ||
err := cmd.CommandRunInteractive(cmd.F, command) | ||
if err != nil { | ||
logger.Debug("Error while running command with simultaneous output", zap.Error(err)) | ||
return msg.ErrorDeps | ||
|
Oops, something went wrong.