
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@sewing-kit/plugins
Advanced tools
@sewing-kit/plugins
Provides API for building sewing-kit
plugins.
For a more in-depth explanation of plugins and the philosophy behind them, check out these docs
@sewing-kit/plugins
also re-exports numerous types and classes from other sewing-kit
packages, such as core
, tasks
, and hooks
.
yarn add @sewing-kit/plugins --dev
In sewing-kit
, plugins are the things that actually "do" stuff. They piggyback off the architecture provided by sewing-kit
's core (i.e. hooks) to inject actual actions into your workspace's tasks.
The @sewing-kit
monorepo provides a suite of ready-made plugins for common use cases, like type-checking with TypeScript, transpiling with Babel, and testing with Jest. However, using sewing-kit
's API you're able (and encouraged) to write your own to fit your specific needs.
Below is an example sewing-kit.config.ts
that sets up a sewing-kit
workspace to lint with ESLint, test with Jest, and type-check with TypeScript. It also includes a custom plugin made with createWorkspaceTestPlugin
that taps into the jestConfig
hook introduced by the jest
plugin to specify a coverage directory.
import {createWorkspace} from '@sewing-kit/config';
import {eslint} from '@sewing-kit/plugin-eslint';
import {jest} from '@sewing-kit/plugin-jest';
import {workspaceTypeScript} from '@sewing-kit/plugin-typescript';
import {createWorkspaceTestPlugin} from '@sewing-kit/plugins';
export default createWorkspace((workspace) => {
workspace.use(
eslint(),
jest(),
workspaceTypeScript(),
createWorkspaceTestPlugin('JestCoveragePlugin', (taskContext) => {
const {hooks: taskHooks} = taskContext;
taskHooks.configure.hook((configHooks) => {
configHooks.jestConfig?.hook((jestConfig) => ({
...jestConfig,
coverageDirectory: './coverage',
}));
});
}),
);
});
Plugins can do anything from configuring hooks, adding steps to tasks, or introducing hooks for other plugins to hook into. Note that JestCoveragePlugin
makes use of the jestConfig
hook, which isn't provided by core sewing-kit
but is introduced to the workspace by jest
.
For more examples on how to write your own plugins, check out the source code for @sewing-kit/plugin-jest
, @sewing-kit/plugin-eslint
, @sewing-kit/plugin-typescript
, among others.
The following functions are provided by @sewing-kit/plugins
to help make writing your own plugins easier:
For composing several plugins into one:
createComposedProjectPlugin()
createComposedWorkspacePlugin()
For project plugins:
createProjectBuildPlugin()
createProjectDevPlugin()
createProjectPlugin()
createProjectTestPlugin()
For workspace plugins:
createWorkspaceBuildPlugin()
createWorkspaceDevPlugin()
createWorkspaceLintPlugin()
createWorkspacePlugin()
createWorkspaceTestPlugin()
createWorkspaceTypeCheckPlugin()
FAQs
APIs for building sewing-kit-next plugins
We found that @sewing-kit/plugins demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.