Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
elm-doc-preview
Advanced tools
This is an Elm 0.19 offline documentation previewer for packages, applications, their dependencies and all cached packages.
It aims at rendering documentation exactly like the official package website to avoid any surprise when releasing a package.
$ npm install -g elm-doc-preview
Usage: edp [options] [path_to_package_or_application]
Options:
-V, --version output the version number
-b, --no-browser do not open in browser when server starts
-o, --output <docs.json> generate docs and exit with status code (/dev/null supported)
-p, --port <port> the server listening port (default: 8000)
-r, --no-reload disable hot reloading
-h, --help output usage information
Environment variables:
ELM_HOME Elm home directory (cache)
For example, from the directory where your project elm.json
is:
$ elm-doc-preview
or
$ edp
or from anywhere:
$ elm-doc-preview path/to/package_or_application
When no package or application is found, elm-doc-preview
will just run as an
offline documentation server for local cached packages.
Application documentation is
not yet supported by Elm,
so elm-doc-preview
will generate a package from the application with the same
modules and build the documentation from it. There are two consequences:
elm-application.json
file to list the application
documented modules (exposed-modules) and to customize the application
name, summary or version that are included in the documentation.Without an elm-application.json
file, elm-doc-preview
will show an
application as my/application 1.0.0
and will report an error about
missing exposed-modules
unless some are eventually found in forked or
local packages included in the application source-directories
.
To configure the application, add an elm-application.json
file with at least
an exposed-modules
value.
For example, here is the
elm-application.json
file for the elm-doc-preview
Elm application followed by a description of
each field:
elm-application.json
:
{
"name": "dmy/elm-doc-preview",
"summary": "Offline documentation previewer",
"version": "3.0.0",
"exposed-modules": [
"Href",
"Session",
"Page.Docs.Block",
"Page.Search",
"Page.Diff",
"Page.Problem",
"Page.Docs",
"Page.Search.Entry",
"Release",
"Utils.Spinner",
"Utils.OneOrMore",
"Utils.Logo",
"Utils.Error",
"Utils.Markdown",
"Main",
"Skeleton"
]
}
It should use the same author/project
format than packages, but the
repository does not have to exist on GitHub.
The default name is my/application
.
A short summary for the application in less than 80 characters.
The default summary is "Elm application".
A version using MAJOR.MINOR.PATCH
format.
The default version is "1.0.0".
The modules to include in the documentation. All exposed symbols inside these modules must be documented or the documentation build will fail.
Port modules will be shown as normal modules.
Exposed modules contain by default those found in forked and local packages (see next section). Setting the field does not remove those modules from the list.
elm-doc-preview
will automatically exposes documentation for forked or local
packages modules if their are exposed in an elm.json
file located in the
directory above the one declared in source-directories
.
Typically, to import a forked package and keep its documentation, just clone it
in the application directory, and add the forked packages src
sub-directory
in elm.json
source-directories
.
See the
project-metadata-utils
fork inside elm-doc-preview
for an example.
There is also an online version supporting documentations loading from github to share them for online reviews:
https://elm-doc-preview.netlify.com
It does not support hot-reloading or dependencies documentation though.
const DocServer = require('elm-doc-preview');
const server = new DocServer();
server.listen();
or with custom options:
const DocServer = require('elm-doc-preview');
// constructor(options) {
// const {
// dir = ".",
// port = 8000,
// browser = true,
// reload = true
// } = options || {};
// ...
const server = new DocServer({ port: 9000, browser: false });
server.listen();
elm-doc-preview
is a development tool and is not designed to be
exposed on internet. As such, no effort at all has been made to secure it
and it most likely contains severe vulnerabilities. If you want to
publicly share some documentation, use the online version or maybe host
static web pages of the documentation (see below).
This is not supported by elm-doc-preview
, you could use ento/elm-doc instead.
Extending elm.json
would not be convenient because elm install
will remove any unexpected field from it when run, and all the additional
fields used by elm-doc-preview
are currently unexpected for an application,
even if they are valid for a package.
They are automatically added in the documentation if you kept the package
elm.json
file in the directory above the package src
one.
docs.json
file?By default, you can get your application docs.json
file at the following
address:
http://localhost:8000/packages/my/application/1.0.0/docs.json
If you added an elm-application.json
file, replace my/application
and
1.0.0
by the name
and version
fields value.
Also replace 8000
by the port used if you changed it.
FAQs
Elm offline documentation previewer with hot reloading.
We found that elm-doc-preview demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.