Remove puppeteer dependency and fix npm cache permissions

This commit is contained in:
root
2026-02-01 01:25:07 +02:00
parent 029947c0b2
commit 3d709093c1
4 changed files with 37 additions and 72 deletions

View File

@@ -364,6 +364,9 @@ class UpgradeCommand extends Command
'PATH' => $path, 'PATH' => $path,
'COMPOSER_ALLOW_SUPERUSER' => '1', 'COMPOSER_ALLOW_SUPERUSER' => '1',
'NPM_CONFIG_CACHE' => $this->getNpmCacheDir(), 'NPM_CONFIG_CACHE' => $this->getNpmCacheDir(),
'PUPPETEER_SKIP_DOWNLOAD' => '1',
'PUPPETEER_CACHE_DIR' => $this->getPuppeteerCacheDir(),
'XDG_CACHE_HOME' => $this->getXdgCacheDir(),
]; ];
} }
@@ -426,6 +429,8 @@ class UpgradeCommand extends Command
$this->basePath.'/database', $this->basePath.'/database',
$this->basePath.'/storage', $this->basePath.'/storage',
$this->getNpmCacheDir(), $this->getNpmCacheDir(),
$this->getPuppeteerCacheDir(),
$this->getXdgCacheDir(),
$this->basePath.'/bootstrap/cache', $this->basePath.'/bootstrap/cache',
]; ];
@@ -441,7 +446,13 @@ class UpgradeCommand extends Command
protected function ensureNpmCacheDirectory(): void protected function ensureNpmCacheDirectory(): void
{ {
$cacheDir = $this->getNpmCacheDir(); $cacheDirs = [
$this->getNpmCacheDir(),
$this->getPuppeteerCacheDir(),
$this->getXdgCacheDir(),
];
foreach ($cacheDirs as $cacheDir) {
if (! File::exists($cacheDir)) { if (! File::exists($cacheDir)) {
File::ensureDirectoryExists($cacheDir); File::ensureDirectoryExists($cacheDir);
} }
@@ -452,11 +463,23 @@ class UpgradeCommand extends Command
} }
} }
}
protected function getNpmCacheDir(): string protected function getNpmCacheDir(): string
{ {
return $this->basePath.'/storage/npm-cache'; return $this->basePath.'/storage/npm-cache';
} }
protected function getPuppeteerCacheDir(): string
{
return $this->basePath.'/storage/puppeteer-cache';
}
protected function getXdgCacheDir(): string
{
return $this->basePath.'/storage/.cache';
}
protected function commandExists(string $command): bool protected function commandExists(string $command): bool
{ {
$result = $this->executeCommand("command -v {$command}"); $result = $this->executeCommand("command -v {$command}");

View File

@@ -2827,6 +2827,13 @@ ENV
" 2>/dev/null || true " 2>/dev/null || true
# Build assets # Build assets
export NPM_CONFIG_CACHE="$JABALI_DIR/storage/npm-cache"
export PUPPETEER_SKIP_DOWNLOAD=1
export PUPPETEER_CACHE_DIR="$JABALI_DIR/storage/puppeteer-cache"
export XDG_CACHE_HOME="$JABALI_DIR/storage/.cache"
mkdir -p "$NPM_CONFIG_CACHE" "$PUPPETEER_CACHE_DIR" "$XDG_CACHE_HOME"
chown -R "$JABALI_USER:www-data" "$NPM_CONFIG_CACHE" "$PUPPETEER_CACHE_DIR" "$XDG_CACHE_HOME"
chmod -R 775 "$NPM_CONFIG_CACHE" "$PUPPETEER_CACHE_DIR" "$XDG_CACHE_HOME"
npm install npm install
npm run build npm run build

64
package-lock.json generated
View File

@@ -16,7 +16,6 @@
"concurrently": "^9.0.1", "concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0.0", "laravel-vite-plugin": "^2.0.0",
"postcss": "^8.4.32", "postcss": "^8.4.32",
"puppeteer": "^24.35.0",
"tailwindcss": "^4.1.18", "tailwindcss": "^4.1.18",
"vite": "^7.0.7" "vite": "^7.0.7"
} }
@@ -513,28 +512,6 @@
"integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==", "integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@puppeteer/browsers": {
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.11.1.tgz",
"integrity": "sha512-YmhAxs7XPuxN0j7LJloHpfD1ylhDuFmmwMvfy/+6nBSrETT2ycL53LrhgPtR+f+GcPSybQVuQ5inWWu5MrWCpA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"debug": "^4.4.3",
"extract-zip": "^2.0.1",
"progress": "^2.0.3",
"proxy-agent": "^6.5.0",
"semver": "^7.7.3",
"tar-fs": "^3.1.1",
"yargs": "^17.7.2"
},
"bin": {
"browsers": "lib/cjs/main-cli.js"
},
"engines": {
"node": ">=18"
}
},
"node_modules/@rollup/rollup-android-arm-eabi": { "node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.55.1", "version": "4.55.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.55.1.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.55.1.tgz",
@@ -2897,47 +2874,6 @@
"once": "^1.3.1" "once": "^1.3.1"
} }
}, },
"node_modules/puppeteer": {
"version": "24.35.0",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-24.35.0.tgz",
"integrity": "sha512-sbjB5JnJ+3nwgSdRM/bqkFXqLxRz/vsz0GRIeTlCk+j+fGpqaF2dId9Qp25rXz9zfhqnN9s0krek1M/C2GDKtA==",
"dev": true,
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"@puppeteer/browsers": "2.11.1",
"chromium-bidi": "12.0.1",
"cosmiconfig": "^9.0.0",
"devtools-protocol": "0.0.1534754",
"puppeteer-core": "24.35.0",
"typed-query-selector": "^2.12.0"
},
"bin": {
"puppeteer": "lib/cjs/puppeteer/node/cli.js"
},
"engines": {
"node": ">=18"
}
},
"node_modules/puppeteer-core": {
"version": "24.35.0",
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.35.0.tgz",
"integrity": "sha512-vt1zc2ME0kHBn7ZDOqLvgvrYD5bqNv5y2ZNXzYnCv8DEtZGw/zKhljlrGuImxptZ4rq+QI9dFGrUIYqG4/IQzA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@puppeteer/browsers": "2.11.1",
"chromium-bidi": "12.0.1",
"debug": "^4.4.3",
"devtools-protocol": "0.0.1534754",
"typed-query-selector": "^2.12.0",
"webdriver-bidi-protocol": "0.3.10",
"ws": "^8.19.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/require-directory": { "node_modules/require-directory": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",

View File

@@ -15,7 +15,6 @@
"concurrently": "^9.0.1", "concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0.0", "laravel-vite-plugin": "^2.0.0",
"postcss": "^8.4.32", "postcss": "^8.4.32",
"puppeteer": "^24.35.0",
"tailwindcss": "^4.1.18", "tailwindcss": "^4.1.18",
"vite": "^7.0.7" "vite": "^7.0.7"
}, },