mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-22 05:02:18 +08:00
19 lines
520 B
JavaScript
19 lines
520 B
JavaScript
|
import { statSync, readFileSync } from 'fs';
|
||
|
import { join } from 'path';
|
||
|
|
||
|
const p = (l) => join(__dirname, '..', '..', ...l);
|
||
|
|
||
|
export const getDeployables = (files, extraFilter) => {
|
||
|
return files.filter((f) => {
|
||
|
const packageJsonLocation = p(['examples', f, 'package.json']);
|
||
|
let stats = null;
|
||
|
try {
|
||
|
stats = statSync(packageJsonLocation);
|
||
|
} catch (e) {
|
||
|
// the folder had no package.json, we'll ignore
|
||
|
}
|
||
|
|
||
|
return stats && stats.isFile() && extraFilter(packageJsonLocation);
|
||
|
});
|
||
|
};
|