From f9e5690b4d1a4c0318a5518079b9abb3cb56e034 Mon Sep 17 00:00:00 2001 From: eliot-akira Date: Thu, 12 Sep 2024 19:26:07 +0200 Subject: [PATCH] Lint: Remove unused variables and code --- packages/wp-now/src/execute-wp-cli.ts | 20 ++------------------ packages/wp-now/src/wp-now.ts | 16 +++------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/packages/wp-now/src/execute-wp-cli.ts b/packages/wp-now/src/execute-wp-cli.ts index c0dd778e..24ec3e62 100644 --- a/packages/wp-now/src/execute-wp-cli.ts +++ b/packages/wp-now/src/execute-wp-cli.ts @@ -5,13 +5,11 @@ import getWpNowConfig from './config'; import { DEFAULT_PHP_VERSION, DEFAULT_WORDPRESS_VERSION } from './constants'; import { phpVar } from '@php-wasm/util'; import { createNodeFsMountHandler, loadNodeRuntime } from '@php-wasm/node'; -// import { getSqliteCommandPath } from '../../../src/lib/sqlite-command-versions'; import { PHP, MountHandler, writeFiles, setPhpIniEntries, - loadPHPRuntime, } from '@php-wasm/universal'; import { readFileSync } from 'fs'; @@ -21,11 +19,9 @@ const isWindows = process.platform === 'win32'; * This is an unstable API. Multiple wp-cli commands may not work due to a current limitation on php-wasm and pthreads. */ export async function executeWPCli( + projectPath: string, args: string[], - { - phpVersion, - projectPath, - }: { phpVersion?: string; projectPath?: string } = {} + { phpVersion }: { phpVersion?: string } = {} ): Promise<{ stdout: string; stderr: string; exitCode: number }> { await downloadWPCLI(); const options = await getWpNowConfig({ @@ -49,7 +45,6 @@ export async function executeWPCli( const wpCliPath = '/tmp/wp-cli.phar'; const stderrPath = '/tmp/stderr'; - const sqliteCommandPath = '/tmp/sqlite-command'; const runCliPath = '/tmp/run-cli.php'; const createFiles = { [wpCliPath]: readFileSync(getWpCliPath()), @@ -99,17 +94,6 @@ export async function executeWPCli( await setPhpIniEntries(php, { 'openssl.cafile': '/internal/shared/ca-bundle.crt', }); - // try { - // php.mkdir(sqliteCommandPath); - // await php.mount( - // sqliteCommandPath, - // createNodeFsMountHandler( - // getSqliteCommandPath() - // ) as unknown as MountHandler - // ); - // } catch (e) { - // console.log(e); - // } try { php.chdir(options.documentRoot); diff --git a/packages/wp-now/src/wp-now.ts b/packages/wp-now/src/wp-now.ts index c21332e7..294342a9 100644 --- a/packages/wp-now/src/wp-now.ts +++ b/packages/wp-now/src/wp-now.ts @@ -1,6 +1,6 @@ import path from 'path'; import { rootCertificates } from 'tls'; -import fs, { copySync } from 'fs-extra'; +import fs from 'fs-extra'; import { createNodeFsMountHandler, loadNodeRuntime } from '@php-wasm/node'; import { PHP, @@ -61,17 +61,9 @@ export default async function startWPNow( ): Promise<{ php: PHP; options: WPNowOptions }> { const { documentRoot } = options; - // Similar logic as bootWordPress() in @wp-playground/wordpess - - const createPhpRuntime = async () => - await loadNodeRuntime(options.phpVersion); const requestHandler = new PHPRequestHandler({ phpFactory: async ({ isPrimary, requestHandler }) => { - const { php, runtimeId } = await getPHPInstance( - options, - isPrimary, - requestHandler - ); + const { php } = await getPHPInstance(options); if (requestHandler) { php.requestHandler = requestHandler; @@ -193,9 +185,7 @@ export default async function startWPNow( } async function getPHPInstance( - options: WPNowOptions, - isPrimary: boolean, - requestHandler: PHPRequestHandler + options: WPNowOptions ): Promise<{ php: PHP; runtimeId: number }> { const id = await loadNodeRuntime(options.phpVersion); const php = new PHP(id);