简体   繁体   中英

How do I use yeoman --force?

I've got a generator that generates stuff:

yo blah -o . fred.txt

This creates file(s) in . based on the contents of fred.txt .

I'd like this to run as part of my build process, so that when I update fred.txt yeoman is re-run to regenerate the outputs.

When I try this by hand, though, yeoman always tells when if the new file differs from the old one, and waits for input. This is no use as part of a build process. The help page suggests that --force would be just the ticket, so I've tried that:

yo --force true blah -o . fred.txt

It still asks the question though. So I also tried this:

yo blah --force true -o . fred.txt

That didn't make any difference. When the new output is different from the old output, it stops and waits for me to press a key.

Can I just make it overwrite the file, no questions asked?

(The build process will run yeoman as if it were being run from the command line.)

Simply use

yo blah -o . fred.txt --force

There's no need to explicitly state true . Generally, if the flag exists, it is treated as Boolean true by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM