+36
| module.exports = { | ||
| 'env': { | ||
| 'browser': false, | ||
| 'es2021': true | ||
| }, | ||
| 'extends': [ | ||
| 'eslint:recommended', | ||
| 'plugin:@typescript-eslint/recommended' | ||
| ], | ||
| 'parser': '@typescript-eslint/parser', | ||
| 'parserOptions': { | ||
| 'ecmaVersion': 'latest', | ||
| 'sourceType': 'module' | ||
| }, | ||
| 'plugins': [ | ||
| '@typescript-eslint' | ||
| ], | ||
| 'rules': { | ||
| 'indent': [ | ||
| 'error', | ||
| 2 | ||
| ], | ||
| 'linebreak-style': [ | ||
| 'error', | ||
| 'unix' | ||
| ], | ||
| 'quotes': [ | ||
| 'error', | ||
| 'single' | ||
| ], | ||
| 'semi': [ | ||
| 'error', | ||
| 'always' | ||
| ] | ||
| } | ||
| }; |
| "use strict"; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.system = void 0; | ||
| const os_1 = __importDefault(require("os")); | ||
| const system = () => { | ||
| return (os_1.default.platform() === 'win32') | ||
| ? '\\' | ||
| : '/'; | ||
| }; | ||
| exports.system = system; |
+5
-2
| { | ||
| "name": "touch-win", | ||
| "version": "0.7.0", | ||
| "description": "A tool that will allow you to create multiple files using the terminal in Windows.", | ||
| "version": "0.7.1", | ||
| "description": "A tool that will allow you to use the 'touch' command on steroids to create multiple files using the terminal on any operating system.", | ||
| "bin": { | ||
@@ -40,2 +40,5 @@ "touch-win": "./lib/src/index.js" | ||
| "@types/yargs": "^17.0.10", | ||
| "@typescript-eslint/eslint-plugin": "^5.29.0", | ||
| "@typescript-eslint/parser": "^5.29.0", | ||
| "eslint": "^8.18.0", | ||
| "rimraf": "^3.0.2", | ||
@@ -42,0 +45,0 @@ "ts-node": "^10.7.0", |
+20
-20
@@ -10,27 +10,27 @@ "use strict"; | ||
| const cli = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)) | ||
| .usage("Usage: touch-win [options] [file ...]") | ||
| .example("touch-win [options] [file ...]", "Create file(s)") | ||
| .example("touch-win src/bin/cli.js src/helpers/file.js src/helpers/directory.js", "Standard use") | ||
| .example("touch-win --base src/components/new_component Component.js Component.css", 'Use with option "base"') | ||
| .example("touch-win --template src/components/new_component/Component.[rf] js test.js css", 'Use with option "template"') | ||
| .example("touch-win --template config/webpack.[rf].js build dev common", 'Use with option "template"') | ||
| .help("h") | ||
| .usage('Usage: touch-win [options] [file ...]') | ||
| .example('touch-win [options] [file ...]', 'Create file(s)') | ||
| .example('touch-win src/bin/cli.js src/helpers/file.js src/helpers/directory.js', 'Standard use') | ||
| .example('touch-win --base src/components/new_component Component.js Component.css', 'Use with option "base"') | ||
| .example('touch-win --template src/components/new_component/Component.[rn] js test.js css', 'Use with option "template"') | ||
| .example('touch-win --template config/webpack.[rn].js build dev common', 'Use with option "template"') | ||
| .help('h') | ||
| .wrap(yargs_1.default.terminalWidth()) | ||
| .alias("h", "help") | ||
| .option("v", { | ||
| alias: "verbose", | ||
| type: "boolean", | ||
| .alias('h', 'help') | ||
| .option('v', { | ||
| alias: 'verbose', | ||
| type: 'boolean', | ||
| default: false, | ||
| describe: "Run with verbose logging", | ||
| describe: 'Run with verbose logging', | ||
| }) | ||
| .option("b", { | ||
| alias: "base", | ||
| type: "string", | ||
| describe: "Base folder to place the file(s)", | ||
| .option('b', { | ||
| alias: 'base', | ||
| type: 'string', | ||
| describe: 'Base folder to place the file(s)', | ||
| }) | ||
| .option("t", { | ||
| alias: "template", | ||
| type: "string", | ||
| describe: "Template to generate files", | ||
| .option('t', { | ||
| alias: 'template', | ||
| type: 'string', | ||
| describe: 'Template to generate files', | ||
| }).argv; | ||
| exports.argv = JSON.parse(JSON.stringify(cli)); |
@@ -12,3 +12,3 @@ "use strict"; | ||
| * @param {string} dirPath - The path of the folder to create. | ||
| * @param {boolean=false} verbose - Activate details information. | ||
| * @param {boolean} verbose - Activate details information. | ||
| * | ||
@@ -20,4 +20,4 @@ * @returns void | ||
| return; | ||
| fs_1.default.mkdir(dirPath, { recursive: true }, (err) => { | ||
| if (err) { | ||
| fs_1.default.mkdir(dirPath, (err) => { | ||
| if (err === false) { | ||
| (0, alerts_1.error)(`could not created folder "${dirPath}"`); | ||
@@ -24,0 +24,0 @@ return; |
@@ -24,3 +24,3 @@ "use strict"; | ||
| // Create file if it doesn't exist's | ||
| fs_1.default.writeFile(filename, "", (err) => { | ||
| fs_1.default.writeFile(filename, '', (err) => { | ||
| if (err) { | ||
@@ -27,0 +27,0 @@ (0, alerts_1.error)(`could not create file ${filename}.`); |
+8
-7
@@ -12,2 +12,3 @@ #!/usr/bin/env node | ||
| const alerts_1 = require("./helpers/alerts"); | ||
| const system_1 = require("./helpers/system"); | ||
| const file_1 = require("./helpers/file"); | ||
@@ -21,14 +22,14 @@ const directory_1 = require("./helpers/directory"); | ||
| if (base) | ||
| file = base + "\\" + file; | ||
| file = base + (0, system_1.system)() + file; | ||
| if (template) { | ||
| if (!template.includes("[rn]")) { | ||
| (0, alerts_1.error)('check that the template has "[rm]"'); | ||
| if (!template.includes('[rn]')) { | ||
| (0, alerts_1.error)('check that the template has "[rn]"'); | ||
| return; | ||
| } | ||
| file = template.replace("[rn]", file); | ||
| file = template.replace('[rn]', file); | ||
| } | ||
| const pathFile = path_1.default.normalize(file).split("\\"); | ||
| let dirPath = "."; | ||
| const pathFile = path_1.default.normalize(file).split((0, system_1.system)()); | ||
| let dirPath = '.'; | ||
| pathFile.forEach((currentPath, index) => { | ||
| dirPath = dirPath + "/" + currentPath; | ||
| dirPath = dirPath + '/' + currentPath; | ||
| const normalizePath = path_1.default.normalize(dirPath); | ||
@@ -35,0 +36,0 @@ if (pathFile.length - 1 !== index) { |
+6
-3
| { | ||
| "name": "touch-win", | ||
| "version": "0.7.0", | ||
| "description": "A tool that will allow you to create multiple files using the terminal in Windows.", | ||
| "version": "0.7.1", | ||
| "description": "A tool that will allow you to use the 'touch' command on steroids to create multiple files using the terminal on any operating system.", | ||
| "bin": { | ||
@@ -40,2 +40,5 @@ "touch-win": "./lib/src/index.js" | ||
| "@types/yargs": "^17.0.10", | ||
| "@typescript-eslint/eslint-plugin": "^5.29.0", | ||
| "@typescript-eslint/parser": "^5.29.0", | ||
| "eslint": "^8.18.0", | ||
| "rimraf": "^3.0.2", | ||
@@ -45,2 +48,2 @@ "ts-node": "^10.7.0", | ||
| } | ||
| } | ||
| } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
156052
0.73%14
16.67%210
31.25%0
-100%9
50%