Merge pull request #1065 from DaAwesomeP/master

Cache NPM dependencies, improve PNG MIME test, fix Anchor Cache image
main
Elbert Alias 9 years ago
commit 380d771258

@ -1,14 +1,21 @@
language: node_js language: node_js
node_js: node_js:
- "4.2" - "4"
sudo: false sudo: false
before_install: before_install:
- export WAPPALYZER_ROOT=$TRAVIS_BUILD_DIR - export WAPPALYZER_ROOT=$TRAVIS_BUILD_DIR
- export WAPPALYZER_NODE_PATH=$TRAVIS_BUILD_DIR - export WAPPALYZER_NODE_PATH=$TRAVIS_BUILD_DIR
- export PATH=$PATH:$TRAVIS_BUILD_DIR/bin - export PATH=$PATH:$TRAVIS_BUILD_DIR/bin
install: - ln -s docker/node/package.json package.json
- 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
after_script: ls -l --block-size=kB build 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 exit 1
fi fi
if [ -z $WAPPALYZER_NODE_PATH ]
then
echo "\$WAPPALYZER_NODE_PATH not set"
exit 1
fi
set -eu set -eu
wappalyzer validate wappalyzer validate
echo "Prettifying apps.json..." 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..." 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..." 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 wappalyzer links
@ -34,7 +41,7 @@ echo "Building Firefox driver..."
pushd $WAPPALYZER_ROOT/src/drivers/firefox > /dev/null 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 popd > /dev/null

@ -27,7 +27,7 @@ path="$path/src"
echo "Validating apps.json..." 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..." echo "Validating regular expressions..."

@ -31,7 +31,11 @@ for (app in json.apps) {
if (exists) { if (exists) {
if (type === "PNG") { if (type === "PNG") {
var buffer = fileType(readChunk.sync(path, 0, 262)); 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); var err = new Error('Incorrect mimetype "' + buffer.mime + '" when expected PNG for app "' + app + '": src/icons/' + iconPath);
throw err; throw err;
} }

@ -32,7 +32,7 @@ RUN su wappalyzer -c "mkdir $WAPPALYZER_NODE_PATH"
ADD node/package.json $WAPPALYZER_NODE_PATH/package.json 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 # 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": { "devDependencies": {
"file-type": "3.3.*", "file-type": "3.4.*",
"is-svg": "1.1.*", "is-svg": "1.1.*",
"read-chunk": "1.0.*" "read-chunk": "1.0.*",
"jsonlint": "*",
"jpm": "*",
"imagemin-cli": "*",
"svgo": "*"
},
"engines": {
"node": ">= 4"
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 B

After

Width:  |  Height:  |  Size: 13 KiB