Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • May 17 16:39
    frbuceta opened #406
  • May 15 17:12
    ECasio opened #242
  • May 13 17:55
    mshima locked #746
  • May 13 14:54
    mshima closed #746
  • May 10 11:51
    adautomendes opened #1762
  • May 06 05:19
    amirmsai opened #746
  • May 04 22:29
    frbuceta opened #253
  • May 03 23:42
    BradTFT closed #1761
  • May 03 16:11
    BradTFT opened #1761
  • May 01 07:08
    dependabot[bot] labeled #745
  • May 01 07:08
    dependabot[bot] labeled #745
  • May 01 07:08
    dependabot[bot] opened #745
  • May 01 07:08

    dependabot[bot] on npm_and_yarn

    Bump mocha from 9.1.3 to 10.0.0… (compare)

  • May 01 07:08

    dependabot[bot] on npm_and_yarn


  • May 01 07:08
    dependabot[bot] closed #742
  • May 01 07:08
    dependabot[bot] labeled #744
  • May 01 07:08
    dependabot[bot] labeled #744
  • May 01 07:08
    dependabot[bot] opened #744
  • May 01 07:08

    dependabot[bot] on npm_and_yarn

    Bump got from 8.3.2 to 12.0.4 … (compare)

  • May 01 07:07

    dependabot[bot] on npm_and_yarn


Hi everyone. I have 'generator-a' which calls for 'generator-b' inside with command composeWith(). Now I want prompts of 'generator-b' to be displayed before prompts of 'generator-a'. Is it possible? What is the best way to achieve this? Thanks.
Minu Francis
Hi All
I am trying to incorporate yeoman in my oclif based CLI and I added the below lines as mentioned in the official documentation:
const env = createEnv()
env.register(require.resolve('../generators/component1'), oclif:component1);
//await super.generate('component1');
env.run('oclif:component1', (err: any, stdout: any, stderr: any) => {
But I seem to be getting this error:
TypeError: Class extends value #<Object> is not a constructor or null
at Object.<anonymous> (C:/Project/SynapseModernization/2020/cli/src/generators/component1.ts:5:42)) 439:23)
at Module.m._compile (C:/Project/SynapseModernization/2020/cli/node_modules/ts-node/src/index.ts:cli/node_modules/ts-node/src/index.ts:442:12)439:23) -environment/lib/store.js:47:27)
at Object.require.extensions.(anonymous function) [as .ts] (C:/Project/SynapseModernization/2020/js:71:39)cli/node_modules/ts-node/src/index.ts:442:12)
at Object.get [as oclif:component1] (C:/Project/SynapseModernization/2020/cli/node_modules/yeoman-environment/lib/store.js:47:27)
at Store.get (C:/Project/SynapseModernization/2020/cli/node_modules/yeoman-environment/lib/store.js:71:39)
at Environment.get (C:/Project/SynapseModernization/2020/cli/node_modules/yeoman-environment/lib/environment.js:540:48)
at Environment.create (C:/Project/SynapseModernization/2020/cli/node_modules/yeoman-environment/lib/environment.js:613:37)
at instantiateAndRun (C:/Project/SynapseModernization/2020/cli/node_modules/yeoman-environment/lib/environment.js:729:30)
at Environment.run (C:/Project/SynapseModernization/2020/cli/node_modules/yeoman-environment/lib/environment.js:758:12)
at CsGenerator.run (C:/Project/SynapseModernization/2020/cli/src/commands/component1.ts:18:9)
at CsGenerator._run (C:/Project/SynapseModernization/2020/cli/node_modules/@oclif/command/lib/command.js:35:31)
Any inputs are greatly appreciated
Minu Francis
And it occurs at env.run call
I would like to know if there is a process to re-scaffold a project (generated with and old version of a generator) with the latest version of the same generator in order to benefit from its latest improvement and also the latest version of the dependencies ? Timpically I am using the yo-office-generator and it comes now with a leaner project structure and dist directory plus some other linter improvements.
Bryan Stopp

Hey folks - question: i'm trying to use the yeoman-test createGenerator helper method. But i get:

TypeError: console.Console is not a constructor

    at new TerminalAdapter (/work/spaces/generator-test/node_modules/yeoman-environment/lib/adapter.js:24:39)

