1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-04 13:10:09 +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,27 +1,33 @@
var path = require('path')
var fs = require('graceful-fs')
var mkdir = require('../mkdirs')
'use strict'
const u = require('universalify').fromCallback
const path = require('path')
const fs = require('graceful-fs')
const mkdir = require('../mkdirs')
const pathExists = require('../path-exists').pathExists
function createLink (srcpath, dstpath, callback) {
function makeLink (srcpath, dstpath) {
fs.link(srcpath, dstpath, function (err) {
fs.link(srcpath, dstpath, err => {
if (err) return callback(err)
callback(null)
})
}
fs.exists(dstpath, function (destinationExists) {
pathExists(dstpath, (err, destinationExists) => {
if (err) return callback(err)
if (destinationExists) return callback(null)
fs.lstat(srcpath, function (err, stat) {
fs.lstat(srcpath, (err, stat) => {
if (err) {
err.message = err.message.replace('lstat', 'ensureLink')
return callback(err)
}
var dir = path.dirname(dstpath)
fs.exists(dir, function (dirExists) {
const dir = path.dirname(dstpath)
pathExists(dir, (err, dirExists) => {
if (err) return callback(err)
if (dirExists) return makeLink(srcpath, dstpath)
mkdir.mkdirs(dir, function (err) {
mkdir.mkdirs(dir, err => {
if (err) return callback(err)
makeLink(srcpath, dstpath)
})
@@ -31,7 +37,7 @@ function createLink (srcpath, dstpath, callback) {
}
function createLinkSync (srcpath, dstpath, callback) {
var destinationExists = fs.existsSync(dstpath)
const destinationExists = fs.existsSync(dstpath)
if (destinationExists) return undefined
try {
@@ -41,8 +47,8 @@ function createLinkSync (srcpath, dstpath, callback) {
throw err
}
var dir = path.dirname(dstpath)
var dirExists = fs.existsSync(dir)
const dir = path.dirname(dstpath)
const dirExists = fs.existsSync(dir)
if (dirExists) return fs.linkSync(srcpath, dstpath)
mkdir.mkdirsSync(dir)
@@ -50,9 +56,6 @@ function createLinkSync (srcpath, dstpath, callback) {
}
module.exports = {
createLink: createLink,
createLinkSync: createLinkSync,
// alias
ensureLink: createLink,
ensureLinkSync: createLinkSync
createLink: u(createLink),
createLinkSync
}