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

chore: use sass instead of node-sass #8916

Merged
merged 14 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ If preferable to use manual deployment, you can use [gh-pages](https://pages.git

**A.** Just as installing, except the `npm` command you'd run would be `npm uninstall` (shortened to `npm un`). e.g.: `lerna exec --scope=@deriv/translations -- npm un i18next`.

3. How do I run `npm ci` or equivalent (to add dependencies based on `package-lock.json`?
3. How do I run `npm ci` or equivalent to add dependencies based on `package-lock.json`?

**A.** You have two options:

Expand All @@ -280,15 +280,7 @@ If preferable to use manual deployment, you can use [gh-pages](https://pages.git

If you face this issue, simply run `sudo chown -R $(whoami) .` from the root of the project.

5. My build(s) fail and I can see it related to Node Sass (`node-sass`), what do I do?

**A.** This issue happens when your `node-sass` has its `binding.node` set to a version of node different from the current projects' one. Please try the following in order:

1. First run `npx lerna exec -- npm rebuild node-sass` and try building your packages again.
2. If that doesn't work, try `npm cache clean --force`, followed by `npm run clean`, and then `npm run bootstrap`.
3. And finally, if that doesn't work then you can read deeper into this [StackOverflow post](https://stackoverflow.com/questions/37986800).

6. How can I regenerate `package-lock.json` file?
5. How can I regenerate `package-lock.json` file?

We have added `bootstrap:dev` to scripts. If you are updating or adding a package and you want to regenerate `package-lock.json` file, you should run this command
`npm run bootstrap:dev`
2 changes: 1 addition & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"eslint-plugin-react-hooks": "^4.2.0",
"history": "^5.0.0",
"mini-css-extract-plugin": "^1.3.4",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/appstore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"fork-ts-checker-webpack-plugin": "^6.5.0",
"lint-staged": "^10.4.0",
"mini-css-extract-plugin": "^1.3.4",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/bot-web-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"lint-staged": "^10.4.0",
"loader-utils": "^1.1.0",
"mini-css-extract-plugin": "^1.3.4",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"raw-loader": "^4.0.0",
"sass-loader": "^12.6.0",
"sass-resources-loader": "^2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cashier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"file-loader": "^6.2.0",
"history": "^5.0.0",
"mini-css-extract-plugin": "^1.3.4",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/cfd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"jsdom-global": "^2.1.1",
"mini-css-extract-plugin": "^1.3.4",
"mock-local-storage": "^1.1.8",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"lint-staged": "^10.4.0",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"sass-loader": "^12.6.0",
"sass-resources-loader": "^2.1.1",
"style-loader": "^1.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ button.dc-input-wrapper {
cursor: pointer;

& ~ .dc-input-wrapper__input {
@extend .input:hover;
@extend .input-hover;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extending Compound classes (doc) is deprecated and not supported in sass.

}
}
&:disabled:hover {
Expand Down Expand Up @@ -158,7 +158,8 @@ button.dc-input-wrapper {
&::placeholder {
border-color: var(--border-normal);
}
&:hover {
&:hover,
&-hover {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Create a class to be able to use it instead of extending the compound class.

border-color: var(--border-hover);
}
&:active,
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/components/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@
max-width: calc(100% - 1.4rem);
}
&:not(&--no-placeholder) {
&__label {
$parent: &;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using parent variable to fix this breaking change.


#{$parent}__label {
color: var(--text-general);
transition: 0.25s ease all;
transform: translateZ(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
align-items: center;
cursor: pointer;
padding: 0.6rem 1.2rem;
@extend %inline-icon.white;
@extend %inline-icon-white;
height: inherit;
width: 40px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ $MIN_HEIGHT_FLOATING: calc(
height: 100%;
width: 100%;
display: flex;
flex-flow: column nowrap;
flex-grow: 1;
}
&__content-inner {
position: absolute;
Expand Down Expand Up @@ -224,10 +226,6 @@ $MIN_HEIGHT_FLOATING: calc(
background-color: var(--general-main-1);

grid-area: form-content;
&-container {
flex-flow: column nowrap;
flex-grow: 1;
}

&-side-note {
min-width: 25.6rem;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"lint-staged": "^10.4.0",
"mini-css-extract-plugin": "^1.3.4",
"mock-local-storage": "^1.1.8",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
&:hover {
svg {
@extend %inline-icon.active;
@extend %inline-icon-active;
}
}
}
2 changes: 1 addition & 1 deletion packages/core/src/sass/app/_common/layout/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
background: var(--text-prominent);
}
.ic-settings__icon {
@extend %inline-icon.active;
@extend %inline-icon-active;
pointer-events: none;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/sass/app/_common/layout/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
}
}
.header__icon {
@extend %inline-icon.active;
@extend %inline-icon-active;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
&:hover {
.notifications-toggle__icon {
@extend %inline-icon.active;
@extend %inline-icon-active;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/p2p/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"eslint-plugin-react-hooks": "^4.2.0",
"lint-staged": "^10.4.0",
"mini-css-extract-plugin": "^1.3.4",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/reports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"jsdom-global": "^2.1.1",
"mini-css-extract-plugin": "^1.3.4",
"mock-local-storage": "^1.1.8",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/reports/src/sass/app/modules/portfolio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
width: 100%;
}
&__icon {
@extend %inline-icon.disabled;
@extend %inline-icon-disabled;
height: 4.8em;
width: 4.8em;
margin-bottom: 1.6em;
Expand Down
17 changes: 11 additions & 6 deletions packages/shared/src/styles/inline-icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@

e.g. style icon on parent hover:
a:hover .inline-icon {
@extend %inline-icon.active;
@extend %inline-icon-active;
}
*/

%inline-icon {
@include colorIcon(var(--text-general), none);

&.active {
&.active,
&-active {
@include colorIcon(var(--text-prominent), none);
}
&.disabled {
&.disabled,
&-disabled {
@include colorIcon(var(--text-disabled), none);
}
&.white {
&.white,
&-white {
@include colorIcon(var(--text-prominent));
}
&.border_hover_color {
&.border_hover_color,
&-border_hover_color {
@include colorIcon(var(--text-prominent));
}
&.secondary {
&.secondary,
&-secondary {
@include colorIcon(var(--text-less-prominent));
}
}
2 changes: 1 addition & 1 deletion packages/trader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"jsdom-global": "^2.1.1",
"mini-css-extract-plugin": "^1.3.4",
"mock-local-storage": "^1.1.8",
"node-sass": "^7.0.1",
"sass": "^1.62.1",
"postcss-loader": "^6.2.1",
"postcss-preset-env": "^7.4.3",
"postcss-scss": "^4.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
}

&__icon_wrapper {
@extend %inline-icon.white;
@extend %inline-icon-white;
/* postcss-bem-linter: ignore */
.color1-fill {
fill: var(--text-colored-background);
Expand Down
2 changes: 1 addition & 1 deletion packages/trader/src/sass/app/modules/portfolio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
width: 100%;
}
&__icon {
@extend %inline-icon.disabled;
@extend %inline-icon-disabled;
height: 4.8em;
width: 4.8em;
margin-bottom: 1.6em;
Expand Down
2 changes: 1 addition & 1 deletion packages/trader/src/sass/app/modules/trading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@
// &-icon {
// width: 64px;
// height: 64px;
// @extend %inline-icon.white;
// @extend %inline-icon-white;
// }
// &-button {
// height: 32px;
Expand Down