From 8d46c98a8f0cf3566c1613f271adbf77256ee4a9 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 21 Nov 2024 18:13:14 +0100 Subject: [PATCH 1/2] osrd-ui: use lerna to build in parallel lerna is already a dependency. Use it so that packages get built in parallel instead of sequentially. Signed-off-by: Simon Ser --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f68d85a1b..1e23ab7c4 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "scripts": { "clean": "npm run clean --workspaces --if-present", - "build": "npm run build --workspaces --if-present", + "build": "lerna run build", "lint": "npm run lint --workspaces --if-present", "test": "npm run test --workspaces --if-present", "storybook": "npm start --workspace=@osrd-project/storybook", From f43870751560f6efd4082b1c067e7604601e7290 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 21 Nov 2024 18:15:50 +0100 Subject: [PATCH 2/2] osrd-ui: cache builds with nx Configure nx (used under-the-hood by lerna) to cache build artifacts. Significantly decreases build time when a single sub-package has changed. Signed-off-by: Simon Ser --- .gitignore | 1 + nx.json | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 nx.json diff --git a/.gitignore b/.gitignore index d93b4f78d..b901fca9d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ storybook-static # IDE .vscode/ +.nx/cache diff --git a/nx.json b/nx.json new file mode 100644 index 000000000..c49706fdf --- /dev/null +++ b/nx.json @@ -0,0 +1,10 @@ +{ + "targetDefaults": { + "build": { + "cache": true, + "outputs": [ + "{projectRoot}/dist" + ] + } + } +}