metro/scripts/_getPackages.js

23 lines
692 B
JavaScript
Raw Normal View History

2017-01-26 12:56:40 +00:00
/**
* Copyright (c) 2014, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @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());
};