install-local-dependencies
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -5,2 +5,12 @@ # Changelog | ||
### [0.2.3](https://github.com/body-builder/install-local-dependencies/compare/v0.2.1...v0.2.3) (2021-11-30) | ||
### Bug Fixes | ||
* Random ENOENT errors in `copy_file_or_directory` on Windows ([e8674fa](https://github.com/body-builder/install-local-dependencies/commit/e8674fa13f3b23c83922c7cee05f56ed07300790)) | ||
* Use POSIX path separator also in `get_target_path` ([8ef6120](https://github.com/body-builder/install-local-dependencies/commit/8ef6120e280a8a3fb3b2469ebc680bc0c25e0cc2)) | ||
* **watch-local-dependencies:** Wait with `add`/`change` events until the entire file gets written ([906c6c6](https://github.com/body-builder/install-local-dependencies/commit/906c6c6443658d5bfe54c52a0b87e462b154a893)) | ||
* Windows backslash-issue in `get_ignore_rules()` ([efb7571](https://github.com/body-builder/install-local-dependencies/commit/efb75710f4e721c35587d2bb55d919a5908ccf00)) | ||
### [0.2.2](https://github.com/body-builder/install-local-dependencies/compare/v0.2.1...v0.2.2) (2021-10-25) | ||
@@ -7,0 +17,0 @@ |
{ | ||
"name": "install-local-dependencies", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Yet another local dependency installer", | ||
@@ -34,3 +34,2 @@ "homepage": "https://github.com/body-builder/install-local-dependencies#readme", | ||
"find-cache-dir": "^3.3.1", | ||
"fs-extra": "^10.0.0", | ||
"lodash": "^4.17.21", | ||
@@ -37,0 +36,0 @@ "npm-packlist": "^3.0.0", |
@@ -0,1 +1,2 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
@@ -11,8 +12,8 @@ const packlist = require('npm-packlist'); | ||
* @param relative_package_path {string} | ||
* @returns {Promise<{package_json_path: string, package_path: string, package_json_filename: string, package_json_content: *}>} | ||
* @returns {{package_json_path: string, package_path: string, package_json_filename: string, package_json_content: *}} | ||
*/ | ||
async function get_package_details(relative_package_path) { | ||
function get_package_details(relative_package_path) { | ||
const package_path = path.resolve(relative_package_path); | ||
if (!await promisified.fs.exists(package_path)) { | ||
if (!fs.existsSync(package_path)) { | ||
throw new Error(`Module '${relative_package_path}' was not found in '${path.resolve()}'.`); | ||
@@ -46,7 +47,7 @@ } | ||
// try to read .npmignore | ||
ignorefile = await promisified.fs.readFile(npmignorePath, 'utf-8'); | ||
ignorefile = await fs.promises.readFile(npmignorePath, 'utf-8'); | ||
} catch (e) { | ||
// .npmignore not found, try to read .gitignore | ||
try { | ||
ignorefile = await promisified.fs.readFile(gitignorePath, 'utf-8'); | ||
ignorefile = await fs.promises.readFile(gitignorePath, 'utf-8'); | ||
} catch (e) { | ||
@@ -138,3 +139,3 @@ // No ignore file found | ||
if (!await promisified.fs.exists(tarball_path)) { | ||
if (!fs.existsSync(tarball_path)) { | ||
throw new Error(`Could not locate the created tarball '${tarball_name}' in '${temp_path}'.`); | ||
@@ -185,3 +186,3 @@ } | ||
const tarball_path = path.resolve(temp_path, tarball_name); | ||
await promisified.fs.unlink(tarball_path); | ||
await fs.promises.unlink(tarball_path); | ||
} | ||
@@ -188,0 +189,0 @@ |
const path = require('path'); | ||
const fs = require('fs'); | ||
const fse = require('fs-extra'); | ||
const pify = require('pify'); | ||
@@ -8,7 +7,2 @@ const rimraf = require('rimraf'); | ||
const promisified = { | ||
fs: { | ||
...pify(fs), | ||
exists: pify(fs.exists, { errorFirst: false }), | ||
}, | ||
fse: pify(fse), | ||
rimraf: pify(rimraf), | ||
@@ -102,4 +96,4 @@ }; | ||
async function validate_path(path) { | ||
if (!await promisified.fs.exists(path)) { | ||
await promisified.fs.mkdir(path, { recursive: true }); | ||
if (!fs.existsSync(path)) { | ||
await fs.promises.mkdir(path, { recursive: true }); | ||
} | ||
@@ -115,3 +109,3 @@ } | ||
try { | ||
return await promisified.fse.lstat(file_path); | ||
return await fs.promises.lstat(file_path); | ||
} catch (e) { | ||
@@ -144,3 +138,3 @@ return null; | ||
if (is_directory) { | ||
return promisified.fs.mkdir(destination_path); | ||
return fs.promises.mkdir(destination_path); | ||
} | ||
@@ -150,3 +144,3 @@ | ||
return promisified.fse.copy(source_path, destination_path); | ||
return fs.promises.copyFile(source_path, destination_path); | ||
} | ||
@@ -160,3 +154,3 @@ | ||
async function detect_newline_at_eof(path) { | ||
const fileContents = await promisified.fs.readFile(path, 'utf-8'); | ||
const fileContents = await fs.promises.readFile(path, 'utf-8'); | ||
@@ -163,0 +157,0 @@ const matches = fileContents.match(/\r?\n$/); |
@@ -0,1 +1,2 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
@@ -40,3 +41,3 @@ const chokidar = require('chokidar'); | ||
promisified.fs.writeFile(package_json_path, JSON.stringify(content, null, 2) + newline_char); | ||
await fs.promises.writeFile(package_json_path, JSON.stringify(content, null, 2) + newline_char); | ||
} | ||
@@ -62,2 +63,3 @@ | ||
* @param manager | ||
* @param install_args | ||
* @returns {Promise<void>} | ||
@@ -153,3 +155,3 @@ */ | ||
if (!await promisified.fs.exists(modules_path)) { | ||
if (!fs.existsSync(modules_path)) { | ||
throw new Error(`Could not find the modules directory. Tried: '${modules_path}'`); | ||
@@ -163,3 +165,3 @@ } | ||
if (!await promisified.fs.exists(installed_package_path)) { | ||
if (!fs.existsSync(installed_package_path)) { | ||
throw new Error(`Could not find the installed package '${local_dependency_name}' in '${installed_package_path}'`); | ||
@@ -232,2 +234,5 @@ } | ||
const watcher = chokidar.watch(files_to_watch, { | ||
awaitWriteFinish: { | ||
stabilityThreshold: 200, | ||
}, | ||
// We compare the paths manually, because glob-patterns were not working on MacOS with folder-specific ignore rules (eg. `/tests`), | ||
@@ -251,4 +256,4 @@ // only if we explicitly set the rule to `/tests/**/*`. We could check each rule, whether it is a folder, and add `/**/*` respectively, | ||
const filename = path.relative(parent_dependency.local_package_path, source_path); | ||
const target_path = path.resolve(parent_dependency.installed_package_path, filename); | ||
const filename = definitely_posix(path.relative(parent_dependency.local_package_path, source_path)); | ||
const target_path = definitely_posix(path.resolve(parent_dependency.installed_package_path, filename)); | ||
@@ -255,0 +260,0 @@ return { |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
31346
9
6
- Removedfs-extra@^10.0.0
- Removedfs-extra@10.1.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjsonfile@6.1.0(transitive)
- Removeduniversalify@2.0.1(transitive)