mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
23 lines
751 B
JavaScript
23 lines
751 B
JavaScript
// ==========================================
|
|
// BOWER: is-repo
|
|
// ==========================================
|
|
// Copyright 2012 Twitter, Inc
|
|
// Licensed under The MIT License
|
|
// http://opensource.org/licenses/MIT
|
|
// ==========================================
|
|
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
var fileExists = require('./file-exists');
|
|
|
|
// This module checks if a path is a local repository
|
|
// If the repository is a link, it will be falsy
|
|
module.exports = function (dir, callback) {
|
|
fileExists(path.join(dir, '.git'), function (exists) {
|
|
if (!exists) return callback(false);
|
|
fs.lstat(dir, function (err, stat) {
|
|
if (err) return callback(false);
|
|
callback(!stat.isSymbolicLink());
|
|
});
|
|
});
|
|
}; |