mac-hardlink
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -6,7 +6,7 @@ #!/usr/bin/env node | ||
const unlinkOnly = _.find(process.argv, '-u'); | ||
const source = process.argv[2]; | ||
const dest = process.argv[3]; | ||
const u = process.argv[4]; | ||
let npmignoreLines; | ||
let npmignoreLines = []; | ||
const blacklist = ['node_modules', '.git', '.github', '.gradle', 'package.json', '.gitignore', '.npmignore', '.idea']; | ||
@@ -36,3 +36,7 @@ | ||
function getNpmIgnore() { | ||
const content = _.trim(fs.readFileSync(`${source}/.npmignore`)); | ||
const npmignorePath = `${source}/.npmignore`; | ||
if (!fs.existsSync(npmignorePath)) { | ||
return []; | ||
} | ||
const content = _.trim(fs.readFileSync(npmignorePath)); | ||
return _.split(content, '\n'); | ||
@@ -77,3 +81,3 @@ } | ||
unhardlink(destFullPath); | ||
if (u) { | ||
if (unlinkOnly) { | ||
console.log(`unlinking ${destFullPath}`); | ||
@@ -89,6 +93,23 @@ return; | ||
function showHelp() { | ||
if (_.find(process.argv, '-h')) { | ||
console.log(`mac-hardlinks \ | ||
usage: | ||
hardlink [src] [dest] : link from src to dest \ | ||
hardlink [src] -u : unlink src`); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
function run() { | ||
if (showHelp()) { | ||
return; | ||
} | ||
assertSourceExists(); | ||
ensureHLN(); | ||
ensureDestExists(); | ||
if (!unlinkOnly) { | ||
ensureDestExists(); | ||
} | ||
npmignoreLines = getNpmIgnore(); | ||
@@ -95,0 +116,0 @@ hardlinkRecursively(); |
{ | ||
"name": "mac-hardlink", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Hardlinks on macOS", | ||
@@ -5,0 +5,0 @@ "author": "Daniel Zlotin <zlotindaniel@gmail.com>", |
# Hardlinks on macOS | ||
## Installation | ||
`npm i -g mac-hardlink` | ||
## Usage | ||
`hardlink <src-dir> <dest-dir>` | ||
or to unlink: | ||
`hardlink <src-dir> <dest-dir> u` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7958
7
97
14