mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-21 19:31:57 +00:00
* Add copyright script Copied over our copyright script from the react repo. I made a small fix to handle shebangs. * Update copyright on all files Run the script.
32 lines
745 B
JavaScript
32 lines
745 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
|
|
module.exports = function walk(dir) {
|
|
let results = [];
|
|
/**
|
|
* If the param is a directory we can return the file
|
|
*/
|
|
if (dir.includes('md')) {
|
|
return [dir];
|
|
}
|
|
const list = fs.readdirSync(dir);
|
|
list.forEach(function (file) {
|
|
file = dir + '/' + file;
|
|
const stat = fs.statSync(file);
|
|
if (stat && stat.isDirectory()) {
|
|
/* Recurse into a subdirectory */
|
|
results = results.concat(walk(file));
|
|
} else {
|
|
/* Is a file */
|
|
results.push(file);
|
|
}
|
|
});
|
|
return results;
|
|
};
|