@evitcastudio/kit 2.3.2 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bundle/cli/cli.js +60 -4
- package/lib/cli/init.d.ts.map +1 -1
- package/lib/cli/init.js +44 -1
- package/package.json +1 -1
package/lib/bundle/cli/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
|
-
* @evitcastudio/kit@
|
|
5
|
-
* Compiled Fri, 20 Mar 2026
|
|
4
|
+
* @evitcastudio/kit@3.0.1 git+https://github.com/EvitcaStudio/Kit.git
|
|
5
|
+
* Compiled Fri, 20 Mar 2026 19:02:00 UTC
|
|
6
6
|
* Copyright (c) 2026 Jared Bates, Evitca Studio, "doubleactii"
|
|
7
7
|
*
|
|
8
8
|
* @evitcastudio/kit is licensed under the MIT License.
|
|
@@ -3512,6 +3512,25 @@ var Gt = (e = "", r) => {
|
|
|
3512
3512
|
${t("gray", x2)} ` : "";
|
|
3513
3513
|
s.write(`${i}${e}
|
|
3514
3514
|
|
|
3515
|
+
`);
|
|
3516
|
+
};
|
|
3517
|
+
var jt = (e) => t("dim", e);
|
|
3518
|
+
var kt2 = (e, r, s) => {
|
|
3519
|
+
const i = { hard: true, trim: false }, a = J2(e, r, i).split(`
|
|
3520
|
+
`), o = a.reduce((n, c) => Math.max(D2(c), n), 0), u = a.map(s).reduce((n, c) => Math.max(D2(c), n), 0), l = r - (u - o);
|
|
3521
|
+
return J2(e, l, i);
|
|
3522
|
+
};
|
|
3523
|
+
var Vt2 = (e = "", r = "", s) => {
|
|
3524
|
+
const i = s?.output ?? N2.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? jt, u = ["", ...kt2(e, rt(i) - 6, o).split(`
|
|
3525
|
+
`).map(o), ""], l = D2(r), n = Math.max(u.reduce((g, E) => {
|
|
3526
|
+
const $ = D2(E);
|
|
3527
|
+
return $ > g ? $ : g;
|
|
3528
|
+
}, 0), l) + 2, c = u.map((g) => `${t("gray", h)} ${g}${" ".repeat(n - D2(g))}${t("gray", h)}`).join(`
|
|
3529
|
+
`), p = a ? `${t("gray", h)}
|
|
3530
|
+
` : "", f = a ? We : ge;
|
|
3531
|
+
i.write(`${p}${t("green", V)} ${t("reset", r)} ${t("gray", se.repeat(Math.max(n - l - 1, 1)) + pe)}
|
|
3532
|
+
${c}
|
|
3533
|
+
${t("gray", f + se.repeat(n + 2) + me)}
|
|
3515
3534
|
`);
|
|
3516
3535
|
};
|
|
3517
3536
|
var Kt = (e) => t("magenta", e);
|
|
@@ -3653,11 +3672,12 @@ ${l}
|
|
|
3653
3672
|
import fs2 from "node:fs";
|
|
3654
3673
|
import path from "node:path";
|
|
3655
3674
|
import { fileURLToPath } from "node:url";
|
|
3656
|
-
import { spawnSync } from "node:child_process";
|
|
3675
|
+
import { spawnSync, execSync } from "node:child_process";
|
|
3676
|
+
import os2 from "node:os";
|
|
3657
3677
|
// package.json
|
|
3658
3678
|
var package_default = {
|
|
3659
3679
|
name: "@evitcastudio/kit",
|
|
3660
|
-
version: "
|
|
3680
|
+
version: "3.0.1",
|
|
3661
3681
|
author: "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
|
|
3662
3682
|
main: "./lib/index.js",
|
|
3663
3683
|
types: "./lib/index.d.ts",
|
|
@@ -3742,6 +3762,20 @@ function getGitUser() {
|
|
|
3742
3762
|
return "Author";
|
|
3743
3763
|
}
|
|
3744
3764
|
}
|
|
3765
|
+
function checkBun() {
|
|
3766
|
+
const result = spawnSync("bun", ["--version"], { stdio: "ignore", shell: true });
|
|
3767
|
+
return !result.error && result.status === 0;
|
|
3768
|
+
}
|
|
3769
|
+
function installBun() {
|
|
3770
|
+
const isWindows = os2.platform() === "win32";
|
|
3771
|
+
const command = isWindows ? 'powershell -c "irm bun.sh/install.ps1 | iex"' : "curl -fsSL https://bun.sh/install | bash";
|
|
3772
|
+
try {
|
|
3773
|
+
execSync(command, { stdio: "inherit" });
|
|
3774
|
+
return true;
|
|
3775
|
+
} catch {
|
|
3776
|
+
return false;
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3745
3779
|
function copyTemplate(pSrc, pDest, pProjectName, pVersion, pAuthor) {
|
|
3746
3780
|
if (!fs2.existsSync(pDest)) {
|
|
3747
3781
|
fs2.mkdirSync(pDest, { recursive: true });
|
|
@@ -3773,6 +3807,28 @@ function copyTemplate(pSrc, pDest, pProjectName, pVersion, pAuthor) {
|
|
|
3773
3807
|
}
|
|
3774
3808
|
async function processInit(pOptions) {
|
|
3775
3809
|
Wt2(source_default.cyan(`Kit CLI v${package_default.version}`));
|
|
3810
|
+
if (!checkBun()) {
|
|
3811
|
+
Vt2(`Kit requires the Bun runtime to build and run projects.
|
|
3812
|
+
You can download it manually at ${source_default.cyan("https://bun.sh/")}`, "Bun Not Found");
|
|
3813
|
+
const install = await Rt({
|
|
3814
|
+
message: "Would you like to install Bun automatically now?",
|
|
3815
|
+
initialValue: true
|
|
3816
|
+
});
|
|
3817
|
+
if (Ct(install) || !install) {
|
|
3818
|
+
Nt(`Please install Bun manually to use Kit: ${source_default.cyan("https://bun.sh/")}
|
|
3819
|
+
Note: Kit projects cannot build or run without Bun.`);
|
|
3820
|
+
process.exit(1);
|
|
3821
|
+
}
|
|
3822
|
+
const sInstall = be();
|
|
3823
|
+
sInstall.start("Installing Bun...");
|
|
3824
|
+
const success = installBun();
|
|
3825
|
+
if (!success) {
|
|
3826
|
+
sInstall.stop(source_default.red("Automatic installation failed."));
|
|
3827
|
+
Vt2(`Please install Bun manually: ${source_default.cyan("https://bun.sh/")}`, "Manual Installation Required");
|
|
3828
|
+
process.exit(1);
|
|
3829
|
+
}
|
|
3830
|
+
sInstall.stop();
|
|
3831
|
+
}
|
|
3776
3832
|
let projectName = pOptions.projectName;
|
|
3777
3833
|
let gameType = "single";
|
|
3778
3834
|
if (!pOptions.single && !pOptions.multi && !projectName) {
|
package/lib/cli/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAyFD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA8JtE"}
|
package/lib/cli/init.js
CHANGED
|
@@ -3,7 +3,8 @@ import chalk from 'chalk';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import { spawnSync, execSync } from 'node:child_process';
|
|
7
|
+
import os from 'node:os';
|
|
7
8
|
import packageJSON from '../../package.json';
|
|
8
9
|
/**
|
|
9
10
|
* Gets the git user name and email from the local system.
|
|
@@ -22,6 +23,27 @@ function getGitUser() {
|
|
|
22
23
|
return 'Author';
|
|
23
24
|
}
|
|
24
25
|
}
|
|
26
|
+
function checkBun() {
|
|
27
|
+
const result = spawnSync('bun', ['--version'], { stdio: 'ignore', shell: true });
|
|
28
|
+
return !result.error && result.status === 0;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Installs Bun using the official installation scripts.
|
|
32
|
+
* @returns True if the installation was successful.
|
|
33
|
+
*/
|
|
34
|
+
function installBun() {
|
|
35
|
+
const isWindows = os.platform() === 'win32';
|
|
36
|
+
const command = isWindows
|
|
37
|
+
? 'powershell -c "irm bun.sh/install.ps1 | iex"'
|
|
38
|
+
: 'curl -fsSL https://bun.sh/install | bash';
|
|
39
|
+
try {
|
|
40
|
+
execSync(command, { stdio: 'inherit' });
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
25
47
|
/**
|
|
26
48
|
* Recursively copy template files and replace placeholders.
|
|
27
49
|
* @param pSrc - Source template directory.
|
|
@@ -70,6 +92,27 @@ function copyTemplate(pSrc, pDest, pProjectName, pVersion, pAuthor) {
|
|
|
70
92
|
*/
|
|
71
93
|
export async function processInit(pOptions) {
|
|
72
94
|
intro(chalk.cyan(`Kit CLI v${packageJSON.version}`));
|
|
95
|
+
// Environment Check
|
|
96
|
+
if (!checkBun()) {
|
|
97
|
+
note(`Kit requires the Bun runtime to build and run projects.\nYou can download it manually at ${chalk.cyan('https://bun.sh/')}`, 'Bun Not Found');
|
|
98
|
+
const install = await confirm({
|
|
99
|
+
message: 'Would you like to install Bun automatically now?',
|
|
100
|
+
initialValue: true,
|
|
101
|
+
});
|
|
102
|
+
if (isCancel(install) || !install) {
|
|
103
|
+
cancel(`Please install Bun manually to use Kit: ${chalk.cyan('https://bun.sh/')}\nNote: Kit projects cannot build or run without Bun.`);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
const sInstall = spinner();
|
|
107
|
+
sInstall.start('Installing Bun...');
|
|
108
|
+
const success = installBun();
|
|
109
|
+
if (!success) {
|
|
110
|
+
sInstall.stop(chalk.red('Automatic installation failed.'));
|
|
111
|
+
note(`Please install Bun manually: ${chalk.cyan('https://bun.sh/')}`, 'Manual Installation Required');
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
sInstall.stop();
|
|
115
|
+
}
|
|
73
116
|
let projectName = pOptions.projectName;
|
|
74
117
|
let gameType = 'single';
|
|
75
118
|
// Interactive Walkthrough
|