FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/lifecycleScripts/install.js at generation-improvements · elfscript/nodegit · GitHub
elfscript
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
lifecycleScripts
/
install.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
120 lines (105 loc) · 3.29 KB
Breadcrumbs
nodegit
/
lifecycleScripts
/
install.js
Copy path
File metadata and controls
120 lines (105 loc) · 3.29 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
var
promisify
=
require
(
"promisify-node"
)
;
var
path
=
require
(
"path"
)
;
var
fs
=
require
(
"fs"
)
;
var
local
=
path
.
join
.
bind
(
path
,
__dirname
)
;
var
whichNativeNodish
=
require
(
"which-native-nodish"
)
;
var
checkPrepared
=
require
(
"./checkPrepared"
)
;
var
prepareForBuild
=
require
(
"./prepareForBuild"
)
;
var
exec
=
promisify
(
function
(
command
,
opts
,
callback
)
{
return
require
(
"child_process"
)
.
exec
(
command
,
opts
,
callback
)
;
}
)
;
var
nwVersion
=
null
;
var
asVersion
=
null
;
return
whichNativeNodish
(
local
(
".."
)
)
.
then
(
function
(
results
)
{
nwVersion
=
results
.
nwVersion
;
asVersion
=
results
.
asVersion
;
}
)
.
then
(
function
(
)
{
if
(
nwVersion
)
{
console
.
info
(
"[nodegit] Must build for node-webkit/nw.js"
)
;
return
checkAndBuild
(
)
;
}
else
if
(
asVersion
)
{
console
.
info
(
"[nodegit] Must build for atom-shell"
)
;
return
checkAndBuild
(
)
;
}
if
(
fs
.
existsSync
(
local
(
"../.didntcomefromthenpmregistry"
)
)
)
{
return
checkAndBuild
(
)
;
}
if
(
process
.
env
.
BUILD_DEBUG
)
{
console
.
info
(
"[nodegit] Doing a debug build, no fetching allowed."
)
;
return
checkAndBuild
(
)
;
}
if
(
process
.
env
.
BUILD_ONLY
)
{
console
.
info
(
"[nodegit] BUILD_ONLY is set to true, no fetching allowed."
)
;
return
checkAndBuild
(
)
;
}
console
.
info
(
"[nodegit] Fetching binary from S3."
)
;
return
exec
(
"node-pre-gyp build"
)
.
then
(
function
(
)
{
console
.
info
(
"[nodegit] Completed installation successfully."
)
;
}
,
function
(
)
{
console
.
info
(
"[nodegit] Failed to install prebuilt binary, "
+
"building manually."
)
;
return
checkAndBuild
(
)
;
}
)
;
}
)
;
function
checkAndBuild
(
)
{
console
.
info
(
"[nodegit] Making sure dependencies are available and native "
+
"code is generated"
)
;
return
checkPrepared
.
checkAll
(
)
.
then
(
function
(
)
{
console
.
info
(
"[nodegit] Retrieving dependencies and regenerating code"
)
;
return
prepareForBuild
(
)
;
}
)
.
then
(
function
(
)
{
return
build
(
)
;
}
)
;
}
function
build
(
)
{
console
.
info
(
"[nodegit] Everything is ready to go, attempting compilation"
)
;
if
(
nwVersion
)
{
console
.
info
(
"[nodegit] Building native node-webkit module."
)
;
}
else
{
console
.
info
(
"[nodegit] Building native node module."
)
;
}
var
opts
=
{
cwd
:
local
(
".."
)
,
maxBuffer
:
Number
.
MAX_VALUE
}
;
var
prefix
=
""
;
var
target
=
""
;
var
debug
=
(
process
.
env
.
BUILD_DEBUG
?
" --debug"
:
""
)
;
var
builder
=
"node-gyp"
;
var
distUrl
=
""
;
if
(
asVersion
)
{
prefix
=
(
process
.
platform
==
"win32"
?
"SET HOME=\"~/.atom-shell-gyp\" && "
:
"HOME=~/.atom-shell-gyp"
)
;
target
=
"--target="
+
asVersion
;
distUrl
=
"--dist-url=https://gh-contractor-zcbenz.s3."
+
"amazonaws.com/atom-shell/dist"
;
}
else
if
(
nwVersion
)
{
builder
=
"nw-gyp"
;
target
=
"--target="
+
nwVersion
;
}
builder
=
path
.
resolve
(
"."
,
"node_modules"
,
".bin"
,
builder
)
;
builder
=
builder
.
replace
(
/
\s
/
g
,
"\\$&"
)
;
var
cmd
=
[
prefix
,
builder
,
"rebuild"
,
target
,
debug
,
distUrl
]
.
join
(
" "
)
.
trim
(
)
;
return
exec
(
cmd
,
opts
)
.
then
(
function
(
)
{
console
.
info
(
"[nodegit] Compilation complete."
)
;
console
.
info
(
"[nodegit] Completed installation successfully."
)
;
}
,
function
(
err
,
stderr
)
{
console
.
error
(
err
)
;
console
.
error
(
stderr
)
;
}
)
;
}
Back
|
FazBrowse Home
|
New Git URL