Replace toml config with a javascript file
This commit is contained in:
@@ -19,29 +19,15 @@ class NewCommand(private val generators: Generators) : CliktCommand("new") {
|
||||
|
||||
Files.createDirectories(root)
|
||||
|
||||
val configFile = """
|
||||
templates = [
|
||||
"README.md"
|
||||
]
|
||||
|
||||
files = [
|
||||
".gitignore"
|
||||
]
|
||||
|
||||
[prompt]
|
||||
fun resource(path: String) = javaClass.getResource("/$path").readText()
|
||||
|
||||
[[prompt.project]]
|
||||
type = "String"
|
||||
name = "name"
|
||||
info = "Project name"
|
||||
""".trimIndent()
|
||||
Files.writeString(root.resolve("index.js"), resource("init/index.js"))
|
||||
Files.writeString(root.resolve("index.d.ts"), resource("init/index.d.ts"))
|
||||
|
||||
Files.writeString(root.resolve("config.toml"), configFile)
|
||||
val tree = root.resolve("tree")
|
||||
Files.createDirectory(tree)
|
||||
|
||||
Files.writeString(tree.resolve("README.md"), "# {{ project.name }}")
|
||||
Files.writeString(tree.resolve(".gitignore"), "# https://git-scm.com/docs/gitignore")
|
||||
Files.writeString(tree.resolve("README.md"), resource("init/README.md"))
|
||||
|
||||
echo("Generator created in $root")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user