forked from fullcalendar/fullcalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-licenses.js
34 lines (27 loc) · 1.19 KB
/
update-licenses.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
27
28
29
30
31
32
33
34
const path = require('path')
const { publicPackageStructs, bundleStructs } = require('./lib/package-index')
const exec = require('./lib/shell').sync.withOptions({
exitOnError: true,
live: true
})
exec([ path.join(__dirname, 'require-clean-working-tree.sh') ])
let subjectStructs = publicPackageStructs.concat(bundleStructs)
let licenseDests = []
for (let struct of subjectStructs) {
let licenseSrc = struct.isPremium
? path.join(__dirname, '../packages-premium/LICENSE.md')
: path.join(__dirname, '../LICENSE.txt')
let licenseDest = path.join(__dirname, '..', struct.dir, struct.isPremium ? 'LICENSE.md' : 'LICENSE.txt')
console.log(licenseSrc, licenseDest)
exec([ 'cp', '-f', licenseSrc, licenseDest ])
licenseDests.push(licenseDest)
}
for (let licenseDest of licenseDests) {
exec(
[ 'git', 'add', path.basename(licenseDest) ],
{ cwd: path.dirname(licenseDest) } // will do it in whatever git repo
)
}
exec([ 'git', 'commit', '-m', 'updated licenses' ], { cwd: path.join(__dirname, '../packages-premium') })
exec([ 'git', 'add', 'packages-premium' ], { cwd: path.join(__dirname, '..') })
exec([ 'git', 'commit', '-m', 'updated licenses' ], { cwd: path.join(__dirname, '..') })