FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/lifecycleScripts/postinstall.js at master · buzzkillhardball/nodegit · GitHub
buzzkillhardball
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
lifecycleScripts
/
postinstall.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
83 lines (75 loc) · 2.68 KB
Breadcrumbs
nodegit
/
lifecycleScripts
/
postinstall.js
Copy path
File metadata and controls
executable file
·
83 lines (75 loc) · 2.68 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
var
fse
=
require
(
"fs-extra"
)
;
var
path
=
require
(
"path"
)
;
var
exec
=
require
(
"../utils/execPromise"
)
;
var
buildFlags
=
require
(
"../utils/buildFlags"
)
;
var
rootPath
=
path
.
join
(
__dirname
,
".."
)
;
function
printStandardLibError
(
)
{
console
.
log
(
"[nodegit] ERROR - the latest libstdc++ is missing on your system!"
)
;
console
.
log
(
""
)
;
console
.
log
(
"On Ubuntu you can install it using:"
)
;
console
.
log
(
""
)
;
console
.
log
(
"$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test"
)
;
console
.
log
(
"$ sudo apt-get update"
)
;
console
.
log
(
"$ sudo apt-get install libstdc++-4.9-dev"
)
;
}
module
.
exports
=
function
install
(
)
{
if
(
buildFlags
.
isGitRepo
)
{
// If we're building NodeGit from a git repo we aren't going to do any
// cleaning up
return
Promise
.
resolve
(
)
;
}
if
(
buildFlags
.
isElectron
||
buildFlags
.
isNWjs
)
{
// If we're building for electron or NWjs, we're unable to require the
// built library so we have to just assume success, unfortunately.
return
Promise
.
resolve
(
)
;
}
return
exec
(
"node "
+
path
.
join
(
rootPath
,
"dist/nodegit.js"
)
)
.
catch
(
function
(
e
)
{
if
(
~
e
.
toString
(
)
.
indexOf
(
"Module version mismatch"
)
)
{
console
.
warn
(
"[nodegit] WARN - NodeGit was built for a different version of node."
)
;
console
.
warn
(
"If you are building NodeGit for electron/nwjs you can "
+
"ignore this warning."
)
;
}
else
{
throw
e
;
}
}
)
.
then
(
function
(
)
{
// Is we're using NodeGit from a package manager then let's clean up after
// ourselves when we install successfully.
if
(
!
buildFlags
.
mustBuild
)
{
// We can't remove the source files yet because apparently the
// "standard workflow" for native node moduels in Electron/nwjs is to
// build them for node and then nah eff that noise let's rebuild them
// again for the actual platform! Hurray!!! When that madness is dead
// we can clean up the source which is a serious amount of data.
// fse.removeSync(path.join(rootPath, "vendor"));
// fse.removeSync(path.join(rootPath, "src"));
// fse.removeSync(path.join(rootPath, "include"));
fse
.
removeSync
(
path
.
join
(
rootPath
,
"build/Release/*.a"
)
)
;
fse
.
removeSync
(
path
.
join
(
rootPath
,
"build/Release/obj.target"
)
)
;
}
}
)
;
}
;
// Called on the command line
if
(
require
.
main
===
module
)
{
module
.
exports
(
)
.
catch
(
function
(
e
)
{
console
.
warn
(
"[nodegit] WARN - Could not finish postinstall"
)
;
if
(
process
.
pladtform
===
"linux"
&&
~
e
.
toString
(
)
.
indexOf
(
"libstdc++"
)
)
{
printStandardLibError
(
)
;
}
else
{
console
.
log
(
e
)
;
}
}
)
;
}
Back
|
FazBrowse Home
|
New Git URL