Skip to content
On this page

yeoman generator 만들기

Title
yeoman generator 만들기
Category
Project
Tags
Aliases
yeoman generator 만들기
Created
2 years ago
Updated
last year

The web's scaffolding tool for modern webapps | Yeoman

Example

Hello World

js
// index.cjs

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

module.exports = class extends Generator {
	method1() {
		this.log('method 1 just ran');
	}

	method2() {
		this.log('method 2 just ran');
	}

	async prompting() {
		const answers = await this.prompt([
			{
				type: 'input',
				name: 'name',
				message: 'Your project name',
				default: this.appname, // Default to current folder name
			},
			{
				type: 'confirm',
				name: 'cool',
				message: 'Would you like to enable the Cool feature?',
			},
		]);

		this.log('app name', answers.name);
		this.log('cool feature', answers.cool);
	}
};
// index.cjs

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

module.exports = class extends Generator {
	method1() {
		this.log('method 1 just ran');
	}

	method2() {
		this.log('method 2 just ran');
	}

	async prompting() {
		const answers = await this.prompt([
			{
				type: 'input',
				name: 'name',
				message: 'Your project name',
				default: this.appname, // Default to current folder name
			},
			{
				type: 'confirm',
				name: 'cool',
				message: 'Would you like to enable the Cool feature?',
			},
		]);

		this.log('app name', answers.name);
		this.log('cool feature', answers.cool);
	}
};

Trouble shooting

Released under the MIT License.