- Uses the GitHub API to create a tree of every file in the following repositories:
netdata/netdatanetdata/.githubnetdata/go.d.pluginnetdata/agent-service-discovery
- Filters out every file except
.md/.mdxfiles (L425). - Filters out specific
.md/.mdxfiles as defined byexcludePatterns(L427-L438). - Downloads the content of each file from GitHub.
- Sanitizes content by removing unnecessary frontmatter, h1s, and Google Analytics tags.
- Renames
README.mdfiles by the folder that contains them. - Normalizes links between documents to match the final structure in the
/docsfolder. - Writes files to their target directory.
node ingest.js
The script takes two additional options: a GitHub username and a branch name. These options override the default
username and branch to ingest documentation files from the netdata/netdata repository, which are netdata and
master.
By overriding the defaults, you can test how a documentation file will look and operate when published on Netdata Learn, or test the functionality of the script itself.
You must use these options together.
node ingest.js USER BRANCH
Currently, these options only affect how
ingest.jspulls files from thenetdata/netdatarepository. The other repositories still ingest from thenetdatauser andmasterbranches.
If you want to pull from a dashboard branch that exists _on the netdata/netdata repository, pass netdata for the
username.
node ingest.js netdata dashboard
For example, let's say you have a fork of the netdata/netdata repository under a GitHub account named userXYZ. You
also have a charts branch on your fork that you want ingest on your local development environment. You would run:
node ingest.js userXYZ charts
ingest.js now pulls files from the charts branch from the userXYZ/netdata repository instead of the default.