metro/scripts/_getPackages.js

21 lines
678 B
JavaScript

/**
* 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.
*/
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() {
return fs
.readdirSync(PACKAGES_DIR)
.map(file => path.resolve(PACKAGES_DIR, file))
.filter(f => fs.lstatSync(path.resolve(f)).isDirectory());
};