catch bad PNG error, cache NPM CLI dependencies, remove phantom from Travis (already included)

main
DaAwesomeP 9 years ago
parent c69079b5b4
commit b986bd668c

@ -1,14 +1,21 @@
language: node_js
node_js:
- "4.2"
- "4"
sudo: false
before_install:
- export WAPPALYZER_ROOT=$TRAVIS_BUILD_DIR
- export WAPPALYZER_NODE_PATH=$TRAVIS_BUILD_DIR
- export PATH=$PATH:$TRAVIS_BUILD_DIR/bin
install:
- npm install jsonlint jpm imagemin-cli svgo -g
- ln -s docker/node/package.json package.json && npm install
- mkdir phantomjs && curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 | tar xvjC phantomjs && ln -s $WAPPALYZER_ROOT/phantomjs/phantomjs-*-linux-x86_64/bin/phantomjs bin/phantomjs
script: wappalyzer build
- export WAPPALYZER_ROOT=$TRAVIS_BUILD_DIR
- export WAPPALYZER_NODE_PATH=$TRAVIS_BUILD_DIR
- export PATH=$PATH:$TRAVIS_BUILD_DIR/bin
- ln -s docker/node/package.json package.json
after_script: ls -l --block-size=kB build
cache:
directories:
- node_modules
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8

@ -7,21 +7,28 @@ then
exit 1
fi
if [ -z $WAPPALYZER_NODE_PATH ]
then
echo "\$WAPPALYZER_NODE_PATH not set"
exit 1
fi
set -eu
wappalyzer validate
echo "Prettifying apps.json..."
jsonlint -ist $'\t' $WAPPALYZER_ROOT/src/apps.json
node $WAPPALYZER_NODE_PATH/node_modules/jsonlint/lib/cli.js -ist $'\t' $WAPPALYZER_ROOT/src/apps.json
echo "Compressing PNG icons..."
imagemin $WAPPALYZER_ROOT/src/icons $WAPPALYZER_ROOT/src/icons -o 7
node $WAPPALYZER_NODE_PATH/node_modules/imagemin-cli/cli.js $WAPPALYZER_ROOT/src/icons $WAPPALYZER_ROOT/src/icons -o 7
echo "Compressing SVG icons..."
svgo -q -f $WAPPALYZER_ROOT/src/icons $WAPPALYZER_ROOT/src/icons
node $WAPPALYZER_NODE_PATH/node_modules/svgo/bin/svgo -q -f $WAPPALYZER_ROOT/src/icons $WAPPALYZER_ROOT/src/icons
wappalyzer links
@ -34,7 +41,7 @@ echo "Building Firefox driver..."
pushd $WAPPALYZER_ROOT/src/drivers/firefox > /dev/null
jpm xpi && mv *.xpi $WAPPALYZER_ROOT/build/wappalyzer_firefox.xpi
node $WAPPALYZER_NODE_PATH/node_modules/jpm/bin/jpm xpi && mv *.xpi $WAPPALYZER_ROOT/build/wappalyzer_firefox.xpi
popd > /dev/null

@ -27,7 +27,7 @@ path="$path/src"
echo "Validating apps.json..."
jsonlint --quiet -V $WAPPALYZER_ROOT/schema.json $path/apps.json
node $WAPPALYZER_NODE_PATH/node_modules/jsonlint/lib/cli.js --quiet -V $WAPPALYZER_ROOT/schema.json $path/apps.json
echo "Validating regular expressions..."

@ -31,7 +31,11 @@ for (app in json.apps) {
if (exists) {
if (type === "PNG") {
var buffer = fileType(readChunk.sync(path, 0, 262));
if (buffer.mime !== 'image/png') {
if (buffer === null) {
var err = new Error('Unknown mimetype or bad file for "' + app + '": src/icons/' + iconPath);
throw err;
}
else if (buffer.mime !== 'image/png') {
var err = new Error('Incorrect mimetype "' + buffer.mime + '" when expected PNG for app "' + app + '": src/icons/' + iconPath);
throw err;
}

@ -32,7 +32,7 @@ RUN su wappalyzer -c "mkdir $WAPPALYZER_NODE_PATH"
ADD node/package.json $WAPPALYZER_NODE_PATH/package.json
RUN npm install jsonlint jpm imagemin-cli svgo -g && su wappalyzer -c "cd $WAPPALYZER_NODE_PATH && npm install"
RUN su wappalyzer -c "cd $WAPPALYZER_NODE_PATH && npm i"
# PhantomJS

@ -1,7 +1,26 @@
{
"name": "wappalyzer-test",
"private": true,
"license": "GPLv3",
"bugs": {
"url": "https://github.com/AliasIO/Wappalyzer/issues"
},
"homepage": "https://github.com/AliasIO/Wappalyzer",
"description": "Build test for Wappalyzer",
"repository": "AliasIO/Wappalyzer",
"scripts": {
"test": "./bin/wappalyzer build"
},
"devDependencies": {
"file-type": "3.3.*",
"file-type": "3.4.*",
"is-svg": "1.1.*",
"read-chunk": "1.0.*"
"read-chunk": "1.0.*",
"jsonlint": "*",
"jpm": "*",
"imagemin-cli": "*",
"svgo": "*"
},
"engines": {
"node": ">= 4"
}
}