braidfs 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +15 -15
- package/package.json +4 -1
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
|
|
2
3
|
let http = require('http');
|
|
3
4
|
let { diff_main } = require('./diff.js')
|
|
@@ -8,22 +9,20 @@ process.on("unhandledRejection", (x) => console.log(`unhandledRejection: ${x.sta
|
|
|
8
9
|
process.on("uncaughtException", (x) => console.log(`uncaughtException: ${x.stack}`))
|
|
9
10
|
|
|
10
11
|
let braidfs_config_dir = require('path').join(require('os').homedir(), '.braidfs')
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
|
|
13
|
+
let braidfs_config_file = require('path').join(braidfs_config_dir, 'config.json')
|
|
14
|
+
if (!require('fs').existsSync(braidfs_config_file)) {
|
|
15
|
+
require('fs').writeFileSync(braidfs_config_file, JSON.stringify({
|
|
16
|
+
port: 10000,
|
|
17
|
+
sync_urls: [],
|
|
18
|
+
sync_index_urls: [],
|
|
19
|
+
proxy_base: require('path').join(require('os').homedir(), 'http'),
|
|
20
|
+
proxy_base_last_versions: require('path').join(braidfs_config_dir, 'proxy_base_last_versions'),
|
|
21
|
+
braid_text_db: require('path').join(braidfs_config_dir, 'braid-text-db'),
|
|
22
|
+
}, null, 4))
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
console.log(`loading config file at: ${braidfs_config_path}`)
|
|
25
|
-
Object.assign(config, JSON.parse(require('fs').readFileSync(braidfs_config_path, 'utf8')))
|
|
26
|
-
} catch (e) { console.error(`Error loading config file:`, e.message) }
|
|
25
|
+
let config = JSON.parse(require('fs').readFileSync(braidfs_config_file, 'utf8'))
|
|
27
26
|
|
|
28
27
|
// process command line args (override config)
|
|
29
28
|
let argv = process.argv.slice(2)
|
|
@@ -41,7 +40,8 @@ while (argv.length) {
|
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
braid_text.db_folder = config.braid_text_db
|
|
44
|
+
|
|
45
45
|
require('fs').mkdirSync(config.proxy_base, { recursive: true })
|
|
46
46
|
require('fs').mkdirSync(config.proxy_base_last_versions, { recursive: true })
|
|
47
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "braidfs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "braid technology synchronizing files and webpages",
|
|
5
5
|
"author": "Braid Working Group",
|
|
6
6
|
"repository": "braid-org/braidfs",
|
|
@@ -9,5 +9,8 @@
|
|
|
9
9
|
"braid-http": "^0.3.20",
|
|
10
10
|
"braid-text": "^0.0.26",
|
|
11
11
|
"chokidar": "^3.6.0"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"braidfs": "./index.js"
|
|
12
15
|
}
|
|
13
16
|
}
|