diff --git a/cmd/create-app/command/default.go b/cmd/create-app/command/default.go index f315665..6215bfb 100755 --- a/cmd/create-app/command/default.go +++ b/cmd/create-app/command/default.go @@ -118,9 +118,10 @@ func (dc *DefaultCommand) Start(data *commander.StartData) error { return nil } params := global.TemplateParams{ + PackageName: fmt.Sprintf("%s/%s/%s", domain, username, projectName), + Username: username, AppName: projectName, RepoUrl: global.GlobalConfig.Repo, - PackageName: fmt.Sprintf("%s/%s/%s", domain, username, projectName), } err := templateInstance.Make(params) if err != nil { diff --git a/pkg/global/global.go b/pkg/global/global.go index e2899fd..ea7cc1e 100644 --- a/pkg/global/global.go +++ b/pkg/global/global.go @@ -6,8 +6,9 @@ type Config struct { } type TemplateParams struct { - AppName string `json:"app_name"` PackageName string `json:"package_name"` + Username string `json:"username"` + AppName string `json:"app_name"` RepoUrl string `json:"repo_url"` } diff --git a/pkg/templates/go_app.go b/pkg/templates/go_app.go index 0214e28..1ede093 100644 --- a/pkg/templates/go_app.go +++ b/pkg/templates/go_app.go @@ -29,7 +29,7 @@ set -euxo pipefail git clone %s --single-branch -v -b main --depth 1 %s cd %s rm -rf .git -PACKAGE_NAME="%s" APP_NAME="%s" NAME="%s" ./init.sh +PACKAGE_NAME="%s" APP_NAME="%s" USERNAME="%s" ./init.sh rm -rf ./init.sh `, gat.Url(), @@ -37,7 +37,7 @@ rm -rf ./init.sh params.AppName, params.PackageName, params.AppName, - params.AppName, + params.Username, ) cmd := exec.Command("bash", "-c", script) cmd.Stdout = os.Stdout diff --git a/pkg/templates/go_grpc_server.go b/pkg/templates/go_grpc_server.go index b4eb634..b993827 100644 --- a/pkg/templates/go_grpc_server.go +++ b/pkg/templates/go_grpc_server.go @@ -29,7 +29,7 @@ set -euxo pipefail git clone %s --single-branch -v -b main --depth 1 %s cd %s rm -rf .git -PACKAGE_NAME="%s" APP_NAME="%s" NAME="%s" ./init.sh +PACKAGE_NAME="%s" APP_NAME="%s" USERNAME="%s" ./init.sh rm -rf ./init.sh `, ggst.Url(), @@ -37,7 +37,7 @@ rm -rf ./init.sh params.AppName, params.PackageName, params.AppName, - params.AppName, + params.Username, ) cmd := exec.Command("bash", "-c", script) cmd.Stdout = os.Stdout diff --git a/pkg/templates/go_lib.go b/pkg/templates/go_lib.go index d3c317a..7b311d3 100644 --- a/pkg/templates/go_lib.go +++ b/pkg/templates/go_lib.go @@ -29,7 +29,7 @@ set -euxo pipefail git clone %s --single-branch -v -b main --depth 1 %s cd %s rm -rf .git -PACKAGE_NAME="%s" APP_NAME="%s" NAME="%s" ./init.sh +PACKAGE_NAME="%s" APP_NAME="%s" USERNAME="%s" ./init.sh rm -rf ./init.sh `, glt.Url(), @@ -37,7 +37,7 @@ rm -rf ./init.sh params.AppName, params.PackageName, params.AppName, - params.PackageName, + params.Username, ) cmd := exec.Command("bash", "-c", script) cmd.Stdout = os.Stdout diff --git a/pkg/templates/go_web_server.go b/pkg/templates/go_web_server.go index d94f58b..52dd1d8 100644 --- a/pkg/templates/go_web_server.go +++ b/pkg/templates/go_web_server.go @@ -29,7 +29,7 @@ set -euxo pipefail git clone %s --single-branch -v -b main --depth 1 %s cd %s rm -rf .git -PACKAGE_NAME="%s" APP_NAME="%s" NAME="%s" ./init.sh +PACKAGE_NAME="%s" APP_NAME="%s" USERNAME="%s" ./init.sh rm -rf ./init.sh `, gwst.Url(), @@ -37,7 +37,7 @@ rm -rf ./init.sh params.AppName, params.PackageName, params.AppName, - params.AppName, + params.Username, ) cmd := exec.Command("bash", "-c", script) cmd.Stdout = os.Stdout diff --git a/pkg/templates/react_app.go b/pkg/templates/react_app.go index 3a7ee94..6b3cb83 100644 --- a/pkg/templates/react_app.go +++ b/pkg/templates/react_app.go @@ -29,13 +29,15 @@ set -euxo pipefail git clone %s --single-branch -v -b main --depth 1 %s cd %s rm -rf .git -cat package.json | sed "s/template/%s/g" > temp && rm -rf package.json && mv temp package.json -npm install +PACKAGE_NAME="%s" APP_NAME="%s" USERNAME="%s" ./init.sh +rm -rf ./init.sh `, rat.Url(), params.AppName, params.AppName, + params.PackageName, params.AppName, + params.Username, ) cmd := exec.Command("bash", "-c", script) cmd.Stdout = os.Stdout diff --git a/pkg/templates/react_dapp.go b/pkg/templates/react_dapp.go index 03f4472..c0cfc89 100644 --- a/pkg/templates/react_dapp.go +++ b/pkg/templates/react_dapp.go @@ -29,13 +29,15 @@ set -euxo pipefail git clone %s --single-branch -v -b main --depth 1 %s cd %s rm -rf .git -cat package.json | sed "s/template/%s/g" > temp && rm -rf package.json && mv temp package.json -npm install +PACKAGE_NAME="%s" APP_NAME="%s" USERNAME="%s" ./init.sh +rm -rf ./init.sh `, rdt.Url(), params.AppName, params.AppName, + params.PackageName, params.AppName, + params.Username, ) cmd := exec.Command("bash", "-c", script) cmd.Stdout = os.Stdout diff --git a/pkg/templates/rust_app.go b/pkg/templates/rust_app.go index 3eeb810..c7970be 100644 --- a/pkg/templates/rust_app.go +++ b/pkg/templates/rust_app.go @@ -29,7 +29,7 @@ set -euxo pipefail git clone %s --single-branch -v -b main --depth 1 %s cd %s rm -rf .git -PACKAGE_NAME="%s" APP_NAME="%s" NAME="%s" ./init.sh +PACKAGE_NAME="%s" APP_NAME="%s" USERNAME="%s" ./init.sh rm -rf ./init.sh `, rat.Url(), @@ -37,7 +37,7 @@ rm -rf ./init.sh params.AppName, params.PackageName, params.AppName, - params.AppName, + params.Username, ) cmd := exec.Command("bash", "-c", script) cmd.Stdout = os.Stdout diff --git a/version/version.go b/version/version.go index 2f476f4..6efe315 100755 --- a/version/version.go +++ b/version/version.go @@ -2,5 +2,5 @@ package version const ( AppName = "create-app" - Version = "v1.1.7" + Version = "v1.1.9" )