Skip to content

Loaded plopfiles do not respect the --force flag #392

@moltar

Description

@moltar

I know it worked on previous versions, and I suspect it might be my local setup, but want to raise an issue to see if there are any other leads, as I've spent over an hour trying to debug this, and so far no leads.

Running

## for TS support
export NODE_OPTIONS="--loader ts-node/esm --no-warnings"

plop --force --plopfile=.plop/plopfile.ts        

Output:

? What is your name? asd
✖  ++ File already exists
 -> /../project/.plop/foo-bar

.plop/plopfile.ts contents:

import type { NodePlopAPI } from 'plop';

module.exports = function (plop: NodePlopAPI) {
  plop.setGenerator('test', {
      description: 'This is loaded.',
      prompts: [{
        name: 'name',
        message: 'What is your name?',
        type: 'input',
      }],
      actions: [
        {
          type: 'add',
          template: 'foo {{name}}',
          path: 'foo-bar',
        }
      ]
  });
};

Version

❯ pnpm ls plop

devDependencies:
plop 3.1.2

Btw, if I use force: true on the action, then it works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions