forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch.js
executable file
·42 lines (35 loc) · 1.08 KB
/
switch.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
36
37
38
39
40
#!/usr/bin/env node
var fs = require('fs')
var path = require('path')
var clean = require('./cleanlib.js')
function toggleMakefile() {
var filename = path.join(__dirname,'Makefile.shared')
var line = fs.readFileSync(filename,'utf8')
var toggled = (line.split('\n').map(x => {
if (x.startsWith('STDLIB')) {
return '# ' + x
} else if (x.startsWith('# STDLIB')) {
return x.substring(2)
}
return x
}).join('\n'))
fs.writeFileSync(filename, toggled, 'utf8')
}
function toggleSharedMakefile(){
var filename = path.join(__dirname, 'test','Makefile')
var line = fs.readFileSync(filename,'utf8')
var toggled = (line.split('\n').map(x => {
if(x.startsWith(' # ocaml_typedtree_test')){
return ' ocaml_typedtree_test'
} else {
if (x.startsWith(' ocaml_typedtree_test')){
return ' # ocaml_typedtree_test'
}
}
return x
})).join('\n')
fs.writeFileSync(filename,toggled,'utf8')
}
toggleMakefile()
toggleSharedMakefile()
clean.run()