Skip to content

Conversation

@just-boris
Copy link
Member

@just-boris just-boris commented Mar 13, 2024

Issue #, if available:

Description of changes:

Allows simplified usage:

import { buildStyles } from "@cloudscape-design/theming-build/internal";

await buildStyles("src", "dist");

Currently we use some hacky options here and there. We can improve this

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Mar 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.60%. Comparing base (89daeee) to head (2d8e7ec).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #72   +/-   ##
=======================================
  Coverage   95.60%   95.60%           
=======================================
  Files          47       47           
  Lines        2889     2891    +2     
  Branches      364      366    +2     
=======================================
+ Hits         2762     2764    +2     
  Misses        123      123           
  Partials        4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@just-boris just-boris force-pushed the expose-styles-build branch from 3230045 to 2d8e7ec Compare March 13, 2024 14:19
}

export async function createStyles(inlines: InlineStylesheet[], outputDir: string, sassDir: string) {
export async function buildStyles(sassDir: string, outputDir: string, inlines: InlineStylesheet[] = []) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Updated this function to follow more intuitive signature "source, destination, options"

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import sass from 'sass';
import * as sass from 'sass';
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing deprecation warning

`import sass from 'sass'` is deprecated.
Please use `import * as sass from 'sass'` instead.

@just-boris just-boris changed the title Expose styles build chore: Expose styles build as a standalone feature Mar 13, 2024
main: './build/index.js',
exports: {
'.': './build/index.js',
'./internal': './build/internal.js'
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving forward, we should replace all current imports

import { buildThemedComponentsInternal } from "@cloudscape-design/theming-build";

to the new subpath

import { buildThemedComponentsInternal } from "@cloudscape-design/theming-build/internal";

Follow our standard naming convention where all team-internal APIs are coming from /internal imports

@just-boris just-boris marked this pull request as ready for review March 13, 2024 14:25
@just-boris just-boris requested a review from a team as a code owner March 13, 2024 14:25
@just-boris just-boris requested review from avinashbot and removed request for a team March 13, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants