From f6ea21c1b57ddd718efc883780f5a72f8faa24b6 Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Tue, 27 Aug 2024 16:41:29 +0200 Subject: [PATCH 1/7] refactor(git): import of dependencies --- pkg/git/src/plugin.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/git/src/plugin.ts b/pkg/git/src/plugin.ts index 174713ed..a5b9f603 100644 --- a/pkg/git/src/plugin.ts +++ b/pkg/git/src/plugin.ts @@ -5,9 +5,9 @@ import { Plugin } from '@slangroom/core'; import gitpkg from 'isomorphic-git'; // TODO: why does this require index.js? -import http from 'isomorphic-git/http/node/index.js'; -import * as fs from 'node:fs/promises'; -import * as path from 'node:path'; +import http from 'isomorphic-git/http/web/index.js'; +import { promises as fs } from 'fs'; +import path from 'path'; // read the version from the package.json import packageJson from '@slangroom/git/package.json' with { type: 'json' }; @@ -24,6 +24,7 @@ export class GitError extends Error { * @internal */ export const sandboxDir = () => { + if (typeof process === 'undefined') return '.'; // TODO: sanitize sandboxDir return process.env['FILES_DIR']; }; From 5e3f8b6edabdc233efdd2b84327a7b6376b1fc27 Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Tue, 27 Aug 2024 16:43:34 +0200 Subject: [PATCH 2/7] feat(browser): add git plugin to @slangroom/browser --- pkg/browser/package.json | 11 ++- pkg/browser/public/index.html | 25 ++++++ pkg/browser/src/index.ts | 10 +++ pkg/browser/tests/example.spec.ts | 4 + pnpm-lock.yaml | 124 ++++++++++++++++++++++++++++++ 5 files changed, 171 insertions(+), 3 deletions(-) diff --git a/pkg/browser/package.json b/pkg/browser/package.json index 472dc579..68c40ba6 100644 --- a/pkg/browser/package.json +++ b/pkg/browser/package.json @@ -3,11 +3,13 @@ "dependencies": { "@slangroom/core": "workspace:*", "@slangroom/deps": "workspace:*", + "@slangroom/git": "workspace:*", "@slangroom/helpers": "workspace:*", "@slangroom/http": "workspace:*", "@slangroom/json-schema": "workspace:*", "@slangroom/pocketbase": "workspace:*", - "@slangroom/qrcode": "workspace:*" + "@slangroom/qrcode": "workspace:*", + "buffer": "^6.0.3" }, "version": "1.39.0", "repository": "https://github.com/dyne/slangroom", @@ -40,10 +42,13 @@ "devDependencies": { "@playwright/test": "^1.40.1", "@types/node": "^20.10.4", - "esbuild": "^0.21.4" + "@types/path-browserify": "^1.0.3", + "@zenfs/core": "^0.16.4", + "esbuild": "^0.21.4", + "path-browserify": "^1.0.1" }, "scripts": { - "build": "pnpm exec esbuild --bundle src/index.ts --outfile=build/slangroom.js --target=es2016 --external:fs --external:path --external:crypto && cp build/slangroom.js public" + "build": "pnpm exec esbuild --bundle src/index.ts --outfile=build/slangroom.js --target=ESNext --external:crypto --alias:fs=@zenfs/core --alias:path=path-browserify && cp build/slangroom.js public" }, "engines": { "node": "^18.20.0 || ^20.10.0 || ^22" diff --git a/pkg/browser/public/index.html b/pkg/browser/public/index.html index 60f545f4..3d7e530f 100644 --- a/pkg/browser/public/index.html +++ b/pkg/browser/public/index.html @@ -14,6 +14,7 @@

Test http

