Skip to content

Commit

Permalink
E Upgrades deprecated dependencies and replaces crypto with crypto-js
Browse files Browse the repository at this point in the history
Upgrade jest configs and move test-runner and integration tests from websmith-sandbox #56
  • Loading branch information
jwloka committed Feb 3, 2025
1 parent 7171a7e commit 56344ae
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 47 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"preinstall": "npx only-allow pnpm"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nrwl/nx-cloud": "18.0.1",
"@nx/eslint-plugin": "^18.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dist": "pnpm clean && pnpm lint && pnpm test && cross-env-shell NODE_ENV=production \"pnpm build\""
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nx/eslint-plugin": "^18.3.4",
"@types/jest": "^29.5.14",
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test:e2e": "jest --verbose"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nx/eslint-plugin": "^18.3.4",
"@quatico/websmith-core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"dist": "cross-env-shell NODE_ENV=production \"pnpm clean && pnpm lint && pnpm test && pnpm build\""
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nx/eslint-plugin": "^18.3.4",
"@quatico/websmith-testing": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dist": "cross-env-shell NODE_ENV=production \"pnpm clean && pnpm lint && pnpm test && pnpm build\""
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nx/eslint-plugin": "^18.3.4",
"@types/jest": "^29.5.14",
Expand Down
2 changes: 1 addition & 1 deletion packages/example-addons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"dist": "pnpm clean && pnpm lint && pnpm test && cross-env-shell NODE_ENV=production \"pnpm build\""
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nx/eslint-plugin": "^18.3.4",
"@quatico/websmith-api": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"dist": "pnpm clean && pnpm lint && pnpm test && cross-env-shell NODE_ENV=production \"pnpm build\""
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nx/eslint-plugin": "^18.3.4",
"@quatico/websmith-core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"require-from-string": "^2.0.2"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nx/eslint-plugin": "^18.3.4",
"@types/jest": "^29.5.14",
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dist": "pnpm clean && pnpm lint && cross-env-shell NODE_ENV=production \"pnpm build\""
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nx/eslint-plugin": "^18.3.4",
"@quatico/websmith-core": "workspace:*",
Expand Down
5 changes: 3 additions & 2 deletions packages/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
"dependencies": {
"@quatico/websmith-api": "workspace:*",
"@quatico/websmith-core": "workspace:*",
"crypto": "^1.0.1"
"crypto-js": "^4.2.0"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/compat": "^1.2.6",
"@eslint/js": "^9.19.0",
"@nx/eslint-plugin": "^18.3.4",
"@quatico/websmith-testing": "workspace:*",
"@types/crypto-js": "^4.2.2",
"@types/jest": "^29.5.14",
"@types/node": "20",
"@types/webpack": "^5.28.5",
Expand Down
8 changes: 4 additions & 4 deletions packages/webpack/src/loader-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* ---------------------------------------------------------------------------------------------
*/

import crypto from "crypto";
import crypto from "crypto-js";
import { type LoaderContext } from "webpack";
import { createOptions } from "./options";
import { type WebsmithLoaderConfig } from "./WebsmithLoaderConfig";
Expand Down Expand Up @@ -66,16 +66,16 @@ const resolveLoaderOptions = (
};

export const getOptionsHash = (options: WebsmithLoaderConfig) => {
const hash = crypto.createHash("sha256");
const hash = crypto.algo.SHA256.create();
Object.keys(options).forEach(key => {
const value = options[key as keyof WebsmithLoaderOptions];
if (value !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
const valueString = isFunction(value) ? value.toString() : JSON.stringify(value);
hash.update(key + valueString);
hash.update(crypto.enc.Utf8.parse(key + valueString));
}
});
return hash.digest("hex").substring(0, 16);
return hash.finalize().toString(crypto.enc.Hex);
};

const isFunction = (value: unknown): value is object => typeof value === "function";
2 changes: 1 addition & 1 deletion packages/webpack/tests/webpack.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type CompilerOptions as WebsmithOptions } from "@quatico/websmith-core";
import { webpack } from "../../node/src";
import { webpack } from "@quatico/websmith-node";
import fs from "fs";
import path from "path";
import ts from "typescript";
Expand Down
79 changes: 48 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 56344ae

Please sign in to comment.