How to use the path function from app-root-path

Find comprehensive JavaScript app-root-path.path code examples handpicked from public code repositorys.

14
15
16
17
18
19
20
21
22
23

const calculatedAppRoot = !!require.main ? path.dirname(require.main.filename) : (!!process.mainModule ? path.dirname(process.mainModule.filename) : process.cwd())

/// Determine root configuration folder
this._configFilePathRelative = opts.relativePath
this._configFilePathAppRoot = fs.existsSync(calculatedAppRoot) ? calculatedAppRoot : appRoot.path

/// include files that match this in their filename (including extension)
this._configSelectors = opts.configSelectors || ['config.js']
this._dataSelectors = opts.dataSelectors || ['.json']
fork icon0
star icon0
watch icon0

16
17
18
19
20
21
22
23
24
25
  }
} catch (e) {
  log.warn('No package.json found at root of project', e)
}


const appRoot = appRootPath.path


module.exports = appRoot
fork icon0
star icon0
watch icon0