From a8ba7569de06b779828226f35f99f4cf700d12c1 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Thu, 30 Nov 2023 16:18:25 +0000 Subject: [PATCH 1/3] fix: remove yarn, use npm --- snap/snapcraft.yaml | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 62bbc3c..6266d5c 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -63,7 +63,7 @@ apps: STORE_DIR: $SNAP_DATA ZWAVEJS_EXTERNAL_CONFIG: $SNAP_DATA/.ext-config DAEMONIZED: 1 - command: bin/yarn start + command: bin/npm start # FIXME command-chain: - helper/env-wrapper plugs: @@ -77,7 +77,7 @@ apps: environment: STORE_DIR: $SNAP_DATA ZWAVEJS_EXTERNAL_CONFIG: $SNAP_DATA/.ext-config - command: bin/yarn start + command: bin/npm start # FIXME command-chain: - helper/env-wrapper plugs: @@ -95,7 +95,7 @@ apps: restart: command: bin/restart -layout: +layout: # FIXME: npm cache is on `~/.npm` /usr/local/share/.cache/yarn: bind: $SNAP/.cache/yarn /usr/local/share/.yarn: @@ -127,52 +127,29 @@ parts: # Used when testing an unreleased version of Z-wavejs # sed -i 's/"zwave-js".*$/"zwave-js"\: "10.0.5-0-pr-4836-ed10b36"/g' ${SNAPCRAFT_PART_BUILD}/package.json - # Link the bundled yarn - mkdir "${SNAPCRAFT_PART_BUILD}/bin" - cd "${SNAPCRAFT_PART_BUILD}/bin" - YARN="$(find ${SNAPCRAFT_PART_BUILD} -name yarn-*.cjs -print0)" - ln -s "../${YARN:${#SNAPCRAFT_PART_BUILD}+1}" ./yarn - chmod +x ./yarn - cd "${SNAPCRAFT_PART_BUILD}" - - # Necessary for the remote build; sometimes. - if [ -n "${http_proxy-}" ]; then - yarn config set httpProxy "${http_proxy}" - fi - if [ -n "${https_proxy-}" ]; then - yarn config set httpsProxy "${https_proxy}" - fi - - yarn install - yarn build:server - yarn build:ui - yarn remove $(cat "${SNAPCRAFT_PART_BUILD}/package.json" | jq -r '.devDependencies | keys | join(" ")') + npm ci + npm run build:server + npm run build:ui + # remove dev dependencies + npm prune --omit=dev # Copy built version into install directory mkdir -p "${SNAPCRAFT_PART_INSTALL}/lib/" \ && cp --archive --link --no-dereference "${SNAPCRAFT_PART_BUILD}" \ "${SNAPCRAFT_PART_INSTALL}/lib/zwave-js-ui" - # Link yarn in install directory - mkdir "${SNAPCRAFT_PART_INSTALL}/bin" \ - && cd "${SNAPCRAFT_PART_INSTALL}/bin" \ - && ln -s "../lib/zwave-js-ui/bin/yarn" "yarn" filesets: zwave-js-ui-include: - bin - lib/zwave-js-ui/.git - - lib/zwave-js-ui/*.md - - lib/zwave-js-ui/bin/yarn - lib/zwave-js-ui/dist - lib/zwave-js-ui/node_modules - lib/zwave-js-ui/server - lib/zwave-js-ui/snippets - lib/zwave-js-ui/package.json - - lib/zwave-js-ui/.yarn - - lib/zwave-js-ui/yarn.lock - - lib/zwave-js-ui/.yarnrc.yml - lib/zwave-js-ui/LICENSE + - lib/zwave-js-ui/README.md stage: - $zwave-js-ui-include From 74c83aa28e2a9b760bd1faac2d664b256334fcbf Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Thu, 30 Nov 2023 17:25:30 +0000 Subject: [PATCH 2/3] fix: restore npm config set --- snap/snapcraft.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 6266d5c..8d329f9 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -127,6 +127,14 @@ parts: # Used when testing an unreleased version of Z-wavejs # sed -i 's/"zwave-js".*$/"zwave-js"\: "10.0.5-0-pr-4836-ed10b36"/g' ${SNAPCRAFT_PART_BUILD}/package.json + # Necessary for the remote build; sometimes. + if [ -n "${http_proxy-}" ]; then + npm config set httpProxy "${http_proxy}" + fi + if [ -n "${https_proxy-}" ]; then + npm config set httpsProxy "${https_proxy}" + fi + npm ci npm run build:server npm run build:ui From 8620e92f9239ed0270791016ef8b69e74422b2f9 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Thu, 30 Nov 2023 17:25:46 +0000 Subject: [PATCH 3/3] fix: remove jq dep --- snap/snapcraft.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 8d329f9..9b977fb 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -164,7 +164,6 @@ parts: dependencies: plugin: nil stage-snaps: - - jq - yq stage-packages: - git