Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
0ab145fa
Commit
0ab145fa
authored
Jan 12, 2017
by
Michael Mifsud
Committed by
GitHub
Jan 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1849 from xzyfer/feat/no-git-in-build
Remove the git fallback
parents
46c0c2be
93eeed1b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
96 deletions
+20
-96
build.js
scripts/build.js
+20
-96
No files found.
scripts/build.js
View file @
0ab145fa
...
...
@@ -2,8 +2,7 @@
* node-sass: scripts/build.js
*/
var
pkg
=
require
(
'../package.json'
),
fs
=
require
(
'fs'
),
var
fs
=
require
(
'fs'
),
mkdir
=
require
(
'mkdirp'
),
path
=
require
(
'path'
),
spawn
=
require
(
'cross-spawn'
),
...
...
@@ -50,74 +49,6 @@ function afterBuild(options) {
}
/**
* manageProcess
*
* @param {ChildProcess} proc
* @param {Function} cb
* @api private
*/
function
manageProcess
(
proc
,
cb
)
{
var
errorMsg
=
''
;
proc
.
stderr
.
on
(
'data'
,
function
(
data
)
{
errorMsg
+=
data
.
toString
();
});
proc
.
on
(
'close'
,
function
(
code
)
{
cb
(
code
===
0
?
null
:
{
message
:
errorMsg
});
});
}
/**
* initSubmodules
*
* @param {Function} cb
* @api private
*/
function
initSubmodules
(
cb
)
{
console
.
log
(
'Detected a git install'
);
console
.
log
(
'Cloning LibSass into src/libsass'
);
var
clone
=
spawn
(
'git'
,
[
'clone'
,
'https://github.com/sass/libsass.git'
,
'./src/libsass'
]);
manageProcess
(
clone
,
function
(
err
)
{
if
(
err
)
{
cb
(
err
);
return
;
}
console
.
log
(
'Checking out LibSass to'
,
pkg
.
libsass
);
var
checkout
=
spawn
(
'git'
,
[
'checkout'
,
pkg
.
libsass
],
{
cwd
:
'./src/libsass'
});
manageProcess
(
checkout
,
function
(
err
)
{
cb
(
err
);
});
});
}
/**
* installGitDependencies
*
* @param {Function} cb
* @api private
*/
function
installGitDependencies
(
options
,
cb
)
{
var
libsassPath
=
'./src/libsass'
;
if
(
process
.
env
.
LIBSASS_EXT
||
options
.
libsassExt
)
{
cb
();
}
else
if
(
fs
.
access
)
{
// node 0.12+, iojs 1.0.0+
fs
.
access
(
libsassPath
,
fs
.
R_OK
,
function
(
err
)
{
err
&&
err
.
code
===
'ENOENT'
?
initSubmodules
(
cb
)
:
cb
();
});
}
else
{
// node < 0.12
fs
.
exists
(
libsassPath
,
function
(
exists
)
{
exists
?
cb
()
:
initSubmodules
(
cb
);
});
}
}
/**
* Build
*
* @param {Object} options
...
...
@@ -125,37 +56,30 @@ function installGitDependencies(options, cb) {
*/
function
build
(
options
)
{
installGitDependencies
(
options
,
function
(
err
)
{
if
(
err
)
{
console
.
error
(
err
.
message
);
process
.
exit
(
1
);
}
var
args
=
[
require
.
resolve
(
path
.
join
(
'node-gyp'
,
'bin'
,
'node-gyp.js'
)),
'rebuild'
,
'--verbose'
].
concat
(
[
'libsass_ext'
,
'libsass_cflags'
,
'libsass_ldflags'
,
'libsass_library'
].
map
(
function
(
subject
)
{
return
[
'--'
,
subject
,
'='
,
process
.
env
[
subject
.
toUpperCase
()]
||
''
].
join
(
''
);
})).
concat
(
options
.
args
);
var
args
=
[
require
.
resolve
(
path
.
join
(
'node-gyp'
,
'bin'
,
'node-gyp.js'
)),
'rebuild'
,
'--verbose'
].
concat
(
[
'libsass_ext'
,
'libsass_cflags'
,
'libsass_ldflags'
,
'libsass_library'
].
map
(
function
(
subject
)
{
return
[
'--'
,
subject
,
'='
,
process
.
env
[
subject
.
toUpperCase
()]
||
''
].
join
(
''
);
})).
concat
(
options
.
args
);
console
.
log
(
'Building:'
,
[
process
.
execPath
].
concat
(
args
).
join
(
' '
));
console
.
log
(
'Building:'
,
[
process
.
execPath
].
concat
(
args
).
join
(
' '
));
var
proc
=
spawn
(
process
.
execPath
,
args
,
{
stdio
:
[
0
,
1
,
2
]
});
var
proc
=
spawn
(
process
.
execPath
,
args
,
{
stdio
:
[
0
,
1
,
2
]
});
proc
.
on
(
'exit'
,
function
(
errorCode
)
{
if
(
!
errorCode
)
{
afterBuild
(
options
);
return
;
}
proc
.
on
(
'exit'
,
function
(
errorCode
)
{
if
(
!
errorCode
)
{
afterBuild
(
options
);
return
;
}
if
(
errorCode
===
127
)
{
console
.
error
(
'node-gyp not found!'
);
}
else
{
console
.
error
(
'Build failed with error code:'
,
errorCode
);
}
if
(
errorCode
===
127
)
{
console
.
error
(
'node-gyp not found!'
);
}
else
{
console
.
error
(
'Build failed with error code:'
,
errorCode
);
}
process
.
exit
(
1
);
});
process
.
exit
(
1
);
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment