Skip to content

Commit a044789

Browse files
authored
chore(scripts): replace stripComments with decomment (#3944)
1 parent 7a9428f commit a044789

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"chai-as-promised": "^7.1.1",
6565
"concurrently": "7.0.0",
6666
"cucumber": "6.0.7",
67+
"decomment": "0.9.5",
6768
"downlevel-dts": "0.10.1",
6869
"eslint": "8.17.0",
6970
"eslint-config-prettier": "8.5.0",
@@ -98,7 +99,6 @@
9899
"prettier": "2.7.1",
99100
"puppeteer": "^5.1.0",
100101
"rimraf": "3.0.2",
101-
"strip-comments": "2.0.1",
102102
"ts-jest": "28.0.5",
103103
"ts-loader": "^7.0.5",
104104
"ts-mocha": "10.0.0",
@@ -109,8 +109,8 @@
109109
"verdaccio": "5.13.0",
110110
"webpack": "5.73.0",
111111
"webpack-cli": "4.10.0",
112-
"yarn": "1.22.10",
113-
"yargs": "17.5.1"
112+
"yargs": "17.5.1",
113+
"yarn": "1.22.10"
114114
},
115115
"workspaces": {
116116
"packages": [

Diff for: scripts/downlevel-dts/downlevelWorkspace.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// @ts-check
22
import { exec } from "child_process";
3+
import decomment from "decomment";
34
import { access, readFile, writeFile } from "fs/promises";
45
import { join } from "path";
56
import prettier from "prettier";
6-
import stripComments from "strip-comments";
77
import { promisify } from "util";
88

99
import { getAllFiles } from "./getAllFiles.mjs";
@@ -40,9 +40,9 @@ export const downlevelWorkspace = async (workspacesDir, workspaceName) => {
4040
for (const downlevelTypesFilepath of files) {
4141
try {
4242
const content = await readFile(downlevelTypesFilepath, "utf8");
43-
const strippedContent = stripComments(content);
43+
const decommentedContent = decomment(content);
4444
try {
45-
const formatted = prettier.format(strippedContent, { parser: "typescript" });
45+
const formatted = prettier.format(decommentedContent, { parser: "typescript" });
4646
await writeFile(downlevelTypesFilepath, formatted);
4747
} catch (error) {
4848
console.warn(`Failed to format "${downlevelTypesFilepath}". Skipping...`);

Diff for: yarn.lock

+8-6
Original file line numberDiff line numberDiff line change
@@ -4612,6 +4612,13 @@ decimal.js@^10.3.1:
46124612
resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.3.1.tgz#d8c3a444a9c6774ba60ca6ad7261c3a94fd5e783"
46134613
integrity sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==
46144614

4615+
4616+
version "0.9.5"
4617+
resolved "https://registry.yarnpkg.com/decomment/-/decomment-0.9.5.tgz#61753c80b8949620eb6bc3f8246cc0e2720ceac1"
4618+
integrity sha512-h0TZ8t6Dp49duwyDHo3iw67mnh9/UpFiSSiOb5gDK1sqoXzrfX/SQxIUQd2R2QEiSnqib0KF2fnKnGfAhAs6lg==
4619+
dependencies:
4620+
esprima "4.0.1"
4621+
46154622
dedent@^0.7.0:
46164623
version "0.7.0"
46174624
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c"
@@ -5304,7 +5311,7 @@ espree@^9.3.2:
53045311
acorn-jsx "^5.3.2"
53055312
eslint-visitor-keys "^3.3.0"
53065313

5307-
esprima@^4.0.0, esprima@^4.0.1:
5314+
esprima@4.0.1, esprima@^4.0.0, esprima@^4.0.1:
53085315
version "4.0.1"
53095316
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
53105317
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
@@ -11018,11 +11025,6 @@ strip-bom@^4.0.0:
1101811025
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878"
1101911026
integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==
1102011027

11021-
11022-
version "2.0.1"
11023-
resolved "https://registry.yarnpkg.com/strip-comments/-/strip-comments-2.0.1.tgz#4ad11c3fbcac177a67a40ac224ca339ca1c1ba9b"
11024-
integrity sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw==
11025-
1102611028
strip-final-newline@^2.0.0:
1102711029
version "2.0.0"
1102811030
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"

0 commit comments

Comments
 (0)