From e996a66596d8f011c11e630f951c81b00aee87bc Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 8 Jun 2023 01:15:57 -0400 Subject: [PATCH 1/2] Update TSCondif Based on #2558. Also fixes errors resulting from the stricter options. --- styles/src/theme/themeConfig.ts | 5 +++++ styles/src/themes/atelier/common.ts | 4 ++-- styles/src/themes/ayu/common.ts | 4 ++-- styles/src/themes/gruvbox/gruvbox-common.ts | 3 ++- styles/tsconfig.json | 16 +++++++++++++++- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/styles/src/theme/themeConfig.ts b/styles/src/theme/themeConfig.ts index 0342d0226d7afdcc2c5c95bc440541694fe3efe5..176ae83bb769f4bdc38f83a64c5963084c56de11 100644 --- a/styles/src/theme/themeConfig.ts +++ b/styles/src/theme/themeConfig.ts @@ -23,6 +23,11 @@ interface ThemeMeta { themeUrl?: string } +export type ThemeFamilyMeta = Pick< + ThemeMeta, + "name" | "author" | "licenseType" | "licenseUrl" +> + export interface ThemeConfigInputColors { neutral: Scale red: Scale diff --git a/styles/src/themes/atelier/common.ts b/styles/src/themes/atelier/common.ts index 961ca64270135eb28affe6818b3a8c409ade864e..2e5be61f52d92d32a58edb6d82517cabd6a0957d 100644 --- a/styles/src/themes/atelier/common.ts +++ b/styles/src/themes/atelier/common.ts @@ -1,4 +1,4 @@ -import { ThemeLicenseType, ThemeConfig, ThemeSyntax } from "../../common" +import { ThemeLicenseType, ThemeSyntax, ThemeFamilyMeta } from "../../common" export interface Variant { colors: { @@ -21,7 +21,7 @@ export interface Variant { } } -export const meta: Partial = { +export const meta: ThemeFamilyMeta = { name: "Atelier", author: "Bram de Haan (http://atelierbramdehaan.nl)", licenseType: ThemeLicenseType.MIT, diff --git a/styles/src/themes/ayu/common.ts b/styles/src/themes/ayu/common.ts index 26e21c19105796bc782844dd2760cb39dda8db09..1eb2c91916d3e374508cf4d0365046583c844e01 100644 --- a/styles/src/themes/ayu/common.ts +++ b/styles/src/themes/ayu/common.ts @@ -3,8 +3,8 @@ import { chroma, colorRamp, ThemeLicenseType, - ThemeConfig, ThemeSyntax, + ThemeFamilyMeta, } from "../../common" export const ayu = { @@ -77,7 +77,7 @@ export const buildSyntax = (t: typeof dark): ThemeSyntax => { } } -export const meta: Partial = { +export const meta: ThemeFamilyMeta = { name: "Ayu", author: "dempfi", licenseType: ThemeLicenseType.MIT, diff --git a/styles/src/themes/gruvbox/gruvbox-common.ts b/styles/src/themes/gruvbox/gruvbox-common.ts index f1c04a069c9d8e352eb95849e5232762b559a5bd..18e8c5b97e5e75f050f83ff9605f3a68ca0bf110 100644 --- a/styles/src/themes/gruvbox/gruvbox-common.ts +++ b/styles/src/themes/gruvbox/gruvbox-common.ts @@ -5,9 +5,10 @@ import { ThemeLicenseType, ThemeConfig, ThemeSyntax, + ThemeFamilyMeta, } from "../../common" -const meta: Partial = { +const meta: ThemeFamilyMeta = { name: "Gruvbox", author: "morhetz ", licenseType: ThemeLicenseType.MIT, diff --git a/styles/tsconfig.json b/styles/tsconfig.json index 13a5faf32b4178df8589be8527a75680ba8487af..6d24728a0a9f0e38b3a038c7c7bf3d0642e6e88f 100644 --- a/styles/tsconfig.json +++ b/styles/tsconfig.json @@ -6,7 +6,21 @@ "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, - "sourceMap": true + "sourceMap": true, + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "strict": true, + "strictNullChecks": true, + "noImplicitThis": true, + "alwaysStrict": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": false, + "experimentalDecorators": true, + "strictPropertyInitialization": false, + "skipLibCheck": true }, "exclude": ["node_modules"] } From 1e43fec1c5bede80da249b4f2a0f5837da1dd42f Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Thu, 8 Jun 2023 01:23:19 -0400 Subject: [PATCH 2/2] Update buildLicenses to only include the theme url if there is one --- styles/src/buildLicenses.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/styles/src/buildLicenses.ts b/styles/src/buildLicenses.ts index 2e1325044de7c8dfe173dab6022bcdab132f9b92..13a6951a8288bfd2349dc466364bb4df517f08cf 100644 --- a/styles/src/buildLicenses.ts +++ b/styles/src/buildLicenses.ts @@ -30,17 +30,19 @@ function generateLicenseFile(themes: ThemeConfig[]) { checkLicenses(themes) for (const theme of themes) { const licenseText = fs.readFileSync(theme.licenseFile).toString() - writeLicense(theme.name, theme.licenseUrl, licenseText) + writeLicense(theme.name, licenseText, theme.licenseUrl) } } function writeLicense( themeName: string, - licenseUrl: string, - licenseText: String + licenseText: string, + licenseUrl?: string ) { process.stdout.write( - `## [${themeName}](${licenseUrl})\n\n${licenseText}\n********************************************************************************\n\n` + licenseUrl + ? `## [${themeName}](${licenseUrl})\n\n${licenseText}\n********************************************************************************\n\n` + : `## ${themeName}\n\n${licenseText}\n********************************************************************************\n\n` ) }