update: Quote from docs that makes me feel this is the suggested way to organize/publish libraries made with SvelteKit:
A component library has the exact same structure as a SvelteKit app,
except that src/lib is the public-facing bit, and your root
package.json is used to publish the package. src/routes might be a
documentation or demo site that accompanies the library, or it might
just be a sandbox you use during development.
I believe it is possible to control what is uploaded to NPM:
[The files
field] tells npm which files it will pack up and upload
to npm. It should contain your output folder (dist by default)...
To exclude unnecessary files (such as unit tests, or modules that are
only imported from src/routes etc) you can add them to an .npmignore
file. This will result in smaller packages that are faster to install.
So, you can manually control what is uploaded to NPM via:
package.json
files
field (whitelist)
.npmignore
(blacklist)
As for dependencies, I believe you can control these with dependencies
and devDependencies
:
dependencies
: modules needed by your library.
devDependencies
: modules needed by examples, but not by your library.
Further reading: