https://github.com/kodedninja/forkup
Updater for forked Beaker sites
https://github.com/kodedninja/forkup
beakerbrowser dat
Last synced: 7 months ago
JSON representation
Updater for forked Beaker sites
- Host: GitHub
- URL: https://github.com/kodedninja/forkup
- Owner: kodedninja
- License: mit
- Created: 2018-03-26T08:43:11.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-05T17:39:21.000Z (almost 8 years ago)
- Last Synced: 2025-04-19T00:41:25.814Z (11 months ago)
- Topics: beakerbrowser, dat
- Language: JavaScript
- Size: 9.77 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```javascript
{
"update": {
"url": "dat://b89507488b68892978dcdc6cb32e21040b2cd0fdcd304c502e17289aad10d95e/",
"files": [
"/bundle.js"
]
}
}
```
Somewhere in your project:
```javascript
const update = require('forkup')
update() // with package.json (recommended)
update('dat://b89507488b68892978dcdc6cb32e21040b2cd0fdcd304c502e17289aad10d95e/', ['/bundle.js']) // alternatively, without package.json (not recommended)
```
## usage
Add an ```"update"``` field to your ```package.json``` (located in the root folder).
```javascript
{
"update": {
"url": "",
"files": [
"",
""
]
}
}
```
I usually add an ```/update``` route to my Choo pages that calls this method. [See in solo](https://github.com/kodedninja/solo/blob/master/src/index.js#L57).
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.