I tried to base my logic off of the tests here: https://github.com/yeoman/yeoman-test/blob/bb820da630d9d7ee8d9e7898848e896427e25675/test/helpers.js#L41-L70 but while that works when i run locally, my generator tests don't work.. Any thoughts?

@bstopp You can step into the yeoman-environment in node_modules, then print the options.console out.
The source code is here: https://github.com/yeoman/environment/blob/master/lib/adapter.js#L24
Bryan Stopp
Yeh - turns out the issue is with Jest. The global console variable/module that Jest creates doesn’t have the specie constructor that the Yeoman Environment expects. Hence the error. Amazingly enough someone committed a fix to Jest yesterday-ish and should make the next release. Heh.
Hhh, interesting.
Bryan Stopp
Bryan Stopp
Craziest thing. Took a while for my coworker to help me find. Thanks tho! πŸ˜†
np ✌️
Bryan Stopp
We are guessing if we moved to Mocha itd work no prob. But i started down the Jest path so dont want to rewrite w/o good reason
I would be willing to move to AVA https://github.com/avajs/ava .
Bryan Stopp
πŸ€¦β€β™‚οΈ im just getting the hang of Jest! 🀣
Both good, just choose your love.
Bryan Stopp
There's no way to determine whether or not an option was set as a default value vs actually passed on the CLI - is there?
Bryan Stopp
When you run composeWith is it aware of other generators running, such that, the same generator won't be executed twice? So i have generator A, and generator B, and both call composeWith('Generator Z') with the same target output folder, it only runs Generator Z once?
How does one get to use ES6 module import/export syntax with yeoman?

Hello all, I have started to use yeoman to generate a project and had little issues so far aside from testing. Writing tests is something I'm still learning about but the issue I'm having I just can't seem to make sense of a solution or find more relevant information online or on the docs, I wonder if someone could help me since I'm really curious to know what can be done to solve it and would be a great lesson for me.

How to test this generator properly

The generator makes one or more requests to download a few .zip files, extracts them and copies them to a directory. This can take a variable amount of time and when I write a test to assert file presence what ends up happening is that the assertions occur while the files are still being downloaded.

The code of my generator is open source and can be found here: https://github.com/csalmeida/generator-hozokit/blob/generate-hozokit/generators/app/index.js

This is the test I attempted to write (tried a few more things but all of them have similar results).

'use strict';
const path = require('path');
const assert = require('yeoman-assert');
const helpers = require('yeoman-test');

