Confluence Attachments
This project is created to automatically create confluence attachments out of files for a given directory.
If an attachment with the same name already exists it will update the attachment with a new version. The previous version will be available for download.
Installation
npm install confluence-attaachment-uploader
Usage
Commands
push
| p
The main purpose of this library is pushing files from a given directory to a confluence page. If a file from the output directory hasn't been uploaded before, a new attachment is created. If the attachment already exists (with the filename), an update will be performed.
delete
| d
Files that have been pushed to a wiki page can be removed as well. Only the files in the output directory will be removed from the given wiki page, to ensure page specific attachments are not removed.
configure
| config
| cfg
The script can be configured by passing parameters to the config command. If any of the required parameters is not found, the script will prompt the user for input.
Parameter | Description | Example |
---|---|---|
username | A valid confluence username | tobias.ouwejan@sap.com |
password | A valid confluence password | 1234 |
page | The confluence page ID that will be used to store the files | 303129511 |
url | The base URL for the confluence site | https://wiki.hybris.com |
sourceDir | A filesystem directory on the local machine that will be recursively scanned for files. System files (files starting with . or ~) are excluded. | ./dist |
blacklist | Additional file pattenrs can be added to skip files form the directory and any of its sub directories. | *.map |
Except for the password, all parameters are cached in the project in a folder ('cache'). This makes it confinient for manual processing as well as storing the cached configuration in a repo.
Example:
# configure the page ID
node dist/index.js config -p 303129511
# configure the confluence URL
node dist/index.js config --url https://wiki.hybris.com
# configure various parameters
node dist/index.js config -p 303129511 --url https://wiki.hybris.com --sourceDir ./dist
list
| l
The persistent configuration can be listed in the console.
reset
| r
Clears the configuration from the persitant cache.
Options
verbose
| v
A little more inforation on the progress can be printed in verbose mode.
Example:
# print verbose information while pushing files
node dist/index.js push -v
Development
The script is developed in typescript and generates a commonjs module that can be used in other nodejs projects.