forked from bencodezen/vue-enterprise-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_start.js
26 lines (21 loc) · 964 Bytes
/
_start.js
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
const path = require('path')
const fs = require('fs')
const headRef = fs
.readFileSync(path.join(__dirname, '.git/HEAD'))
.toString()
.trim()
.match(/^ref: (.+)$/)[1]
const headSha = fs
.readFileSync(path.join(__dirname, '.git/' + headRef))
.toString()
.trim()
const ciBadge =
'[](https://circleci.com/gh/chrisvfritz/vue-enterprise-boilerplate/tree/master)'
const divergeDate = new Date().toString().slice(4, 15)
const compareUrl = `https://github.com/chrisvfritz/vue-enterprise-boilerplate/compare/${headSha}...master`
const startNote = `**You diverged from the boilerplate on ${divergeDate}. See [what's been added](${compareUrl}) since then.**`
const newReadmeContent = fs
.readFileSync(path.join(__dirname, 'README.md'))
.toString()
.replace(ciBadge, startNote)
fs.writeFileSync(path.join(__dirname, 'README.md'), newReadmeContent)