max pleaner
max pleaner

Reputation: 26768

How can I package a boilerplate in to a NPM library?

I have created a boiler plate which has server/client folders. I want to make a wrapper NPM library which copies this boiler, verbatim, to their computer.

Is there a way to package the source code into a NPM library as something that can easily be copied onto their computer? Or would it be easier to just make the wrapper library copy it from git?

Upvotes: 0

Views: 279

Answers (2)

cchamberlain
cchamberlain

Reputation: 17956

The best example to follow when creating a boilerplate is probably create-react-app. It is structured as a set of npm packages all bundled up in a lerna monorepo. It is extremely easy to use and its structure has been well thought out, making it a great example to build from.

Upvotes: 1

rsp
rsp

Reputation: 111336

You can put anything in the npm package and it will be installed with npm install - unless it's in .npmignore on .gitignore. It will be installed in node_modules directory of the current project or globally if you use npm install module-name -g

If you have a client and server directory in your module then it will be installed in node_modules/module-name/client and node_modules/module-name/server.

Upvotes: 1

Related Questions