From 0f3d2c5308aceb2fb1132e03295c06b1e4ea67c2 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 7 Jun 2024 18:44:58 +0200 Subject: [PATCH] fix(ci): switch back to lts node This also tests https://github.com/ipfs/npm-kubo/pull/74 removing the need for hack from https://github.com/ipfs/ipfs-desktop/pull/2662 --- .github/workflows/ci.yml | 6 +++--- patches/kubo+0.29.0-rc2.patch | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 patches/kubo+0.29.0-rc2.patch diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fe84a189..b5cff8de8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: '18.17.1' + node-version: 'lts/*' - name: Read ipfs-webui CID from package.json id: read-webui-version @@ -87,7 +87,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: '18.17.1' + node-version: 'lts/*' - name: Read ipfs-webui CID from package.json id: read-webui-version @@ -154,7 +154,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: '18.17.1' + node-version: 'lts/*' - name: Read ipfs-webui CID from package.json id: read-webui-version diff --git a/patches/kubo+0.29.0-rc2.patch b/patches/kubo+0.29.0-rc2.patch new file mode 100644 index 000000000..55cbdb273 --- /dev/null +++ b/patches/kubo+0.29.0-rc2.patch @@ -0,0 +1,29 @@ +diff --git a/node_modules/kubo/bin/ipfs b/node_modules/kubo/bin/ipfs +index 70b8f92..4d3c24c 100644 +--- a/node_modules/kubo/src/download.js ++++ b/node_modules/kubo/src/download.js +@@ -204,7 +204,23 @@ async function link ({ depBin, version }) { + } + + console.info('Linking', depBin, 'to', localBin) +- fs.symlinkSync(depBin, localBin) ++ try { ++ fs.symlinkSync(depBin, localBin) ++ } catch (err) { ++ // Try to recover when creating symlink on modern Windows fails (https://github.com/ipfs/npm-kubo/issues/68) ++ if (isWin && typeof err === 'object' && err !== null && 'code' in err && err.code === 'EPERM') { ++ console.info('Symlink creation failed due to insufficient privileges. Attempting to copy file instead...') ++ try { ++ fs.copyFileSync(depBin, localBin) ++ console.info('Copying', depBin, 'to', localBin) ++ } catch (copyErr) { ++ console.error('File copy also failed:', copyErr) ++ throw copyErr ++ } ++ } else { ++ throw err ++ } ++ } + + if (isWin) { + // On Windows, update the shortcut file to use the .exe