🆕 Add new script init-just.ts and update metadata file to include its details
This commit is contained in:
@@ -169,6 +169,15 @@
|
||||
"publish_time": 1775929369681,
|
||||
"update_time": 1776006975912
|
||||
},
|
||||
"init-just.ts": {
|
||||
"script_name": "init-just.ts",
|
||||
"script_length": 1503,
|
||||
"script_sha256": "6e7310da61cc06afed6dde2d78ae69ba85e3905369fa8b44df5e5ca2b3a25e5c",
|
||||
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/init-just.ts",
|
||||
"single_script_file": true,
|
||||
"publish_time": 1776272649361,
|
||||
"update_time": 1776272649361
|
||||
},
|
||||
"init-tsscript.ts": {
|
||||
"script_name": "init-tsscript.ts",
|
||||
"script_length": 1992,
|
||||
|
||||
72
single-scripts/init-just.ts
Executable file
72
single-scripts/init-just.ts
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env runts -- --allow-all
|
||||
|
||||
import {parseArgs} from "jsr:@std/cli/parse-args";
|
||||
import {existsPath, exit, log, writeStringToFile,} from "../libraries/deno-commons-mod.ts";
|
||||
|
||||
const TEMPLATE_JAVA = `_:
|
||||
@just --list
|
||||
|
||||
alias b:=build
|
||||
alias p:=publish
|
||||
alias pub:=publish
|
||||
alias i:=ide
|
||||
|
||||
# Init for IDEA
|
||||
ide:
|
||||
buildj idea
|
||||
|
||||
# Build Project
|
||||
build:
|
||||
buildj clean
|
||||
buildj
|
||||
|
||||
# Build and Publish
|
||||
publish: build
|
||||
hatter repo publish`;
|
||||
|
||||
function parseFlags(): any {
|
||||
const flags = parseArgs(Deno.args, {
|
||||
boolean: ["help", "java"],
|
||||
alias: {
|
||||
h: "help",
|
||||
},
|
||||
});
|
||||
const helpMessage = `init-just.ts - DESCRIPTION
|
||||
|
||||
init-just.ts --java - init java justfile
|
||||
`;
|
||||
if (flags.help) {
|
||||
console.log(helpMessage);
|
||||
exit(0);
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const flags = parseFlags();
|
||||
|
||||
let template = null;
|
||||
if (flags.java) {
|
||||
template = TEMPLATE_JAVA;
|
||||
}
|
||||
if (!template) {
|
||||
log.error("Template not found.");
|
||||
exit(1);
|
||||
}
|
||||
if (await existsPath("justfile")) {
|
||||
log.error("justfile already exists");
|
||||
exit(1);
|
||||
}
|
||||
await writeStringToFile("justfile", template);
|
||||
log.success("justfile write success");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
log.error(err);
|
||||
exit(1);
|
||||
}).then(() => exit(0));
|
||||
|
||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260416T010402+08:00.MEYCIQCBl5jqJiCgiASHYp7g
|
||||
// 3RJDq7H8vkicou6d+eYvd6vftAIhANygF6r1pOYHsdEjasoIvB+oM475zT+9q2kMtc5xXiGL
|
||||
Reference in New Issue
Block a user