forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.js
executable file
·35 lines (28 loc) · 1.13 KB
/
release.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
35
#!/usr/bin/env node
//@ts-check
// used as a unit of releasing
var path = require('path')
var fs = require('fs')
var cp = require('child_process')
var rootDir = path.join(__dirname,'..')
var libJsDir = path.join(rootDir,'lib','js')
var jscompDir = path.join(rootDir,'jscomp')
function run() {
for (let file of fs.readdirSync(libJsDir)) {
if (file.endsWith('.js')) {
fs.unlinkSync(path.join(libJsDir, file))
}
}
cp.execSync(`git clean -dfx stubs ext common syntax depends core bsb main .`,
{ cwd: jscompDir, encoding: 'utf8', stdio: [0, 1, 2] })
cp.execSync(`git clean -dfx templates && ocp-ocamlres templates -o bsb_templates.ml`,
{ cwd: path.join(jscompDir,'bsb'), encoding: 'utf8', stdio: [0, 1, 2] })
cp.execSync(`ninja -t clean -g && ninja`,
{ cwd: jscompDir, encoding: 'utf8', stdio: [0, 1, 2] })
cp.execSync('ninja', {cwd : path.join(rootDir,'lib'), stdio:[0,1,2]})
cp.execSync('ninja -f release.ninja -t clean && ninja -f release.ninja', { cwd: path.join(rootDir, 'jscomp'), stdio: [0, 1, 2]})
}
if(require.main === module){
run()
}
exports.run = run