Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sourcebit-source-filesystem

Package Overview
Dependencies
Maintainers
16
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sourcebit-source-filesystem - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

4

package.json
{
"name": "sourcebit-source-filesystem",
"version": "0.1.4",
"version": "0.1.5",
"description": "Sourcebit filesystem source plugin",

@@ -29,3 +29,3 @@ "main": "src/index.js",

"@stackbit/sdk": "^0.2.16",
"@stackbit/utils": "^0.1.0",
"@stackbit/utils": "^0.2.1",
"chokidar": "^3.5.2",

@@ -32,0 +32,0 @@ "fs-extra": "^10.0.0",

@@ -6,3 +6,3 @@ const chokidar = require('chokidar');

const { loadConfig } = require('@stackbit/sdk');
const { parseFile, mapPromise, readDirRecursively } = require('@stackbit/utils');
const { parseFile, mapPromise, reducePromise, readDirRecursively } = require('@stackbit/utils');
const { matchObjectsToModels } = require('./models-matcher');

@@ -28,2 +28,6 @@

function logError(message) {
console.error(`[${SOURCE}] ${message}`);
}
module.exports.bootstrap = async ({ setPluginContext, options, refresh }) => {

@@ -142,20 +146,25 @@ let { watch, sources = [] } = options;

}).sort();
return mapPromise(filePaths, async filePath => {
return reducePromise(filePaths, async (result, filePath) => {
const absFilePath = path.join(absSourcePath, filePath);
const data = await parseFile(absFilePath);
const relProjectPath = path.relative(absProjectPath, absFilePath);
const relSourcePath = path.relative(absSourcePath, absFilePath);
return _.assign({
__metadata: {
id: `${relProjectPath}`,
source: SOURCE,
sourceName: name,
sourcePath: sourcePath,
relSourcePath: relSourcePath,
relProjectPath: relProjectPath
}
}, data);
});
try {
const data = await parseFile(absFilePath);
result.push(_.assign({
__metadata: {
id: `${relProjectPath}`,
source: SOURCE,
sourceName: name,
sourcePath: sourcePath,
relSourcePath: relSourcePath,
relProjectPath: relProjectPath
}
}, data));
} catch (error) {
logError(`failed to parse file: ${relProjectPath}`);
}
return result;
}, []);
});
return _.chain(result).flatten().value();
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc