Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
schbrain-archetype-initializer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
schbrain-archetype-initializer
Commits
b78ff402
Commit
b78ff402
authored
Mar 27, 2022
by
liaozan
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add more options for generate
parent
9b4df313
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
211 additions
and
220 deletions
+211
-220
initializer-backend/pom.xml
initializer-backend/pom.xml
+0
-8
initializer-backend/src/main/java/com/schbrain/archetype/initializer/param/ArchetypeGenerateParam.java
...n/archetype/initializer/param/ArchetypeGenerateParam.java
+3
-2
initializer-ui/babel.config.js
initializer-ui/babel.config.js
+1
-1
initializer-ui/package.json
initializer-ui/package.json
+2
-4
initializer-ui/src/App.vue
initializer-ui/src/App.vue
+185
-5
initializer-ui/src/components/BackendStarter.vue
initializer-ui/src/components/BackendStarter.vue
+0
-183
initializer-ui/src/main.js
initializer-ui/src/main.js
+0
-2
initializer-ui/src/router/index.js
initializer-ui/src/router/index.js
+0
-15
pom.xml
pom.xml
+20
-0
No files found.
initializer-backend/pom.xml
View file @
b78ff402
...
...
@@ -26,29 +26,21 @@
<groupId>
com.schbrain.framework
</groupId>
<artifactId>
logger-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.maven
</groupId>
<artifactId>
maven-embedder
</artifactId>
<version>
${maven-embedder.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.maven
</groupId>
<artifactId>
maven-compat
</artifactId>
<version>
${maven-embedder.version}
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.aether
</groupId>
<artifactId>
aether-connector-basic
</artifactId>
<version>
${aether.version}
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.aether
</groupId>
<artifactId>
aether-transport-http
</artifactId>
<version>
${aether.version}
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.jgit
</groupId>
...
...
initializer-backend/src/main/java/com/schbrain/archetype/initializer/param/ArchetypeGenerateParam.java
View file @
b78ff402
package
com.schbrain.archetype.initializer.param
;
import
lombok.Data
;
import
org.springframework.util.StringUtils
;
import
javax.validation.constraints.NotBlank
;
...
...
@@ -37,7 +38,7 @@ public class ArchetypeGenerateParam {
private
String
subModuleNamePrefix
;
public
String
getSubModuleNamePrefix
()
{
if
(
this
.
subModuleNamePrefix
==
null
)
{
if
(
!
StringUtils
.
hasText
(
this
.
subModuleNamePrefix
)
)
{
if
(
this
.
artifactId
.
contains
(
DELIMITER
))
{
this
.
subModuleNamePrefix
=
this
.
artifactId
.
split
(
DELIMITER
)[
1
];
}
else
{
...
...
@@ -48,7 +49,7 @@ public class ArchetypeGenerateParam {
}
public
String
getPackageName
()
{
if
(
this
.
packageName
==
null
)
{
if
(
!
StringUtils
.
hasText
(
this
.
packageName
)
)
{
this
.
packageName
=
String
.
format
(
"%s.%s"
,
this
.
groupId
,
this
.
getSubModuleNamePrefix
());
}
return
this
.
packageName
;
...
...
initializer-ui/babel.config.js
View file @
b78ff402
initializer-ui/package.json
View file @
b78ff402
...
...
@@ -9,10 +9,8 @@
},
"dependencies"
:
{
"axios"
:
"^0.26.1"
,
"core-js"
:
"^3.21.1"
,
"element-plus"
:
"^2.1.4"
,
"vue"
:
"^3.2.31"
,
"vue-router"
:
"^4.0.14"
"element-plus"
:
"^2.1.6"
,
"vue"
:
"^3.2.31"
},
"devDependencies"
:
{
"@babel/core"
:
"^7.17.8"
,
...
...
initializer-ui/src/App.vue
View file @
b78ff402
<
template
>
<BackendStarter/>
<div
id=
"form"
class=
"form"
>
<p
class=
"form-title"
>
项目初始代码生成
</p>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-group"
>
GroupId
</label>
<input
id=
"input-group"
v-model=
"form.groupId"
class=
"form-input"
type=
"text"
>
</div>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-artifact"
>
ArtifactId
</label>
<input
id=
"input-artifact"
v-model=
"form.artifactId"
class=
"form-input"
type=
"text"
>
</div>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-version"
>
Version
</label>
<input
id=
"input-version"
v-model=
"form.version"
class=
"form-input"
type=
"text"
>
</div>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-packageName"
>
PackageName
</label>
<input
id=
"input-packageName"
v-model=
"form.packageName"
class=
"form-input"
placeholder=
"默认为 GroupId"
type=
"text"
>
</div>
<input
class=
"form-submit"
type=
"button"
value=
"生成"
@
click=
"submit"
>
<input
:disabled=
"this.id === null"
class=
"form-submit"
type=
"button"
value=
"预览"
@
click=
"preview"
>
<input
:disabled=
"this.id === null"
class=
"form-submit"
type=
"button"
value=
"下载"
@
click=
"download"
>
<el-dialog
v-model=
"dialogVisible"
title=
"预览"
width=
"30%"
>
<el-tree
:data=
"treeData"
:props=
"defaultProps"
@
node-click=
"handleNodeClick"
/>
<template
#footer
>
<span
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"dialogVisible = false"
>
关闭
</el-button>
</span>
</
template
>
</el-dialog>
</div>
</template>
<
script
>
import
BackendStarter
from
'
./components/BackendStarter
'
import
axios
from
'
./util/request
'
import
{
ElMessageBox
}
from
'
element-plus
'
export
default
{
components
:
{
BackendStarter
name
:
"
BackendStarter
"
,
data
()
{
return
{
id
:
null
,
dialogVisible
:
false
,
fileContentDialogVisible
:
false
,
fileContent
:
''
,
defaultProps
:
{
children
:
'
children
'
,
label
:
'
fileName
'
,
},
treeData
:
[],
form
:
{
groupId
:
''
,
artifactId
:
''
,
version
:
'
1.0.0-SNAPSHOT
'
,
packageName
:
''
,
}
}
},
methods
:
{
submit
:
function
()
{
axios
.
post
(
'
/archetype/generate
'
,
this
.
form
).
then
(
res
=>
{
this
.
id
=
res
.
data
.
result
},
error
=>
{
ElMessageBox
.
alert
(
error
.
data
.
message
)
})
},
preview
:
function
()
{
axios
.
get
(
`/archetype/preview/
${
this
.
id
}
`
,
this
.
form
).
then
(
res
=>
{
this
.
treeData
=
res
.
data
.
result
this
.
dialogVisible
=
true
},
error
=>
{
ElMessageBox
.
alert
(
error
.
data
.
message
)
})
},
download
:
function
()
{
axios
.
get
(
`/archetype/download/
${
this
.
id
}
`
,
{
responseType
:
'
blob
'
}).
then
(
res
=>
{
const
{
headers
,
data
}
=
res
const
fileName
=
headers
[
'
content-disposition
'
].
replace
(
/
\w
+;
\s
filename="
(
.*
)
"/
,
'
$1
'
)
this
.
downloadGeneratedProject
(
data
,
fileName
);
},
error
=>
{
const
reader
=
new
FileReader
();
reader
.
readAsText
(
error
.
data
,
'
utf-8
'
);
reader
.
onload
=
function
()
{
ElMessageBox
.
alert
(
JSON
.
parse
(
reader
.
result
).
message
,
'
提示
'
,
{
confirmButtonText
:
'
确定
'
})
}
})
},
handleNodeClick
:
function
(
data
)
{
const
{
file
,
fileContent
}
=
data
if
(
!
file
)
{
return
}
this
.
fileContentDialogVisible
=
true
this
.
fileContent
=
fileContent
},
downloadGeneratedProject
:
function
(
data
,
fileName
)
{
const
blob
=
new
Blob
([
data
])
const
link
=
document
.
createElement
(
'
a
'
);
link
.
style
.
display
=
"
none
"
;
link
.
href
=
URL
.
createObjectURL
(
blob
);
link
.
download
=
fileName
;
document
.
body
.
appendChild
(
link
);
link
.
click
();
URL
.
revokeObjectURL
(
link
.
href
);
document
.
body
.
removeChild
(
link
);
}
}
}
</
script
>
<
style
scoped
>
.form
{
text-align
:
center
;
margin
:
80px
auto
;
max-width
:
500px
;
background
:
#FFF
;
padding
:
30px
;
box-shadow
:
rgba
(
187
,
187
,
187
,
1
)
0
0
20px
-1px
;
-webkit-box-shadow
:
rgba
(
187
,
187
,
187
,
1
)
0
0
20px
-1px
;
font
:
14px
Arial
,
Helvetica
,
sans-serif
;
border-radius
:
10px
;
-webkit-border-radius
:
10px
;
}
.form-title
{
font-size
:
20px
;
margin-top
:
0
;
}
.form-div
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
10px
;
}
.form-label
{
width
:
150px
;
}
.form-input
{
color
:
#555
;
width
:
100%
;
padding
:
3px
10px
;
margin-top
:
10px
;
margin-right
:
6px
;
margin-bottom
:
10px
;
border
:
1px
solid
#9a9191
;
background
:
transparent
;
height
:
25px
;
line-height
:
15px
;
outline
:
0
;
border-radius
:
10px
;
-webkit-border-radius
:
10px
;
}
.form-submit
{
margin
:
10px
5px
0
5px
;
background
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0.05
,
#ff5bb0
),
color-stop
(
1
,
#ef027d
));
border-radius
:
9px
;
-webkit-border-radius
:
9px
;
border
:
1px
solid
#ee1eb5
;
display
:
inline-block
;
color
:
#ffffff
;
font-size
:
15px
;
font-weight
:
bold
;
font-style
:
normal
;
height
:
35px
;
line-height
:
30px
;
width
:
60px
;
text-decoration
:
none
;
text-shadow
:
1px
1px
0
#c70067
;
cursor
:
pointer
;
}
.form-submit
:disabled
{
background
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0.05
,
#000000
),
color-stop
(
1
,
#000000
));
border
:
1px
solid
#000000
;
text-shadow
:
1px
1px
0
#000000
;
cursor
:
not-allowed
;
}
</
style
>
\ No newline at end of file
initializer-ui/src/components/BackendStarter.vue
deleted
100644 → 0
View file @
9b4df313
<!--suppress JSCheckFunctionSignatures -->
<
template
>
<div
id=
"form"
class=
"form"
>
<p
class=
"form-title"
>
项目初始代码生成
</p>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-group"
>
GroupId
</label>
<input
id=
"input-group"
v-model=
"form.groupId"
class=
"form-input"
type=
"text"
>
</div>
<div
class=
"form-div"
>
<label
class=
"form-label"
for=
"input-artifact"
>
ArtifactId
</label>
<input
id=
"input-artifact"
v-model=
"form.artifactId"
class=
"form-input"
type=
"text"
>
</div>
<input
class=
"form-submit"
type=
"button"
value=
"生成"
@
click=
"submit"
>
<input
:disabled=
"this.id === null"
class=
"form-submit"
type=
"button"
value=
"预览"
@
click=
"preview"
>
<input
:disabled=
"this.id === null"
class=
"form-submit"
type=
"button"
value=
"下载"
@
click=
"download"
>
<el-dialog
v-model=
"dialogVisible"
title=
"预览"
width=
"30%"
>
<el-tree
:data=
"treeData"
:props=
"defaultProps"
@
node-click=
"handleNodeClick"
/>
<template
#footer
>
<span
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"dialogVisible = false"
>
关闭
</el-button>
</span>
</
template
>
</el-dialog>
</div>
</template>
<
script
>
import
axios
from
'
../util/request
'
import
{
ElMessageBox
}
from
'
element-plus
'
export
default
{
name
:
"
BackendStarter
"
,
data
()
{
return
{
id
:
null
,
dialogVisible
:
false
,
fileContentDialogVisible
:
false
,
fileContent
:
''
,
defaultProps
:
{
children
:
'
children
'
,
label
:
'
fileName
'
,
},
treeData
:
[],
form
:
{
groupId
:
''
,
artifactId
:
''
,
}
}
},
methods
:
{
submit
:
function
()
{
axios
.
post
(
'
/archetype/generate
'
,
this
.
form
).
then
(
res
=>
{
this
.
id
=
res
.
data
.
result
},
error
=>
{
ElMessageBox
.
alert
(
error
.
data
.
message
)
})
},
preview
:
function
()
{
axios
.
get
(
`/archetype/preview/
${
this
.
id
}
`
,
this
.
form
).
then
(
res
=>
{
this
.
treeData
=
res
.
data
.
result
this
.
dialogVisible
=
true
},
error
=>
{
ElMessageBox
.
alert
(
error
.
data
.
message
)
})
},
download
:
function
()
{
axios
.
get
(
`/archetype/download/
${
this
.
id
}
`
,
{
responseType
:
'
blob
'
}).
then
(
res
=>
{
const
{
headers
,
data
}
=
res
const
fileName
=
headers
[
'
content-disposition
'
].
replace
(
/
\w
+;
\s
filename="
(
.*
)
"/
,
'
$1
'
)
this
.
downloadGeneratedProject
(
data
,
fileName
);
},
error
=>
{
const
reader
=
new
FileReader
();
reader
.
readAsText
(
error
.
data
,
'
utf-8
'
);
reader
.
onload
=
function
()
{
ElMessageBox
.
alert
(
JSON
.
parse
(
reader
.
result
).
message
,
'
提示
'
,
{
confirmButtonText
:
'
确定
'
})
}
})
},
handleNodeClick
:
function
(
data
)
{
const
{
file
,
fileContent
}
=
data
if
(
!
file
)
{
return
}
this
.
fileContentDialogVisible
=
true
this
.
fileContent
=
fileContent
},
downloadGeneratedProject
:
function
(
data
,
fileName
)
{
const
blob
=
new
Blob
([
data
])
const
link
=
document
.
createElement
(
'
a
'
);
link
.
style
.
display
=
"
none
"
;
link
.
href
=
URL
.
createObjectURL
(
blob
);
link
.
download
=
fileName
;
document
.
body
.
appendChild
(
link
);
link
.
click
();
URL
.
revokeObjectURL
(
link
.
href
);
document
.
body
.
removeChild
(
link
);
}
}
}
</
script
>
<
style
scoped
>
.form
{
text-align
:
center
;
margin-left
:
auto
;
margin-right
:
auto
;
margin-top
:
50px
;
max-width
:
500px
;
background
:
#FFF
;
padding
:
30px
30px
20px
30px
;
box-shadow
:
rgba
(
187
,
187
,
187
,
1
)
0
0
20px
-1px
;
-webkit-box-shadow
:
rgba
(
187
,
187
,
187
,
1
)
0
0
20px
-1px
;
font
:
14px
Arial
,
Helvetica
,
sans-serif
;
border-radius
:
10px
;
-webkit-border-radius
:
10px
;
}
.form-title
{
font-size
:
20px
;
}
.form-div
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
10px
;
}
.form-label
{
width
:
150px
;
}
.form-input
{
color
:
#555
;
width
:
100%
;
padding
:
3px
0
3px
5px
;
margin-top
:
10px
;
margin-right
:
6px
;
margin-bottom
:
10px
;
border
:
1px
solid
#9a9191
;
background
:
transparent
;
height
:
25px
;
line-height
:
15px
;
outline
:
0
;
border-radius
:
10px
;
-webkit-border-radius
:
10px
;
}
.form-submit
{
margin
:
10px
5px
0
5px
;
background
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0.05
,
#ff5bb0
),
color-stop
(
1
,
#ef027d
));
border-radius
:
9px
;
-webkit-border-radius
:
9px
;
border
:
1px
solid
#ee1eb5
;
display
:
inline-block
;
color
:
#ffffff
;
font-size
:
15px
;
font-weight
:
bold
;
font-style
:
normal
;
height
:
35px
;
line-height
:
30px
;
width
:
60px
;
text-decoration
:
none
;
text-shadow
:
1px
1px
0
#c70067
;
cursor
:
pointer
;
}
.form-submit
:disabled
{
background
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0.05
,
#000000
),
color-stop
(
1
,
#000000
));
border
:
1px
solid
#000000
;
text-shadow
:
1px
1px
0
#000000
;
cursor
:
not-allowed
;
}
</
style
>
\ No newline at end of file
initializer-ui/src/main.js
View file @
b78ff402
import
{
createApp
}
from
'
vue
'
import
ElementPlus
from
'
element-plus
'
import
'
element-plus/dist/index.css
'
import
vRouter
from
'
./router
'
import
App
from
'
./App.vue
'
const
app
=
createApp
(
App
)
app
.
use
(
vRouter
)
app
.
use
(
ElementPlus
)
app
.
mount
(
'
#app
'
)
\ No newline at end of file
initializer-ui/src/router/index.js
deleted
100644 → 0
View file @
9b4df313
import
BackendStarter
from
"
@/components/BackendStarter
"
;
import
{
createRouter
,
createWebHistory
}
from
'
vue-router
'
const
routes
=
[
{
path
:
'
/
'
,
component
:
BackendStarter
},
]
const
options
=
{
history
:
createWebHistory
(),
routes
,
}
const
router
=
createRouter
(
options
)
export
default
router
\ No newline at end of file
pom.xml
View file @
b78ff402
...
...
@@ -40,6 +40,26 @@
<artifactId>
initializer-backend
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.maven
</groupId>
<artifactId>
maven-embedder
</artifactId>
<version>
${maven-embedder.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.maven
</groupId>
<artifactId>
maven-compat
</artifactId>
<version>
${maven-embedder.version}
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.aether
</groupId>
<artifactId>
aether-connector-basic
</artifactId>
<version>
${aether.version}
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.aether
</groupId>
<artifactId>
aether-transport-http
</artifactId>
<version>
${aether.version}
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment