aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Hand <joe@joeahand.com>2016-12-17 13:23:02 -0800
committerJoe Hand <joe@joeahand.com>2016-12-17 13:23:02 -0800
commit0ab374236a130f1ed834fd24c7cb2b9a94e0103d (patch)
treef13a0795304cee26981b00f122339820fb81d0b1 /scripts
parentc8966c84ba4005889b45fc418c48499f33deddac (diff)
downloaddat-docs-0ab374236a130f1ed834fd24c7cb2b9a94e0103d.tar.gz
dat-docs-0ab374236a130f1ed834fd24c7cb2b9a94e0103d.zip
add sync script for travis
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build.js8
-rw-r--r--scripts/sync.js35
2 files changed, 43 insertions, 0 deletions
diff --git a/scripts/build.js b/scripts/build.js
new file mode 100644
index 0000000..136d99a
--- /dev/null
+++ b/scripts/build.js
@@ -0,0 +1,8 @@
+var fs = require('fs')
+var mkdirp = require('mkdirp')
+var ndjson = require('ndjson')
+
+mkdirp.sync('docs/modules')
+process.stdin.pipe(ndjson.parse()).on('data', function (obj) {
+ fs.writeFileSync('docs/modules/' + obj.name + '.md', obj.readme)
+})
diff --git a/scripts/sync.js b/scripts/sync.js
new file mode 100644
index 0000000..73e86b7
--- /dev/null
+++ b/scripts/sync.js
@@ -0,0 +1,35 @@
+var path = require('path')
+var ghAuth = require('ghauth')
+var ecosystem = require('ecosystem-docs')
+var split = require('split2')
+
+var modules = []
+
+process.stdin.pipe(split()).on('data', function (data) {
+ modules.push(data)
+}).on('end', function () {
+ syncModules(modules, function () {
+ process.exit(0)
+ })
+})
+
+function syncModules (modules, cb) {
+ console.log('syncing', modules)
+ if (process.env.GH_TOKEN) return sync(process.env.GH_TOKEN)
+
+ ghAuth({
+ configName: 'ecosystem-docs',
+ userAgent: 'ecosystem-docs',
+ scopes: ['user']
+ }, (err, auth) => {
+ if (err) return cb(err)
+ sync(auth.token)
+ })
+
+ function sync (token) {
+ ecosystem.sync(modules, {
+ data: path.join(__dirname, '..', '.data'),
+ token: token
+ }, cb)
+ }
+} \ No newline at end of file