-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
30 lines (21 loc) · 784 Bytes
/
init.js
File metadata and controls
30 lines (21 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
import fs from 'fs';
import path from 'path';
import GitHandler from './handler/GitHandler.js';
const git = new GitHandler('./');
const repo = 'https://gitlab.com/denko/denkoken_twitter_authentication.git';
const target = 'twitter.json';
const dstDir = 'config';
git.clone(repo).
then((dir) => {
const srcPath = path.resolve(dir, target);
const dstPath = path.resolve(dstDir, target);
const srcObj = JSON.parse(fs.readFileSync(srcPath, 'utf8'));
const dstObj = JSON.parse(fs.readFileSync(dstPath, 'utf8'));
const result = JSON.stringify(Object.assign({}, srcObj, dstObj));
fs.writeFileSync(path.resolve(dstDir, target), result);
console.log('twitter authentication successed');
}).
catch((err) => {
console.log(err);
});