0

I have a react boilerplate that configures a nodejs server for background api calls and a create-react-app for the frontend.

I wanted to create a npm package that would prepare the whole environment when installing.

Eg.: npm i myPackage

This would create all the files and folders based on the structure I have defined, just like cloning the repository...

How could achieve that?

I just need some directions on how to start this, I published an npm package based on my repository and it only downloaded two files but not the whole structure.

1 Answer 1

1

Try adding a postinstall script like

"scripts": {
   "postinstall": "./executable-script or cp dir/* $INIT_CWD/"
}

into the package.json file. It will run right after the package is installed.

For more documentation read https://docs.npmjs.com/misc/scripts and https://docs.npmjs.com/cli/run-script.

I never used it before, but it would likely solve it for you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.