forkup
Updater for forked Beaker sites. It simply checks the version in package.json
and downloads a set of files from the upstream.
installation
npm i -S forkup
example
package.json:
"update": "url": "dat://b89507488b68892978dcdc6cb32e21040b2cd0fdcd304c502e17289aad10d95e/" "files": "/bundle.js"
Somewhere in your project:
const update = // with package.json (recommended) // alternatively, without package.json (not recommended)
usage
Add an "update"
field to your package.json
(located in the root folder).
"update": "url": "<upstream dat url>" "files": "<file>" "<file>"
I usually add an /update
route to my Choo pages that calls this method. See in solo.
Alternatively you can use the check
and update
functions separately.
api
forkup([dat_url, files])
Parameters required only if not using package.json
. Updates every file in files
if the version is less then the version at dat_url
(the URL of the upstream site).
check([dat_url])
Parameter required only if not using package.json
. Checks if update is available. If yes returns an Array
, else false
.
update(archives, [files])
files
is only required if not using package.json
. archives
is the output of check
. Does the update.