diff --git a/Dockerfile.emscripten b/Dockerfile.emscripten index 13082f05dbb08cb6aa2f921c0ee2c2cd98dd4fd4..88eca12d33a66f5700ac242ed1d3156ac07b7cfe 100644 --- a/Dockerfile.emscripten +++ b/Dockerfile.emscripten @@ -170,3 +170,5 @@ USER emscripten WORKDIR /home/emscripten ADD --chown=emscripten ./scripts/bash/npm-helpers /home/emscripten/scripts/ + +RUN /home/emscripten/scripts/npm_download_browser_extensions.sh /home/emscripten/preinstalled_browser_extensions diff --git a/docker-bake.hcl b/docker-bake.hcl index 6be5818c5d4508733ba80a5bc6be904cbbd06654..7d33720dec7d6cdfd4f159f90348ddb68ed50778 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -83,7 +83,7 @@ target "tox-test-runner" { target "emsdk" { dockerfile = "Dockerfile.emscripten" - tags = generate-tags("emsdk", "${EMSCRIPTEN_VERSION}-2") + tags = generate-tags("emsdk", "${EMSCRIPTEN_VERSION}-3") cache-from = generate-cache-from("emsdk", "${EMSCRIPTEN_VERSION}") cache-to = generate-cache-to("emsdk", "${EMSCRIPTEN_VERSION}") args = { diff --git a/pnpm-config/.devcontainer/devcontainer.json b/pnpm-config/.devcontainer/devcontainer.json index e38ca1efb9d5f256d948e12b8dcbc40383b8b6c1..386feff570a38efa9b9d42295c6e3317e4440b78 100644 --- a/pnpm-config/.devcontainer/devcontainer.json +++ b/pnpm-config/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "name": "Hive NodeJS & Typescript", - "image": "registry.gitlab.syncad.com/hive/common-ci-configuration/emsdk:4.0.1-2@sha256:d0c5fbd811ef2447fdf411ee1e2a111c50ad0ec610cf3d6bf2d186530bc883ad", + "image": "registry.gitlab.syncad.com/hive/common-ci-configuration/emsdk:4.0.1-3@sha256:a2aef5aee0c4bcf1655cd9388d9d940ebfe588c66dae12d0abf5e21a6aff6f0d", "containerUser": "emscripten", "customizations": { "vscode": { diff --git a/pnpm-config/.npmrc b/pnpm-config/.npmrc index 3f2019ebeaf5b086cadf3e2ab7dc89fc0c09d56c..ef2000296c33e681c21f0b3fbebd1cbfe276f272 100644 --- a/pnpm-config/.npmrc +++ b/pnpm-config/.npmrc @@ -6,3 +6,6 @@ engine-strict=true # Always install/remove dependencies from the pnpm workspace root ignore-workspace-root-check=true + +#When executing commands recursively in a workspace, execute them on the root workspace project as well +include-workspace-root=true diff --git a/pnpm-config/pnpm-workspace.yaml b/pnpm-config/pnpm-workspace.yaml index c63c89259a29b56e7f533c13dbf575ce3a7b8e01..e8f86fbf75aefe15c6e8998084613772f9c44454 100644 --- a/pnpm-config/pnpm-workspace.yaml +++ b/pnpm-config/pnpm-workspace.yaml @@ -1,5 +1,7 @@ packages: - - ./* # maybe we can constrain it to some common subdirs + - './src/**/*' + - './packages/**/*' + - './wasm/**/*' catalogs: # Can be referenced through "catalog:rollup-toolset" diff --git a/scripts/bash/build_emscripten_image.sh b/scripts/bash/build_emscripten_image.sh index abb3eb3ea24e18b9eb6c4ce7ce45606c56cb8437..b48e89e84b84e6439c07e14887fd459070402ae9 100755 --- a/scripts/bash/build_emscripten_image.sh +++ b/scripts/bash/build_emscripten_image.sh @@ -10,6 +10,7 @@ EMSDK_VERSION=${1:-"4.0.1"} export DOCKER_BUILDKIT=1 docker build --target=supplemented_emscripten_builder \ + --progress=plain \ --build-arg "EMSCRIPTEN_VERSION=${EMSDK_VERSION}" \ - --tag "${REGISTRY}emsdk:${EMSDK_VERSION}-2" \ + --tag "${REGISTRY}emsdk:${EMSDK_VERSION}-3" \ --file "${SRCDIR}/Dockerfile.emscripten" "${SRCDIR}" diff --git a/scripts/bash/npm-helpers/npm_build_package.sh b/scripts/bash/npm-helpers/npm_build_package.sh index 59d2e0ac505ffaa1dde6e68a66d13657b232415c..78ba021e5fc6a974c75fade31c066039602d02d3 100755 --- a/scripts/bash/npm-helpers/npm_build_package.sh +++ b/scripts/bash/npm-helpers/npm_build_package.sh @@ -15,7 +15,7 @@ pushd "${SOURCE_DIR}" # move to the project directory (where package.json file i "${SCRIPTPATH}/npm_generate_version.sh" "${SOURCE_DIR}" "${REGISTRY_URL}" "${SCOPE}" "${PROJECT_NAME}" "${COMMIT_REF_PROTECTED}" "${COMMIT_TAG}" -npm run build +pnpm --recursive --workspace-concurrency=1 run build "${SCRIPTPATH}/npm_pack_package.sh" "${SOURCE_DIR}" "${REGISTRY_URL}" "${SCOPE}" "${PROJECT_NAME}" "${OUTPUT_DIR}" "${COMMIT_REF_PROTECTED}" "${COMMIT_TAG}" diff --git a/scripts/bash/npm-helpers/npm_download_browser_extensions.sh b/scripts/bash/npm-helpers/npm_download_browser_extensions.sh new file mode 100755 index 0000000000000000000000000000000000000000..4dac92104d3835287a6aa879270345fdfb63cc01 --- /dev/null +++ b/scripts/bash/npm-helpers/npm_download_browser_extensions.sh @@ -0,0 +1,52 @@ +#!/bin/bash +set -xeuo pipefail + +SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" + +TARGET_DIR=${1:?"Missing arg #1 to specify target directory to save downloaded files"} + +abs_target_dir=`realpath -m --relative-base="$SCRIPTPATH" "$TARGET_DIR"` +TARGET_DIR="${abs_target_dir}" + +mkdir -vp "${TARGET_DIR}" + +pushd "${TARGET_DIR}" + +declare -A EXTENSION_LIST=( + ["Hive-Keychain"]="jcacnejopjdphbnjgfaaobbfafkihpep" + ["Meta-mask"]="nkbihfbeogaeaoehlefnkodbefgpgknn" +) + +for i in "${!EXTENSION_LIST[@]}"; do + # echo "Key: $i value: ${EXTlist[$i]}" + extensionName=$i + extensionID=${EXTENSION_LIST[$i]} + + # we could try to use Chrome documented way to specify extensions to be automatically installed, but it is not honored in headless version of Chromium + # https://developer.chrome.com/docs/extensions/how-to/distribute/install-extensions#preference-linux + #echo '{"external_update_url": "https://clients2.google.com/service/update2/crx"}' > /opt/google/chrome/extensions/${extensionID}.json + + DOWNLOAD_FILE_NAME="crx?response=redirect&os=win&arch=x86-64&os_arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=unknown&prodversion=9999.0.9999.0&acceptformat=crx2,crx3&x=id=${extensionID}&uc" + DOWNLOAD_URL="https://clients2.google.com/service/update2/crx?response=redirect&os=win&arch=x86-64&os_arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=unknown&prodversion=9999.0.9999.0&acceptformat=crx2,crx3&x=id%3D${extensionID}%26uc" + wget -nc "${DOWNLOAD_URL}" + + UNZIP_DIR="${TARGET_DIR}/${extensionName}" + if [[ -d "${UNZIP_DIR}" ]]; + then + echo "${extensionName} extension directory exists. Skipping..." + else + echo "Unpacking ${extensionName} into directory: ${UNZIP_DIR}" + + mkdir -vp "${UNZIP_DIR}" + pushd "${UNZIP_DIR}" + + # unzip often failed with random errors, so instead of regular cp, let's try to fix it immediately + zip -FFv "$TARGET_DIR/${DOWNLOAD_FILE_NAME}" --out "${extensionName}.zip" + #cp -n "$TARGET_DIR/${DOWNLOAD_FILE_NAME}" "${extensionName}.zip" + + unzip "./${extensionName}.zip" + popd + fi +done + +popd diff --git a/scripts/bash/npm-helpers/npm_publish.sh b/scripts/bash/npm-helpers/npm_publish.sh index 68e6175783ff6aefab6f1934778ed2094f0487d0..0a4790b9c4155207aa2194dbd15b1b25eb39bdd9 100755 --- a/scripts/bash/npm-helpers/npm_publish.sh +++ b/scripts/bash/npm-helpers/npm_publish.sh @@ -40,7 +40,7 @@ else set -e echo "Publishing ${NAME}@${VERSION} to tag ${PACKAGE_DIST_TAG}" # We are going to repack the tarball as there are registry-dependent data in each job for package.json - pnpm publish --no-git-checks --access=public --tag "${PACKAGE_DIST_TAG}" + pnpm --recursive publish --no-git-checks --access=public --tag "${PACKAGE_DIST_TAG}" fi popd diff --git a/templates/npm_projects.gitlab-ci.yml b/templates/npm_projects.gitlab-ci.yml index 8bc7607961edb64604b7a9e290af0c30c6f4a8ce..360008e21dadcea52b511d63810e95fe98743945 100644 --- a/templates/npm_projects.gitlab-ci.yml +++ b/templates/npm_projects.gitlab-ci.yml @@ -2,8 +2,8 @@ include: - local: templates/base.gitlab-ci.yml variables: - # uses registry.gitlab.syncad.com/hive/common-ci-configuration/emsdk:4.0.1-2 - EMSCRIPTEN_IMAGE_TAG: "4.0.1-2@sha256:a63a3ed761ce99ec858855bbdaf1cda03e383635dd7e88754010a746f7fd2cb3" + # uses registry.gitlab.syncad.com/hive/common-ci-configuration/emsdk:4.0.1-3 + EMSCRIPTEN_IMAGE_TAG: "4.0.1-3@sha256:a2aef5aee0c4bcf1655cd9388d9d940ebfe588c66dae12d0abf5e21a6aff6f0d" EMSCRIPTEN_IMAGE: "registry.gitlab.syncad.com/hive/common-ci-configuration/emsdk:$EMSCRIPTEN_IMAGE_TAG" .node_based_job_base: @@ -28,7 +28,7 @@ variables: before_script: - !reference [.node_based_job_base, before_script] - - pnpm install --frozen-lockfile # install all required dependencies + - pnpm --recursive install --frozen-lockfile # install all required dependencies .filter_out_swagger_json: extends: .node_based_job_base