Skip to content

Commit

Permalink
Replaced "fast-safe-stringify" with "safe-stable-stringify"
Browse files Browse the repository at this point in the history
  • Loading branch information
MillanWangGadget committed Nov 21, 2024
1 parent 7a7fe72 commit 7704429
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"chalk": "^5.3.0",
"cheerio": "1.0.0-rc.12",
"eslint": "^8.52.0",
"fast-safe-stringify": "^2.1.1",
"fs-extra": "^11.2.0",
"gitpkg": "1.0.0-beta.4",
"globby": "^14.0.1",
Expand All @@ -52,6 +51,7 @@
"lodash": "^4.17.21",
"prettier": "^2.8.8",
"publint": "^0.2.7",
"safe-stable-stringify": "^2.5.0",
"traverse": "^0.6.9",
"tsx": "^4.7.3",
"typescript": "^5.4.5"
Expand Down
8 changes: 5 additions & 3 deletions src/scrape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ import { getVocabulary, schemaWalk } from "@cloudflare/json-schema-walker";
import { inferSchema } from "@jsonhero/schema-infer";
import chalk from "chalk";
import cheerio from "cheerio";
import safeStringify from "fast-safe-stringify";
import fs from "fs-extra";
import { globby } from "globby";
import got from "got";
import { cloneDeep, cloneDeepWith, isEqual, merge, pick, uniq } from "lodash";
import path from "path";
import { configure } from "safe-stable-stringify";
import { getPackageRootDir } from "src";
import { startDecoding } from "./shopify.js";

const stringify = configure({ deterministic: true });

const startVersion = "2024-04";

function assert<T>(value: T | false | undefined | null, message?: string): T {
Expand Down Expand Up @@ -79,8 +81,8 @@ const sortStringArrays = (obj: Object) => {
};

const getDeterministicObject = (obj: Object): Object => {
const stableString = safeStringify.stableStringify(sortStringArrays(obj));
return JSON.parse(stableString);
const stableString = stringify(sortStringArrays(obj));
return JSON.parse(stableString!);
};

const inferSchemaFromExamplePayload = (examplePayload: Record<string, any>, metadata: { name: string }) => {
Expand Down

0 comments on commit 7704429

Please sign in to comment.