-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Prepare design tokens template
A step to support cloudscape-design/theming-core#35 This change - configures the `designTokensOutputDir` which holds the package.json which will be part of the generated build time theme artifacts. - simplifies the way how we generate the themed components by generating the `buildThemedComponents` as part of the components build. It allows us to remove the ts build step in the theming package (which generates the build artifacts).
- Loading branch information
1 parent
f9029ce
commit bfc3f75
Showing
4 changed files
with
99 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src-themeable/internal/template/internal/generated/theming/index.cjs.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { ThemePreset, GlobalValue, TypedModeValueOverride } from '@cloudscape-design/theming-build'; | ||
|
||
export interface TypedOverride { | ||
tokens: Partial<Record<string, GlobalValue | TypedModeValueOverride>>; | ||
} | ||
export const preset: ThemePreset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { join } from 'path'; | ||
import { buildThemedComponents as themingCoreBuild } from '@cloudscape-design/theming-build'; | ||
import { preset, TypedOverride } from './internal/template/internal/generated/theming/index.cjs'; | ||
|
||
const internalDir = join(__dirname, './internal'); | ||
const scssDir = join(internalDir, './scss'); | ||
const templateDir = join(internalDir, './template'); | ||
const designTokensTemplateDir = join(internalDir, './template-tokens'); | ||
|
||
export type Theme = TypedOverride; | ||
export interface BuildThemedComponentsParams { | ||
theme: Theme; | ||
outputDir: string; | ||
baseThemeId?: string; | ||
} | ||
|
||
export function buildThemedComponents({ theme, outputDir, baseThemeId }: BuildThemedComponentsParams): Promise<void> { | ||
return themingCoreBuild({ | ||
override: theme, | ||
preset, | ||
baseThemeId, | ||
componentsOutputDir: join(outputDir, 'components'), | ||
designTokensOutputDir: join(outputDir, 'design-tokens'), | ||
templateDir, | ||
designTokensTemplateDir, | ||
scssDir, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "@tsconfig/node16/tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "src-themeable", | ||
"declaration": true, | ||
"incremental": true | ||
}, | ||
"include": ["src-themeable"] | ||
} |