@evitcastudio/kit 1.1.2 → 1.1.4
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 +21 -11
- package/lib/kit.d.ts.map +1 -1
- package/lib/kit.js +0 -1
- package/lib/types/shared-types.d.ts +2 -2
- package/lib/types/shared-types.d.ts.map +1 -1
- package/package.json +18 -8
- package/CONTRIBUTING.md +0 -0
- package/bin/cli.ts +0 -71
- package/bin/index.ts +0 -11
- package/bin/resource-builder.ts +0 -219
- package/bin/types/shared-types.ts +0 -10
- package/bun-build.ts +0 -56
- package/bun.lockb +0 -0
- package/bunfig.toml +0 -4
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -85
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1610
- package/docs/classes/index.Kit.html +0 -24
- package/docs/index.html +0 -16
- package/docs/modules/index.html +0 -1
- package/docs/modules/types_shared-types.html +0 -1
- package/docs/modules.html +0 -1
- package/docs/types/types_shared-types.EmitterEvent.html +0 -4
- package/docs/types/types_shared-types.KitPluginConstructor.html +0 -1
- package/docs/types/types_shared-types.Listener.html +0 -1
- package/docs/types/types_shared-types.ResourceData.html +0 -1
- package/docs/variables/types_shared-types.VYLO.html +0 -1
- package/src/event-system.ts +0 -30
- package/src/index.ts +0 -1
- package/src/kit.ts +0 -177
- package/src/types/shared-types.ts +0 -29
- package/src/types/vylo.d.ts +0 -3790
- package/tests/kit-cli.test.ts +0 -75
- package/tests/kit.test.ts +0 -33
- package/tsconfig.json +0 -37
package/lib/bundle/cli/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
|
-
* @evitcastudio/kit@1.1.
|
|
5
|
-
* Compiled
|
|
6
|
-
* Copyright (c)
|
|
4
|
+
* @evitcastudio/kit@1.1.4 git+https://github.com/EvitcaStudio/Kit.git
|
|
5
|
+
* Compiled Wed, 01 Jan 2025 08:27:49 UTC
|
|
6
|
+
* Copyright (c) 2025 Jared Bates, Evitca Studio, "doubleactii"
|
|
7
7
|
*
|
|
8
8
|
* @evitcastudio/kit is licensed under the MIT License.
|
|
9
9
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -2575,7 +2575,7 @@ class KitCLI {
|
|
|
2575
2575
|
// package.json
|
|
2576
2576
|
var package_default = {
|
|
2577
2577
|
name: "@evitcastudio/kit",
|
|
2578
|
-
version: "1.1.
|
|
2578
|
+
version: "1.1.4",
|
|
2579
2579
|
author: "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
|
|
2580
2580
|
main: "./lib/index.js",
|
|
2581
2581
|
types: "./lib/index.d.ts",
|
|
@@ -2600,23 +2600,30 @@ var package_default = {
|
|
|
2600
2600
|
homepage: "https://github.com/EvitcaStudio/Kit",
|
|
2601
2601
|
license: "MIT",
|
|
2602
2602
|
scripts: {
|
|
2603
|
-
prepublishOnly: "bun run build
|
|
2603
|
+
prepublishOnly: "bun run build",
|
|
2604
2604
|
test: "bun test ./tests",
|
|
2605
|
+
lint: "bun eslint ./src",
|
|
2606
|
+
pack: "bun pm pack --dry-run",
|
|
2605
2607
|
"build-types": "bun tsc",
|
|
2606
|
-
|
|
2608
|
+
build: "bun bun-build.ts",
|
|
2607
2609
|
"build-docs": "bun typedoc ./src/index.ts ./src/types/shared-types.ts",
|
|
2608
|
-
"build-all": "bun run build-types && bun run build
|
|
2610
|
+
"build-all": "bun run build-types && bun run build && bun run build-docs"
|
|
2609
2611
|
},
|
|
2610
2612
|
bin: {
|
|
2611
|
-
kit: "
|
|
2613
|
+
kit: "lib/bundle/cli/cli.js"
|
|
2612
2614
|
},
|
|
2613
2615
|
devDependencies: {
|
|
2614
|
-
"@
|
|
2616
|
+
"@eslint/create-config": "1.4.0",
|
|
2617
|
+
"@eslint/js": "^9.17.0",
|
|
2618
|
+
"@evitcastudio/kit-plugin": "^1.0.7",
|
|
2615
2619
|
"@types/bun": "latest",
|
|
2616
2620
|
"@types/node": "^22.10.2",
|
|
2617
2621
|
bun: "^1.1.42",
|
|
2622
|
+
eslint: "^9.17.0",
|
|
2623
|
+
globals: "^15.14.0",
|
|
2618
2624
|
typedoc: "^0.27.5",
|
|
2619
|
-
typescript: "^5.7.2"
|
|
2625
|
+
typescript: "^5.7.2",
|
|
2626
|
+
"typescript-eslint": "^8.19.0"
|
|
2620
2627
|
},
|
|
2621
2628
|
dependencies: {
|
|
2622
2629
|
chalk: "^5.4.0",
|
|
@@ -2625,7 +2632,10 @@ var package_default = {
|
|
|
2625
2632
|
},
|
|
2626
2633
|
directories: {
|
|
2627
2634
|
test: "tests"
|
|
2628
|
-
}
|
|
2635
|
+
},
|
|
2636
|
+
files: [
|
|
2637
|
+
"/lib"
|
|
2638
|
+
]
|
|
2629
2639
|
};
|
|
2630
2640
|
|
|
2631
2641
|
// bin/cli.ts
|
package/lib/kit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../src/kit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,sBAAsB,CAAC;AAe9B,qBAAa,GAAG;IACZ;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,OAAO,CAAiC;IACvD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmC;IAC1D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,MAAM,CAAuC;IAE5D,OAAO;IAIP;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI;IAM3E;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI;IAkBlF;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAInE;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,MAAM,EAAE;IAI7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,IAAI;IAWlB;;;;;MAKE;IACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG,IAAI;IAQ7E;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI;IAOnG;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAiB1B;;OAEG;WACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CA0B7C"}
|
package/lib/kit.js
CHANGED
|
@@ -11,8 +11,8 @@ declare global {
|
|
|
11
11
|
/**
|
|
12
12
|
* The data associated with the event.
|
|
13
13
|
*/
|
|
14
|
-
data?: Record<string,
|
|
15
|
-
} & Record<string,
|
|
14
|
+
data?: Record<string, unknown>;
|
|
15
|
+
} & Record<string, unknown>;
|
|
16
16
|
type ResourceData = {
|
|
17
17
|
resourceIdentifier: string;
|
|
18
18
|
fileName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-types.d.ts","sourceRoot":"","sources":["../../src/types/shared-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"shared-types.d.ts","sourceRoot":"","sources":["../../src/types/shared-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,CAAC,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,YAAY,GAAG;QAChB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE5B,KAAK,YAAY,GAAG;QAChB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAA;KACnB,CAAC;IAEF,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAE9C,KAAK,oBAAoB,CAAC,CAAC,SAAS,SAAS,IAAI,UAAU,CAAC,CAAC;IAE7D,IAAI,IAAI,EAAE,QAAQ,CAAC;CACtB;AAED,YAAY,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evitcastudio/kit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"author": "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -25,23 +25,30 @@
|
|
|
25
25
|
"homepage": "https://github.com/EvitcaStudio/Kit",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"scripts": {
|
|
28
|
-
"prepublishOnly": "bun run build
|
|
28
|
+
"prepublishOnly": "bun run build",
|
|
29
29
|
"test": "bun test ./tests",
|
|
30
|
+
"lint": "bun eslint ./src",
|
|
31
|
+
"pack": "bun pm pack --dry-run",
|
|
30
32
|
"build-types": "bun tsc",
|
|
31
|
-
"build
|
|
33
|
+
"build": "bun bun-build.ts",
|
|
32
34
|
"build-docs": "bun typedoc ./src/index.ts ./src/types/shared-types.ts",
|
|
33
|
-
"build-all": "bun run build-types && bun run build
|
|
35
|
+
"build-all": "bun run build-types && bun run build && bun run build-docs"
|
|
34
36
|
},
|
|
35
37
|
"bin": {
|
|
36
|
-
"kit": "
|
|
38
|
+
"kit": "lib/bundle/cli/cli.js"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
|
-
"@
|
|
41
|
+
"@eslint/create-config": "1.4.0",
|
|
42
|
+
"@eslint/js": "^9.17.0",
|
|
43
|
+
"@evitcastudio/kit-plugin": "^1.0.7",
|
|
40
44
|
"@types/bun": "latest",
|
|
41
45
|
"@types/node": "^22.10.2",
|
|
42
46
|
"bun": "^1.1.42",
|
|
47
|
+
"eslint": "^9.17.0",
|
|
48
|
+
"globals": "^15.14.0",
|
|
43
49
|
"typedoc": "^0.27.5",
|
|
44
|
-
"typescript": "^5.7.2"
|
|
50
|
+
"typescript": "^5.7.2",
|
|
51
|
+
"typescript-eslint": "^8.19.0"
|
|
45
52
|
},
|
|
46
53
|
"dependencies": {
|
|
47
54
|
"chalk": "^5.4.0",
|
|
@@ -50,5 +57,8 @@
|
|
|
50
57
|
},
|
|
51
58
|
"directories": {
|
|
52
59
|
"test": "tests"
|
|
53
|
-
}
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"/lib"
|
|
63
|
+
]
|
|
54
64
|
}
|
package/CONTRIBUTING.md
DELETED
|
File without changes
|
package/bin/cli.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { KitCLI } from '.';
|
|
4
|
-
import './types/shared-types';
|
|
5
|
-
import packageJSON from '../package.json';
|
|
6
|
-
|
|
7
|
-
const program = new Command();
|
|
8
|
-
|
|
9
|
-
program
|
|
10
|
-
.version(`${packageJSON.version}`)
|
|
11
|
-
.description(`Kit - ${packageJSON['cli-description']}`);
|
|
12
|
-
|
|
13
|
-
program
|
|
14
|
-
.option('-i, --in <path>', 'Input directory')
|
|
15
|
-
.option('-o, --out <path>', 'Output directory')
|
|
16
|
-
.option('-is, --ignore-sound', 'Ignore sound files', false)
|
|
17
|
-
.option('-v, --verbose', 'Enable verbose mode', false);
|
|
18
|
-
|
|
19
|
-
program.helpInformation = () => {
|
|
20
|
-
return `
|
|
21
|
-
Kit CLI - ${packageJSON['cli-description']}
|
|
22
|
-
Version: ${packageJSON.version}
|
|
23
|
-
|
|
24
|
-
Usage: kit <command> [options]
|
|
25
|
-
|
|
26
|
-
Commands:
|
|
27
|
-
build Build resources from the specified directory
|
|
28
|
-
--help Display this help message
|
|
29
|
-
|
|
30
|
-
Options:
|
|
31
|
-
-i, --in <path> Input directory (required)
|
|
32
|
-
-o, --out <path> Output directory (required)
|
|
33
|
-
-is, --ignore-sound Ignore sound files (optional)
|
|
34
|
-
-v, --verbose Enable verbose mode for debugging
|
|
35
|
-
|
|
36
|
-
Examples:
|
|
37
|
-
kit build --in ./src --out ./dist --verbose
|
|
38
|
-
kit build --in ./resources --out ./dist --ignore-sound
|
|
39
|
-
`;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// Display help if no command is provided
|
|
43
|
-
if (!process.argv.slice(2).length) {
|
|
44
|
-
program.help();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Build Command
|
|
48
|
-
program
|
|
49
|
-
.command('build')
|
|
50
|
-
.description('Build resources from the specified directory')
|
|
51
|
-
.action(() => {
|
|
52
|
-
const flags = program.opts();
|
|
53
|
-
|
|
54
|
-
if (!flags.in || !flags.out) {
|
|
55
|
-
console.error('Error: --in and --out are required flags for the build command.');
|
|
56
|
-
process.exit(1);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const ProcessOptions: ProcessOptions = {
|
|
60
|
-
inDirectory: flags.in,
|
|
61
|
-
outDirectory: flags.out,
|
|
62
|
-
ignoreSound: flags.ignoreSound || false,
|
|
63
|
-
verbose: flags.verbose || false,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
KitCLI.processResources(ProcessOptions);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
program.parse(process.argv);
|
|
70
|
-
|
|
71
|
-
|
package/bin/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { processResources } from './resource-builder';
|
|
2
|
-
import './types/shared-types';
|
|
3
|
-
|
|
4
|
-
export class KitCLI {
|
|
5
|
-
/**
|
|
6
|
-
* Start resource builder.
|
|
7
|
-
*/
|
|
8
|
-
static async processResources(pProcessOptions: ProcessOptions): Promise<void> {
|
|
9
|
-
await processResources(pProcessOptions);
|
|
10
|
-
}
|
|
11
|
-
}
|
package/bin/resource-builder.ts
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import { join, extname, basename } from 'path';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
-
import './types/shared-types';
|
|
6
|
-
|
|
7
|
-
// Logging helpers
|
|
8
|
-
const log = console.log;
|
|
9
|
-
const info = chalk.hex('#ffa552');
|
|
10
|
-
const error = chalk.hex('#c42847');
|
|
11
|
-
const alert = chalk.hex('#EFF2C0');
|
|
12
|
-
|
|
13
|
-
// Resource types and valid file extensions
|
|
14
|
-
const RESOURCE_TYPES = ['interface', 'icon', 'map', 'sound', 'macros'];
|
|
15
|
-
const VALID_EXTENSIONS = ['vyint', 'vyi', 'vym', 'vymac', 'mp3', 'aac', 'wav', 'm4a', 'ogg', 'flac'] as const;
|
|
16
|
-
|
|
17
|
-
type ResourceJSON = Record<typeof RESOURCE_TYPES[number], { resourceIdentifier: string; fileName: string }[]>;
|
|
18
|
-
|
|
19
|
-
// State variables
|
|
20
|
-
let resourceJSON: ResourceJSON = initializeResourceJSON();
|
|
21
|
-
let isVerbose: boolean | undefined = false;
|
|
22
|
-
let ignoringSound: boolean | undefined = false;
|
|
23
|
-
let resourceInDirectory = '';
|
|
24
|
-
let resourceOutDirectory = '';
|
|
25
|
-
const resourcesToProcess: { filePath: string; type: typeof RESOURCE_TYPES[number] }[] = [];
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Initializes the resource JSON structure.
|
|
29
|
-
*/
|
|
30
|
-
function initializeResourceJSON(): ResourceJSON {
|
|
31
|
-
return RESOURCE_TYPES.reduce((acc, type) => {
|
|
32
|
-
acc[type] = [];
|
|
33
|
-
return acc;
|
|
34
|
-
}, {} as ResourceJSON);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Processes a single file and updates the resource JSON.
|
|
39
|
-
*/
|
|
40
|
-
function prepareFileForProcessing(filePath: string): void {
|
|
41
|
-
const extension = extname(filePath).slice(1);
|
|
42
|
-
const fileName = filePath.replace(/^.*[\\\/]/, '');
|
|
43
|
-
const resourceIdentifier = `${uuidv4()}.${extension}`;
|
|
44
|
-
|
|
45
|
-
const type = getResourceType(extension);
|
|
46
|
-
if (!type) return;
|
|
47
|
-
|
|
48
|
-
if (type === 'sound' && ignoringSound) {
|
|
49
|
-
logVerbose(`[Ignored File] ${filePath} (ignoreSound flag enabled)`);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
resourcesToProcess.push({ filePath, type });
|
|
54
|
-
resourceJSON[type].push({ resourceIdentifier, fileName });
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Determines the resource type based on the file extension.
|
|
59
|
-
*/
|
|
60
|
-
function getResourceType(pExtension: string): typeof RESOURCE_TYPES[number] | null {
|
|
61
|
-
switch (pExtension) {
|
|
62
|
-
case 'vyint': return 'interface';
|
|
63
|
-
case 'vyi': return 'icon';
|
|
64
|
-
case 'vym': return 'map';
|
|
65
|
-
case 'vymac': return 'macros';
|
|
66
|
-
case 'mp3':
|
|
67
|
-
case 'aac':
|
|
68
|
-
case 'wav':
|
|
69
|
-
case 'm4a':
|
|
70
|
-
case 'ogg':
|
|
71
|
-
case 'flac': return 'sound';
|
|
72
|
-
default: return null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Processes a directory and its contents recursively.
|
|
78
|
-
*/
|
|
79
|
-
async function processDirectory(pDirectoryPath: string): Promise<void> {
|
|
80
|
-
try {
|
|
81
|
-
const contents = await fs.readdir(pDirectoryPath);
|
|
82
|
-
|
|
83
|
-
for (const item of contents) {
|
|
84
|
-
const itemPath = join(pDirectoryPath, item);
|
|
85
|
-
const stats = await fs.stat(itemPath);
|
|
86
|
-
|
|
87
|
-
if (stats.isDirectory()) {
|
|
88
|
-
await processDirectory(itemPath);
|
|
89
|
-
} else if (isValidExtension(extname(itemPath).slice(1))) {
|
|
90
|
-
prepareFileForProcessing(itemPath);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
} catch (pError) {
|
|
94
|
-
logError(`[Error] Processing directory: ${pError}`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Checks if a file extension is valid.
|
|
100
|
-
*/
|
|
101
|
-
function isValidExtension(pExtension: string): boolean {
|
|
102
|
-
return VALID_EXTENSIONS.includes(pExtension as typeof VALID_EXTENSIONS[number]);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Executes all file copy operations in parallel after preparation.
|
|
107
|
-
*/
|
|
108
|
-
async function processAllFiles(): Promise<void> {
|
|
109
|
-
try {
|
|
110
|
-
await clearResourceTypeDirectories(`${resourceOutDirectory}/resources`, RESOURCE_TYPES);
|
|
111
|
-
// Create copy operations for all files
|
|
112
|
-
const copyOperations = resourcesToProcess.map(({ filePath, type }) => {
|
|
113
|
-
const fileName = basename(filePath); // Use path.basename for cleaner code
|
|
114
|
-
const resource = resourceJSON[type].find(res => res.fileName === fileName);
|
|
115
|
-
|
|
116
|
-
if (!resource) {
|
|
117
|
-
throw new Error(`Resource not found for file: ${fileName}`);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const destination = join(resourceOutDirectory, 'resources', type);
|
|
121
|
-
return copyFile(filePath, destination, resource.resourceIdentifier);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// Execute all copy operations concurrently
|
|
125
|
-
await Promise.all(copyOperations);
|
|
126
|
-
|
|
127
|
-
logVerbose(`[Kit CLI] All resources have been processed.`);
|
|
128
|
-
await saveResourceJSON();
|
|
129
|
-
} catch (pError: any) {
|
|
130
|
-
logError(`[Error] Processing files in batch: ${pError.message}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Clears specified directories within a base directory.
|
|
136
|
-
* @param pBaseDirectory - The path to the base directory.
|
|
137
|
-
* @param pDirectoriesToRemove - An array of directory names to be removed.
|
|
138
|
-
*/
|
|
139
|
-
async function clearResourceTypeDirectories(pBaseDirectory: string, pDirectoriesToRemove: string[]): Promise<void> {
|
|
140
|
-
try {
|
|
141
|
-
// Iterate over each directory to remove
|
|
142
|
-
for (const directory of pDirectoriesToRemove) {
|
|
143
|
-
const directoryPath = join(pBaseDirectory, directory);
|
|
144
|
-
// Check if the directory exists
|
|
145
|
-
const directoryExists = await fs.stat(directoryPath).then(stat => stat.isDirectory()).catch(() => false);
|
|
146
|
-
// If the directory exists, remove it
|
|
147
|
-
if (directoryExists) {
|
|
148
|
-
await fs.rm(directoryPath, { recursive: true });
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
} catch (pError) {
|
|
152
|
-
log(`${error(`[Error]`)} clearing directories: ${pError}`);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Copies a file to the specified directory.
|
|
159
|
-
*/
|
|
160
|
-
async function copyFile(pSource: string, pDestinationDir: string, pNewName: string): Promise<void> {
|
|
161
|
-
try {
|
|
162
|
-
await fs.mkdir(pDestinationDir, { recursive: true });
|
|
163
|
-
await fs.copyFile(pSource, join(pDestinationDir, pNewName));
|
|
164
|
-
} catch (pError) {
|
|
165
|
-
logError(`[Error] Copying file ${pSource}: ${pError}`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Saves the resource JSON to a file.
|
|
171
|
-
*/
|
|
172
|
-
async function saveResourceJSON(): Promise<void> {
|
|
173
|
-
const filePath = join(resourceOutDirectory, 'resource.json');
|
|
174
|
-
try {
|
|
175
|
-
await fs.writeFile(filePath, JSON.stringify(resourceJSON, null, 2));
|
|
176
|
-
} catch (pError) {
|
|
177
|
-
logError(`[Error] Saving resource JSON: ${pError}`);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Main entry point for building resources.
|
|
183
|
-
*/
|
|
184
|
-
export async function processResources({ inDirectory, outDirectory, verbose, ignoreSound }: ProcessOptions): Promise<void> {
|
|
185
|
-
// Initialize state
|
|
186
|
-
resourceInDirectory = inDirectory;
|
|
187
|
-
resourceOutDirectory = outDirectory;
|
|
188
|
-
isVerbose = verbose;
|
|
189
|
-
ignoringSound = ignoreSound;
|
|
190
|
-
resourceJSON = initializeResourceJSON();
|
|
191
|
-
|
|
192
|
-
// Validate inputs
|
|
193
|
-
if (!resourceInDirectory || !resourceOutDirectory) {
|
|
194
|
-
logError('[Error] Input and output directories must be specified');
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Process resources
|
|
199
|
-
await processDirectory(resourceInDirectory);
|
|
200
|
-
|
|
201
|
-
if (resourcesToProcess.length > 0) {
|
|
202
|
-
await processAllFiles();
|
|
203
|
-
} else {
|
|
204
|
-
logAlert('No resources found!');
|
|
205
|
-
await saveResourceJSON();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function logVerbose(pMessage: string): void {
|
|
210
|
-
if (isVerbose) log(info(pMessage));
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function logError(pMessage: string): void {
|
|
214
|
-
log(error(pMessage));
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function logAlert(pMessage: string): void {
|
|
218
|
-
log(alert(pMessage));
|
|
219
|
-
}
|
package/bun-build.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import Bun from 'bun';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import packageJson from './package.json';
|
|
4
|
-
|
|
5
|
-
const banner = [
|
|
6
|
-
`/*!`,
|
|
7
|
-
` * ${packageJson.name}@${packageJson.version} ${packageJson.repository.url}`,
|
|
8
|
-
` * Compiled ${new Date().toUTCString().replace(/GMT/g, 'UTC')}`,
|
|
9
|
-
` * Copyright (c) ${new Date().getFullYear()} Jared Bates, Evitca Studio, "doubleactii"`,
|
|
10
|
-
` *`,
|
|
11
|
-
` * ${packageJson.name} is licensed under the MIT License.`,
|
|
12
|
-
` * http://www.opensource.org/licenses/mit-license`,
|
|
13
|
-
` */`,
|
|
14
|
-
].join('\n');
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function logMessage(pLevel: string, pMessage: string): void {
|
|
18
|
-
const colors = { error: '#c42847', info: '#ffa552' };
|
|
19
|
-
const levelFormatted = pLevel.charAt(0).toUpperCase() + pLevel.slice(1);
|
|
20
|
-
const color = colors[pLevel] || '#ffa552';
|
|
21
|
-
console.log(chalk.hex(color)(`[${levelFormatted}]`), `${pMessage}`);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const oldNow = Date.now();
|
|
25
|
-
|
|
26
|
-
await Promise.all([
|
|
27
|
-
// Natural version
|
|
28
|
-
Bun.build({
|
|
29
|
-
entrypoints: ['./src/index.ts'],
|
|
30
|
-
outdir: './dist/bundle',
|
|
31
|
-
naming: 'kit.js',
|
|
32
|
-
banner: banner,
|
|
33
|
-
target: 'browser'
|
|
34
|
-
}),
|
|
35
|
-
// Minified version
|
|
36
|
-
Bun.build({
|
|
37
|
-
entrypoints: ['./src/index.ts'],
|
|
38
|
-
outdir: './dist/bundle/min',
|
|
39
|
-
naming: 'kit.min.js',
|
|
40
|
-
minify: true,
|
|
41
|
-
banner: banner,
|
|
42
|
-
target: 'browser'
|
|
43
|
-
}),
|
|
44
|
-
// CLI version
|
|
45
|
-
Bun.build({
|
|
46
|
-
entrypoints: ['./bin/cli.ts'],
|
|
47
|
-
outdir: './lib/bundle/cli',
|
|
48
|
-
naming: 'cli.js',
|
|
49
|
-
banner: banner,
|
|
50
|
-
target: 'node'
|
|
51
|
-
})
|
|
52
|
-
]);
|
|
53
|
-
|
|
54
|
-
const elapsed = Date.now() - oldNow;
|
|
55
|
-
|
|
56
|
-
logMessage('info', `Client Build took: ${elapsed}ms`);
|
package/bun.lockb
DELETED
|
Binary file
|
package/bunfig.toml
DELETED
package/docs/.nojekyll
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
package/docs/assets/hierarchy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
window.hierarchyData = "eJyrVirKzy8pVrKKjtVRKkpNy0lNLsnMzwMKVNfWAgCbHgqm"
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--light-hl-0: #795E26;
|
|
3
|
-
--dark-hl-0: #DCDCAA;
|
|
4
|
-
--light-hl-1: #000000;
|
|
5
|
-
--dark-hl-1: #D4D4D4;
|
|
6
|
-
--light-hl-2: #A31515;
|
|
7
|
-
--dark-hl-2: #CE9178;
|
|
8
|
-
--light-hl-3: #0000FF;
|
|
9
|
-
--dark-hl-3: #569CD6;
|
|
10
|
-
--light-hl-4: #AF00DB;
|
|
11
|
-
--dark-hl-4: #C586C0;
|
|
12
|
-
--light-hl-5: #001080;
|
|
13
|
-
--dark-hl-5: #9CDCFE;
|
|
14
|
-
--light-hl-6: #008000;
|
|
15
|
-
--dark-hl-6: #6A9955;
|
|
16
|
-
--light-hl-7: #267F99;
|
|
17
|
-
--dark-hl-7: #4EC9B0;
|
|
18
|
-
--light-hl-8: #0070C1;
|
|
19
|
-
--dark-hl-8: #4FC1FF;
|
|
20
|
-
--light-code-background: #FFFFFF;
|
|
21
|
-
--dark-code-background: #1E1E1E;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@media (prefers-color-scheme: light) { :root {
|
|
25
|
-
--hl-0: var(--light-hl-0);
|
|
26
|
-
--hl-1: var(--light-hl-1);
|
|
27
|
-
--hl-2: var(--light-hl-2);
|
|
28
|
-
--hl-3: var(--light-hl-3);
|
|
29
|
-
--hl-4: var(--light-hl-4);
|
|
30
|
-
--hl-5: var(--light-hl-5);
|
|
31
|
-
--hl-6: var(--light-hl-6);
|
|
32
|
-
--hl-7: var(--light-hl-7);
|
|
33
|
-
--hl-8: var(--light-hl-8);
|
|
34
|
-
--code-background: var(--light-code-background);
|
|
35
|
-
} }
|
|
36
|
-
|
|
37
|
-
@media (prefers-color-scheme: dark) { :root {
|
|
38
|
-
--hl-0: var(--dark-hl-0);
|
|
39
|
-
--hl-1: var(--dark-hl-1);
|
|
40
|
-
--hl-2: var(--dark-hl-2);
|
|
41
|
-
--hl-3: var(--dark-hl-3);
|
|
42
|
-
--hl-4: var(--dark-hl-4);
|
|
43
|
-
--hl-5: var(--dark-hl-5);
|
|
44
|
-
--hl-6: var(--dark-hl-6);
|
|
45
|
-
--hl-7: var(--dark-hl-7);
|
|
46
|
-
--hl-8: var(--dark-hl-8);
|
|
47
|
-
--code-background: var(--dark-code-background);
|
|
48
|
-
} }
|
|
49
|
-
|
|
50
|
-
:root[data-theme='light'] {
|
|
51
|
-
--hl-0: var(--light-hl-0);
|
|
52
|
-
--hl-1: var(--light-hl-1);
|
|
53
|
-
--hl-2: var(--light-hl-2);
|
|
54
|
-
--hl-3: var(--light-hl-3);
|
|
55
|
-
--hl-4: var(--light-hl-4);
|
|
56
|
-
--hl-5: var(--light-hl-5);
|
|
57
|
-
--hl-6: var(--light-hl-6);
|
|
58
|
-
--hl-7: var(--light-hl-7);
|
|
59
|
-
--hl-8: var(--light-hl-8);
|
|
60
|
-
--code-background: var(--light-code-background);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
:root[data-theme='dark'] {
|
|
64
|
-
--hl-0: var(--dark-hl-0);
|
|
65
|
-
--hl-1: var(--dark-hl-1);
|
|
66
|
-
--hl-2: var(--dark-hl-2);
|
|
67
|
-
--hl-3: var(--dark-hl-3);
|
|
68
|
-
--hl-4: var(--dark-hl-4);
|
|
69
|
-
--hl-5: var(--dark-hl-5);
|
|
70
|
-
--hl-6: var(--dark-hl-6);
|
|
71
|
-
--hl-7: var(--dark-hl-7);
|
|
72
|
-
--hl-8: var(--dark-hl-8);
|
|
73
|
-
--code-background: var(--dark-code-background);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.hl-0 { color: var(--hl-0); }
|
|
77
|
-
.hl-1 { color: var(--hl-1); }
|
|
78
|
-
.hl-2 { color: var(--hl-2); }
|
|
79
|
-
.hl-3 { color: var(--hl-3); }
|
|
80
|
-
.hl-4 { color: var(--hl-4); }
|
|
81
|
-
.hl-5 { color: var(--hl-5); }
|
|
82
|
-
.hl-6 { color: var(--hl-6); }
|
|
83
|
-
.hl-7 { color: var(--hl-7); }
|
|
84
|
-
.hl-8 { color: var(--hl-8); }
|
|
85
|
-
pre, code { background: var(--code-background); }
|