Due to an unfortunate series of commands, I've locked myself out of publishing the doc-snippets package under the doc-snippets name for the next 24 hours. This PR will be updated with the appropriate package once NPM lets me.
TODO:
[x] Use doc-snippets package instead of doc-snippets-temp.
This PR aims to extract the logic behind snippet extraction/injection into its own package.
Additionally, the package exposes a simple CLI tool that combines the extraction and injection logic which allows devs to run the "default" behavior without much hassle.
Exported functions:
extractSnippets(dir) //Returns a `Record<string, string>` of all snippets found within `dir`.
injectSnippets(snippets, dir) //Injects snippets into .md files found inside `dir`
The CLI can be called as follows:
doc-snippets combine <snippetsDir> <docsDir> <outputDir>
# Example used within the documentation package
# Extracts snippets from ./snippets and outputs a copy of ./src/docs into ./docs with injected snippets
doc-snippets combine ./snippets ./src/docs ./docs
Closes #232
Due to an unfortunate series of commands, I've locked myself out of publishing the
doc-snippets
package under thedoc-snippets
name for the next 24 hours. This PR will be updated with the appropriate package once NPM lets me.TODO:
doc-snippets
package instead ofdoc-snippets-temp
.New repository
https://github.com/polywrap/doc-snippets
PR description
This PR aims to extract the logic behind snippet extraction/injection into its own package. Additionally, the package exposes a simple CLI tool that combines the extraction and injection logic which allows devs to run the "default" behavior without much hassle.
Exported functions:
The CLI can be called as follows: