Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh development dependencies and use prettier 3 for formatting #202

Merged
merged 35 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
97b8283
Now using Node.js v18.19.0 ; Added package-lock.json and related changes
Jan 12, 2024
99d8fe7
Updated ESLint and related dependencies
Jan 12, 2024
1fa1edb
Updated 'unexpected' and related dependencies
Jan 12, 2024
ae799f2
Minor version updates for dependencies in package.json
Jan 12, 2024
564ff64
Now using prettier@^3.1.1 and related updates
Jan 12, 2024
c39c06a
Now using mocha@^10.2.0
Jan 12, 2024
2015669
Pinned to mime@=3.0.0 in package.json for now since newer version is …
Jan 12, 2024
aed881e
Now using browser-sync@^3.0.2
Jan 12, 2024
e75af26
Now using sinon@^17.0.1
Jan 12, 2024
401d31e
Added a 'Sample guide for updating image test data' in test/processIm…
Jan 12, 2024
9e61a22
Minor update in npm scripts
Jan 12, 2024
d5c5422
Minor code refactoring
Jan 12, 2024
8792115
Now using sharp@^0.33.1 and related updates for some images in testda…
Jan 12, 2024
441b082
Pinned to gifsicle@=5.3.0 in package.json for now since newer version…
Jan 12, 2024
3cf09e4
Now using exif-reader@^2.0.0
Jan 12, 2024
3cd44e6
Now using impro@~0.14.2
Jan 12, 2024
8cec575
Now using offline-github-changelog@^3.0.1
Jan 12, 2024
f8673b5
Updated package-lock.json
Jan 12, 2024
5d7358c
Using Node.js 18 and 20 now (dropping support for Node.js 16)
Jan 12, 2024
016707f
Added some npm package overrides to get rid of critical and high vuln…
Jan 12, 2024
c651684
Removed package-lock.json and added to .gitignore
Jan 12, 2024
c93259b
Removed pinning of versions for some npm packages
Jan 12, 2024
8839d92
General package update prettier@^3.2.1
Jan 12, 2024
354c8ec
General package update sharp@^0.33.2
Jan 12, 2024
d803eb9
Some changes in npm scripts
Jan 12, 2024
01ad85f
Brought back 'package-lock = false' in .npmrc
Jan 12, 2024
81fa842
Now using prettier@~3.2.1
paras20xx Jan 12, 2024
9d825c7
Updated .gitignore
Jan 12, 2024
4482960
Removed the changes for "overrides" in package.json
Jan 19, 2024
5a96498
reset tool versions
alexjeffburke Jan 30, 2024
2619487
Revert "General package update sharp@^0.33.2"
alexjeffburke Jan 30, 2024
42f53b0
Revert "Now using sharp@^0.33.1 and related updates for some images i…
alexjeffburke Jan 30, 2024
5028ba5
Revert "Using Node.js 18 and 20 now (dropping support for Node.js 16)"
alexjeffburke Jan 30, 2024
d0d525b
more version resets
alexjeffburke Jan 30, 2024
c2ca220
reset .nvmrc
alexjeffburke Jan 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
strategy:
matrix:
node:
- '16'
- '18'
- '20'
steps:
Expand Down Expand Up @@ -39,7 +38,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '16'
node-version: '18'
- name: Install dependencies
run: sudo add-apt-repository -y ppa:inkscape.dev/stable && sudo apt-get install -y optipng pngcrush pngquant graphicsmagick imagemagick libjpeg-turbo-progs inkscape libcairo2-dev libgif-dev libjpeg8-dev zlib1g-dev
- run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.20.2
v18.19.0
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"singleQuote": true
"singleQuote": true,
"trailingComma": "es5"
}
64 changes: 32 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,51 @@
"lib"
],
"dependencies": {
"accepts": "^1.3.3",
"accepts": "^1.3.8",
"animated-gif-detector": "^1.2.0",
"exif-reader": "^1.0.2",
"exif-reader": "^2.0.0",
"gm-papandreou": "^1.23.0-patch1",
"hijackresponse": "^5.0.0",
"httperrors": "^2.0.1",
"impro": "~0.14.1",
"inkscape": "^3.0.0",
"httperrors": "^2.3.0",
"impro": "~0.14.2",
alexjeffburke marked this conversation as resolved.
Show resolved Hide resolved
"inkscape": "^3.1.1",
alexjeffburke marked this conversation as resolved.
Show resolved Hide resolved
"jpegtran": "^2.0.0",
"mime": "^3.0.0",
"optimist": "^0.6.1",
"optipng": "^4.0.0",
"optipng": "^4.2.0",
alexjeffburke marked this conversation as resolved.
Show resolved Hide resolved
"passerror": "^1.1.1",
"pngcrush": "^3.0.0",
"pngquant": "^4.0.0",
"sharp": "^0.32.0"
"pngquant": "^4.2.0",
alexjeffburke marked this conversation as resolved.
Show resolved Hide resolved
"sharp": "^0.33.2"
alexjeffburke marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"browser-sync": "^2.18.6",
"compression": "^1.6.1",
"eslint": "^8.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-mocha": "^10.0.1",
"eslint-plugin-n": "^15.1.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^6.0.0",
"browser-sync": "^3.0.2",
"compression": "^1.7.4",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-mocha": "^10.2.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-standard": "^5.0.0",
"express": "^4.16.3",
"express": "^4.18.2",
"gifsicle": "^5.3.0",
"magicpen": "^6.0.2",
"magicpen-prism": "^5.0.0",
"magicpen": "^6.2.4",
"magicpen-prism": "^5.0.1",
"memoizesync": "^1.1.1",
"mocha": "^9.0.1",
"nyc": "^15.0.0",
"offline-github-changelog": "^1.7.0",
"prettier": "~2.5.0",
"sinon": "^12.0.1",
"svgfilter": "^4.0.0",
"unexpected": "^12.0.0",
"unexpected-express": "^13.0.1",
"unexpected-http": "^8.0.1",
"unexpected-image": "^4.0.0",
"unexpected-sinon": "^11.0.0"
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"offline-github-changelog": "^3.0.1",
"prettier": "~3.2.1",
"sinon": "^17.0.1",
"svgfilter": "^4.1.0",
"unexpected": "^12.0.5",
"unexpected-express": "^13.1.2",
"unexpected-http": "^9.0.0",
"unexpected-image": "^4.1.0",
"unexpected-sinon": "^11.1.0"
},
"scripts": {
"docker:build": "docker build -t express-processimage-dev .",
Expand Down
56 changes: 48 additions & 8 deletions test/processImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,48 @@ const load = memoizeSync((fileName) =>
fs.readFileSync(pathModule.resolve(__dirname, '..', 'testdata', fileName))
);

/*
Sample guide for updating image test data:
* Suppose, the original test case looks like this:
it('should do an entropy-based crop', () =>
expect(
'GET /turtle.jpg?resize=100,200&crop=entropy',
'to yield response',
{
body: expect
.it('to equal', load('turtleCroppedEntropy100x200.jpg'))
.and('to have metadata satisfying', {
size: {
width: 100,
height: 200
}
})
}
));
* Rename the concerned file to the new name (turtleCroppedEntropy100x200.jpg -> turtleCroppedEntropy100x200.old.jpg)
* Now, temporarily update the test case in a way to make it pass, like:
it('should do an entropy-based crop', () =>
expect(
'GET /turtle.jpg?resize=100,200&crop=entropy',
'to yield response',
{
statusCode: 200
}
).then((context) => {
const outputPath = pathModule.resolve(root, 'turtleCroppedEntropy100x200.jpg');
const body = context.httpResponse.body;
fs.writeFileSync(outputPath, body);
}));
* Run the test case. This will create a new file with the new name (turtleCroppedEntropy100x200.jpg)
* Now, compare the new file with the old file using appropriate tool, if required
* If the new file is:
* Correct, then:
* revert the test case to the original state
* delete the old file (turtleCroppedEntropy100x200.old.jpg)
* Incorrect, then:
* revert the test case to the original state and investigate
*/

describe('express-processimage', () => {
let config;
let impro;
Expand Down Expand Up @@ -49,14 +91,12 @@ describe('express-processimage', () => {

impro = middleware._impro;

return expect(
express().use(middleware).use(express.static(root)),
'to yield exchange',
{
request: subject,
response: value,
}
);
const app = express().use(middleware).use(express.static(root));

return expect(app, 'to yield exchange', {
request: subject,
response: value,
});
}
)
.addAssertion(
Expand Down
Binary file modified testdata/turtleCroppedAttention100x200.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified testdata/turtleCroppedEntropy100x200.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified testdata/turtleCroppedNorth.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading