commit a64bd3503e344b33d2a11f7cb6d297cfdbde2c33 Author: Killer Boss Original <73131550+killerbossoriginal@users.noreply.github.com> Date: Wed Nov 2 19:48:49 2022 +0100 0.0.1 diff --git a/.github/workflow/npm.yml b/.github/workflow/npm.yml new file mode 100644 index 0000000..727dfca --- /dev/null +++ b/.github/workflow/npm.yml @@ -0,0 +1,44 @@ +name: Publish to NPM +on: + release: + types: [created] +jobs: + Publish-NPM: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '16.x' + registry-url: 'https://registry.npmjs.org' + scope: '@fiusdevelopment' + - name: Install dependencies 🔧 + run: npm ci + - name: Publish package on NPM 📦 + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + REGISTRY1: 'registry.npmjs.org' + REGISTRY2: 'registry=https://registry.npmjs.org/' + + Publish-GitHub-NPM: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '16.x' + registry-url: 'https://npm.pkg.github.com' + scope: '@fiusdevelopment' + - name: Install dependencies 🔧 + run: npm ci + - name: Publish package on NPM 📦 + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.GP_TOKEN }} + REGISTRY1: 'npm.pkg.github.com' + REGISTRY2: '@fiusdevelopment:registry=https://npm.pkg.github.com' \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..7348006 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +//${REGISTRY1}/:_authToken=${NODE_AUTH_TOKEN} +${REGISTRY2} \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..ed9de22 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,61 @@ +FIUS License V1.1 +---------------------------------------------------------------- +1. Definitions + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "License" + means this document. + +1.3. "Modifications" + means any of the following: + + (a) any file in Code that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.4. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.5. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +1.6. "The owners" + Who own this project + +1.7. "The code" / "The Software" / "The project" / "The idea" + It means the product or creation that this document governs (Including the idea). + +------------------------------------------------ +2. License Grants, Conditions and Limitation + +2.1. Each contributor has ownership of what he creates, no exceptions. + It may require the removal of what it creates from the project, + the removal may be denied. + +2.2. You can Contribute at the project by request. + +2.3. You can't copy or share the code. + +2.4. You can't get / use this code from here, you have to get a public + from a public source. + +2.5. The owners have the full rights and choice what to do of this project, + including your contribution. \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..e758abb --- /dev/null +++ b/index.js @@ -0,0 +1,56 @@ +const { writeFile, readFile, mkdir } = require('node:fs/promises'); +const readline = require ('node:readline/promises'); +const { stdin, stdout } = require('node:process'); +var readlineSync = require('readline-sync'); +var name; + +function getTime () { + const date_time = new Date(); + const year = date_time.getFullYear(); + const month = ("0" + (date_time.getMonth() + 1)).slice(-2); + const day = ("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}) +}; + +function createLog () { + mkdir('./logs', { recursive: true }); + var time = getTime(); + name = `${time.year}.${time.month}.${time.day}.${time.hours}.${time.minutes}.${time.seconds}.log`; + writeFile(`./logs/${name}`, ''); + return(name) +}; + +function log (string) { + readFile(`./logs/${name}`, 'utf8') + .then(async (err, data) => { + if (!data) data = ''; + data += string + '\n'; + writeFile(`./logs/${name}`, data); + }) +}; + +function cin (question, hide) { + return new Promise((resolve, reject) => { + try { + var answer = readlineSync.question(`${question} `, { + hideEchoBack: hide || false + }) + return resolve(answer); + } catch (e) { + console.log(e) + return resolve('error'); + } + }) +}; + +async function cout (string) { + var time = getTime(); + string = `[${time.year}.${time.month}.${time.day}-${time.hours}:${time.minutes}:${time.seconds}] | ${String(string)}` + console.log(string); + log(string); +}; + +module.exports = { cin, createCin, cout, createLog, log }; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8414a1d --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "@fiusdevelopment/std", + "version": "0.0.1", + "description": "Standard module for javascript", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/FIUSDevelopment/std.git" + }, + "keywords": [ + "std", + "standard", + "npmjs", + "npm", + "module", + "javascript" + ], + "author": "FIUS Development | Killer Boss Original - EnyGasELuce", + "license": "SEE LICENSE IN LICENSE.txt", + "bugs": { + "url": "https://github.com/FIUSDevelopment/std/issues" + }, + "homepage": "https://github.com/FIUSDevelopment/std#readme" +}