diff --git a/.eslintrc b/.eslintrc index f8ad5be8..90546ece 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,8 @@ { - "extends": "@dadi", + + "extends": "eslint:recommended", "rules": { - "require-atomic-updates": "off" + + } -} +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2c25a166..1b3c845f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ workspace/_exif/* workspace/_tmp/* .vscode/settings.json +images/ \ No newline at end of file diff --git a/README.md b/README.md index 8fc00eda..67220e5a 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ CDN is part of DADI, a suite of components covering the full development stack, ## Requirements -- **[Node.js](https://www.nodejs.org/)** (supported versions: 6.9.2, 6.11.1, 8.9.4) +- **[Node.js](https://www.nodejs.org/)** (supported versions: 10.16.3 to 14.15.0) ## Your first CDN project diff --git a/config.js b/config.js index 515a2195..712440d9 100755 --- a/config.js +++ b/config.js @@ -11,7 +11,7 @@ const schema = { server: { host: { doc: 'The IP address the application will run on', - format: 'ipaddress', + format: String, default: '0.0.0.0' }, port: { diff --git a/dadi/lib/handlers/image.js b/dadi/lib/handlers/image.js index 5afa56dd..0071bf06 100644 --- a/dadi/lib/handlers/image.js +++ b/dadi/lib/handlers/image.js @@ -1061,7 +1061,7 @@ ImageHandler.prototype.process = function(sharpImage, imageBuffer) { return resolve(help.streamToBuffer(pluginStream)) } - sharpImage.toBuffer({}, (err, buffer, info) => { + sharpImage.toBuffer(true, (err, buffer, info) => { if (err) return reject(err) let processBuffer = Promise.resolve(buffer) diff --git a/package.json b/package.json index dce20d2f..5e872947 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,68 @@ { - "name": "@dadi/cdn", - "version": "4.0.0", - "product": "DADI CDN", - "description": "A high performance, just-in-time asset manipulation and delivery layer designed as a modern content distribution solution.", - "scripts": { - "init": "validate-commit-msg", - "start": "node index.js --node_env=development", - "test": "rm -f config/config.test.json && eslint --ext js,jsx . && prettier --check '**/*.{js,jsx,md,html,css}' && npm run test:run && ./node_modules/.bin/nyc report", - "test:run": "rm -rf cache && env NODE_ENV=test ./node_modules/.bin/nyc --reporter=lcov -x '**/workspace/**' -x 'test/**' ./node_modules/mocha/bin/_mocha test", - "precommit": "node scripts/precommit.js", - "posttest": "./scripts/coverage.js", - "snyk-protect": "snyk protect", - "prepare": "npm run snyk-protect" + "_from": "@dadi/cdn", + "_id": "@dadi/cdn@4.0.0", + "_inBundle": false, + "_integrity": "sha512-7eLU2ARl7Liio9e4w45ltjfEI9J32+KWYlteswC7e8sQYzkyG9pV1IpttiVzHzeMh++W1Ur5S+K0mpNHd8tjBw==", + "_location": "/@dadi/cdn", + "_phantomChildren": { + "base64-js": "1.3.1", + "chownr": "1.1.4", + "color": "3.1.3", + "detect-libc": "1.0.3", + "end-of-stream": "1.4.4", + "fs-constants": "1.0.0", + "fs-copy-file-sync": "1.1.1", + "github-from-package": "0.0.0", + "ieee754": "1.1.13", + "inherits": "2.0.4", + "minimist": "1.2.5", + "mkdirp-classic": "0.5.3", + "nan": "2.14.2", + "napi-build-utils": "1.0.2", + "node-abi": "2.19.1", + "noop-logger": "0.1.1", + "npmlog": "4.1.2", + "once": "1.4.0", + "rc": "1.2.8", + "simple-concat": "1.0.1", + "string_decoder": "1.1.1", + "tar": "4.4.13", + "tunnel-agent": "0.6.0", + "util-deprecate": "1.0.2", + "which-pm-runs": "1.0.0" + }, + "_requested": { + "type": "tag", + "registry": true, + "raw": "@dadi/cdn", + "name": "@dadi/cdn", + "escapedName": "@dadi%2fcdn", + "scope": "@dadi", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/@dadi/cdn/-/cdn-4.0.0.tgz", + "_shasum": "5f6e00327162cdb0fe071796f95220dc1382255c", + "_spec": "@dadi/cdn", + "_where": "/var/www/my-app", + "author": { + "name": "DADI", + "email": "team@dadi.tech" + }, + "bugs": { + "url": "https://github.com/dadi/cdn/issues" + }, + "bundleDependencies": false, "dependencies": { + "@babel/cli": "^7.12.1", "@dadi/boot": "^1.1.4", "@dadi/cache": "^3.0.0", - "@dadi/logger": "latest", + "@dadi/logger": "^1.4.3", "@dadi/status": "^1.0.4", "accept-language-parser": "^1.2.0", "aspect-fit": "^1.0.2", @@ -26,6 +72,7 @@ "babel-preset-env": "1.6.1", "babel-preset-minify": "0.5.0", "body-parser": "^1.18.2", + "braces": "^3.0.2", "chokidar": "^2.0.3", "cloudfront": "~0.4.0", "color-namer": "^1.1.0", @@ -33,11 +80,11 @@ "compressible": "^2.0.13", "concat-stream": "^2.0.0", "console-stamp": "^0.2.2", - "convict": "^4.0.0", + "convict": "^6.0.0", "cron": "^1.4.0", "etag": "^1.7.0", "exif-reader-paras20xx": "^1.1.1", - "farmhash": "2.1.0", + "farmhash": "^3.1.0", "finalhandler": "~1.1.0", "fs-extra": "^7.0.1", "gifwrap": "^0.7.5", @@ -45,14 +92,17 @@ "image-size-stream": "1.1.0", "imagemin": "^6.0.0", "imagemin-jpegtran": "^6.0.0", - "jimp": "^0.6.1", + "jimp": "^0.16.1", + "js-yaml": "^3.14.0", "jsonwebtoken": "^8.2.1", "length-stream": "~0.1.1", "maxmind": "^2.2.0", "mime": "^2.4.0", + "minimist": "^1.2.5", "mkdirp": "^0.5.1", - "node-minify": "^3.3.0", - "node-vibrant": "^2.1.2", + "node-minify": "^3.6.0", + "node-vibrant": "^3.1.6", + "npm": "^7.0.7", "object-path": "^0.11.4", "range-parser": "^1.2.0", "range-stream": "^1.1.0", @@ -60,10 +110,10 @@ "request-promise": "^4.1.1", "router": "~1.3.0", "sha1": "~1.1.1", - "sharp": "^0.22.0", + "sharp": "^0.26.2", "simple-bufferstream": "^1.0.0", - "smartcrop-sharp": "^2.0.2", - "snyk": "^1.232.0", + "smartcrop-sharp": "^2.0.3", + "snyk": "^1.192.4", "sqwish": "^0.2.2", "stream-length": "^1.0.2", "streamifier": "^0.1.1", @@ -74,6 +124,8 @@ "uuid": "latest", "validate-commit-message": "^3.0.1" }, + "deprecated": false, + "description": "A high performance, just-in-time asset manipulation and delivery layer designed as a modern content distribution solution.", "devDependencies": { "@dadi/eslint-config": "^1.1.0", "@dadi/prettier-config": "^1.1.0", @@ -86,7 +138,7 @@ "husky": "^1.3.1", "it-each": "^0.3.1", "lint-staged": "^9.2.5", - "mocha": "^5.2.0", + "mocha": "^8.2.0", "nock": "^9.0.2", "nyc": "^14.0.0", "prettier": "^1.18.2", @@ -97,29 +149,38 @@ "superagent": "^5.0.2", "supertest": "^4.0.0" }, - "repository": { - "type": "git", - "url": "https://github.com/dadi/cdn.git" - }, - "bugs": { - "url": "https://github.com/dadi/cdn/issues" - }, - "homepage": "https://github.com/dadi/cdn", "directories": { "test": "test" }, - "author": "DADI ", - "license": "SEE LICENSE IN GPL.md", - "snyk": true, + "homepage": "https://github.com/dadi/cdn", "husky": { "hooks": { "pre-commit": "lint-staged" } }, + "license": "SEE LICENSE IN GPL.md", "lint-staged": { "*.{js,jsx,md,html,css}": [ "prettier --write", "git add" ] - } + }, + "name": "@dadi/cdn", + "product": "DADI CDN", + "repository": { + "type": "git", + "url": "git+https://github.com/dadi/cdn.git" + }, + "scripts": { + "init": "validate-commit-msg", + "posttest": "./scripts/coverage.js", + "precommit": "node scripts/precommit.js", + "prepare": "npm run snyk-protect", + "snyk-protect": "snyk protect", + "start": "node index.js --node_env=development", + "test": "rm -f config/config.test.json && eslint --ext js,jsx . && prettier --check '**/*.{js,jsx,md,html,css}' && npm run test:run && ./node_modules/.bin/nyc report", + "test:run": "rm -rf cache && env NODE_ENV=test ./node_modules/.bin/nyc --reporter=lcov -x '**/workspace/**' -x 'test/**' ./node_modules/mocha/bin/_mocha test" + }, + "snyk": true, + "version": "4.0.0" }