new-vscode-project template command

This commit is contained in:
2023-03-18 18:05:58 -06:00
parent 2d2c11df9f
commit c1df082448
3 changed files with 36 additions and 3 deletions

View File

@@ -39,6 +39,8 @@ class Main {
newFlixelProject(args);
case "new-express-project":
newExpressProject(args);
case "new-vscode-project":
newVscodeProject(args);
case "implement":
// kiss implement [type] [fromLib]
var _pwd = args.pop();
@@ -197,7 +199,30 @@ class Main {
makeFileForNewProject(["package.json"]);
var packageFile = Path.join([projectDir, "package.json"]);
var packageJson = Json.parse(File.getContent(packageFile));
packageJson.title = title;
packageJson.name = title;
File.saveContent(packageFile, Json.stringify(packageJson, null, "\t"));
makeFileForNewProject(["test.sh"]);
}
static function newVscodeProject(args:Array<String>) {
var title = promptFor("title (lower-case!)").toLowerCase();
var pkg = title.replace("-", "_");
var kissVscodeApiLibPath = new Process("haxelib", ["libpath", "kiss-vscode-api"]).stdout.readAll().toString().trim();
var workingDir = Sys.args().pop();
var projectDir = Path.join([workingDir, title]);
FileSystem.createDirectory(projectDir);
var makeFileForNewProject:haxe.Constraints.Function = _makeFileForNewProject.bind(kissVscodeApiLibPath, _, workingDir, title, pkg);
var makeFolderForNewProject:haxe.Constraints.Function = _makeFolderForNewProject.bind(kissVscodeApiLibPath, _, workingDir, title, pkg);
makeFolderForNewProject(["src"]);
makeFileForNewProject([".gitignore"]);
makeFileForNewProject([".vscodeignore"]);
makeFileForNewProject(["README.md"]);
makeFileForNewProject(["build.hxml"]);
makeFileForNewProject(["package.json"]);
var packageFile = Path.join([projectDir, "package.json"]);
var packageJson = Json.parse(File.getContent(packageFile));
packageJson.name = title;
File.saveContent(packageFile, Json.stringify(packageJson, null, "\t"));
makeFileForNewProject(["test.sh"]);
}

View File

@@ -6,4 +6,13 @@
(printThroughInfoMessage)
// Add your extension's commands here with (defCommand <...>):
// (defCommand context yourExt.exampleCommand "An example command for your extension" "C-; C-1" [] (doSomething))
// Add your extension's configuration here with (defConfiguration <...>):
// (defConfiguration
// :Bool configBool
// (object
// default false)
// :String configString
// (object
// default ""))
)

View File

@@ -1,8 +1,7 @@
{
"main": "index.js",
"name": "ksr_express",
"name": "ksr-express",
"description": "An ExpressJS website made with Kisslang",
"title": "ksr-express",
"dependencies": {
"express": "^4.18.1",
"@types/express": "^4.17.13"