Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
yeoman-environment
Advanced tools
Handles the lifecyle and bootstrapping of generators in a specific environment
The yeoman-environment npm package is a robust tool for managing the lifecycle and execution of Yeoman generators. It provides a powerful API to handle the environment in which generators run, making it easier to create, run, and manage generators.
Creating a new environment
This feature allows you to create a new Yeoman environment instance. The environment is responsible for running the generators and managing their lifecycle.
const yeoman = require('yeoman-environment');
const env = yeoman.createEnv();
Registering a generator
This feature allows you to register a generator with a specific namespace. The generator can then be run using this namespace.
env.register(require.resolve('generator-name'), 'namespace');
Running a generator
This feature allows you to run a registered generator by its namespace. You can also pass options and a callback function to be executed once the generator has finished running.
env.run('namespace', options, done);
Resolving a generator
This feature allows you to resolve a generator by its namespace. This can be useful if you need to interact with the generator programmatically.
const Generator = env.get('namespace');
The yeoman-generator package provides the base class for creating Yeoman generators. While yeoman-environment focuses on managing the environment and lifecycle of generators, yeoman-generator is used to define the generators themselves.
Plop is a micro-generator framework that allows you to create and run generators. It is similar to yeoman-environment in that it helps manage the lifecycle of generators, but it is generally considered to be simpler and more lightweight.
Hygen is a code generator tool that focuses on being fast and easy to use. It provides a different approach to code generation compared to yeoman-environment, with a focus on simplicity and speed.
Handles the lifecycle and bootstrapping of generators in a specific environment
It provides a high-level API to discover, create and run generators, as well as further tuning of where and how a generator is resolved.
$ npm install yeoman-environment
Full documentation available here.
import { createEnv } from 'yeoman-environment';
// The #lookup() method will search the user computer for installed generators
// The search if done from the current working directory
await env.lookup();
await env.run('angular', { skipInstall: true });
For advance usage, see our API documentation for latest yeoman-environment.
API documentation for yeoman-environment v2.x.
BSD-2-Clause © Yeoman
FAQs
Handles the lifecyle and bootstrapping of generators in a specific environment
The npm package yeoman-environment receives a total of 682,228 weekly downloads. As such, yeoman-environment popularity was classified as popular.
We found that yeoman-environment demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.