Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const readmePath = path.resolve(packageFullPath, 'readme.md');
const docsPath = path.resolve(packageFullPath, 'docs');
const basePath = packagePath.split(path.sep).shift();
// load the package manifest
const manifest = require(manifestPath);
// check if the source files exist
const [ hasReadme, hasDocs ] = await Promise.all([
fs.pathExists(readmePath),
fs.pathExists(docsPath)
]);
// pull all of the files into Gatsby
await Promise.all([
filesystem.sourceNodes(props, {
name: `package-${packagePath}`,
path: manifestPath
}),
hasReadme && filesystem.sourceNodes(props, {
name: `package-${packagePath}`,
path: readmePath
}),
hasDocs && filesystem.sourceNodes(props, {
name: `package-${packagePath}`,
path: docsPath
})
]);
// HACK: attempt to pull in any stories from workbench for this package
const { stories } = components.find((component) => {
return component.package.name === manifest.name;
// load the package manifest
const manifest = require(manifestPath);
// check if the source files exist
const [ hasReadme, hasDocs ] = await Promise.all([
fs.pathExists(readmePath),
fs.pathExists(docsPath)
]);
// pull all of the files into Gatsby
await Promise.all([
filesystem.sourceNodes(props, {
name: `package-${packagePath}`,
path: manifestPath
}),
hasReadme && filesystem.sourceNodes(props, {
name: `package-${packagePath}`,
path: readmePath
}),
hasDocs && filesystem.sourceNodes(props, {
name: `package-${packagePath}`,
path: docsPath
})
]);
// HACK: attempt to pull in any stories from workbench for this package
const { stories } = components.find((component) => {
return component.package.name === manifest.name;
}) || {};
// HACK: if the component has stories then remove references used for hot-reloading
if (stories) {