From 9e6549db2e071782e7ff630b396d41b7309b4a8a Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+SamTV12345@users.noreply.github.com> Date: Sun, 17 Mar 2024 19:37:41 +0100 Subject: [PATCH 1/4] Fix uncaught error. Symlink not working with scoped packages (#6233) --- .../workflows/upgrade-from-latest-release.yml | 89 ++++++++++--------- src/static/js/pluginfw/LinkInstaller.ts | 17 +++- src/static/js/pluginfw/installer.ts | 2 - 3 files changed, 60 insertions(+), 48 deletions(-) diff --git a/.github/workflows/upgrade-from-latest-release.yml b/.github/workflows/upgrade-from-latest-release.yml index f2c713c471d..8d83bfc9347 100644 --- a/.github/workflows/upgrade-from-latest-release.yml +++ b/.github/workflows/upgrade-from-latest-release.yml @@ -29,13 +29,50 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} + - uses: pnpm/action-setup@v3 + name: Install pnpm + with: + version: 8 + run_install: false + - name: Only install direct dependencies + run: pnpm config set auto-install-peers false + - name: Install libreoffice + uses: awalsh128/cache-apt-pkgs-action@v1.4.2 + with: + packages: libreoffice libreoffice-pdfimport + version: 1.0 + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Only install direct dependencies + run: pnpm config set auto-install-peers false + - + name: Install libreoffice + uses: awalsh128/cache-apt-pkgs-action@v1.4.2 + with: + packages: libreoffice libreoffice-pdfimport + version: 1.0 + - + name: Install all dependencies and symlink for ep_etherpad-lite + run: bin/installDeps.sh + - name: Install admin ui + working-directory: admin + run: pnpm install + - name: Build admin ui + working-directory: admin + run: pnpm build - name: Install Etherpad plugins - # Important: Installer for old master which does not have pnpm right now - # The --legacy-peer-deps flag is required to work around a bug in npm v7: - # https://github.com/npm/cli/issues/2199 run: > - npm install --no-save --legacy-peer-deps + pnpm run install-plugins ep_align ep_author_hover ep_cursortrace @@ -49,12 +86,12 @@ jobs: ep_spellcheck ep_subscript_and_superscript ep_table_of_contents - - - name: Install all dependencies and symlink for ep_etherpad-lite - run: src/bin/installDeps.sh - name: Run the backend tests - run: cd src && npm test + run: pnpm run test + - + name: Install all dependencies and symlink for ep_etherpad-lite + run: ./bin/installDeps.sh # Because actions/checkout@v4 is called with "ref: master" and without # "fetch-depth: 0", the local clone does not have the ${GITHUB_SHA} # commit. Fetch ${GITHUB_REF} to get the ${GITHUB_SHA} commit. Note that a @@ -70,44 +107,12 @@ jobs: # For pull requests, ${GITHUB_SHA} is the automatically generated merge # commit that merges the PR's source branch to its destination branch. run: git checkout "${GITHUB_SHA}" - - uses: pnpm/action-setup@v3 - name: Install pnpm - with: - version: 8 - run_install: false - - name: Only install direct dependencies - run: pnpm config set auto-install-peers false - - - name: Install libreoffice - uses: awalsh128/cache-apt-pkgs-action@v1.4.2 - with: - packages: libreoffice libreoffice-pdfimport - version: 1.0 - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + - name: Install all dependencies and symlink for ep_etherpad-lite run: bin/installDeps.sh - - - name: Run the backend tests - run: pnpm test - - - name: Install Cypress - working-directory: ./src - run: pnpm install cypress - name: Run Etherpad & Test Frontend working-directory: ./src run: | - pnpm run dev & - curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test - ./node_modules/cypress/bin/cypress run --config-file tests/frontend/cypress/cypress.config.js + pnpm run test-ui --project=chromium diff --git a/src/static/js/pluginfw/LinkInstaller.ts b/src/static/js/pluginfw/LinkInstaller.ts index a3034e28170..f3906f36903 100644 --- a/src/static/js/pluginfw/LinkInstaller.ts +++ b/src/static/js/pluginfw/LinkInstaller.ts @@ -35,7 +35,6 @@ export class LinkInstaller { this.dependenciesMap.set(dependency, new Set([name])) } } - } public async installFromPath(path: string) { @@ -177,9 +176,10 @@ export class LinkInstaller { // We already added the sub dependency this.dependenciesMap.get(dependency)?.add(plugin) } else { - this.linkDependency(dependency) - // Read sub dependencies + try { + this.linkDependency(dependency) + // Read sub dependencies const json:IPluginInfo = JSON.parse( readFileSync(pathToFileURL(path.join(pluginInstallPath, dependency, 'package.json'))) as unknown as string); if(json.dependencies){ @@ -199,7 +199,16 @@ export class LinkInstaller { // Check if the dependency is already installed accessSync(path.join(node_modules, dependency), constants.F_OK) } catch (err) { - symlinkSync(path.join(pluginInstallPath, dependency), path.join(node_modules, dependency), 'dir') + try { + if(dependency.startsWith("@")){ + const newDependency = dependency.split("@")[0] + symlinkSync(path.join(pluginInstallPath, dependency), path.join(node_modules, newDependency), 'dir') + } else { + symlinkSync(path.join(pluginInstallPath, dependency), path.join(node_modules, dependency), 'dir') + } + } catch (e) { + // Nothing to do. We're all set + } } } diff --git a/src/static/js/pluginfw/installer.ts b/src/static/js/pluginfw/installer.ts index 1912ed7f5fc..973bdd56f56 100644 --- a/src/static/js/pluginfw/installer.ts +++ b/src/static/js/pluginfw/installer.ts @@ -79,8 +79,6 @@ export const checkForMigration = async () => { // Initialize linkInstaller await linkInstaller.init() - - try { await fs.access(installedPluginsPath, fs.constants.F_OK); } catch (err) { From eacf82053d7c86f0e4fd4d88ffffe863fb339866 Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+SamTV12345@users.noreply.github.com> Date: Sun, 17 Mar 2024 21:55:27 +0100 Subject: [PATCH 2/4] Fix upgrade from latest release workflow * Install playwright. * Fixed. * Fixed. * Run only backend tests. --- .github/workflows/upgrade-from-latest-release.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/upgrade-from-latest-release.yml b/.github/workflows/upgrade-from-latest-release.yml index 8d83bfc9347..627c85af88a 100644 --- a/.github/workflows/upgrade-from-latest-release.yml +++ b/.github/workflows/upgrade-from-latest-release.yml @@ -107,12 +107,5 @@ jobs: # For pull requests, ${GITHUB_SHA} is the automatically generated merge # commit that merges the PR's source branch to its destination branch. run: git checkout "${GITHUB_SHA}" - - - - name: Install all dependencies and symlink for ep_etherpad-lite - run: bin/installDeps.sh - - - name: Run Etherpad & Test Frontend - working-directory: ./src - run: | - pnpm run test-ui --project=chromium + - name: Run the backend tests + run: pnpm run test From eafba4ac3f4a26f6b99bad63e7ad5c44f52436e4 Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Sun, 17 Mar 2024 22:00:33 +0100 Subject: [PATCH 3/4] Added changelog for 2.0.1 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b5c29985f4..b565eed2c36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 2.0.1 + +### Notable enhancements and fixes + +- Fixed a bug where a plugin depending on a scoped dependency would not install successfully. + + # 2.0.0 From 8dd9fb3b039815a62c1a2a7d0b15ccb1d559c898 Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Sun, 17 Mar 2024 22:02:49 +0100 Subject: [PATCH 4/4] bump version --- admin/package.json | 2 +- bin/package.json | 2 +- package.json | 2 +- src/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/package.json b/admin/package.json index 9a92b4e26b8..9f829a531bc 100644 --- a/admin/package.json +++ b/admin/package.json @@ -1,7 +1,7 @@ { "name": "admin", "private": true, - "version": "2.0.0", + "version": "2.0.1", "type": "module", "scripts": { "dev": "vite", diff --git a/bin/package.json b/bin/package.json index c00ac1e18e4..a39797a8b03 100644 --- a/bin/package.json +++ b/bin/package.json @@ -1,6 +1,6 @@ { "name": "bin", - "version": "2.0.0", + "version": "2.0.1", "description": "", "main": "checkAllPads.js", "directories": { diff --git a/package.json b/package.json index bbb9d14b25f..022eefbfb67 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,6 @@ "type": "git", "url": "https://github.com/ether/etherpad-lite.git" }, - "version": "2.0.0", + "version": "2.0.1", "license": "Apache-2.0" } diff --git a/src/package.json b/src/package.json index e0a64e9a3d5..339b97d7fd0 100644 --- a/src/package.json +++ b/src/package.json @@ -125,6 +125,6 @@ "test-admin": "npx playwright test tests/frontend-new/admin-spec --workers 1", "test-admin:ui": "npx playwright test tests/frontend-new/admin-spec --ui --workers 1" }, - "version": "2.0.0", + "version": "2.0.1", "license": "Apache-2.0" }