yeoman / environment

Yeoman runtime environment
BSD 2-Clause "Simplified" License
128 stars 70 forks source link

Conflicter from previous environment instantiation is used and not recreated #324

Closed Himavanth closed 3 years ago

Himavanth commented 3 years ago

Sample code

let env = yeoman.createEnv()
    // first run app generator that will generate the root skeleton
    const appGen = env.instantiate(generators['base-app'], {
      options: {
        'skip-prompt': flags.yes,
        'project-name': projectName
      }
    })
    await env.runGenerator(appGen)

    // Creating new Yeoman env here to workaround an issue where 
    // yeoman reuses the conflicter from previous environment.
    // env = yeoman.createEnv()

      const extGen = env.instantiate(
        extensionPoints[i].generator,
        {
          options: {
            'skip-prompt': flags.yes,
            // do not prompt for overwrites
            force: true
          }
        })
      await env.runGenerator(extGen)

Now, at the last line, extGen should have run with new options which include force but it doesn't because the previous conflicter is used. https://github.com/yeoman/environment/blob/main/lib/environment.js#L1013 I think a new conflicter should be re-created if env is re-instantiated because the force parameter is a part of instantiation options.

mshima commented 3 years ago

Makes sense. Maybe the environment can set conflicter to undefined at end event.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open with no activity. Remove stale label or comment or this will be closed