FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/lifecycleScripts/prepareForBuild.js at master · v09-software/nodegit · GitHub
v09-software
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
lifecycleScripts
/
prepareForBuild.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
62 lines (56 loc) · 1.53 KB
Breadcrumbs
nodegit
/
lifecycleScripts
/
prepareForBuild.js
Copy path
File metadata and controls
62 lines (56 loc) · 1.53 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
var
Promise
=
require
(
"nodegit-promise"
)
;
var
cp
=
require
(
"child_process"
)
;
var
path
=
require
(
"path"
)
;
var
local
=
path
.
join
.
bind
(
path
,
__dirname
)
;
var
check
=
require
(
local
(
"checkPrepared"
)
)
.
checkGenerated
;
var
retrieve
=
require
(
local
(
"retrieveExternalDependencies"
)
)
;
var
generate
=
require
(
local
(
"../generate"
)
)
;
module
.
exports
=
function
prepareForBuild
(
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
cp
.
exec
(
"npm install --ignore-scripts"
,
function
(
err
,
stdout
,
stderr
)
{
if
(
err
)
{
console
.
error
(
stderr
)
;
reject
(
err
,
stderr
)
;
}
else
{
resolve
(
)
;
console
.
info
(
stdout
)
;
}
}
)
;
}
)
.
then
(
function
(
)
{
return
Promise
.
all
(
[
retrieve
(
)
,
doGenerate
(
)
]
)
;
}
)
;
}
;
function
doGenerate
(
)
{
console
.
info
(
"[nodegit] Detecting generated code."
)
;
return
check
(
)
.
then
(
function
(
allThere
)
{
if
(
allThere
)
{
console
.
info
(
"[nodegit] Generated code is intact."
)
;
return
Promise
.
resolve
(
)
;
}
else
{
console
.
info
(
"[nodegit] Generated code is missing or incomplete, "
+
"regenerating now."
)
;
return
new
Promise
(
function
(
resolve
,
reject
)
{
try
{
generate
(
)
;
console
.
info
(
"[nodegit] Code regenerated."
)
;
resolve
(
)
;
}
catch
(
e
)
{
console
.
info
(
"[nodegit] Error generating code."
)
;
console
.
info
(
e
)
;
//console.info(stderr);
reject
(
e
)
;
}
}
)
;
}
}
)
;
}
// Called on the command line
if
(
require
.
main
===
module
)
{
module
.
exports
(
)
;
}
Back
|
FazBrowse Home
|
New Git URL