mem-fs-editor
Advanced tools
Comparing version 11.0.0 to 11.0.1
@@ -14,3 +14,8 @@ import assert from 'assert'; | ||
to = path.resolve(to); | ||
options = options || {}; | ||
options = options ?? {}; | ||
const { fromBasePath } = options; | ||
if (fromBasePath) { | ||
const applyBasePath = (from) => (path.isAbsolute(from) ? from : path.resolve(fromBasePath, from)); | ||
from = Array.isArray(from) ? from.map(applyBasePath) : applyBasePath(from); | ||
} | ||
let files = []; | ||
@@ -40,3 +45,3 @@ if (options.noGlob) { | ||
const processDestinationPath = options.processDestinationPath || ((path) => path); | ||
const root = options.fromBasePath || getCommonPath(from); | ||
const root = fromBasePath ?? getCommonPath(from); | ||
generateDestination = (filepath) => { | ||
@@ -43,0 +48,0 @@ const toFile = path.relative(root, filepath); |
@@ -29,3 +29,3 @@ import ejs from 'ejs'; | ||
if (Array.isArray(filePath)) { | ||
return filePath.reduce((memo, pattern) => memo.concat(globify(normalize(pattern))), []); | ||
return filePath.reduce((memo, pattern) => memo.concat(globify(pattern)), []); | ||
} | ||
@@ -32,0 +32,0 @@ filePath = normalize(filePath); |
{ | ||
"name": "mem-fs-editor", | ||
"version": "11.0.0", | ||
"version": "11.0.1", | ||
"description": "File edition helpers working on top of mem-fs", | ||
@@ -41,5 +41,5 @@ "type": "module", | ||
"deep-extend": "^0.6.0", | ||
"ejs": "^3.1.9", | ||
"ejs": "^3.1.10", | ||
"globby": "^13.2.2", | ||
"isbinaryfile": "^5.0.0", | ||
"isbinaryfile": "5.0.2", | ||
"minimatch": "^9.0.3", | ||
@@ -46,0 +46,0 @@ "multimatch": "^6.0.0", |
@@ -13,8 +13,9 @@ # mem-fs-editor | ||
import { create as createMemFs } from 'mem-fs'; | ||
import editor from 'mem-fs-editor'; | ||
import { create as createEditor } from 'mem-fs-editor'; | ||
const store = createMemFs(); | ||
const fs = editor.create(store); | ||
const fs = createEditor(store); | ||
fs.write('somefile.js', 'var a = 1;'); | ||
await fs.commit() | ||
``` | ||
@@ -21,0 +22,0 @@ |
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
44699
827
161
Updatedejs@^3.1.10
Updatedisbinaryfile@5.0.2