Skip to content

Migrate build config to rslib #1197

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
16 changes: 6 additions & 10 deletions client/apollo/css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@
"sass": "dist/apollo.scss",
"style": "dist/apollo.css",
"exports": {
"./logo-axa.svg": {
"development": "./files/assets/logo-axa.svg",
"default": "./dist/assets/logo-axa.svg"
},
"./logo-axa.svg": "./files/assets/logo-axa.svg",
"./dist/*": {
"development": "./src/*",
"default": "./dist/*"
}
},
"files": [
"dist"
"dist",
"files"
],
"scripts": {
"prebuild": "rimraf dist",
"build": "postcss \"src/**/*.scss\" --base src --dir dist --ext css --verbose --env production",
"postbuild": "copyfiles --up 1 \"src/**/*.{scss,css}\" files/**/*.svg dist",
"build": "rslib build",
"stylelint": "stylelint \"src/**/*.{scss,css}\"",
"stylelint:fix": "stylelint \"src/**/*.{scss,css}\" --fix"
},
Expand All @@ -36,8 +32,8 @@
"@axa-fr/postcss-config-design-system": "*",
"@axa-fr/prettier-config-design-system": "*",
"@axa-fr/stylelint-config-design-system": "*",
"copyfiles": "^2.4.1",
"rimraf": "^6.0.1"
"@rsbuild/plugin-sass": "^1.3.2",
"@rslib/core": "^0.10.0"
},
"repository": {
"type": "git",
Expand Down
44 changes: 44 additions & 0 deletions client/apollo/css/rslib.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { pluginSass } from '@rsbuild/plugin-sass';
import { defineConfig } from "@rslib/core";
import { join } from "path";

export default defineConfig({
Copy link
Contributor

Choose a reason for hiding this comment

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

on ne pouvait pas faire du partage de config ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Je pense que oui mais comme on ne l'avait pas faire pour vitest et tsconfig je me suis dit que c'était pas utile ici.

plugins: [pluginSass()],
lib: [
{
source: {
entry: {
index: ["./src/**"],
},
},
output: {
target: "web",
distPath: {
root: "dist",
},
copy: [
{ from: '**/*.scss', context: join(__dirname, 'src') },
],
minify: {
css: true,
},
sourceMap: {
css: true,
}
},
tools: {
cssLoader: {
url: {
filter: (url) => {
const filter = ['/files/', '@material-symbols/'];

return filter.includes(url);
},
}
}
},
bundle: false,
format: "esm",
},
],
});
8 changes: 4 additions & 4 deletions client/apollo/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@axa-fr/design-system-apollo-react",
"version": "0.1.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
Expand All @@ -28,8 +29,7 @@
"dist"
],
"scripts": {
"prebuild": "rimraf dist",
"build": "tsc -p tsconfig.build.json",
"build": "rslib build",
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
"eslint:fix": "eslint src --ext js,jsx,ts,tsx --fix",
"prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx|svg)\" --check --ignore-unknown",
Expand Down Expand Up @@ -73,6 +73,8 @@
"@axa-fr/design-system-look-and-feel-css": "*",
"@axa-fr/eslint-config-design-system": "*",
"@axa-fr/prettier-config-design-system": "*",
"@rsbuild/plugin-react": "^1.3.2",
"@rslib/core": "^0.10.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
Expand All @@ -82,11 +84,9 @@
"@types/jest-axe": "^3.5.9",
"@vitest/coverage-v8": "^3.0.7",
"@vitest/ui": "^3.0.7",
"copyfiles": "^2.4.1",
"jest-axe": "^9.0.0",
"jsdom": "^25.0.1",
"react": "^19.0.0",
"rimraf": "^6.0.1",
"vitest": "^3.0.7"
},
"lint-staged": {
Expand Down
36 changes: 36 additions & 0 deletions client/apollo/react/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { pluginReact } from "@rsbuild/plugin-react";
import { defineConfig } from "@rslib/core";

export default defineConfig({
plugins: [pluginReact()],
lib: [
{
source: {
tsconfigPath: "./tsconfig.build.json",
entry: {
index: ["./src/**", "!src/**/*.scss", "!src/**/*.{test,spec}.*"],
},
},
output: {
target: "web",
distPath: {
root: "dist",
assets: "assets",
svg: "assets/svg",
font: "assets/font",
wasm: "assets/wasm",
image: "assets/image",
media: "assets/media",
},
},
redirect: {
style: {
extension: false,
},
},
bundle: false,
dts: true,
format: "esm",
},
],
});
2 changes: 1 addition & 1 deletion client/apollo/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
"types": [
"vite/client",
"@rslib/core/types",
"@testing-library/jest-dom",
"vitest/globals"
] /* Specify type package names to be included without being referenced in a source file. */,
Expand Down
8 changes: 3 additions & 5 deletions client/look-and-feel/css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@
"files"
],
"scripts": {
"prebuild": "rimraf dist",
"build": "postcss \"src/**/*.scss\" --base src --dir dist --ext css --verbose --env production",
"postbuild": "copyfiles --up 1 \"src/**/*.{scss,css}\" dist",
"build": "rslib build",
"stylelint": "stylelint \"src/**/*.{scss,css}\"",
"stylelint:fix": "stylelint \"src/**/*.{scss,css}\" --fix"
},
"devDependencies": {
"@axa-fr/postcss-config-design-system": "*",
"@axa-fr/prettier-config-design-system": "*",
"@axa-fr/stylelint-config-design-system": "*",
"copyfiles": "^2.4.1",
"rimraf": "^6.0.1"
"@rsbuild/plugin-sass": "^1.3.2",
"@rslib/core": "^0.10.0"
},
"peerDependencies": {
"@material-symbols/svg-400": ">= 0.19.0"
Expand Down
44 changes: 44 additions & 0 deletions client/look-and-feel/css/rslib.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { pluginSass } from '@rsbuild/plugin-sass';
import { defineConfig } from "@rslib/core";
import { join } from "path";

export default defineConfig({
plugins: [pluginSass()],
lib: [
{
source: {
entry: {
index: ["./src/**"],
},
},
output: {
target: "web",
distPath: {
root: "dist",
},
copy: [
{ from: '**/*.scss', context: join(__dirname, 'src') },
],
minify: {
css: true,
},
sourceMap: {
css: true,
}
},
tools: {
cssLoader: {
url: {
filter: (url) => {
const filter = ['/files/', '@material-symbols/'];

return filter.includes(url);
},
}
}
},
bundle: false,
format: "esm",
},
],
});
11 changes: 5 additions & 6 deletions client/look-and-feel/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@axa-fr/design-system-look-and-feel-react",
"version": "0.1.0",
"description": "",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
Expand All @@ -28,9 +29,7 @@
"dist"
],
"scripts": {
"prebuild": "rimraf dist",
"build": "tsc -p tsconfig.build.json",
"postbuild": "copyfiles --up 1 \"src/assets/svg/*.svg\" ./dist/",
"build": "rslib build",
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
"eslint:fix": "eslint src --ext js,jsx,ts,tsx --fix",
"prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx|svg)\" --check --ignore-unknow",
Expand Down Expand Up @@ -69,10 +68,12 @@
"dompurify": "^3.1.5"
},
"devDependencies": {
"@axa-fr/design-system-look-and-feel-css": "*",
"@axa-fr/design-system-apollo-react": "*",
"@axa-fr/design-system-look-and-feel-css": "*",
"@axa-fr/eslint-config-design-system": "*",
"@axa-fr/prettier-config-design-system": "*",
"@rsbuild/plugin-react": "^1.3.2",
"@rslib/core": "^0.10.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
Expand All @@ -82,11 +83,9 @@
"@types/jest-axe": "^3.5.9",
"@vitest/coverage-v8": "^3.0.7",
"@vitest/ui": "^3.0.7",
"copyfiles": "^2.4.1",
"jest-axe": "^9.0.0",
"jsdom": "^25.0.1",
"react": "^19.0.0",
"rimraf": "^6.0.1",
"vitest": "^3.0.7"
},
"lint-staged": {
Expand Down
36 changes: 36 additions & 0 deletions client/look-and-feel/react/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { pluginReact } from "@rsbuild/plugin-react";
import { defineConfig } from "@rslib/core";

export default defineConfig({
plugins: [pluginReact()],
lib: [
{
source: {
tsconfigPath: "./tsconfig.build.json",
entry: {
index: ["./src/**", "!src/**/*.scss", "!src/**/*.{test,spec}.*"],
},
},
output: {
target: "web",
distPath: {
root: "dist",
assets: "assets",
svg: "assets/svg",
font: "assets/font",
wasm: "assets/wasm",
image: "assets/image",
media: "assets/media",
},
},
redirect: {
style: {
extension: false,
},
},
bundle: false,
dts: true,
format: "esm",
},
],
});
2 changes: 1 addition & 1 deletion client/look-and-feel/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
"types": [
"vite/client",
"@rslib/core/types",
"@testing-library/jest-dom",
"vitest/globals"
] /* Specify type package names to be included without being referenced in a source file. */,
Expand Down
Loading