-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.ts
93 lines (86 loc) · 2.28 KB
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright © 2022 Dpm Land. All Rights Reserved.
import { CompileApp } from './src/compiler.ts';
import { MoveTheBinary } from './src/copy.ts';
import figlet from 'https://x.nest.land/deno-figlet@0.0.5/mod.js';
import * as colors from 'https://deno.land/std@0.158.0/fmt/colors.ts';
/*
* Add the Types for the Params in the Function!
*/
interface MonkTypes {
versions: {
downloadVersion: 'canary' | 'stable';
canary: {
url: string;
branch: string;
};
stable: {
url: string;
branch: string;
};
};
files: {
appName: string;
stable: {
importMapFile: string;
mainFile: string;
};
canary: {
importMapFile: string;
mainFile: string;
};
};
social?: {
github?: string;
discord?: string;
errors?: string;
};
}
/**
* Make the Monk Setup Function
*/
export async function Monk(options: MonkTypes) {
console.log(
colors.cyan(colors.dim('Made with Monk: github.com/dpmland/monk')),
);
console.log(
colors.brightGreen(
await figlet(`${options.files.appName.toLowerCase()}`),
),
);
await CompileApp({
typeInstall: options.versions.downloadVersion,
stableURL: options.versions.stable.url,
stableBranch: options.versions.stable.branch,
canaryURL: options.versions.canary.url,
canaryBranch: options.versions.canary.branch,
files: {
stable: {
importMapFile: options.files.stable.importMapFile,
mainFile: options.files.stable.mainFile,
fileOut: options.files.appName,
},
canary: {
importMapFile: options.files.canary.importMapFile,
mainFile: options.files.canary.mainFile,
fileOut: options.files.appName,
},
},
});
await MoveTheBinary({
version: options.versions.downloadVersion,
appName: options.files.appName,
files: {
compiledFilename: options.files.appName,
},
});
if (typeof options.social != 'undefined') {
console.log(
colors.bold(
colors.brightGreen('Done! If you want know more check this links!!'),
),
);
console.log(`GitHub: ${colors.underline(options.social?.errors!)}`);
console.log(`Issue: ${colors.underline(options.social?.errors!)}`);
console.log(`Discord: ${colors.underline(options.social?.discord!)}`);
}
}