plopjs / plop

Consistency Made Simple
http://plopjs.com
MIT License
7.06k stars 277 forks source link

Is it possible to print text? #433

Closed CRC32EX closed 4 months ago

CRC32EX commented 4 months ago

I just want to print text.

Like this. How can i do it?

$ npm run plop
? Enter your name: user001
✔  ++ \src\user001.ts

THIS FILE IS VERY IMPORTANT.
After create this file, You have to send message to "john doe (john@example.com)".
export default function (plop) {
  plop.setGenerator('test001', {
    prompts: [
      {
        type: "input",
        name: "name",
        message: "Enter your name",
      }
    ],
    actions: [
      {
        type: "add",
        path: "src/{{name}}.ts",
        templateFile: "plop/templates/user.ts.hbs",
      },
      {
        type: "print_message", // ???
        message: "THIS FILE IS VERY IMPORTANT.\nAfter create this file, You have to send message to "john doe (john@example.com)"."
      },
    ]
  })
}
amwmedia commented 4 months ago

Plop supports comments

CRC32EX commented 4 months ago

Thank you !!! It works fine!!!

plopfile.mjs

export default function (plop) {
  plop.setGenerator('test001', {
    prompts: [
      {
        type: "input",
        name: "name",
        message: "Enter your name",
      }
    ],
    actions: [
      {
        type: "add",
        path: "src/{{name}}.ts",
        templateFile: "plop/templates/user.ts.hbs",
      },
      "THIS FILE IS VERY IMPORTANT.",
      `After create this file, You have to send message to "john doe (john@example.com)".`
    ]
  })
}