@adobe/spectrum-tokens 13.0.0-beta.48 → 13.0.0-beta.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/tasks/diff.js CHANGED
@@ -54,7 +54,11 @@ async function run() {
54
54
  async function getNewTokens() {
55
55
  try {
56
56
  await access(localTokenPath);
57
- return JSON.parse(await readFile(localTokenPath, { encoding: "utf8" }));
57
+ return JSON.parse(
58
+ convertNumberStringsToNumbers(
59
+ await readFile(localTokenPath, { encoding: "utf8" }),
60
+ ),
61
+ );
58
62
  } catch {
59
63
  console.error("cannot access");
60
64
  }
@@ -72,7 +76,11 @@ async function getOldTokens() {
72
76
  const oldTokenPath = join(tmpDir.path, "package", tokenPath);
73
77
  await access(oldTokenPath);
74
78
  console.log(`Comparing against ${stdout.trim()}`);
75
- return JSON.parse(await readFile(oldTokenPath, { encoding: "utf8" }));
79
+ return JSON.parse(
80
+ convertNumberStringsToNumbers(
81
+ await readFile(oldTokenPath, { encoding: "utf8" }),
82
+ ),
83
+ );
76
84
  }
77
85
 
78
86
  function calculatePossibleRenames(diffResult, oldTokens, newTokens) {
@@ -92,6 +100,12 @@ function calculatePossibleRenames(diffResult, oldTokens, newTokens) {
92
100
  });
93
101
  }
94
102
 
103
+ function convertNumberStringsToNumbers(dataString) {
104
+ return dataString.replace(/"([\d]*\.?[\d]*)"/g, (match, p1) => {
105
+ return p1;
106
+ });
107
+ }
108
+
95
109
  function logResultCategory(diffResult, categoryKey, msg) {
96
110
  const results = diffResult[categoryKey];
97
111
  const resultCount = Object.keys(results).length;