This repository was archived by the owner on Feb 17, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpostinstall.js
More file actions
66 lines (58 loc) · 1.97 KB
/
postinstall.js
File metadata and controls
66 lines (58 loc) · 1.97 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
var fs = require('fs')
var process = require('process')
class InstallReact {
constructor(uibuilderNodeName) {
this.reactRelativePath = '\\uibuilder\\' + uibuilderNodeName + '\\src\\react_app\\'
this.uibuilderDistRelativePath = '\\uibuilder\\' + uibuilderNodeName + '\\dist\\'
this.uibuilderNodePath = '\\node_modules\\node-red-contrib-uibuilder\\nodes\\src\\'
this.uibuilderFile = 'uibuilderfe.min.js'
}
createSymlink() {
let err = "ok"
console.log('TODO: Create symlink for uibuilderfe.min.js')
console.log(process.cwd() + this.uibuilderNodePath)
console.log(process.cwd() + this.reactRelativePath + 'libs/')
fs.symlink(process.cwd() + this.uibuilderNodePath, process.cwd() + this.reactRelativePath + 'src/libs/uibuilder/', 'junction', function(err,stdout,stderr){
console.log('err: ' + err)
console.log('stdout: ' + stdout)
console.log('stderr: ' + stderr)
if (err == null){
console.log('Symlink created')
}
})
console.log('Create symlink for node-red dist folder')
fs.symlink(process.cwd() + this.reactRelativePath + 'build/', process.cwd() + this.uibuilderDistRelativePath, 'junction', function(err,stdout,stderr){
// console.log('err: ' + err)
// console.log('stdout: ' + stdout)
// console.log('stderr: ' + stderr)
if (err == null){
console.log('Symlink created')
}
})
}
installReact() {
let stdout = "ok"
var react = process.cwd() + this.reactRelativePath
console.log('Installing ReactJS in cwd: ' + react);
stdout = require('child_process').execSync('npm install', {cwd:react})
if(stdout.status){
console.log(stdout.status)
process.exit()
}
stdout = require('child_process').execSync('npm run build', {cwd:react})
if(stdout.status){
console.log(stdout.status)
process.exit()
}
return stdout
}
execute() {
this.createSymlink()
this.installReact()
}
}
const react_ui = new InstallReact("react_ui");
react_ui.execute()
// const snw = new InstallReactAndNodered("snw");
// snw.execute()
console.log("Install Done")