[JS, Wizard] Add react application template
^KT-41417 fixed
This commit is contained in:
+3
@@ -129,6 +129,9 @@ project.template.native.console.description=Application with Kotlin/Native that
|
||||
project.template.browser.title=Browser Application
|
||||
project.template.browser.description=A blank application targeting the browser
|
||||
|
||||
project.template.react.title=React Application
|
||||
project.template.react.description=React application targeting Browser
|
||||
|
||||
project.template.nodejs.title=Node.JS Application
|
||||
project.template.nodejs.description=A blank application targeting Node.js
|
||||
|
||||
|
||||
+26
@@ -77,6 +77,7 @@ sealed class ProjectTemplate : DisplayableSettingItem {
|
||||
MultiplatformLibraryProjectTemplate,
|
||||
NativeApplicationProjectTemplate,
|
||||
FrontendApplicationProjectTemplate,
|
||||
ReactApplicationProjectTemplate,
|
||||
FullStackWebApplicationProjectTemplate,
|
||||
NodeJsApplicationProjectTemplate
|
||||
)
|
||||
@@ -298,6 +299,31 @@ object FrontendApplicationProjectTemplate : ProjectTemplate() {
|
||||
)
|
||||
}
|
||||
|
||||
object ReactApplicationProjectTemplate : ProjectTemplate() {
|
||||
override val title = KotlinNewProjectWizardBundle.message("project.template.react.title")
|
||||
override val description = KotlinNewProjectWizardBundle.message("project.template.react.description")
|
||||
override val id = "reactApplication"
|
||||
|
||||
@NonNls
|
||||
override val suggestedProjectName = "myKotlinJsApplication"
|
||||
override val projectKind = ProjectKind.Js
|
||||
|
||||
override val setsPluginSettings: List<SettingWithValue<*, *>>
|
||||
get() = listOf(
|
||||
KotlinPlugin.modules.reference withValue listOf(
|
||||
Module(
|
||||
"js",
|
||||
BrowserJsSinglePlatformModuleConfigurator,
|
||||
template = ReactJsClientTemplate(),
|
||||
sourcesets = SourcesetType.ALL.map { type ->
|
||||
Sourceset(type, dependencies = emptyList())
|
||||
},
|
||||
subModules = emptyList()
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
object MultiplatformMobileApplicationProjectTemplate : ProjectTemplate() {
|
||||
override val title = KotlinNewProjectWizardBundle.message("project.template.mpp.mobile.title")
|
||||
override val description = KotlinNewProjectWizardBundle.message("project.template.mpp.mobile.description")
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ class ReactJsClientTemplate : JsClientTemplate() {
|
||||
buildList {
|
||||
val hasKtorServNeighbourTarget = hasKtorServNeighbourTarget(module)
|
||||
if (!hasKtorServNeighbourTarget) {
|
||||
+(FileTemplateDescriptor("$id/index.html.vm") asResourceOf SourcesetType.main)
|
||||
+(FileTemplateDescriptor("jsClient/index.html.vm") asResourceOf SourcesetType.main)
|
||||
}
|
||||
+(FileTemplateDescriptor("$id/reactClient.kt.vm", "client.kt".asPath()) asSrcOf SourcesetType.main)
|
||||
+(FileTemplateDescriptor("$id/reactComponent.kt.vm", "welcome.kt".asPath()) asSrcOf SourcesetType.main)
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ class SimpleJsClientTemplate : JsClientTemplate() {
|
||||
buildList {
|
||||
val hasKtorServNeighbourTarget = hasKtorServNeighbourTarget(module)
|
||||
if (!hasKtorServNeighbourTarget) {
|
||||
+(FileTemplateDescriptor("$id/index.html.vm") asResourceOf SourcesetType.main)
|
||||
+(FileTemplateDescriptor("jsClient/index.html.vm") asResourceOf SourcesetType.main)
|
||||
}
|
||||
if (useKotlinxHtml.reference.settingValue()) {
|
||||
+(FileTemplateDescriptor("$id/client.kt.vm") asSrcOf SourcesetType.main)
|
||||
|
||||
Reference in New Issue
Block a user