Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop display field #258

Merged
merged 8 commits into from
Mar 27, 2024
12 changes: 6 additions & 6 deletions bases/recommended.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"compilerOptions": {
"target": "es2016",
"target": "ES2015",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"target": "ES2015",
"target": "ES2016",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Recommended"
"display": "Recommended",
"$schema": "https://json.schemastore.org/tsconfig"
}
5 changes: 4 additions & 1 deletion scripts/create-npm-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -44,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 {
Expand Down
5 changes: 3 additions & 2 deletions scripts/generate-recommend.ts
Original file line number Diff line number Diff line change
@@ -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" });
Expand All @@ -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, " ");
Expand Down
Loading