From 7fa77dab1f38bf591353d9276aff15f405a08675 Mon Sep 17 00:00:00 2001 From: yinm Date: Mon, 25 Mar 2024 22:36:10 +0900 Subject: [PATCH 1/8] Drop `display` field --- scripts/create-npm-packages.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/create-npm-packages.ts b/scripts/create-npm-packages.ts index 19fc831..e3519c6 100644 --- a/scripts/create-npm-packages.ts +++ b/scripts/create-npm-packages.ts @@ -26,6 +26,9 @@ for await (const tsconfigEntry of Deno.readDir("bases")) { const tsconfigText = await Deno.readTextFile(newPackageTSConfigPath) const tsconfigJSON = JSON.parse(stripJsonComments(tsconfigText)) +// Drop `display` field in tsconfig.json for npm package + await Deno.writeTextFile(newPackageTSConfigPath, tsconfigText.replace(/\s*"display.*/,'')) + // Edit the package.json const packageText = await Deno.readTextFile(path.join(packagePath, "package.json")) const packageJSON = JSON.parse(packageText) From caec0fe316946325b63c666f7037d88e01f54c89 Mon Sep 17 00:00:00 2001 From: yinm Date: Mon, 25 Mar 2024 22:37:39 +0900 Subject: [PATCH 2/8] Refer to the same `tsconfig.json` as the npm package --- scripts/create-npm-packages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create-npm-packages.ts b/scripts/create-npm-packages.ts index e3519c6..86c5fe2 100644 --- a/scripts/create-npm-packages.ts +++ b/scripts/create-npm-packages.ts @@ -47,7 +47,7 @@ for await (const tsconfigEntry of Deno.readDir("bases")) { let packageText = await Deno.readTextFile(fileToEdit) packageText = packageText.replace(/\[filename\]/g, name) .replace(/\[display_title\]/g, title) - .replace(/\[tsconfig\]/g, Deno.readTextFileSync(tsconfigFilePath)) + .replace(/\[tsconfig\]/g, Deno.readTextFileSync(newPackageTSConfigPath)) // Inject readme-extra if any try { From a4353d81202a8ed58e012ec399ff965129f40749 Mon Sep 17 00:00:00 2001 From: yinm Date: Mon, 25 Mar 2024 22:44:15 +0900 Subject: [PATCH 3/8] Fix error that 'readLines' does not exist Use a version that is same version at `deploy-changed-npm-packages.ts` --- scripts/generate-recommend.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate-recommend.ts b/scripts/generate-recommend.ts index ebe5efc..62e0526 100644 --- a/scripts/generate-recommend.ts +++ b/scripts/generate-recommend.ts @@ -1,5 +1,5 @@ import stripJsonComments from "https://esm.sh/strip-json-comments"; -import * as bufio from "https://deno.land/std/io/buffer.ts"; +import * as bufio from "https://deno.land/std@0.164.0/io/buffer.ts"; import * as path from "https://deno.land/std/path/mod.ts"; const tsconfigStorage = await Deno.makeTempDir({ prefix: "tsconfig" }); From 826487907842ab113f4a52a9ecd6e7f46647483b Mon Sep 17 00:00:00 2001 From: yinm Date: Mon, 25 Mar 2024 22:45:55 +0900 Subject: [PATCH 4/8] deno run --allow-read --allow-run --allow-env --allow-write --allow-net scripts/generate-recommend.ts --- bases/recommended.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bases/recommended.json b/bases/recommended.json index bf42abb..37e6114 100644 --- a/bases/recommended.json +++ b/bases/recommended.json @@ -1,11 +1,11 @@ { "compilerOptions": { - "target": "es2016", + "target": "ES2015", "module": "commonjs", - "strict": true, "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true }, "$schema": "https://json.schemastore.org/tsconfig", "display": "Recommended" From 2b4aacf5f840bb56b7497d947c419a0db0ec4da9 Mon Sep 17 00:00:00 2001 From: yinm Date: Mon, 25 Mar 2024 22:48:46 +0900 Subject: [PATCH 5/8] Sort field order for dropping `display` field at generating npm package --- scripts/generate-recommend.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/generate-recommend.ts b/scripts/generate-recommend.ts index 62e0526..2d0bcc4 100644 --- a/scripts/generate-recommend.ts +++ b/scripts/generate-recommend.ts @@ -14,8 +14,9 @@ let packageText = await Deno.readTextFile(path.join(tsconfigStorage, "tsconfig.j // This will strip comments const parsed = JSON.parse(stripJsonComments(packageText)); -parsed["$schema"] = "https://json.schemastore.org/tsconfig"; +// `display` field will be dropped at generating npm package, so prevent the order from being last in the JSON file parsed.display = "Recommended"; +parsed["$schema"] = "https://json.schemastore.org/tsconfig"; parsed.compilerOptions.target = "ES2015"; const result = JSON.stringify(parsed, null, " "); From 7ca1d5c6e2f771ba71326b64f9fc03fa50638288 Mon Sep 17 00:00:00 2001 From: yinm Date: Mon, 25 Mar 2024 22:50:52 +0900 Subject: [PATCH 6/8] deno run --allow-read --allow-run --allow-env --allow-write --allow-net scripts/generate-recommend.ts --- bases/recommended.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bases/recommended.json b/bases/recommended.json index 37e6114..ff4d2d8 100644 --- a/bases/recommended.json +++ b/bases/recommended.json @@ -7,6 +7,6 @@ "strict": true, "skipLibCheck": true }, - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Recommended" + "display": "Recommended", + "$schema": "https://json.schemastore.org/tsconfig" } \ No newline at end of file From 11277a3af4378fbb1ef3480b0600984d8b6ef6e8 Mon Sep 17 00:00:00 2001 From: yinm Date: Tue, 26 Mar 2024 09:23:17 +0900 Subject: [PATCH 7/8] Remove unnecessary override --- scripts/generate-recommend.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/generate-recommend.ts b/scripts/generate-recommend.ts index 2d0bcc4..0bff235 100644 --- a/scripts/generate-recommend.ts +++ b/scripts/generate-recommend.ts @@ -17,7 +17,6 @@ const parsed = JSON.parse(stripJsonComments(packageText)); // `display` field will be dropped at generating npm package, so prevent the order from being last in the JSON file parsed.display = "Recommended"; parsed["$schema"] = "https://json.schemastore.org/tsconfig"; -parsed.compilerOptions.target = "ES2015"; const result = JSON.stringify(parsed, null, " "); From 15ede8eb165ac58391c66724887be03608d6c1e8 Mon Sep 17 00:00:00 2001 From: yinm Date: Tue, 26 Mar 2024 09:24:39 +0900 Subject: [PATCH 8/8] deno run --allow-read --allow-run --allow-env --allow-write --allow-net scripts/generate-recommend.ts --- bases/recommended.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bases/recommended.json b/bases/recommended.json index ff4d2d8..304c172 100644 --- a/bases/recommended.json +++ b/bases/recommended.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES2015", + "target": "es2016", "module": "commonjs", "esModuleInterop": true, "forceConsistentCasingInFileNames": true,