115 — File Watcher 4B (buckets)
watcher4bis a node program watching for file changes in a project folder and its sub folders.When a file changes or is created, a copy is made in the cloud, i.e: on a bucket on Linode ObjectStorage.
a configuration file (
.fw4b.yaml) must exists in the project folder . It defines the files to be watched. (See specs below).On startup,
fw4bwill check if server contains newer files. By default, the program will ask for permission to update local folder.On startup, there is also an option to list local files, newer than corresponding files on the server. Using option
--commitwill update the server.Must be installed using
NPM(node program manager) See below.project folder :
/2022/281-watcher-4-bucketGood news:
<article>is copied in the html, still allowing markdown code inside.
Installation
$ git clone https://github.com/abatros/281-file-watcher-for-buckets.git
Update Installation
If
fw4bis already installed, a check-update can be performed.Goto installation folder, something lile
./fw4b/containing subfolder./fw4b/.git$ git statusshould list files ready to be pushed on the server and files not staged (not added). See below.
dkz@LG:~/2022/281-watcher-4-bucket$ git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: index.js
Untracked files:
(use "git add <file>..." to include in what will be committed)
node_modules/
package-lock.json
no changes added to commit (use "git add" and/or "git commit -a")
Look for → "Your branch is up to date with 'origin/main'"
then you can add, commit if needed.$ git commit -m 'some-comment'→ to commit$ git push→ to update the server$ git pull→ to get latest version (update local folder)
Technical Notes ::article.
1 The main file (index.js) load the configuration file then invoke chokikar.watch on the specified folder.
2 When a file changes, s3_commit is in charge of writing that file on the appropriate bucket.
3 Some files need processing: for .MD file, they must be saved on the bucket first, then a renderer must create the html, and finally the html code must be written on the bucket.
4 There is an issue with html files. Should the static website operates with file name having extension '.html' or not ? Should it be
orlekkyweb.com/115-file-watcher-4blekkyweb.com/115-file-watcher-4b.html