I'm using hygen to create templates for my project.
How to run a script (nodejs) after hygen
command complete in hygen way?
hygen my-package new awsome-package
For example after this command I want to add line to tsconfig.json
in the current project.
In hygen you have Shell option
This is mean that you can run a shell command (script), you just create a file and insert the following content for example:
---
sh: "mkdir -p <%= cwd %>/given/app/shell && cat > <%= cwd %>/given/app/shell/hello.piped"
---
hello, this was piped!
When you run your command then hello.piped will have hello, this was piped!
text just by cmd command.
In this example, you can add a package to package.json and then run yarn install.
---
inject: true
to: package.json
after: dependencies
skip_if: lodash
sh: cd <%= cwd %> && yarn install
---
"lodash":"*",
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With