Creating a simple package.json
yarn init
{
"name": "freedraw",
"version": "1.0.0",
"main": "index.js",
"license": "MIT"
}
Adding leaflet-freedraw dependency:
yarn add leaflet-freedraw
{
"name": "freedraw",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"leaflet-freedraw": "^2.13.0"
}
}
The installed node module only contains this:
/dist
package.json
LICENSE
README.md
There sould also be the source folder installed:
/src
The devs from freedraw say the /src folder should also be there.
I'm using a lot of packages and I get the /src folder everywhere except here. Same happens with npm
.
There sould also be the source folder installed
There is no obligation for an author to also publish the src on npm.
As pointed out by Ivan, it looks like the author did configure their package to publish only files in the "dist" folder: (that might be a mistake on their part)
Extract from package.json
:
{
"files": [
"dist"
],
}
https://github.com/Wildhoney/Leaflet.FreeDraw/commit/3b82125994e9676ea018d67bf04a679934bbf5e8
npm doc for package.json
"files" field:
The optional
files
field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to.gitignore
, but reversed: including a file, directory, or glob pattern (*
,**/*
, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to["*"]
, which means it will include all files.
https://docs.npmjs.com/configuring-npm/package-json.html#files