@achingbrain/debootstrap
Advanced tools
Comparing version 0.0.1 to 0.0.2
const fs = require('fs-extra') | ||
const path = require('path') | ||
const dereferenceDir = (dir) => { | ||
const dereferenceDir = (options) => { | ||
return new Promise((resolve, reject) => { | ||
if (!dir) { | ||
if (!options.path) { | ||
return reject(new Error('Please specify a directory')) | ||
} | ||
const backup = `${dir}.backup` | ||
const backup = `${options.path}.backup` | ||
const dotDirs = [] | ||
fs.copy(dir, backup, { | ||
fs.copy(options.path, backup, { | ||
dereference: true, | ||
@@ -25,6 +25,7 @@ filter: (filePath) => { | ||
.then(() => Promise.all( | ||
dotDirs.map(dotDir => fs.copy(dotDir, dotDir.replace(dir, backup))) | ||
dotDirs | ||
.map(dotDir => fs.copy(dotDir, dotDir.replace(options.path, backup))) | ||
)) | ||
.then(() => fs.remove(dir)) | ||
.then(() => fs.move(backup, dir)) | ||
.then(() => fs.remove(options.path)) | ||
.then(() => fs.move(backup, options.path)) | ||
.then(resolve) | ||
@@ -31,0 +32,0 @@ .catch(reject) |
{ | ||
"name": "@achingbrain/debootstrap", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Like lerna bootstrap, but in reverse", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6168
139