I have just released the initial version of a new dashboard 2 ui node @colinl/node-red-dashboard-2-ui-gauge-classic which is a multi-needle classic style gauge. It is working ok, but the examples are not being installed. They are .json files in a folder called examples
in the repository. Is there something else I need to do to get the examples included?
You havent incuded the examples folder in your package Colin
"files": [
"dist/*",
"nodes/*",
"ui/*",
"resources/*"
],
I looked at other nodes and they do not specify examples
either, but I realise now that they don't specify files
at all, so it defaults to everything. This is the first time I have published a node where files
is specified.
Thanks. New release coming shortly.
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.
I think that most of us ignore it. On the assumption that, if we've put something in the repo, it should be in the published package.
Yes, it is there is this node because I started with ui-example node, which has the files specified. I haven't actually looked to see if it is necessary.
If you prefer a negative style rather than an include style (which can be a bit fragile when you add future folders and forget to add them), you can add a .npmignore
file instead.
Less fragile certainly, but a bit opaque maybe.
@Colin - Don't know if your aware or not but you can include spaces in the names of the examples to make them more readable in the NR examples section.
So for example, MultiNeedleGaugeExample.json
could be Multi Needle Gauge Example.json
, and of course it would then display as Multi Needle Gauge Example
in examples.
I suppose it is my age that means that spaces in filenames have always been an anathema to me.
You are right though, perhaps I should hold my nose in this case.
Yeah, I didn't like using spaces in the filenames either, but I needed formatting with spaces. Perhaps we can ask for an enhancement that will allow underscores to generate the proper spaces in the examples?
In my opinion, using the files
whitelist is the safest option and best option. I have accidentally included some test files in the past simply because they were in the directory when publishing. And then to deal with unpublishing a package from npm, argh, real pain in the... Another thing you can do before publishing is to run npm pack
and it will show you the list of files included.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.