From 36d7d09b0124bb4af4031641abf9c85fa822fa91 Mon Sep 17 00:00:00 2001 From: Darius Rapalis Date: Fri, 18 Feb 2022 16:04:45 +0200 Subject: [PATCH] Initial commit --- .gitignore | 1 + .prettierrc | 6 ++++++ README.md | 1 + lib/index.d.ts | 1 + lib/index.js | 8 ++++++++ package-lock.json | 20 ++++++++++++++++++++ package.json | 30 ++++++++++++++++++++++++++++++ src/index.ts | 19 +++++++++++++++++++ tsconfig.json | 11 +++++++++++ 9 files changed, 97 insertions(+) create mode 100644 .gitignore create mode 100644 .prettierrc create mode 100644 README.md create mode 100644 lib/index.d.ts create mode 100644 lib/index.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/index.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0a72520 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "semi": true, + "singleQuote": true +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..1ef7647 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Utils Package diff --git a/lib/index.d.ts b/lib/index.d.ts new file mode 100644 index 0000000..3964965 --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1 @@ +export declare const getCLIArguments: () => void; diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 0000000..058d88a --- /dev/null +++ b/lib/index.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getCLIArguments = void 0; +var getCLIArguments = function () { + console.log(process.argv); +}; +exports.getCLIArguments = getCLIArguments; +(0, exports.getCLIArguments)(); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..53c5674 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,20 @@ +{ + "name": "utils", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "17.0.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.18.tgz", + "integrity": "sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA==", + "dev": true + }, + "typescript": { + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", + "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..84aefa7 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "utils", + "version": "0.0.0", + "description": "Utility package for easier development", + "main": "index.js", + "scripts": { + "build": "tsc", + "start": "tsc && node lib/index.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/rdarius/utils.git" + }, + "keywords": [ + "utils", + "utility", + "utilities" + ], + "author": "Darius Rapalis", + "license": "MIT", + "bugs": { + "url": "https://github.com/rdarius/utils/issues" + }, + "homepage": "https://github.com/rdarius/utils#readme", + "devDependencies": { + "@types/node": "^17.0.18", + "typescript": "^4.5.5" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..b6f471d --- /dev/null +++ b/src/index.ts @@ -0,0 +1,19 @@ +export const getCLIArguments = () => { + + const args = {}; + + for(let arg of process.argv) { + if (arg.startsWith('-')) { + + } + } +}; + +export const createParamIfDoesNotExist = (object: Object, param: string, expectedType: "array" | "object") => { + if (object.hasOwnProperty(param)) { + // object[param] = expectedType === 'array' ? [] : {}; + } +} + + +getCLIArguments(); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..ca4bf6a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "declaration": true, + "outDir": "./lib", + "strict": true + }, + "include": ["src"], + "exclude": ["node_modules", "**/__tests__/*"] +}