metro/scripts/_getPackages.js

22 lines
577 B
JavaScript
Raw Permalink Normal View History

2017-01-26 12:56:40 +00:00
/**
* Copyright (c) 2014-present, Facebook, Inc.
2017-01-26 12:56:40 +00:00
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
2017-01-26 12:56:40 +00:00
*/
const fs = require('fs');
const path = require('path');
const PACKAGES_DIR = path.resolve(__dirname, '../packages');
// Get absolute paths of all directories under packages/*
module.exports = function getPackages() {
2017-05-22 10:51:24 +00:00
return fs
.readdirSync(PACKAGES_DIR)
2017-01-26 12:56:40 +00:00
.map(file => path.resolve(PACKAGES_DIR, file))
.filter(f => fs.lstatSync(path.resolve(f)).isDirectory());
};