@admc-go-th/admc-library 1.0.0

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 ADDED
@@ -0,0 +1,20 @@
1
+ # Introduction
2
+ TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
3
+
4
+ # Getting Started
5
+ TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
6
+ 1. Installation process
7
+ 2. Software dependencies
8
+ 3. Latest releases
9
+ 4. API references
10
+
11
+ # Build and Test
12
+ TODO: Describe and show how to build your code and run the tests.
13
+
14
+ # Contribute
15
+ TODO: Explain how other users and developers can contribute to make your code better.
16
+
17
+ If you want to learn more about creating good readme files then refer the following [guidelines](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). You can also seek inspiration from the below readme files:
18
+ - [ASP.NET Core](https://github.com/aspnet/Home)
19
+ - [Visual Studio Code](https://github.com/Microsoft/vscode)
20
+ - [Chakra Core](https://github.com/Microsoft/ChakraCore)
package/logger.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ declare class Logger {
2
+ name: string;
3
+ command: string;
4
+ private _console;
5
+ private _endCommand;
6
+ constructor();
7
+ private print;
8
+ type(): void;
9
+ private append;
10
+ info(...args: any[]): this;
11
+ success(...args: any[]): this;
12
+ warning(...args: any[]): this;
13
+ error(...args: any[]): this;
14
+ }
15
+ declare const logger: Logger;
16
+
17
+ export { logger as default };
package/logger.js ADDED
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/logger.ts
21
+ var logger_exports = {};
22
+ __export(logger_exports, {
23
+ default: () => logger_default
24
+ });
25
+ module.exports = __toCommonJS(logger_exports);
26
+ var CONFIG = {
27
+ COLOR: {
28
+ black: { font: "\x1B[30m", background: "\x1B[40m" },
29
+ red: { font: "\x1B[31m", background: "\x1B[41m" },
30
+ green: { font: "\x1B[32m", background: "\x1B[42m" },
31
+ yellow: { font: "\x1B[33m", background: "\x1B[43m" },
32
+ blue: { font: "\x1B[34m", background: "\x1B[44m" },
33
+ magenta: { font: "\x1B[35m", background: "\x1B[45m" },
34
+ cyan: { font: "\x1B[36m", background: "\x1B[46m" },
35
+ white: { font: "\x1B[37m", background: "\x1B[47m" }
36
+ }
37
+ };
38
+ var Logger = class {
39
+ name;
40
+ command;
41
+ _console;
42
+ _endCommand;
43
+ constructor() {
44
+ this.name = "";
45
+ this.command = "";
46
+ this._console = console;
47
+ this._endCommand = "\x1B[0m";
48
+ }
49
+ print(color, ...args) {
50
+ let date = (/* @__PURE__ */ new Date()).toISOString();
51
+ this.append(...args);
52
+ let command = color + "\u{1F4A1} " + date + ": " + this.command + " " + this._endCommand;
53
+ this._console.log(command);
54
+ this.command = "";
55
+ }
56
+ type() {
57
+ }
58
+ append(...args) {
59
+ for (const idx in args) {
60
+ const arg = args[idx];
61
+ if (typeof arg === "string") {
62
+ this.command += arg;
63
+ } else {
64
+ try {
65
+ this.command += JSON.stringify(arg);
66
+ } catch {
67
+ this.command += arg;
68
+ }
69
+ }
70
+ this.command += " ";
71
+ }
72
+ return this;
73
+ }
74
+ info(...args) {
75
+ var color = CONFIG.COLOR.blue;
76
+ this.print(color.font, ...args);
77
+ return this;
78
+ }
79
+ success(...args) {
80
+ var color = CONFIG.COLOR.green;
81
+ this.print(color.font, ...args);
82
+ return this;
83
+ }
84
+ warning(...args) {
85
+ var color = CONFIG.COLOR.yellow;
86
+ this.print(color.font, ...args);
87
+ return this;
88
+ }
89
+ error(...args) {
90
+ var color = CONFIG.COLOR.red;
91
+ this.print(color.font, ...args);
92
+ return this;
93
+ }
94
+ };
95
+ var logger = new Logger();
96
+ var logger_default = logger;
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@admc-go-th/admc-library",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "./index.js",
6
+ "types": "./index.d.ts",
7
+ "scripts": {
8
+ "build": "tsup",
9
+ "postbuild": "npm-prepare-dist",
10
+ "link-app": "npm run build && cd dist && npm link",
11
+ "publish-app": "npm run build && cd dist && npm publish --access=public",
12
+ "format": "prettier --write ."
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "*.js",
17
+ "*.d.ts"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://wewebplus@dev.azure.com/wewebplus/admincourt.go.th/_git/admc-library"
22
+ },
23
+ "keywords": [
24
+ "admc.go.th"
25
+ ],
26
+ "author": "oasnaw@gmail.com",
27
+ "license": "MIT",
28
+ "module": "./index.js"
29
+ }