2021-10-28 19:32:31 +00:00
|
|
|
const getAppRoot = () => {
|
|
|
|
// Figure out where we're installed.
|
|
|
|
// Typically will be in node_modules/, but WooCommerce
|
|
|
|
// uses a local file path (packages/js/e2e-environment).
|
|
|
|
let appPath = false;
|
2022-07-27 20:13:17 +00:00
|
|
|
const dirPath = __dirname;
|
2021-10-28 19:32:31 +00:00
|
|
|
|
2022-07-27 20:13:17 +00:00
|
|
|
if ( dirPath.indexOf( 'node_modules' ) > -1 ) {
|
|
|
|
appPath = dirPath.split( 'node_modules' )[ 0 ];
|
|
|
|
} else if ( dirPath.indexOf( 'packages/js/e2e-environment' ) > -1 ) {
|
|
|
|
appPath = dirPath.split( 'packages/js/e2e-environment' )[ 0 ];
|
2021-10-28 19:32:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return appPath;
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = getAppRoot;
|