Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@stackbit/sdk
Advanced tools
Stackbit SDK contains set of utilities to work with stackbit.yaml file.
npm install @stackbit/sdk
Create a FileBrowser
with FileSystemFileBrowserAdapter
or GitHubFileBrowserAdapter
:
Analyzing a local project:
import { FileSystemFileBrowserAdapter, FileBrowser } from '@stackbit/sdk';
const fileBrowserAdapter = new FileSystemFileBrowserAdapter({ dirPath: inputDir });
const fileBrowser = new FileBrowser({ fileBrowserAdapter });
Analyzing a remote GitHub project:
import { GitHubFileBrowserAdapter, FileBrowser } from '@stackbit/sdk';
const fileBrowserAdapter = new GitHubFileBrowserAdapter({
owner: 'stackbit',
repo: 'theme',
branch: 'master',
auth: GITHUB_PERSONAL_ACCESS_TOKEN
});
const fileBrowser = new FileBrowser({ fileBrowserAdapter });
Then, pass the fileBrowser
to the analyzeSite()
method, get the result and save the config
as stackbit.yaml
:
import { writeConfig, analyzeSite } from '@stackbit/sdk';
const analyzeResult = await analyzeSite({ fileBrowser });
await writeConfig({ dirPath: inputDir, config: analyzeResult.config });
Load and validate stackbit.yaml
. Any errors will be returned within the errors
array.
import { loadConfig } from '@stackbit/sdk';
const configResult = await loadConfig({ dirPath: inputDir });
configResult.errors.forEach((error) => {
console.log(error.message);
});
If configResult.config
is not null, pass it to load and validate web-site's content. Any errors will be returned within the errors
array, and loaded content within the contentItems
:
import { loadContent } from '@stackbit/sdk';
if (configResult.config) {
return;
}
const contentResult = await loadContent({ dirPath: inputDir, config: configResult.config });
contentResult.contentItems.forEach((contentItem) => {
console.log(contentItem.__metadata.filePath);
});
contentResult.errors.forEach((error) => {
console.log(error.message);
});
FAQs
Stackbit SDK
The npm package @stackbit/sdk receives a total of 337,692 weekly downloads. As such, @stackbit/sdk popularity was classified as popular.
We found that @stackbit/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.