touch-win
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -43,9 +43,9 @@ #!/usr/bin/env node | ||
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); | ||
if (path_split.length - 1 === index && !cli_1.default.D) { | ||
// Create file | ||
(0, file_1.create_file)(path_file); | ||
return; | ||
} | ||
// Create file | ||
(0, file_1.create_file)(path_file); | ||
// Create director | ||
(0, directory_1.create_folder)(path_file); | ||
}); | ||
@@ -52,0 +52,0 @@ }); |
@@ -28,2 +28,7 @@ "use strict"; | ||
}) | ||
.option('D', { | ||
alias: 'directories-only', | ||
type: 'boolean', | ||
describe: 'Create directories only' | ||
}) | ||
.alias('h', 'help') | ||
@@ -30,0 +35,0 @@ .example('touch-win src/bin/cli.js src/helpers/file.js src/helpers/directory.js', 'Standard use') |
{ | ||
"name": "touch-win", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"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.", | ||
@@ -11,3 +11,5 @@ "main": "bin/index.js", | ||
"prepare": "npm run build", | ||
"build": "rimraf ./bin && tsc", | ||
"dev:win": ".\\node_modules\\.bin\\rimraf .bin\\ && tsc", | ||
"dev": "./node_modules/.bin/rimraf .bin/ && tsc", | ||
"build": "tsc", | ||
"test": "jest" | ||
@@ -36,3 +38,3 @@ }, | ||
"devDependencies": { | ||
"@types/jest": "28.1.7", | ||
"@types/jest": "^29.5.1", | ||
"@types/node": "18.7.5", | ||
@@ -45,2 +47,3 @@ "@types/yargs": "17.0.11", | ||
"prettier": "2.7.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "28.0.8", | ||
@@ -47,0 +50,0 @@ "typescript": "4.7.4" |
@@ -47,10 +47,10 @@ #!/usr/bin/env node | ||
if (path_split.length - 1 !== index) { | ||
// Create directory | ||
create_folder(path_file); | ||
if (path_split.length - 1 === index && !argv.D) { | ||
// Create file | ||
create_file(path_file); | ||
return; | ||
} | ||
// Create file | ||
create_file(path_file); | ||
// Create director | ||
create_folder(path_file); | ||
}); | ||
@@ -57,0 +57,0 @@ }); |
@@ -24,2 +24,7 @@ import yargs from 'yargs'; | ||
}) | ||
.option('D', { | ||
alias: 'directories-only', | ||
type: 'boolean', | ||
describe: 'Create directories only' | ||
}) | ||
.alias('h', 'help') | ||
@@ -26,0 +31,0 @@ |
import { create_file } from '../src/helpers/file'; | ||
test('Create a file called "touch-win.js" in the "test" folder', () => { | ||
expect(() => create_file('tests/touch-win.js')).toMatchSnapshot( | ||
'Successfully created file "tests/touch-win.js"' | ||
const nameFile = 'tests/touch-win.js'; | ||
test('Create a file called "touch-win.js" in the "test" folder', (): void => { | ||
expect(() => create_file(nameFile)).toMatchSnapshot( | ||
`Successfully created file "${nameFile}"` | ||
); | ||
}); |
import { create_folder } from '../src/helpers/directory'; | ||
test('Create a folder inside "tests" with the name "files_test"', () => { | ||
expect(() => create_folder('tests/files_test')).toMatchSnapshot(''); | ||
const nameDir = 'tests/dir_test'; | ||
test(`Create a folder inside "tests" with the name "${nameDir}"`, (): void => { | ||
expect(() => create_folder(nameDir)).toMatchSnapshot(''); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
160312
337
11