1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-04 05:10:05 +02:00

update dependencies

This commit is contained in:
s2
2018-10-10 15:11:12 +02:00
parent da4083f574
commit 5c55c54b71
90877 changed files with 339776 additions and 33677 deletions

View File

@@ -1,7 +1,10 @@
var fs = require('graceful-fs')
var path = require('path')
var ncp = require('./ncp')
var mkdir = require('../mkdirs')
'use strict'
const fs = require('graceful-fs')
const path = require('path')
const ncp = require('./ncp')
const mkdir = require('../mkdirs')
const pathExists = require('../path-exists').pathExists
function copy (src, dest, options, callback) {
if (typeof options === 'function' && !callback) {
@@ -13,27 +16,34 @@ function copy (src, dest, options, callback) {
callback = callback || function () {}
options = options || {}
// Warn about using preserveTimestamps on 32-bit node:
if (options.preserveTimestamps && process.arch === 'ia32') {
console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n
see https://github.com/jprichardson/node-fs-extra/issues/269`)
}
// don't allow src and dest to be the same
var basePath = process.cwd()
var currentPath = path.resolve(basePath, src)
var targetPath = path.resolve(basePath, dest)
const basePath = process.cwd()
const currentPath = path.resolve(basePath, src)
const targetPath = path.resolve(basePath, dest)
if (currentPath === targetPath) return callback(new Error('Source and destination must not be the same.'))
fs.lstat(src, function (err, stats) {
fs.lstat(src, (err, stats) => {
if (err) return callback(err)
var dir = null
let dir = null
if (stats.isDirectory()) {
var parts = dest.split(path.sep)
const parts = dest.split(path.sep)
parts.pop()
dir = parts.join(path.sep)
} else {
dir = path.dirname(dest)
}
fs.exists(dir, function (dirExists) {
pathExists(dir, (err, dirExists) => {
if (err) return callback(err)
if (dirExists) return ncp(src, dest, options, callback)
mkdir.mkdirs(dir, function (err) {
mkdir.mkdirs(dir, err => {
if (err) return callback(err)
ncp(src, dest, options, callback)
})