Socket
Socket
Sign inDemoInstall

touch-win

Package Overview
Dependencies
2
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

75

bin/index.js

@@ -8,42 +8,47 @@ #!/usr/bin/env node

const path_1 = __importDefault(require("path"));
const open_1 = __importDefault(require("open"));
const cli_1 = require("./lib/cli");
const chalk_1 = __importDefault(require("chalk"));
const cli_1 = __importDefault(require("./lib/cli"));
const alerts_1 = require("./helpers/alerts");
const directory_1 = require("./helpers/directory");
const file_1 = require("./helpers/file");
if (Object.keys(cli_1.argv).length <= 3 && cli_1.argv._.length === 0) {
(0, alerts_1.info)(`Use the command "${cli_1.argv.$0} --help" for help`);
}
if (cli_1.argv.author) {
(0, open_1.default)('https://github.com/sponsors/zitrocode');
}
if (cli_1.argv._.length !== 0) {
cli_1.argv._.forEach((file) => {
// Convert file to string
file = file.toString();
let base_path = path_1.default.join(file);
if (cli_1.argv.base) {
base_path = path_1.default.join(cli_1.argv.base, file);
}
if (cli_1.argv.template) {
if (!cli_1.argv.template.includes('[rn]')) {
(0, alerts_1.error)('Check that template has "[rn]"');
return;
(() => {
if (Object.keys(cli_1.default).length <= 3 && cli_1.default._.length === 0) {
(0, alerts_1.info)(`Use the command "${cli_1.default.$0} --help" for help`);
return;
}
if (cli_1.default.a) {
console.log('Name:', chalk_1.default.green('Oscar Ortiz (zitrocode)'));
console.log('GitHub:', 'https://github.com/sponsors/zitrocode');
return;
}
if (cli_1.default._.length !== 0) {
cli_1.default._.forEach((file) => {
// Convert file to string
file = file.toString();
let base_path = path_1.default.join(file);
if (cli_1.default.b) {
base_path = path_1.default.join(cli_1.default.b, file);
}
file = cli_1.argv.template.replace('[rn]', file);
base_path = path_1.default.join(file);
}
const path_split = base_path.split(path_1.default.sep);
let path_file = '.';
path_split.forEach((currentPath, index) => {
path_file = path_1.default.normalize(path_file + path_1.default.sep + currentPath);
if (path_split.length - 1 !== index) {
// Create directory
(0, directory_1.create_folder)(path_file);
return;
if (cli_1.default.t) {
if (!cli_1.default.t.includes('[rn]')) {
(0, alerts_1.error)('Check that template has "[rn]"');
return;
}
file = cli_1.default.t.replace('[rn]', file);
base_path = path_1.default.join(file);
}
// Create file
(0, file_1.create_file)(path_file);
const path_split = base_path.split(path_1.default.sep);
let path_file = '.';
path_split.forEach((currentPath, index) => {
path_file = path_1.default.normalize(path_file + path_1.default.sep + currentPath);
if (path_split.length - 1 !== index) {
// Create directory
(0, directory_1.create_folder)(path_file);
return;
}
// Create file
(0, file_1.create_file)(path_file);
});
});
});
}
}
})();

@@ -6,3 +6,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.argv = void 0;
const yargs_1 = __importDefault(require("yargs"));

@@ -35,3 +34,4 @@ const helpers_1 = require("yargs/helpers");

.example('touch-win --template config/webpack.[rn].js build dev common', 'Use with option "template"')
.help().argv;
exports.argv = JSON.parse(JSON.stringify(cli));
.help()
.parseSync();
exports.default = cli;
{
"name": "touch-win",
"version": "1.0.1",
"version": "1.0.2",
"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.",

@@ -32,3 +32,2 @@ "main": "bin/index.js",

"chalk": "4.1.2",
"open": "8.4.0",
"yargs": "17.5.1"

@@ -35,0 +34,0 @@ },

#!/usr/bin/env node
import path from 'path';
import open from 'open';
import chalk from 'chalk';
import { argv } from './lib/cli';
import argv from './lib/cli';
import { info, error } from './helpers/alerts';

@@ -10,45 +10,50 @@ import { create_folder } from './helpers/directory';

if (Object.keys(argv).length <= 3 && argv._.length === 0) {
info(`Use the command "${argv.$0} --help" for help`);
}
(() => {
if (Object.keys(argv).length <= 3 && argv._.length === 0) {
info(`Use the command "${argv.$0} --help" for help`);
return;
}
if (argv.author) {
open('https://github.com/sponsors/zitrocode');
}
if (argv.a) {
console.log('Name:', chalk.green('Oscar Ortiz (zitrocode)'));
console.log('GitHub:', 'https://github.com/sponsors/zitrocode');
return;
}
if (argv._.length !== 0) {
argv._.forEach((file: string | number) => {
// Convert file to string
file = file.toString();
let base_path = path.join(file);
if (argv._.length !== 0) {
argv._.forEach((file: string | number) => {
// Convert file to string
file = file.toString();
let base_path = path.join(file);
if (argv.base) {
base_path = path.join(argv.base, file);
}
if (argv.b) {
base_path = path.join(argv.b, file);
}
if (argv.template) {
if (!argv.template.includes('[rn]')) {
error('Check that template has "[rn]"');
return;
if (argv.t) {
if (!argv.t.includes('[rn]')) {
error('Check that template has "[rn]"');
return;
}
file = argv.t.replace('[rn]', file);
base_path = path.join(file);
}
file = argv.template.replace('[rn]', file);
base_path = path.join(file);
}
const path_split = base_path.split(path.sep);
let path_file = '.';
path_split.forEach((currentPath: string, index: number) => {
path_file = path.normalize(path_file + path.sep + currentPath);
const path_split = base_path.split(path.sep);
let path_file = '.';
path_split.forEach((currentPath: string, index: number) => {
path_file = path.normalize(path_file + path.sep + currentPath);
if (path_split.length - 1 !== index) {
// Create directory
create_folder(path_file);
return;
}
if (path_split.length - 1 !== index) {
// Create directory
create_folder(path_file);
return;
}
// Create file
create_file(path_file);
// Create file
create_file(path_file);
});
});
});
}
}
})();
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
interface Argv {
_: (string | number)[];
base?: string;
author?: boolean;
template?: string;
b?: string;
a?: boolean;
t?: string;
$0: string;
}
const cli = yargs(hideBin(process.argv))

@@ -53,4 +42,5 @@ .scriptName('touch-win')

)
.help().argv;
.help()
.parseSync();
export const argv: Argv = JSON.parse(JSON.stringify(cli));
export default cli;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc