Code Monkey home page Code Monkey logo

Comments (6)

BlackDex avatar BlackDex commented on May 25, 2024

You need to run npm ci in the main directory. Once that is done you need to go to the apps/web folder, and run the build command.

Check the Dockerfile which does a change of directory after the npm ci command.

from bw_web_builds.

ecesarini avatar ecesarini commented on May 25, 2024

You need to run npm ci in the main directory. Once that is done you need to go to the apps/web folder, and run the build command.

Check the Dockerfile which does a change of directory after the npm ci command.

Hi thank you for your time.
In my Dockerfile, before npm ci WORKDIR is /vault.
Next, after npm audit fix it switches in WORKDIR /vault/apps/web.

For the moment i fixed it using npm install instead of npm ci that let the build overwrite package-lock.json, building successfully.
Web vault seems working fine, but i don't know if it's a good practice.

Thank you again

from bw_web_builds.

ecesarini avatar ecesarini commented on May 25, 2024

Hi,
there's another problem trying to build by 'npm old fashion way'.

The script i run doesn't work with new repository arrangement.

#!/bin/bash

echo "Set version vX.YZ.K. Current v2022.6.0"
read VS
rm -rf npm_log.txt web-vault vw-web-vault.zip ${VS}.patch
git clone https://github.com/bitwarden/clients.git web-vault

wget https://raw.githubusercontent.com/dani-garcia/bw_web_builds/master/patches/${VS}.patch
cat ${VS}.patch vw-mod_${VS}.patch > web-vault/${VS}.patch

cd web-vault

git -c advice.detachedHead=false checkout "web-${VS}"
git apply -v --check --ignore-space-change --reject ${VS}.patch

while [[ -z "$COMP" && "$COMP" != "y" && "$COMP" != "n" ]]
do
    echo "Patch check has finished, do you wanna build? (y,n)"
    read COMP
    if [ "$COMP" = y ]; then
        git apply -v --ignore-space-change --reject ${VS}.patch 2>&1 | tee ../npm_log.txt

        #npm ci 2>&1 | tee -a ../npm_log.txt
        npm install 2>&1 | tee -a ../npm_log.txt
        npm audit fix | tee -a ../npm_log.txt || true

        cd apps/web
        npm run dist:oss:selfhost 2>&1 | tee -a ../npm_log.txt
        mv build vw-web-vault
        zip -qr ../vw-web-vault-${VS}.zip vw-web-vault/
    elif [ "$COMP" = n ]; then
        exit 1
    fi
done

My script seems to accord with the path order to run npm directives: (npm install and npm audit fix in the "root" web-vault directory and npm run dist:oss:selfhost in web-vault/apps/web. Anyway i get the errors below: it looks like the dependecies installed in the repository's root don't work.
The same script has always worked succesfully until v2022.5.2 bitwarden repository, before merging all clients projects. What I'm doing wrong?

> @bitwarden/[email protected] dist:oss:selfhost
> npm run build:oss:selfhost:prod

> @bitwarden/[email protected] build:oss:selfhost:prod
> cross-env ENV=selfhosted NODE_ENV=production npm run build:oss

sh: 1: cross-env: not found

Thank you

from bw_web_builds.

BlackDex avatar BlackDex commented on May 25, 2024

@bitwarden/[email protected] dist:oss:selfhost
npm run build:oss:selfhost:prod

@bitwarden/[email protected] build:oss:selfhost:prod
cross-env ENV=selfhosted NODE_ENV=production npm run build:oss

sh: 1: cross-env: not found

Not sure where that is coming from. I don't seem to have that specific issue at all.
Not via the docker build or the build using the host it self.

Also, i would suggest to keep using npm ci instead of npm install, since npm ci doesn't modify versions, and should produce more reliable builds because of this. It is also important to try and use the exact same versions as Bitwarden does for there CI builds, so nodejs v16.x and npm v8.11 (See: https://github.com/bitwarden/clients/runs/7290756644?check_suite_focus=true#step:4:14 ). Maybe a minor version difference will not matter that much, but i know major versions do cause issue, like with the CLI, it will generate a broken build when complied with v18 for example.

from bw_web_builds.

ecesarini avatar ecesarini commented on May 25, 2024

@bitwarden/[email protected] dist:oss:selfhost
npm run build:oss:selfhost:prod

@bitwarden/[email protected] build:oss:selfhost:prod
cross-env ENV=selfhosted NODE_ENV=production npm run build:oss

sh: 1: cross-env: not found

Not sure where that is coming from. I don't seem to have that specific issue at all. Not via the docker build or the build using the host it self.

Also, i would suggest to keep using npm ci instead of npm install, since npm ci doesn't modify versions, and should produce more reliable builds because of this. It is also important to try and use the exact same versions as Bitwarden does for there CI builds, so nodejs v16.x and npm v8.11 (See: https://github.com/bitwarden/clients/runs/7290756644?check_suite_focus=true#step:4:14 ). Maybe a minor version difference will not matter that much, but i know major versions do cause issue, like with the CLI, it will generate a broken build when complied with v18 for example.

Thank you,
the link you shared to check npm version is very useful.

Anyway, about npm ci i really need to edit package.json in the repo's main directory to add dependencies that let me handle cookies in my web vault. If use npm ci instead of npm install i get error and the docker build stops itself:

npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.

and i don't know how to get rid of it.
It didn't happen when package.json was in the same directory of web-vault, that is before v2022.6.0 when each client had its own repo project.

from bw_web_builds.

BlackDex avatar BlackDex commented on May 25, 2024

Ah, in that case, since you change stuff, then i think you need to use npm install. And if that works, the i would use that.

For other how-to's i suggest to check the clients repo. That is a bit out of the range for this repo.

from bw_web_builds.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.