Skip to content

Commit

Permalink
[#503] Make compose becomes default template
Browse files Browse the repository at this point in the history
  • Loading branch information
thiennguyen0196 committed Oct 13, 2023
1 parent 574b54d commit a66ed41
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ A collection of our Android templates:
```
package-name= New package name (i.e., com.example.package)
app-name= New app name (i.e., MyApp, "My App", "my-app")
template= Template (i.e., compose)
template= Template (i.e., compose) (optional, default: compose)
force= Force project creation even if the script fails (default: false)
destination= Set the output location where the project should be generated (i.e., /Users/johndoe/documents/projectfolder)
```
Expand Down
7 changes: 0 additions & 7 deletions gradle-wrapper.properties

This file was deleted.

12 changes: 2 additions & 10 deletions scripts/new_project.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object NewProject {
Run kscript new_project.kts to create a new project with the following arguments:
$KEY_PACKAGE_NAME= New package name (i.e., com.example.package)
$KEY_APP_NAME= New app name (i.e., MyApp, "My App", "my-app")
$KEY_TEMPLATE= Template (i.e. $TEMPLATE_COMPOSE)
$KEY_TEMPLATE= Template (i.e. $TEMPLATE_COMPOSE) (optional, default: $TEMPLATE_COMPOSE)
$KEY_FORCE= Force project creation even if the script fails (default: false)
$KEY_DESTINATION= Set the output location where the project should be generated (i.e., /Users/johndoe/documents/projectfolder)
Expand Down Expand Up @@ -83,7 +83,7 @@ object NewProject {
}
}

private var template: String = ""
private var template: String = TEMPLATE_COMPOSE

private val templatePackageName
get() = TEMPLATE_PACKAGE_NAME_COMPOSE
Expand Down Expand Up @@ -114,7 +114,6 @@ object NewProject {
private fun handleArguments(args: Array<String>) {
var hasAppName = false
var hasPackageName = false
var hasTemplate = false
args.forEach { arg ->
when {
arg == KEY_HELP -> {
Expand All @@ -139,7 +138,6 @@ object NewProject {
arg.startsWith("$KEY_TEMPLATE$DELIMITER_ARGUMENT") -> {
val (key, value) = arg.split(DELIMITER_ARGUMENT)
validateTemplate(value)
hasTemplate = true
}

arg.startsWith("$KEY_FORCE$DELIMITER_ARGUMENT") -> {
Expand Down Expand Up @@ -173,12 +171,6 @@ object NewProject {
exitAfterMessage = true,
isError = true,
)

!hasTemplate -> showMessage(
message = "ERROR: No template has been provided \n$helpMessage",
exitAfterMessage = true,
isError = true,
)
}
}

Expand Down

0 comments on commit a66ed41

Please sign in to comment.