From 3bc5f72a40c18d1df424cbf4d2c53a9836732f71 Mon Sep 17 00:00:00 2001 From: AlexMikhalev Date: Thu, 30 May 2024 10:51:40 +0100 Subject: [PATCH] node yarn fixes Signed-off-by: AlexMikhalev --- desktop/Earthfile | 7 ++++--- scripts/yarn_and_build.sh | 7 +++++++ terraphim_server/build.rs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100755 scripts/yarn_and_build.sh diff --git a/desktop/Earthfile b/desktop/Earthfile index 55ffd412..b19c1619 100644 --- a/desktop/Earthfile +++ b/desktop/Earthfile @@ -2,7 +2,7 @@ VERSION --cache-persist-option --global-cache 0.7 PROJECT applied-knowledge-systems/terraphim-project FROM ghcr.io/terraphim/terraphim_builder_native:latest -WORKDIR frontend +WORKDIR /code/desktop deps: # COPY package.json tsconfig.json yarn.lock vite.config.ts tsconfig.node.json index.html ./ @@ -10,9 +10,10 @@ deps: # COPY --dir src src # COPY --dir public public RUN oro apply -q || true - RUN pkgx +yarnpkg.com yarn + RUN /code/desktop/scripts/yarn_and_build.sh build: FROM +deps - RUN pkgx +yarnpkg.com yarn run build + # RUN pkgx +yarnpkg.com yarn run build + SAVE ARTIFACT dist /dist AS LOCAL dist \ No newline at end of file diff --git a/scripts/yarn_and_build.sh b/scripts/yarn_and_build.sh new file mode 100755 index 00000000..be34d2a9 --- /dev/null +++ b/scripts/yarn_and_build.sh @@ -0,0 +1,7 @@ +!/usr/bin/env bash +# this is to install and build front end inside bionic +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash +bash -c "source $HOME/.nvm/nvm.sh && nvm install 16.15.1" +bash -c "source $HOME/.nvm/nvm.sh && npm install -g yarn" +bash -c "source $HOME/.nvm/nvm.sh && cd /code/desktop && yarn && yarn build" +cp -Rv /code/desktop/dist /code/terraphim_server/ \ No newline at end of file diff --git a/terraphim_server/build.rs b/terraphim_server/build.rs index d182829b..66f20970 100644 --- a/terraphim_server/build.rs +++ b/terraphim_server/build.rs @@ -101,7 +101,7 @@ fn should_build(dirs: &Dirs) -> bool { /// Runs JS package manager to install packages and build the JS bundle fn build_js(dirs: &Dirs) { - let pkg_manager = "yarn"; + let pkg_manager = "./scripts/yarn_and_build.sh"; p!("install js packages...");