tico-basics 1.0.0 → 1.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/README.md +58 -9
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -1,34 +1,83 @@
|
|
|
1
1
|
# Tico Basics
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/tico-basics)
|
|
4
|
+
[](https://www.npmjs.com/package/tico-basics)
|
|
5
|
+
[](https://github.com/tiaguinho2009/tico-basics/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
**Tico Basics** is a lightweight utility package providing essential tools for **event handling** and **logging** in JavaScript/TypeScript projects.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
* **Events Module** – Utilities to handle events easily and efficiently
|
|
14
|
+
* **Logs Module** – Colorful logging with `chalk` support for readable console output
|
|
15
|
+
|
|
16
|
+
---
|
|
4
17
|
|
|
5
18
|
## Installation
|
|
6
19
|
|
|
7
20
|
```bash
|
|
8
|
-
npm install
|
|
21
|
+
npm install tico-basics
|
|
9
22
|
```
|
|
10
23
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- **Events Module** - Event handling utilities
|
|
14
|
-
- **Logs Module** - Logging utilities with `chalk` support for colored output
|
|
24
|
+
---
|
|
15
25
|
|
|
16
26
|
## Usage
|
|
17
27
|
|
|
18
28
|
```typescript
|
|
19
|
-
import {
|
|
29
|
+
import { EventSystem, Logger } from "tico-basics";
|
|
30
|
+
|
|
31
|
+
// Define your event types (optional, recommended for TypeScript)
|
|
32
|
+
interface Events {
|
|
33
|
+
"test": [string, number];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Create a Logger instance
|
|
37
|
+
const log = new Logger("MyApp");
|
|
38
|
+
|
|
39
|
+
// Create an EventSystem instance with typed events
|
|
40
|
+
const events = new EventSystem<Events>({
|
|
41
|
+
debug: true, // enables internal debug logging
|
|
42
|
+
}, log);
|
|
43
|
+
|
|
44
|
+
// Logger usage
|
|
45
|
+
log.info("Application starting");
|
|
46
|
+
log.success("Application started");
|
|
47
|
+
log.warn("This is a warning");
|
|
48
|
+
log.error("This is an error");
|
|
49
|
+
|
|
50
|
+
// Measure execution time
|
|
51
|
+
log.time("Startup");
|
|
52
|
+
// ... initialization code
|
|
53
|
+
log.timeEnd("Startup");
|
|
54
|
+
|
|
55
|
+
// Register and emit events
|
|
56
|
+
events.on("test", (message, code) => {
|
|
57
|
+
log.info(`Event received: ${message} (${code})`);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
events.emit("test", "Hello World", 123);
|
|
20
61
|
```
|
|
21
62
|
|
|
63
|
+
---
|
|
64
|
+
|
|
22
65
|
## Build
|
|
23
66
|
|
|
67
|
+
If you want to rebuild the package from source:
|
|
68
|
+
|
|
24
69
|
```bash
|
|
25
70
|
npm run build
|
|
26
71
|
```
|
|
27
72
|
|
|
73
|
+
---
|
|
74
|
+
|
|
28
75
|
## License
|
|
29
76
|
|
|
30
|
-
AGPL-3.0-only
|
|
77
|
+
This project is licensed under **AGPL-3.0-only** – see the [LICENSE](https://github.com/tiaguinho2009/tico-basics/blob/main/LICENSE) file for details.
|
|
78
|
+
|
|
79
|
+
---
|
|
31
80
|
|
|
32
81
|
## Author
|
|
33
82
|
|
|
34
|
-
tiaguinho2009
|
|
83
|
+
**tiaguinho2009** – [GitHub](https://github.com/tiaguinho2009)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tico-basics",
|
|
3
3
|
"displayName": "Tico Basics",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "Just basic stuff that I use in all my projects",
|
|
6
6
|
"keywords": ["tico09"],
|
|
7
7
|
"license": "AGPL-3.0-only",
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
"import": "./dist/index.js"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/tiaguinho2009/tico-basics.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/tiaguinho2009/tico-basics/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/tiaguinho2009/tico-basics#readme",
|
|
19
27
|
"sideEffects": false,
|
|
20
28
|
"files": ["dist"],
|
|
21
29
|
"scripts": {
|