Socket
Socket
Sign inDemoInstall

touch-win

Package Overview
Dependencies
86
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.3 to 0.6.0

18

index.js
#!/usr/bin/env node
const path = require("path");

@@ -11,6 +10,12 @@

const createDirectory = require("./src/helpers/directory");
const alerts = require("./src/helpers/alerts");
const files = argv._;
const verbose = argv.verbose;
const template = argv.template;
const opts = {
error: false,
}
files.forEach((file) => {

@@ -21,2 +26,13 @@ if (argv.base) {

if (template) {
if (!template.includes("[rf]")) {
opts.error = true;
alerts.error('Check that the template has "[rf]"');
return;
}
file = template.replace("[rf]", file);
}
const path_file = path.normalize(file).split("\\");

@@ -23,0 +39,0 @@

2

package.json
{
"name": "touch-win",
"version": "0.5.3",
"version": "0.6.0",
"description": "This package written in JavaScript allows you to use the Linux \"touch\" command on Windows.",

@@ -5,0 +5,0 @@ "bin": {

# 🧑‍💻 Touch Win
> If you think that touch-win is a great project, consider making a small donation to be able to continue creating more projects like this. <a href="https://github.com/sponsors/zitrocode">GitHub Sponsor</a>.
---
This project provides a simple and fast solution to create multiple files from a single command; Touch-win is inspired by the "touch" command found on Linux and UNIX based systems.

@@ -7,6 +11,8 @@

## ✨ Features
## ✨ Features
- Allows you to create multiple files with a single command.
- Automatically creates the necessary folders for the location of the file to create if it does not exist.
- Allows you to create files from a base path.
- Allows you to create files from a template.

@@ -16,5 +22,7 @@ <!-- ## ⚡️ Requirements -->

## 📦 Installation
Install touch-win with your package manager:
#### NPM
```bash

@@ -25,2 +33,3 @@ npm install -g touch-win

## 🚀 Usage
```bash

@@ -31,20 +40,27 @@ touch-win --help

```bash
Usage: index.js [options] [file ...]
Usage: touch-win [options] [file ...]
Options:
--version Show version number [boolean]
-h, --help Show help [boolean]
-v, --verbose Run with verbose logging [boolean] [default: false]
-b, --base Base folder to place the file(s) [string]
--version Show version number [boolean]
-h, --help Show help [boolean]
-v, --verbose Run with verbose logging [boolean] [default: false]
-b, --base Base folder to place the file(s) [string]
-t, --template Template to generate files [string]
Examples:
touch-win [options] [file ...] Create file(s)
Examples:
index.js [options] [file ...] Create file(s)
touch-win src/bin/cli.js src/helpers/file.js src/helpers/directory.js Standard use
touch-win --base src/components/new_component Component.js Component.css Use with option "base"
touch-win --template src/components/new_component/Component.[rf] js test.js css Use with option "template"
touch-win --template config/webpack.[rf].js build dev common Use with option "template"
```
### Base
This option allows you to create files from a base path, this will help you not to repeat the same path in each file.
### Examples
```bash
# Usage normal
# Standard use
touch-win src/bin/cli.js src/helpers/file.js src/helpers/directory.js

@@ -59,3 +75,3 @@

```bash
# Usage with option "base"
# Use with option "base"
touch-win --base src/components/new_component component.js style.sass

@@ -67,3 +83,25 @@

```
___
**⚠️ WARNING:** This package is still under development, so it may have some bugs.
```bash
# Use with option "template"
touch-win --template src/components/NewComponent.[rf] js test.js css
# return
successfully created "src\components\NewComponent.js"
successfully created "src\components\NewComponent.test.js"
successfully created "src\components\NewComponent.css"
```
```bash
# Use with option "template"
touch-win --template config/webpack.[rf].js dev build common
# return
successfully created "config\webpack.dev.js"
successfully created "config\webpack.build.js"
successfully created "config\webpack.common.js"
```
---
**⚠️ WARNING:** This package is still under development, so it may have some bugs.

@@ -1,5 +0,12 @@

const yargs = require("yargs")(process.argv.slice(2))
const yargs = require("yargs")
yargs(process.argv.slice(2))
.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")
.wrap(yargs.terminalWidth())
.alias("h", "help")

@@ -16,4 +23,10 @@ .option("v", {

describe: "Base folder to place the file(s)",
}).argv;
})
.option("t", {
alias: "template",
type: "string",
describe: "Template to generate files"
})
.argv;
module.exports = yargs;
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