From fdfd8c092dee212bdaa4bc5d69883c391ed82fef Mon Sep 17 00:00:00 2001 From: KillerBossOriginal Date: Sun, 5 Feb 2023 13:38:01 +0100 Subject: [PATCH] 2023.02.05 --- .github/workflows/npm-publish.yml | 12 +++++++++-- index.ts | 13 ------------ package.json | 10 ++++++--- src/cin.ts | 22 ------------------- src/cout.ts | 35 ------------------------------- src/getTime.ts | 16 -------------- src/index.ts | 11 ++++++++++ src/log.ts | 24 --------------------- tsconfig.json | 2 +- 9 files changed, 29 insertions(+), 116 deletions(-) delete mode 100644 index.ts delete mode 100644 src/cin.ts delete mode 100644 src/cout.ts delete mode 100644 src/getTime.ts create mode 100644 src/index.ts delete mode 100644 src/log.ts diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 83fa8a7..8180b6e 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -4,7 +4,7 @@ on: types: [created] jobs: Publish-NPM: - runs-on: ubuntu-latest + runs-on: node1 steps: - name: Checkout uses: actions/checkout@v2 @@ -14,6 +14,10 @@ jobs: node-version: '16.x' registry-url: 'https://registry.npmjs.org' scope: '@thundernetworkrad' + - name: Install Dependencies + run: npm i + - name: Build + run: npm run build - name: Publish package on NPM 📦 run: npm publish --access public env: @@ -22,7 +26,7 @@ jobs: REGISTRY2: 'registry=https://registry.npmjs.org/' Publish-GitHub-NPM: - runs-on: ubuntu-latest + runs-on: node1 steps: - name: Checkout uses: actions/checkout@v2 @@ -32,6 +36,10 @@ jobs: node-version: '16.x' registry-url: 'https://npm.pkg.github.com' scope: '@thundernetworkrad' + - name: Install Dependencies + run: npm i + - name: Build + run: npm run build - name: Publish package on NPM 📦 run: npm publish --access public env: diff --git a/index.ts b/index.ts deleted file mode 100644 index 43df023..0000000 --- a/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -//import { appendFile, existsSync } from 'node:fs'; -//import { mkdir } from 'node:fs/promises'; -import getTime from './src/getTime.js'; -import log from './src/log.js'; -import cin from './src/cin.js'; -import cout from './src/cout.js' - -export default { - getTime, - log, - cin, - cout -} \ No newline at end of file diff --git a/package.json b/package.json index c63b632..45b3dd1 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "@thundernetworkrad/std", - "version": "2023.01.29", + "version": "2023.02.05", "description": "Standard module for JavaScript / TypeScript", "main": "build/index.js", - "types": "dist/index.d.ts", + "types": "build/index.d.ts", "scripts": { - "install": "tsc" + "build": "tsc" }, "repository": { "type": "git", @@ -26,8 +26,12 @@ }, "homepage": "https://github.com/ThunderNetworkRaD/std#readme", "dependencies": { + "@thundernetworkrad/logs": "^2023.2.5-1", "@thundernetworkrad/readline-sync": "^2023.1.26-2", + "@thundernetworkrad/time": "^2023.2.5-2", "@types/node": "^18.11.18", + "node-cin": "^2023.2.5", + "node-cout": "^2023.2.5-1", "tslib": "^2.5.0", "typescript": "^4.9.4" } diff --git a/src/cin.ts b/src/cin.ts deleted file mode 100644 index d505064..0000000 --- a/src/cin.ts +++ /dev/null @@ -1,22 +0,0 @@ -import readlineSync from '@thundernetworkrad/readline-sync'; -/** - * - * @param question what question you need to make? - * @param hide is the question private? - * @returns - */ -function cin (question: string, hide: boolean) { - return new Promise((resolve) => { - try { - let answer: string = readlineSync.question(`${question} `, { - hideEchoBack: hide || false - }) - return resolve(answer); - } catch (e) { - console.log(e) - return resolve('error'); - } - }) -}; - -export default cin; \ No newline at end of file diff --git a/src/cout.ts b/src/cout.ts deleted file mode 100644 index ccb5cd6..0000000 --- a/src/cout.ts +++ /dev/null @@ -1,35 +0,0 @@ -let debug: number, logs1: boolean|undefined|null; -import getTime from './getTime.js'; -import log from './log.js'; -export default class createCout { - /** - * @constructor - * @param debugLevel from what debug level you want to log? - * @param logs do you want files log? - */ - constructor (debugLevel: number, logs?: boolean) { - if (!debugLevel) debugLevel = 0; - if (!logs) logs = false; - debug = debugLevel; - logs1 = logs; - } - - /** - * - * @param string what to log? - * @param debugLevel from what debug level this will logged? - * @returns - */ - cout (string: string, debugLevel?: number) { - if (!debugLevel) debugLevel = 0; - var time = getTime(); - - if (debug >= debugLevel) { - console.log(`[${time.year}.${time.month}.${time.day}-${time.hours}:${time.minutes}:${time.seconds}] | ${String(string)}`); - if (logs1) { - log(`[${time.year}.${time.month}.${time.day}-${time.hours}:${time.minutes}:${time.seconds}] | ${String(string)}`); - } - } - return; - }; -} \ No newline at end of file diff --git a/src/getTime.ts b/src/getTime.ts deleted file mode 100644 index a285f61..0000000 --- a/src/getTime.ts +++ /dev/null @@ -1,16 +0,0 @@ - -/** - * - * @returns - */ -function getTime () { - const date_time = new Date(); - const year = date_time.getFullYear(); - const month = parseInt(("0" + (date_time.getMonth() + 1)).slice(-2)); - const day = parseInt(("0" + date_time.getDate()).slice(-2)); - const hours = date_time.getHours(); - const minutes = date_time.getMinutes(); - const seconds = date_time.getSeconds(); - return({year, month, day, hours, minutes, seconds}) -}; -export default getTime; \ No newline at end of file diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..fe247dc --- /dev/null +++ b/src/index.ts @@ -0,0 +1,11 @@ +import { getTime } from '@thundernetworkrad/time'; +import { log } from '@thundernetworkrad/logs'; +import { cin } from 'node-cin'; +import { createCout } from 'node-cout'; + +export default { + getTime, + log, + cin, + createCout +} \ No newline at end of file diff --git a/src/log.ts b/src/log.ts deleted file mode 100644 index 4471a49..0000000 --- a/src/log.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { appendFile, existsSync } from 'node:fs'; -import { mkdir } from 'node:fs/promises'; -import getTime from './getTime.js'; - -let time; -const startTime = getTime(); -time = startTime; -const name = `${time.year}.${time.month}.${time.day}.${time.hours}.${time.minutes}.${time.seconds}.log`; - -/** - * - * @param string to log - */ -function log (string?: string) { - if (!existsSync('./logs')) mkdir('./logs', { recursive: true }); - - appendFile(`./logs/${name}`, string+'\n', (err: any) => { - if (err) { - throw err - } - }) -}; - -export default log; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index a377134..5e9d717 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,7 +26,7 @@ /* Modules */ "module": "CommonJS", /* Specify what module code is generated. */ - "rootDir": "./", /* Specify the root folder within your source files. */ + "rootDir": "src", /* Specify the root folder within your source files. */ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */