From b1f315287a4383ac36421403d58d54150bf428d5 Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Thu, 25 Apr 2024 12:09:06 +0200 Subject: [PATCH] Remove the wp-playground/node package (#1323) It wasn't used anywhere and generated type problems in the Loopback request PR. There's little value in fixing them, especially considering the PHP Server explorations at https://github.com/WordPress/wordpress-playground/pull/1289, so let's just remove it. ## Testing instructions Confirm the CI checks pass. --- packages/playground/node/.babelrc | 3 - packages/playground/node/.eslintrc.json | 18 ----- packages/playground/node/README.md | 11 --- packages/playground/node/jest.config.ts | 14 ---- packages/playground/node/package.json | 5 -- packages/playground/node/project.json | 42 ----------- packages/playground/node/src/index.ts | 77 --------------------- packages/playground/node/tsconfig.json | 13 ---- packages/playground/node/tsconfig.lib.json | 11 --- packages/playground/node/tsconfig.spec.json | 20 ------ tsconfig.base.json | 1 - 11 files changed, 215 deletions(-) delete mode 100644 packages/playground/node/.babelrc delete mode 100644 packages/playground/node/.eslintrc.json delete mode 100644 packages/playground/node/README.md delete mode 100644 packages/playground/node/jest.config.ts delete mode 100644 packages/playground/node/package.json delete mode 100644 packages/playground/node/project.json delete mode 100644 packages/playground/node/src/index.ts delete mode 100644 packages/playground/node/tsconfig.json delete mode 100644 packages/playground/node/tsconfig.lib.json delete mode 100644 packages/playground/node/tsconfig.spec.json diff --git a/packages/playground/node/.babelrc b/packages/playground/node/.babelrc deleted file mode 100644 index 5f2f47b93d..0000000000 --- a/packages/playground/node/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": [["@nx/js/babel", { "useBuiltIns": "usage" }]] -} diff --git a/packages/playground/node/.eslintrc.json b/packages/playground/node/.eslintrc.json deleted file mode 100644 index 79fd7c1d98..0000000000 --- a/packages/playground/node/.eslintrc.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": ["../../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], - "overrides": [ - { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], - "rules": {} - }, - { - "files": ["*.ts", "*.tsx"], - "rules": {} - }, - { - "files": ["*.js", "*.jsx"], - "rules": {} - } - ] -} diff --git a/packages/playground/node/README.md b/packages/playground/node/README.md deleted file mode 100644 index f75532065c..0000000000 --- a/packages/playground/node/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# playground-node - -This library was generated with [Nx](https://nx.dev). - -## Running unit tests - -Run `nx test playground-node` to execute the unit tests via [Jest](https://jestjs.io). - -## Running lint - -Run `nx lint playground-node` to execute the lint via [ESLint](https://eslint.org/). diff --git a/packages/playground/node/jest.config.ts b/packages/playground/node/jest.config.ts deleted file mode 100644 index 0cc97cb1b2..0000000000 --- a/packages/playground/node/jest.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'playground-node', - preset: '../../../jest.preset.js', - testEnvironment: 'node', - transform: { - '^.+\\.[tj]sx?$': [ - 'ts-jest', - { tsconfig: '/tsconfig.spec.json' }, - ], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../../coverage/packages/playground/node', -}; diff --git a/packages/playground/node/package.json b/packages/playground/node/package.json deleted file mode 100644 index 0b0eb90ba2..0000000000 --- a/packages/playground/node/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "@wp-playground/node", - "version": "0.0.1", - "private": true -} diff --git a/packages/playground/node/project.json b/packages/playground/node/project.json deleted file mode 100644 index 0f636cd019..0000000000 --- a/packages/playground/node/project.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "playground-node", - "$schema": "../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "packages/playground/node/src", - "projectType": "library", - "targets": { - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/playground/node", - "tsConfig": "packages/playground/node/tsconfig.lib.json", - "packageJson": "packages/playground/node/package.json", - "main": "packages/playground/node/src/index.ts", - "assets": ["packages/playground/node/*.md"], - "updateBuildableProjectDepsInPackageJson": true - } - }, - "lint": { - "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["packages/playground/node/**/*.ts"] - } - }, - "test": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "packages/playground/node/jest.config.ts", - "passWithNoTests": true - }, - "configurations": { - "ci": { - "ci": true, - "codeCoverage": true - } - } - } - }, - "tags": [] -} diff --git a/packages/playground/node/src/index.ts b/packages/playground/node/src/index.ts deleted file mode 100644 index 9fd9c8d4bd..0000000000 --- a/packages/playground/node/src/index.ts +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Early draft of a Node.js playground package. - * This is meant to streamline the Node.js workflow - * and make it easier to build things like VS Code extensions, - * Express servers, and CLI tools - */ - -import { - Blueprint, - compileBlueprint, - defineSiteUrl, - runBlueprintSteps, -} from '@wp-playground/blueprints'; -import { NodePHP } from '@php-wasm/node'; -import { UniversalPHP } from '@php-wasm/universal'; -import { collectPhpLogs, logger } from '@php-wasm/logger'; - -export interface NodePlaygroundOptions { - blueprint?: Blueprint; - wordpressPathOnHost: string; - serverUrl: string; -} - -export async function startPlaygroundNode( - options: NodePlaygroundOptions -): Promise { - /** - * @TODO figure out how to handle: - * * WordPress installation? There are no wp.data files like in the web version - * * Managing WordPress versions - * * Existing WordPress installations - * * Mounting existing themes, plugins, and core WP files - * - * Perhaps there is too much custom logic to be able to even have - * a generic "startPlaygroundNode" function? - * - * @TODO use this workflow to compile WordPress for the web - */ - const compiled = compileBlueprint(options.blueprint || {}); - const playground = await NodePHP.load(compiled.versions.php, { - requestHandler: { - documentRoot: options.wordpressPathOnHost, - absoluteUrl: options.serverUrl, - }, - }); - - collectPhpLogs(logger, playground); - - await defineSiteUrl(playground, { - siteUrl: options.serverUrl, - }); - - await allowWpOrgHosts(playground, options.wordpressPathOnHost); - - await runBlueprintSteps(compiled, playground); - return playground; -} - -export async function allowWpOrgHosts( - php: UniversalPHP, - wordpressPath: string -) { - await php.mkdir(`${wordpressPath}/wp-content/mu-plugins`); - await php.writeFile( - `${wordpressPath}/wp-content/mu-plugins/0-allow-wp-org.php`, - `