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: switch to sass-embedded and remedy sass API deprecation warnings #1926

Merged
merged 11 commits into from
Oct 9, 2024
3 changes: 2 additions & 1 deletion apps/demo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"vue-router": "^4.4.5"
},
"devDependencies": {
"sass": "catalog:",
"@sit-onyx/shared": "workspace:^",
"sass-embedded": "catalog:",
"vue": "catalog:"
}
}
4 changes: 2 additions & 2 deletions apps/demo-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
import { VITE_BASE_CONFIG } from "./node_modules/@sit-onyx/shared/vite.config.base";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
...VITE_BASE_CONFIG,
});
larsrickert marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
"@playwright/test": "^1.47.2",
"@sit-onyx/chartjs-plugin": "workspace:^",
"@sit-onyx/icons": "workspace:^",
"@sit-onyx/shared": "workspace:^",
"@sit-onyx/vitepress-theme": "workspace:^",
"chart.js": "^4.4.4",
"postcss": "^8.4.47",
"sass-embedded": "catalog:",
"sit-onyx": "workspace:^",
"vite": "^5.4.8",
"vitepress": "^1.4.0",
Expand Down
14 changes: 3 additions & 11 deletions apps/docs/src/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { fileURLToPath } from "node:url";
import { defineConfig, type DefaultTheme, type UserConfig } from "vitepress";
import packageJson from "../../../../packages/sit-onyx/package.json" with { type: "json" };
import viteConfig from "../../vite.config";

// https://vitepress.dev/reference/site-config
export const CONFIG = {
vite: {
resolve: {
alias: {
"~components": getFilePath("../../../../packages/sit-onyx/src/components"),
},
},
...viteConfig,
plugins: [], // don't use any of the default (vue) plugins, as it would conflict with vitepress setup
},
title: "onyx",
description: packageJson.description,
Expand Down Expand Up @@ -217,8 +214,3 @@ export const CONFIG = {
} as const satisfies UserConfig<DefaultTheme.Config>;

export default defineConfig(CONFIG);

/** Gets the given path while ensuring cross-platform and correct decoding */
function getFilePath(path: string) {
return fileURLToPath(new URL(path, import.meta.url));
}
4 changes: 2 additions & 2 deletions apps/docs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import vue from "@vitejs/plugin-vue";
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import { VITE_BASE_CONFIG } from "./node_modules/@sit-onyx/shared/vite.config.base";

// https://vitejs.dev/config
export default defineConfig({
plugins: [vue()],
...VITE_BASE_CONFIG,
resolve: {
alias: {
"~components": getFilePath("../../packages/sit-onyx/src/components"),
Expand Down
1 change: 1 addition & 0 deletions apps/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"sit-onyx": "workspace:^"
},
"devDependencies": {
"@sit-onyx/shared": "workspace:^",
"vue": "catalog:"
}
}
4 changes: 2 additions & 2 deletions apps/playground/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
import { VITE_BASE_CONFIG } from "./node_modules/@sit-onyx/shared/vite.config.base";

// https://vitejs.dev/config
export default defineConfig({
plugins: [vue()],
...VITE_BASE_CONFIG,
optimizeDeps: {
// needed in order for the web workers of "@vue/repl" to work
exclude: ["@vue/repl"],
Expand Down
1 change: 1 addition & 0 deletions packages/chartjs-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"sit-onyx": "workspace:^"
},
"devDependencies": {
"@sit-onyx/shared": "workspace:^",
"@vue/compiler-dom": "catalog:",
"chart.js": "catalog:",
"vue": "catalog:",
Expand Down
4 changes: 2 additions & 2 deletions packages/chartjs-plugin/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
import { VITE_BASE_CONFIG } from "./node_modules/@sit-onyx/shared/vite.config.base";

// https://vitejs.dev/config
export default defineConfig({
plugins: [vue()],
...VITE_BASE_CONFIG,
});
Empty file added packages/shared/index.ts
JoCa96 marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
12 changes: 12 additions & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@sit-onyx/shared",
"version": "1.0.0",
"description": "",
"private": true,
"type": "module",
"peerDependencies": {
"@vitejs/plugin-vue": "^5.1.4",
"sass-embedded": "catalog:",
"vue": "catalog:"
}
}
20 changes: 20 additions & 0 deletions packages/shared/vite.config.base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import vue from "@vitejs/plugin-vue";
import { deprecations, type Deprecation, type Options } from "sass-embedded";
import type { UserConfig } from "vite";

type ViteScssOptions = Options<"async"> & { api: "modern-compiler" };

export const VITE_BASE_CONFIG = {
plugins: [vue()],
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler",
// error for all warnings
fatalDeprecations: (Object.values(deprecations) as Deprecation[]).filter(
({ status }) => status !== "future",
),
} satisfies ViteScssOptions,
},
},
} satisfies UserConfig;
3 changes: 2 additions & 1 deletion packages/sit-onyx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@
"devDependencies": {
"@axe-core/playwright": "^4.10.0",
"@sit-onyx/headless": "workspace:^",
"@sit-onyx/shared": "workspace:^",
"@storybook/addon-a11y": "^8.3.5",
"@vue/compiler-dom": "catalog:",
"eslint-plugin-vue-scoped-css": "^2.8.1",
"sass": "catalog:",
"sass-embedded": "catalog:",
"vue": "catalog:",
"vue-component-type-helpers": "^2.1.6"
}
Expand Down
16 changes: 2 additions & 14 deletions packages/sit-onyx/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/// <reference types="vitest" />
import vue from "@vitejs/plugin-vue";
import { fileURLToPath, URL } from "node:url";
import { Deprecation, deprecations, Options } from "sass";
import { defineConfig } from "vite";
import { VITE_BASE_CONFIG } from "./node_modules/@sit-onyx/shared/vite.config.base";
import packageJson from "./package.json";
import { vuePluginOptions } from "./playwright.config";

type ViteScssOptions = Options<"async"> & { api: "modern-compiler" };

// https://vitejs.dev/config
export default defineConfig({
...VITE_BASE_CONFIG,
plugins: [vue(vuePluginOptions)],
build: {
lib: {
Expand All @@ -32,17 +31,6 @@ export default defineConfig({
exclude: ["src/**/*.stories.ts"],
},
},
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler",
// error for all warnings
fatalDeprecations: (Object.values(deprecations) as Deprecation[]).filter(
({ status }) => status !== "future",
),
} satisfies ViteScssOptions,
},
},
});

/** Gets the given path while ensuring cross-platform and correct decoding */
Expand Down
Loading
Loading