mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-30 16:18:07 +01:00
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
|
var fsp = require('fs-promise')
|
||
|
var path = require('path')
|
||
|
var prompt = require('prompt')
|
||
|
var open = require('open')
|
||
|
var extend = require('extend')
|
||
|
var notices = require('./notices.json')
|
||
|
|
||
|
var id = 0
|
||
|
var date = new Date().toDateString()
|
||
|
|
||
|
var notice = {
|
||
|
read: false,
|
||
|
date: date,
|
||
|
}
|
||
|
|
||
|
fsp.readdir('notices')
|
||
|
.then((files) => {
|
||
|
files.forEach(file => { id ++ })
|
||
|
Promise.resolve()
|
||
|
}).then(() => {
|
||
|
fsp.writeFile(`notices/notice_${id}.md`,'Message goes here. Please write out your notice and save before proceeding at the command line.')
|
||
|
.then(() => {
|
||
|
open(`notices/notice_${id}.md`)
|
||
|
prompt.start()
|
||
|
prompt.get(['title'], (err, result) => {
|
||
|
notice.title = result.title
|
||
|
fsp.readFile(`notices/notice_${id}.md`)
|
||
|
.then((body) => {
|
||
|
notice.body = body.toString()
|
||
|
notice.id = id
|
||
|
notices.push(notice)
|
||
|
return fsp.writeFile(`development/notices.json`, JSON.stringify(notices))
|
||
|
})
|
||
|
})
|
||
|
})
|
||
|
})
|