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
e54581d7
Commit
e54581d7
authored
Nov 13, 2016
by
Michael Mifsud
Committed by
GitHub
Nov 13, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1796 from sass/feat/clean-up-script-logging
Use npmlog for all install script output
parents
fdda2541
0f2e0044
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
21 deletions
+30
-21
extensions.js
lib/extensions.js
+4
-2
build.js
scripts/build.js
+22
-16
install.js
scripts/install.js
+4
-3
No files found.
lib/extensions.js
View file @
e54581d7
...
...
@@ -181,9 +181,11 @@ function getBinaryName() {
}
else
if
(
pkg
.
nodeSassConfig
&&
pkg
.
nodeSassConfig
.
binaryName
)
{
binaryName
=
pkg
.
nodeSassConfig
.
binaryName
;
}
else
{
binaryName
=
[
process
.
platform
,
'-'
,
binaryName
=
[
process
.
platform
,
'-'
,
process
.
arch
,
'-'
,
process
.
versions
.
modules
].
join
(
''
);
process
.
versions
.
modules
].
join
(
''
);
}
return
[
binaryName
,
'binding.node'
].
join
(
'_'
);
...
...
scripts/build.js
View file @
e54581d7
...
...
@@ -2,12 +2,12 @@
* node-sass: scripts/build.js
*/
var
eol
=
require
(
'os'
).
EOL
,
pkg
=
require
(
'../package.json'
),
var
pkg
=
require
(
'../package.json'
),
fs
=
require
(
'fs'
),
mkdir
=
require
(
'mkdirp'
),
path
=
require
(
'path'
),
spawn
=
require
(
'cross-spawn'
),
log
=
require
(
'npmlog'
),
sass
=
require
(
'../lib/extensions'
);
/**
...
...
@@ -28,23 +28,23 @@ function afterBuild(options) {
mkdir
(
path
.
dirname
(
install
),
function
(
err
)
{
if
(
err
&&
err
.
code
!==
'EEXIST'
)
{
console
.
error
(
err
.
message
);
log
.
error
(
'node-sass build'
,
err
.
message
);
return
;
}
fs
.
stat
(
target
,
function
(
err
)
{
if
(
err
)
{
console
.
error
(
'Build succeeded but target not found'
);
log
.
error
(
'node-sass build'
,
'Build succeeded but target not found'
);
return
;
}
fs
.
rename
(
target
,
install
,
function
(
err
)
{
if
(
err
)
{
console
.
error
(
err
.
message
);
log
.
error
(
'node-sass build'
,
err
.
message
);
return
;
}
console
.
log
(
'Installed in "'
+
install
+
'"'
);
log
.
info
(
'node-sass build'
,
'Installed to %s'
,
install
);
});
});
});
...
...
@@ -76,8 +76,8 @@ function manageProcess(proc, cb) {
*/
function
initSubmodules
(
cb
)
{
console
.
log
(
'Detected a git install'
);
console
.
log
(
'Cloning l
ibSass into src/libsass'
);
log
.
info
(
'node-sass build'
,
'Detected a git install'
);
log
.
info
(
'node-sass build'
,
'Cloning L
ibSass into src/libsass'
);
var
clone
=
spawn
(
'git'
,
[
'clone'
,
'https://github.com/sass/libsass.git'
,
'./src/libsass'
]);
manageProcess
(
clone
,
function
(
err
)
{
...
...
@@ -86,7 +86,7 @@ function initSubmodules(cb) {
return
;
}
console
.
log
(
'Checking out libsass to '
+
pkg
.
libsass
);
log
.
info
(
'node-sass build'
,
'Checking out LibSass to %s'
,
pkg
.
libsass
);
var
checkout
=
spawn
(
'git'
,
[
'checkout'
,
pkg
.
libsass
],
{
cwd
:
'./src/libsass'
});
manageProcess
(
checkout
,
function
(
err
)
{
...
...
@@ -128,7 +128,7 @@ function installGitDependencies(options, cb) {
function
build
(
options
)
{
installGitDependencies
(
options
,
function
(
err
)
{
if
(
err
)
{
console
.
error
(
err
.
message
);
log
.
error
(
'node-sass build'
,
err
.
message
);
process
.
exit
(
1
);
}
...
...
@@ -137,7 +137,7 @@ function build(options) {
return
[
'--'
,
subject
,
'='
,
process
.
env
[
subject
.
toUpperCase
()]
||
''
].
join
(
''
);
})).
concat
(
options
.
args
);
console
.
log
([
'Building:'
,
process
.
execPath
].
concat
(
args
).
join
(
' '
));
log
.
info
(
'node-sass build'
,
[
process
.
execPath
].
concat
(
args
).
join
(
' '
));
var
proc
=
spawn
(
process
.
execPath
,
args
,
{
stdio
:
[
0
,
1
,
2
]
...
...
@@ -146,11 +146,15 @@ function build(options) {
proc
.
on
(
'exit'
,
function
(
errorCode
)
{
if
(
!
errorCode
)
{
afterBuild
(
options
);
return
;
}
console
.
error
(
errorCode
===
127
?
'node-gyp not found!'
:
'Build failed'
);
if
(
errorCode
===
127
)
{
log
.
error
(
'node-sass build'
,
'node-gyp not found!'
);
}
else
{
log
.
error
(
'node-sass build'
,
'Build failed with error code: %d'
,
errorCode
);
}
process
.
exit
(
1
);
});
});
...
...
@@ -203,16 +207,18 @@ function testBinary(options) {
return
build
(
options
);
}
console
.
log
(
'"'
+
sass
.
getBinaryPath
()
+
'" exists.'
,
eol
,
'testing binary.'
);
log
.
info
(
'node-sass build'
,
'Binary found at %s'
,
sass
.
getBinaryPath
());
log
.
info
(
'node-sass build'
,
'Testing binary'
);
try
{
require
(
'../'
).
renderSync
({
data
:
's { a: ss }'
});
console
.
log
(
'Binary is fine; exiting.
'
);
log
.
info
(
'node-sass build'
,
'Binary is fine
'
);
}
catch
(
e
)
{
console
.
log
([
'Problem with the binary:'
,
e
,
'Manual build incoming.'
].
join
(
eol
));
log
.
error
(
'node-sass build'
,
'Binary has a problem: %s'
,
e
);
log
.
info
(
'node-sass build'
,
'Building the binary locally'
);
return
build
(
options
);
}
...
...
scripts/install.js
View file @
e54581d7
...
...
@@ -48,7 +48,7 @@ function download(url, dest, cb) {
return
response
.
statusCode
>=
200
&&
response
.
statusCode
<
300
;
};
log
.
http
(
'node-sass install'
,
'
Start downloading binary at '
+
url
);
log
.
http
(
'node-sass install'
,
'
Downloading binary from %s'
,
url
);
try
{
request
(
url
,
downloadOptions
(),
function
(
err
,
response
)
{
...
...
@@ -57,12 +57,13 @@ function download(url, dest, cb) {
}
else
if
(
!
successful
(
response
))
{
reportError
([
'HTTP error'
,
response
.
statusCode
,
response
.
statusMessage
].
join
(
' '
));
}
else
{
log
.
http
(
'node-sass install'
,
'Download complete'
);
cb
();
}
})
.
on
(
'response'
,
function
(
response
)
{
var
length
=
parseInt
(
response
.
headers
[
'content-length'
],
10
);
var
progress
=
log
.
newItem
(
url
,
length
);
var
progress
=
log
.
newItem
(
''
,
length
);
if
(
successful
(
response
))
{
response
.
pipe
(
fs
.
createWriteStream
(
dest
));
...
...
@@ -108,7 +109,7 @@ function checkAndDownloadBinary() {
return
;
}
log
.
info
(
'node-sass install'
,
'Binary
downloaded and installed at '
+
sass
.
getBinaryPath
());
log
.
info
(
'node-sass install'
,
'Binary
saved at %s'
,
sass
.
getBinaryPath
());
});
});
}
...
...
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