+
diff --git a/pkg/browser/src/index.ts b/pkg/browser/src/index.ts index 51986419..caf90152 100644 --- a/pkg/browser/src/index.ts +++ b/pkg/browser/src/index.ts @@ -4,6 +4,7 @@ import { Slangroom, version as coreVersion } from '@slangroom/core'; import { qrcode, version as qrcodeVersion } from '@slangroom/qrcode'; +import { git, version as gitVersion } from '@slangroom/git'; import { http, version as httpVersion } from '@slangroom/http'; import { pocketbase, version as pocketbaseVersion } from '@slangroom/pocketbase'; import { helpers, version as helpersVersion } from '@slangroom/helpers'; @@ -11,9 +12,16 @@ import { JSONSchema, version as jsonSchemaVersion } from '@slangroom/json-schema import { zenroomVersion } from '@slangroom/deps/zenroom'; import packageJson from '@slangroom/browser/package.json' with { type: 'json' }; +// web dependencies +import { Buffer } from 'buffer'; + export const version = packageJson.version; const plugins_dict = { + git: { + plugin: git, + version: gitVersion + }, http: { plugin: http, version: httpVersion @@ -51,4 +59,6 @@ const slangroom = new Slangroom(plugins); // eslint-disable-next-line @typescript-eslint/no-explicit-any (window as any).slangroom = slangroom; // instead of casting window to any, you can extend the Window interface: https://stackoverflow.com/a/43513740/5433572 +window.Buffer = Buffer; + console.log(welcome_message); diff --git a/pkg/browser/tests/example.spec.ts b/pkg/browser/tests/example.spec.ts index f121edd9..5909dd72 100644 --- a/pkg/browser/tests/example.spec.ts +++ b/pkg/browser/tests/example.spec.ts @@ -22,4 +22,8 @@ test('check results of slangroom', async ({ page }) => { await expect(page.locator('#test-pocketbase-2')).toContainText( "{\"output\":{\"name\":\"test organization\"}}" ); + + await expect(page.locator('#test-git')).toContainText( + "{\"checked\":\"true\"}" + ); }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 242a61aa..cda658e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,6 +119,9 @@ importers: '@slangroom/deps': specifier: workspace:* version: link:../deps + '@slangroom/git': + specifier: workspace:* + version: link:../git '@slangroom/helpers': specifier: workspace:* version: link:../helpers @@ -134,6 +137,9 @@ importers: '@slangroom/qrcode': specifier: workspace:* version: link:../qrcode + buffer: + specifier: ^6.0.3 + version: 6.0.3 devDependencies: '@playwright/test': specifier: ^1.40.1 @@ -141,9 +147,18 @@ importers: '@types/node': specifier: ^20.10.4 version: 20.10.4 + '@types/path-browserify': + specifier: ^1.0.3 + version: 1.0.3 + '@zenfs/core': + specifier: ^0.16.4 + version: 0.16.4 esbuild: specifier: ^0.21.4 version: 0.21.4 + path-browserify: + specifier: ^1.0.1 + version: 1.0.1 pkg/core: dependencies: @@ -861,6 +876,7 @@ packages: '@humanwhocodes/config-array@0.11.14': resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} engines: {node: '>=10.10.0'} + deprecated: Use @eslint/config-array instead '@humanwhocodes/module-importer@1.0.1': resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} @@ -868,6 +884,7 @@ packages: '@humanwhocodes/object-schema@2.0.2': resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==} + deprecated: Use @eslint/object-schema instead '@hutson/parse-repository-url@5.0.0': resolution: {integrity: sha512-e5+YUKENATs1JgYHMzTr2MW/NDcXGfYFAuOQU8gJgF/kEh4EqKgfGrfLI67bMD4tbhZVlkigz/9YYwWcbOFthg==} @@ -1283,12 +1300,21 @@ packages: '@types/node@20.11.30': resolution: {integrity: sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==} + '@types/node@20.16.1': + resolution: {integrity: sha512-zJDo7wEadFtSyNz5QITDfRcrhqDvQI1xQNQ0VoizPjM/dVAODqqIUWbJPkvsxmTI0MYRGRikcdjMPhOssnPejQ==} + '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} + '@types/path-browserify@1.0.3': + resolution: {integrity: sha512-ZmHivEbNCBtAfcrFeBCiTjdIc2dey0l7oCGNGpSuRTy8jP6UVND7oUowlvDujBy8r2Hoa8bfFUOCiPWfmtkfxw==} + '@types/qrcode@1.5.5': resolution: {integrity: sha512-CdfBi/e3Qk+3Z/fXYShipBT13OJ2fDO2Q2w5CIP5anLTLIndQG9z6P1cnm+8zCWSpm5dnxMFd/uREtb0EXuQzg==} + '@types/readable-stream@4.0.15': + resolution: {integrity: sha512-oAZ3kw+kJFkEqyh7xORZOku1YAKvsFTogRY8kVl4vHpEKiDkfnSA/My8haRE7fvmix5Zyy+1pwzOi7yycGLBJw==} + '@types/semver@7.5.8': resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} @@ -1467,6 +1493,11 @@ packages: '@vueuse/shared@10.9.0': resolution: {integrity: sha512-Uud2IWncmAfJvRaFYzv5OHDli+FbOzxiVEQdLCKQKLyhz94PIyFC3CHcH7EDMwIn8NPtD06+PNbC/PiO0LGLtw==} + '@zenfs/core@0.16.4': + resolution: {integrity: sha512-QYT0tB3iHWo6q4KlSTl1zr2LWLgayNOHGPw5x+s926weH3Nrnw2Npe2gfLK05UFvXhhTynee8DgYGjFhgqBUmg==} + engines: {node: '>= 16'} + hasBin: true + JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} hasBin: true @@ -1487,6 +1518,10 @@ packages: zod: optional: true + abort-controller@3.0.0: + resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} + engines: {node: '>=6.5'} + acorn-import-attributes@1.9.2: resolution: {integrity: sha512-O+nfJwNolEA771IYJaiLWK1UAwjNsQmZbTRqqwBYxCgVQTmpFEMvBw6LOIQV0Me339L5UMVYFyRohGnGlQDdIQ==} peerDependencies: @@ -1581,10 +1616,12 @@ packages: are-we-there-yet@3.0.1: resolution: {integrity: sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + deprecated: This package is no longer supported. are-we-there-yet@4.0.2: resolution: {integrity: sha512-ncSWAawFhKMJDTdoAeOV+jyW1VCMj5QIAwULIBV0SSR7B/RLPPEQiknKcg/RIIZlUQrxELpsxMiTUoAQ4sIUyg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + deprecated: This package is no longer supported. arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} @@ -1688,6 +1725,9 @@ packages: buffer@5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + builtins@5.0.1: resolution: {integrity: sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==} @@ -2181,9 +2221,17 @@ packages: ethereum-cryptography@2.1.2: resolution: {integrity: sha512-Z5Ba0T0ImZ8fqXrJbpHcbpAvIswRte2wGNR/KePnu8GbbvgJ47lMxT/ZZPG6i9Jaht4azPDop4HaM00J0J59ug==} + event-target-shim@5.0.1: + resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} + engines: {node: '>=6'} + eventemitter3@5.0.1: resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + execa@8.0.1: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} @@ -2338,10 +2386,12 @@ packages: gauge@4.0.4: resolution: {integrity: sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + deprecated: This package is no longer supported. gauge@5.0.1: resolution: {integrity: sha512-CmykPMJGuNan/3S4kZOpvvPYSNqSHANiWnh9XcMU2pSjtBfF0XzZ2p1bFAxTbnFxyBuPxQYHhzwaoOmUdqzvxQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + deprecated: This package is no longer supported. generic-pool@3.9.0: resolution: {integrity: sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==} @@ -2404,6 +2454,7 @@ packages: glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Glob versions prior to v9 are no longer supported globals@13.24.0: resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} @@ -2565,6 +2616,7 @@ packages: inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -3158,10 +3210,12 @@ packages: npmlog@6.0.2: resolution: {integrity: sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + deprecated: This package is no longer supported. npmlog@7.0.1: resolution: {integrity: sha512-uJ0YFk/mCQpLBt+bxN88AKd+gyqZvZDbtiNxk6Waqcj2aPRyfVx8ITawkyQynxUagInjdYT1+qj4NfA5KJJUxg==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + deprecated: This package is no longer supported. object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} @@ -3280,6 +3334,9 @@ packages: parse-url@8.1.0: resolution: {integrity: sha512-xDvOoLU5XRrcOZvnI6b8zA6n9O9ejNk/GExuz1yBuWUGn9KA97GI6HTs6u02wKara1CeVmZhH+0TZFdWScR89w==} + path-browserify@1.0.1: + resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} + path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -3398,6 +3455,10 @@ packages: resolution: {integrity: sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + process@0.11.10: + resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} + engines: {node: '>= 0.6.0'} + promise-all-reject-late@1.0.1: resolution: {integrity: sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==} @@ -3472,6 +3533,10 @@ packages: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} engines: {node: '>= 6'} + readable-stream@4.5.2: + resolution: {integrity: sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + regexp-to-ast@0.5.0: resolution: {integrity: sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw==} @@ -3518,6 +3583,7 @@ packages: rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true rollup@4.13.0: @@ -3929,6 +3995,9 @@ packages: undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + undici-types@6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + unicorn-magic@0.1.0: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} engines: {node: '>=18'} @@ -3963,6 +4032,9 @@ packages: util@0.12.5: resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + utilium@0.4.4: + resolution: {integrity: sha512-TjhvLLoSi3WmzAR1QMFwGykW31cEOzbVoPqqopY6UYcm+5MfsF0ep3+DuJmAnOlU/zglGDwR96j0hjiHfwP4og==} + uuid@8.3.2: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true @@ -5224,12 +5296,23 @@ snapshots: dependencies: undici-types: 5.26.5 + '@types/node@20.16.1': + dependencies: + undici-types: 6.19.8 + '@types/normalize-package-data@2.4.4': {} + '@types/path-browserify@1.0.3': {} + '@types/qrcode@1.5.5': dependencies: '@types/node': 20.11.30 + '@types/readable-stream@4.0.15': + dependencies: + '@types/node': 20.16.1 + safe-buffer: 5.1.2 + '@types/semver@7.5.8': {} '@types/validator@13.11.9': {} @@ -5460,6 +5543,16 @@ snapshots: - '@vue/composition-api' - vue + '@zenfs/core@0.16.4': + dependencies: + '@types/node': 20.16.1 + '@types/readable-stream': 4.0.15 + buffer: 6.0.3 + eventemitter3: 5.0.1 + minimatch: 9.0.3 + readable-stream: 4.5.2 + utilium: 0.4.4 + JSONStream@1.3.5: dependencies: jsonparse: 1.3.1 @@ -5475,6 +5568,10 @@ snapshots: optionalDependencies: zod: 3.22.4 + abort-controller@3.0.0: + dependencies: + event-target-shim: 5.0.1 + acorn-import-attributes@1.9.2(acorn@8.11.3): dependencies: acorn: 8.11.3 @@ -5716,6 +5813,11 @@ snapshots: base64-js: 1.5.1 ieee754: 1.2.1 + buffer@6.0.3: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + builtins@5.0.1: dependencies: semver: 7.6.0 @@ -6275,8 +6377,12 @@ snapshots: '@scure/bip32': 1.3.1 '@scure/bip39': 1.2.1 + event-target-shim@5.0.1: {} + eventemitter3@5.0.1: {} + events@3.3.0: {} + execa@8.0.1: dependencies: cross-spawn: 7.0.3 @@ -7461,6 +7567,8 @@ snapshots: dependencies: parse-path: 7.0.0 + path-browserify@1.0.1: {} + path-exists@4.0.0: {} path-exists@5.0.0: {} @@ -7554,6 +7662,8 @@ snapshots: proc-log@3.0.0: {} + process@0.11.10: {} + promise-all-reject-late@1.0.1: {} promise-call-limit@3.0.1: {} @@ -7629,6 +7739,14 @@ snapshots: string_decoder: 1.3.0 util-deprecate: 1.0.2 + readable-stream@4.5.2: + dependencies: + abort-controller: 3.0.0 + buffer: 6.0.3 + events: 3.3.0 + process: 0.11.10 + string_decoder: 1.3.0 + regexp-to-ast@0.5.0: {} require-directory@2.1.1: {} @@ -8084,6 +8202,8 @@ snapshots: undici-types@5.26.5: {} + undici-types@6.19.8: {} + unicorn-magic@0.1.0: {} unique-filename@1.1.1: @@ -8122,6 +8242,10 @@ snapshots: is-typed-array: 1.1.12 which-typed-array: 1.1.13 + utilium@0.4.4: + dependencies: + eventemitter3: 5.0.1 + uuid@8.3.2: {} uuid@9.0.1: {} From b9f4c43138b2060de730e7c970c72777ecd9520d Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Tue, 27 Aug 2024 16:57:47 +0200 Subject: [PATCH 3/7] chore: set timeout limit to 15s on playwright tests --- pkg/browser/tests/example.spec.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/browser/tests/example.spec.ts b/pkg/browser/tests/example.spec.ts index 5909dd72..ec2c5c01 100644 --- a/pkg/browser/tests/example.spec.ts +++ b/pkg/browser/tests/example.spec.ts @@ -5,6 +5,9 @@ import { test, expect } from '@playwright/test'; test('check results of slangroom', async ({ page }) => { + // set timeout + test.setTimeout(testInfo.timeout * 3); + await page.goto('http://localhost:8080/'); // Expects page to have a heading with the name of Installation. From 9331bd856a0c56d35174f53cc32f74c1897c4269 Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Tue, 27 Aug 2024 17:02:56 +0200 Subject: [PATCH 4/7] chore(browser): fix timeout in playwright tests --- pkg/browser/tests/example.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/browser/tests/example.spec.ts b/pkg/browser/tests/example.spec.ts index ec2c5c01..d79a7b15 100644 --- a/pkg/browser/tests/example.spec.ts +++ b/pkg/browser/tests/example.spec.ts @@ -6,7 +6,7 @@ import { test, expect } from '@playwright/test'; test('check results of slangroom', async ({ page }) => { // set timeout - test.setTimeout(testInfo.timeout * 3); + test.setTimeout(15000); await page.goto('http://localhost:8080/'); From c2677677a8ec0baeee8c03110637edd67c6fc8de Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Tue, 27 Aug 2024 17:24:06 +0200 Subject: [PATCH 5/7] test(browser): increase timeout limit to specific git test --- pkg/browser/tests/example.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/browser/tests/example.spec.ts b/pkg/browser/tests/example.spec.ts index d79a7b15..351d2ce3 100644 --- a/pkg/browser/tests/example.spec.ts +++ b/pkg/browser/tests/example.spec.ts @@ -6,7 +6,7 @@ import { test, expect } from '@playwright/test'; test('check results of slangroom', async ({ page }) => { // set timeout - test.setTimeout(15000); + test.setTimeout(30000); await page.goto('http://localhost:8080/'); @@ -27,6 +27,7 @@ test('check results of slangroom', async ({ page }) => { ); await expect(page.locator('#test-git')).toContainText( - "{\"checked\":\"true\"}" + "{\"checked\":\"true\"}", + { timeout: 20000 } ); }); From 2e1fb96c4b0e9299836772605841f7cdaa15672e Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Thu, 29 Aug 2024 12:17:45 +0200 Subject: [PATCH 6/7] ci: try to setup a proxy server to clone from browser --- .github/workflows/ci.yml | 6 ++++++ pkg/browser/public/index.html | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2947030..7f63fe1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,12 @@ jobs: run: pnpm coverage - name: ๐Ÿงช Test grammar package run: pnpm test:grammar + - name: โ†•๏ธ Setup cors free proxy for cloning + run: | + git clone https://github.com/wmhilton/cors-buster + cd cors-buster + pnpm install + PORT=8000 pnpm start & - name: ๐Ÿ“จ Setup playwright run: | npx playwright install diff --git a/pkg/browser/public/index.html b/pkg/browser/public/index.html index 3d7e530f..e71490ac 100644 --- a/pkg/browser/public/index.html +++ b/pkg/browser/public/index.html @@ -134,7 +134,7 @@

Test http

slangroom .execute(scriptGit, { data:{ - url: "https://cors.isomorphic-git.org/github.com/srfsh/dumb", + url: "http://localhost:8000/github.com/srfsh/dumb", path: "slangroom", checked: "true" } From 30e85873b6a81334c3471dcd58656112d8947ec1 Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Thu, 29 Aug 2024 12:26:38 +0200 Subject: [PATCH 7/7] ci: use npm for the proxy server instead of pnpm --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f63fe1e..4e544ca6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,8 +57,8 @@ jobs: run: | git clone https://github.com/wmhilton/cors-buster cd cors-buster - pnpm install - PORT=8000 pnpm start & + npm install + PORT=8000 npm start & - name: ๐Ÿ“จ Setup playwright run: | npx playwright install