Skip to content

Commit 822ae5b

Browse files
committed
chore(design-system): migrate build config to rslib
1 parent 250a604 commit 822ae5b

24 files changed

+2668
-2340
lines changed

client/apollo/css/package.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,18 @@
55
"sass": "dist/apollo.scss",
66
"style": "dist/apollo.css",
77
"exports": {
8-
"./logo-axa.svg": {
9-
"development": "./files/assets/logo-axa.svg",
10-
"default": "./dist/assets/logo-axa.svg"
11-
},
8+
"./logo-axa.svg": "./files/assets/logo-axa.svg",
129
"./dist/*": {
1310
"development": "./src/*",
1411
"default": "./dist/*"
1512
}
1613
},
1714
"files": [
18-
"dist"
15+
"dist",
16+
"files"
1917
],
2018
"scripts": {
21-
"prebuild": "rimraf dist",
22-
"build": "postcss \"src/**/*.scss\" --base src --dir dist --ext css --verbose --env production",
23-
"postbuild": "copyfiles --up 1 \"src/**/*.{scss,css}\" files/**/*.svg dist",
19+
"build": "rslib build",
2420
"stylelint": "stylelint \"src/**/*.{scss,css}\"",
2521
"stylelint:fix": "stylelint \"src/**/*.{scss,css}\" --fix"
2622
},
@@ -36,8 +32,8 @@
3632
"@axa-fr/postcss-config-design-system": "*",
3733
"@axa-fr/prettier-config-design-system": "*",
3834
"@axa-fr/stylelint-config-design-system": "*",
39-
"copyfiles": "^2.4.1",
40-
"rimraf": "^6.0.1"
35+
"@rsbuild/plugin-sass": "^1.3.2",
36+
"@rslib/core": "^0.10.0"
4137
},
4238
"repository": {
4339
"type": "git",

client/apollo/css/rslib.config.mjs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { pluginSass } from '@rsbuild/plugin-sass';
2+
import { defineConfig } from "@rslib/core";
3+
import { join } from "path";
4+
5+
export default defineConfig({
6+
plugins: [pluginSass()],
7+
lib: [
8+
{
9+
source: {
10+
entry: {
11+
index: ["./src/**"],
12+
},
13+
},
14+
output: {
15+
target: "web",
16+
distPath: {
17+
root: "dist",
18+
},
19+
copy: [
20+
{ from: '**/*.scss', context: join(__dirname, 'src') },
21+
],
22+
minify: {
23+
css: true,
24+
},
25+
sourceMap: {
26+
css: true,
27+
}
28+
},
29+
tools: {
30+
cssLoader: {
31+
url: {
32+
filter: (url) => {
33+
const filter = ['/files/', '@material-symbols/'];
34+
35+
return filter.includes(url);
36+
},
37+
}
38+
}
39+
},
40+
bundle: false,
41+
format: "esm",
42+
},
43+
],
44+
});

client/apollo/react/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@axa-fr/design-system-apollo-react",
33
"version": "0.1.0",
44
"description": "",
5+
"type": "module",
56
"main": "./dist/index.js",
67
"types": "./dist/index.d.ts",
78
"exports": {
@@ -28,8 +29,7 @@
2829
"dist"
2930
],
3031
"scripts": {
31-
"prebuild": "rimraf dist",
32-
"build": "tsc -p tsconfig.build.json",
32+
"build": "rslib build",
3333
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
3434
"eslint:fix": "eslint src --ext js,jsx,ts,tsx --fix",
3535
"prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx|svg)\" --check --ignore-unknown",
@@ -73,6 +73,8 @@
7373
"@axa-fr/design-system-look-and-feel-css": "*",
7474
"@axa-fr/eslint-config-design-system": "*",
7575
"@axa-fr/prettier-config-design-system": "*",
76+
"@rsbuild/plugin-react": "^1.3.2",
77+
"@rslib/core": "^0.10.0",
7678
"@testing-library/dom": "^10.4.0",
7779
"@testing-library/jest-dom": "^6.6.3",
7880
"@testing-library/react": "^16.2.0",
@@ -82,11 +84,9 @@
8284
"@types/jest-axe": "^3.5.9",
8385
"@vitest/coverage-v8": "^3.0.7",
8486
"@vitest/ui": "^3.0.7",
85-
"copyfiles": "^2.4.1",
8687
"jest-axe": "^9.0.0",
8788
"jsdom": "^25.0.1",
8889
"react": "^19.0.0",
89-
"rimraf": "^6.0.1",
9090
"vitest": "^3.0.7"
9191
},
9292
"lint-staged": {

client/apollo/react/rslib.config.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { pluginReact } from "@rsbuild/plugin-react";
2+
import { defineConfig } from "@rslib/core";
3+
4+
export default defineConfig({
5+
plugins: [pluginReact()],
6+
lib: [
7+
{
8+
source: {
9+
tsconfigPath: "./tsconfig.build.json",
10+
entry: {
11+
index: ["./src/**", "!src/**/*.scss", "!src/**/*.{test,spec}.*"],
12+
},
13+
},
14+
output: {
15+
target: "web",
16+
distPath: {
17+
root: "dist",
18+
assets: "assets",
19+
svg: "assets/svg",
20+
font: "assets/font",
21+
wasm: "assets/wasm",
22+
image: "assets/image",
23+
media: "assets/media",
24+
},
25+
},
26+
redirect: {
27+
style: {
28+
extension: false,
29+
},
30+
},
31+
bundle: false,
32+
dts: true,
33+
format: "esm",
34+
},
35+
],
36+
});

client/apollo/react/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
4040
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
4141
"types": [
42-
"vite/client",
42+
"@rslib/core/types",
4343
"@testing-library/jest-dom",
4444
"vitest/globals"
4545
] /* Specify type package names to be included without being referenced in a source file. */,

client/look-and-feel/css/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,16 @@
1717
"files"
1818
],
1919
"scripts": {
20-
"prebuild": "rimraf dist",
21-
"build": "postcss \"src/**/*.scss\" --base src --dir dist --ext css --verbose --env production",
22-
"postbuild": "copyfiles --up 1 \"src/**/*.{scss,css}\" dist",
20+
"build": "rslib build",
2321
"stylelint": "stylelint \"src/**/*.{scss,css}\"",
2422
"stylelint:fix": "stylelint \"src/**/*.{scss,css}\" --fix"
2523
},
2624
"devDependencies": {
2725
"@axa-fr/postcss-config-design-system": "*",
2826
"@axa-fr/prettier-config-design-system": "*",
2927
"@axa-fr/stylelint-config-design-system": "*",
30-
"copyfiles": "^2.4.1",
31-
"rimraf": "^6.0.1"
28+
"@rsbuild/plugin-sass": "^1.3.2",
29+
"@rslib/core": "^0.10.0"
3230
},
3331
"peerDependencies": {
3432
"@material-symbols/svg-400": ">= 0.19.0"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { pluginSass } from '@rsbuild/plugin-sass';
2+
import { defineConfig } from "@rslib/core";
3+
import { join } from "path";
4+
5+
export default defineConfig({
6+
plugins: [pluginSass()],
7+
lib: [
8+
{
9+
source: {
10+
entry: {
11+
index: ["./src/**"],
12+
},
13+
},
14+
output: {
15+
target: "web",
16+
distPath: {
17+
root: "dist",
18+
},
19+
copy: [
20+
{ from: '**/*.scss', context: join(__dirname, 'src') },
21+
],
22+
minify: {
23+
css: true,
24+
},
25+
sourceMap: {
26+
css: true,
27+
}
28+
},
29+
tools: {
30+
cssLoader: {
31+
url: {
32+
filter: (url) => {
33+
const filter = ['/files/', '@material-symbols/'];
34+
35+
return filter.includes(url);
36+
},
37+
}
38+
}
39+
},
40+
bundle: false,
41+
format: "esm",
42+
},
43+
],
44+
});

client/look-and-feel/react/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@axa-fr/design-system-look-and-feel-react",
33
"version": "0.1.0",
44
"description": "",
5+
"type": "module",
56
"main": "./dist/index.js",
67
"types": "./dist/index.d.ts",
78
"exports": {
@@ -28,9 +29,7 @@
2829
"dist"
2930
],
3031
"scripts": {
31-
"prebuild": "rimraf dist",
32-
"build": "tsc -p tsconfig.build.json",
33-
"postbuild": "copyfiles --up 1 \"src/assets/svg/*.svg\" ./dist/",
32+
"build": "rslib build",
3433
"eslint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
3534
"eslint:fix": "eslint src --ext js,jsx,ts,tsx --fix",
3635
"prettier": "prettier \"src/**/*.!(js|jsx|ts|tsx|svg)\" --check --ignore-unknow",
@@ -69,10 +68,12 @@
6968
"dompurify": "^3.1.5"
7069
},
7170
"devDependencies": {
72-
"@axa-fr/design-system-look-and-feel-css": "*",
7371
"@axa-fr/design-system-apollo-react": "*",
72+
"@axa-fr/design-system-look-and-feel-css": "*",
7473
"@axa-fr/eslint-config-design-system": "*",
7574
"@axa-fr/prettier-config-design-system": "*",
75+
"@rsbuild/plugin-react": "^1.3.2",
76+
"@rslib/core": "^0.10.0",
7677
"@testing-library/dom": "^10.4.0",
7778
"@testing-library/jest-dom": "^6.6.3",
7879
"@testing-library/react": "^16.2.0",
@@ -82,11 +83,9 @@
8283
"@types/jest-axe": "^3.5.9",
8384
"@vitest/coverage-v8": "^3.0.7",
8485
"@vitest/ui": "^3.0.7",
85-
"copyfiles": "^2.4.1",
8686
"jest-axe": "^9.0.0",
8787
"jsdom": "^25.0.1",
8888
"react": "^19.0.0",
89-
"rimraf": "^6.0.1",
9089
"vitest": "^3.0.7"
9190
},
9291
"lint-staged": {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { pluginReact } from "@rsbuild/plugin-react";
2+
import { defineConfig } from "@rslib/core";
3+
4+
export default defineConfig({
5+
plugins: [pluginReact()],
6+
lib: [
7+
{
8+
source: {
9+
tsconfigPath: "./tsconfig.build.json",
10+
entry: {
11+
index: ["./src/**", "!src/**/*.scss", "!src/**/*.{test,spec}.*"],
12+
},
13+
},
14+
output: {
15+
target: "web",
16+
distPath: {
17+
root: "dist",
18+
assets: "assets",
19+
svg: "assets/svg",
20+
font: "assets/font",
21+
wasm: "assets/wasm",
22+
image: "assets/image",
23+
media: "assets/media",
24+
},
25+
},
26+
redirect: {
27+
style: {
28+
extension: false,
29+
},
30+
},
31+
bundle: false,
32+
dts: true,
33+
format: "esm",
34+
},
35+
],
36+
});

client/look-and-feel/react/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
4141
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
4242
"types": [
43-
"vite/client",
43+
"@rslib/core/types",
4444
"@testing-library/jest-dom",
4545
"vitest/globals"
4646
] /* Specify type package names to be included without being referenced in a source file. */,

0 commit comments

Comments
 (0)