42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { Cliffy, Path, FS, Compress, Base64 } from "../deps.ts";
|
|
import {
|
|
getMeta,
|
|
setMeta,
|
|
IMeta,
|
|
getConfig,
|
|
isInteractive,
|
|
} from "../global.ts";
|
|
|
|
export default async function init() {
|
|
let existing = {};
|
|
try {
|
|
existing = await getMeta();
|
|
} catch (err) {}
|
|
let meta: IMeta = {
|
|
name: Path.basename(Deno.cwd()).toLowerCase().replace(/\s+/g, "-"),
|
|
version: "0.0.1",
|
|
description: "",
|
|
author: getConfig("author"),
|
|
contributors: [],
|
|
files: ["**/*.ts", "**/*.js"],
|
|
...existing,
|
|
};
|
|
|
|
if (isInteractive()) {
|
|
meta.name = await Cliffy.Input.prompt({
|
|
message: "What's the name of your package?",
|
|
default: meta.name,
|
|
});
|
|
meta.description = await Cliffy.Input.prompt({
|
|
message: "What's the description of your package?",
|
|
default: meta.description,
|
|
});
|
|
meta.author = await Cliffy.Input.prompt({
|
|
message: "Who's the author of your package?",
|
|
default: meta.author,
|
|
});
|
|
}
|
|
|
|
await setMeta(meta);
|
|
}
|