describe('generator-hozokit:app', () => {
  beforeAll(() => {
    return helpers
      .run(path.join(__dirname, '../generators/app'))
      .withPrompts({ projectName: 'Hozokit Test', installWordpress: false })
      .then(function() {
        // Checks that Hozokit was successfully extracted and present.
        assert.file(['../hozokit-test/wp-content/themes/hozokit-test', '../hozokit-test/wp-content/themes/hozokit-test/index.php', '../hozokit-test/wp-content/themes/hozokit-test/templates/base.twig']);

        // Checks that Wordpres has not been installed.
        assert.noFile(['wp-login.php', 'index.php', 'wp-includes']);

        // Checks that no zip files remain on the system.

It also seems that the examples in the docs are written in Mocha but the generator ships with Jest?

Any help from someone experienced in this would be deeply appreciated! πŸ™

Hi, I finally installed yeoman, but I get these warning / issues from the npm install:

npm install --global yo
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated request@2.88.2: request has been deprecated, see request/request#3142
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated axios@0.18.1: Critical security vulnerability fixed in v0.21.1. For more information, see axios/axios#3410

added 728 packages, and audited 729 packages in 35s

34 packages are looking for funding
run npm fund for details

4 high severity vulnerabilities

(Sorry about the formatting, I haven't done this before)
Is there a fix for addressing the depreciated packages? I don't want to use yeoman with those vulnerabilities.
Cassandra Granade
@pjmattingly Looking at axios/axios#3410, it seems like they only pushed the fix in v0.21.1 two days ago?
@cgranade Hi Chris, thanks for responding. I'm glad to see they're working on a fix. Is there anything I can do in the mean-time to work with it, before the fix is published?
I want to be sure I'm doing my due diligence, since I'm working on a project for my University as a graduate project.
Hello, is it possibile to wait for this.fs.copy to finish before running other code? I want to replace some placeholder in the files but they still don't exist when my code runs.

@y-chen the way I do this is with a regEx for instance

this.destinationPath('/index.html'), {
    process: function (content) {
var regExTitle = new RegExp('title', 'g');

var newContent = content 
.replace(regExTitle, 'content you wish to add to file');
return newContent;

Hope this helps if your question has not already been answered

Not sure if this is possible but is there a way of copying files from a URL rather than a local directory. the reason I would like to do this is so I can keep the templates updated on git for instance. Thanks
Bryan Stopp
Is there an updated link to the Yeoman Test API documentation? The link off of this page (https://yeoman.io/authoring/testing.html) still links to v2.7 - and the current release is 5.0
1 reply
Documentation still says the target directory is passed to the promise, but now it's a RunResult object...
Velten Heyn
Hi there, I'm trying to use the yeoman cli yo my-template -o . --force to force update a template. But it is asking me all the questions for initialization again (eg. projectname ...). Also the ones which are stored in a .yo-rc.json . Do I have to adapt the template to be able to work with the force argument?
Bryan Stopp
This message was deleted
Andy Freidenfelds
im using yeoman-generator version 5.2.0 ... in the writing(){...} block im trying to run this.npmInstall(deps.dev, { 'save-dev': true }); but its saying that this.npmInstall is not a function. did the api change?
Andy Freidenfelds
seems like it. someone should really update the docs. :smile:
Hello all, I have built a pretty huge Generator for personal use. I have the main generator that gives the user the option to run a sub-generator. I then have a number of sub-generators that use the same prompts and a number of functions in the wright function that are the same across all generators. My question is, is there a way to modulate my generator so I can have one place to update functions/prompts that would take effect across all sub-generators but would only require one file update. if someone could point me in the direction of some documentation that would be great. Thanks in advance

Hi, I am trying to rename files using registerTransformStream and gulp, when I use copyTpl it copies both the transformed directory (TestProject) and the original (_name).

  "devDependencies": {
    "eslint": "^6.6.0",
    "eslint-config-prettier": "^6.6.0",
    "eslint-config-xo": "^0.27.2",
    "eslint-plugin-prettier": "^3.1.1",
    "husky": "^3.0.9",
    "jest": "^26.1.0",
    "lint-staged": "^9.4.3",
    "prettier": "^1.19.1",
    "yeoman-assert": "^3.1.0",
    "yeoman-test": "^1.7.0"
  "engines": {
    "npm": ">= 4.0.0"
  "dependencies": {
    "chalk": "^2.1.0",
    "gulp-rename": "^2.0.0",
    "yeoman-generator": "^2.0.5",
    "yosay": "^2.0.1"

Code is as follows;

const Generator = require("yeoman-generator");
const chalk = require("chalk");
const yosay = require("yosay");
const rename = require("gulp-rename");
const { v4: uuidv4 } = require("uuid");

module.exports = class extends Generator {
  prompting() {
        `Welcome to the sensational ${chalk.red(
        )} generator!`

    const prompts = [
        type: "input",
        name: "name",
          "What is the name of the project? (lowercase & no punctuation only)",
        default: this.appname,
        store: true

    return this.prompt(prompts).then(props => {
      this.props = props;

  writing() {
    var props = this.props;
      rename(function(path) {
        path.dirname = path.dirname.replace(/(_name)/g, props.name);

        name: props.name.toLowerCase(),
      { globOptions: { ignore: "_name" } }

    this.log.writeln('\n→ WRITING COMPLETED');

  end() {
    this.log.writeln('\n→ SCAFFOLD COMPLETED');

Any ideas how I either remove or exclude the original "_name" dir?

Above appears to happen as I move from yeoman 3.1.1 -> ^4.0.0
Alexander Stefurishin
I want to create a generator for project scaffolding in monorepository. It can't be public, and there's no sense in publishing it. How I can avoid "npm link" hustle to use it? Is there a well-know recipe?
or should I really do npm link every time I want to use it?
or should I really start maintainging private npm registry with CICD for a local tool
hello @astef a bit late but maybe still useful: you only need to "npm link" once. And if you update the name of your local folder containing your generator.
Bryan Stopp
Is there a way in a package.json or some other metadata location to tell Yoeman Environment that generators are nested deeper than one folder, and to look further?
Is yeoman still used today and still maintained? Afaik the last commit is from last year. Or is it just "finished" :D