When creating packages, I believe it's important to include a demo app. However, I'm unsure about the best way to organize the file structure for this purpose.
My goal is to have one Github repository containing both my published NPM module and a simple demo webapp.
Ideally, I would like to have a top-level structure like this:
package/
demo/
Where only the code inside the package/
directory gets distributed to NPM. I could use the files: ['package']
option in the package.json
file, but then all the code will have that path prefix, such as:
node_modules/MyPackageName/package/index.js
Is there a way to modify the path prefix so that it changes the top-level directory and removes the extra package/
used for organizing the files?
I know some people might have solutions for this, but I'd prefer not to have two separate repositories - one for the demo and one for the package.
Clarification: I want to be able to install the package directly from Github, similar to a "poor-man's private NPM". Therefore, I don't want to publish from within the 'package' directory. I believe you can specify a branch when using Github URLs, but not a subdirectory.