Socket
Socket
Sign inDemoInstall

yeoman-generator

Package Overview
Dependencies
13
Maintainers
10
Versions
166
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

yeoman-generator


Version published
Weekly downloads
775K
decreased by-21.54%
Maintainers
10
Created
Weekly downloads
 

Package description

What is yeoman-generator?

Yeoman Generator is a scaffolding tool for building web applications. It provides a powerful and flexible way to create and manage project templates, allowing developers to quickly set up new projects with a consistent structure and configuration.

What are yeoman-generator's main functionalities?

Creating a Basic Generator

This feature allows you to create a basic Yeoman generator that copies a template file to the destination directory. The `copyTpl` method is used to process the template with provided data.

const Generator = require('yeoman-generator');

module.exports = class extends Generator {
  writing() {
    this.fs.copyTpl(
      this.templatePath('index.html'),
      this.destinationPath('index.html'),
      { title: 'Templated HTML' }
    );
  }
};

Prompting User Input

This feature allows you to prompt the user for input during the generator's execution. The `prompt` method is used to ask questions and store the answers.

const Generator = require('yeoman-generator');

module.exports = class extends Generator {
  async prompting() {
    this.answers = await this.prompt([{
      type: 'input',
      name: 'name',
      message: 'Your project name',
      default: this.appname // Default to current folder name
    }]);
  }
};

Composing with Other Generators

This feature allows you to compose your generator with other generators. The `composeWith` method is used to integrate another generator into your own.

const Generator = require('yeoman-generator');

module.exports = class extends Generator {
  initializing() {
    this.composeWith(require.resolve('generator-other/generators/app'));
  }
};

Other packages similar to yeoman-generator

Readme

Source

Generator npm Build Status Coverage Status Gitter

Rails-inspired generator system that provides scaffolding for your apps

Getting Started

If you're interested in writing your own Yeoman generator we recommend reading the official getting started guide. The guide covers all the basics you need to get started.

A generator can be as complex as you want it to be. It can simply copy a bunch of boilerplate files, or it can be more advanced asking the user's preferences to scaffold a tailor made project. This decision is up to you.

The fastest way to get started is to use generator-generator, a Yeoman generator to generate a Yeoman generator.

After reading the getting started guide, you might want to read the code source or visit our API documentation for a list of all methods available.

API documentation for v4.x.

Debugging

See the debugging guide.

Contributing

We love contributors! See our contribution guideline to get started.

Sponsors

Love Yeoman work and community? Help us keep it alive by donating funds to cover project expenses!
[Become a sponsor]

License

BSD license Copyright (c) Google

Keywords

FAQs

Last updated on 11 Feb 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc