Files
meteor/lib/util/getMeteorProjectRootPath.js
Dominik Ferber f1da865eca refactor(): Make Meteor file metadata available to rules
Rules now get the Meteor root directory passed to them. They can use that information to extract further information about the file being linted based on its path in the project.
2015-10-01 10:14:36 +02:00

20 lines
498 B
JavaScript

import path from 'path'
// must be require for rewire to work
var pathExists = require('path-exists')
export default function getMeteorProjectRootPath (currentDirectory) {
// No folder with '.meteor/release' in it found
if (currentDirectory === path.sep) {
return false
}
const meteorPath = path.join(currentDirectory, '.meteor', 'release')
if (pathExists.sync(meteorPath)) {
return currentDirectory
}
return getMeteorProjectRootPath(path.join(currentDirectory, '..'))
}