diff --git a/.gitignore b/.gitignore index 417b044..65cabca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ +vendor/ dist/ coverage/ .DS_Store diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..025572f --- /dev/null +++ b/composer.lock @@ -0,0 +1,324 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "6b02eac65a2ad8795a7767e1d424313f", + "packages": [ + { + "name": "symfony/finder", + "version": "v8.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "8da41214757b87d97f181e3d14a4179286151007" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/8da41214757b87d97f181e3d14a4179286151007", + "reference": "8da41214757b87d97f181e3d14a4179286151007", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "symfony/filesystem": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v8.0.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-03-30T15:14:47+00:00" + }, + { + "name": "wp-cli/mustache", + "version": "v2.14.99", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/mustache.php.git", + "reference": "ca23b97ac35fbe01c160549eb634396183d04a59" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/mustache.php/zipball/ca23b97ac35fbe01c160549eb634396183d04a59", + "reference": "ca23b97ac35fbe01c160549eb634396183d04a59", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "replace": { + "mustache/mustache": "^2.14.2" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.19.3", + "yoast/phpunit-polyfills": "^2.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Mustache": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "A Mustache implementation in PHP.", + "homepage": "https://github.com/bobthecow/mustache.php", + "keywords": [ + "mustache", + "templating" + ], + "support": { + "source": "https://github.com/wp-cli/mustache.php/tree/v2.14.99" + }, + "time": "2025-05-06T16:15:37+00:00" + }, + { + "name": "wp-cli/mustangostang-spyc", + "version": "0.6.6", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/spyc.git", + "reference": "30f25baaaba939caaff1f4b8c7ed998632f59fe2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/spyc/zipball/30f25baaaba939caaff1f4b8c7ed998632f59fe2", + "reference": "30f25baaaba939caaff1f4b8c7ed998632f59fe2", + "shasum": "" + }, + "require": { + "php": ">=5.3.1" + }, + "require-dev": { + "phpunit/phpunit": "4.3.*@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.5.x-dev" + } + }, + "autoload": { + "files": [ + "includes/functions.php" + ], + "psr-4": { + "Mustangostang\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "mustangostang", + "email": "vlad.andersen@gmail.com" + } + ], + "description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)", + "homepage": "https://github.com/mustangostang/spyc/", + "support": { + "source": "https://github.com/wp-cli/spyc/tree/0.6.6" + }, + "time": "2026-03-12T12:30:41+00:00" + }, + { + "name": "wp-cli/php-cli-tools", + "version": "v0.12.9", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/php-cli-tools.git", + "reference": "c3d25138ce46a66647ec0dc9b17bf300338494aa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/c3d25138ce46a66647ec0dc9b17bf300338494aa", + "reference": "c3d25138ce46a66647ec0dc9b17bf300338494aa", + "shasum": "" + }, + "require": { + "php": ">= 7.2.24" + }, + "require-dev": { + "roave/security-advisories": "dev-latest", + "wp-cli/wp-cli-tests": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.12.x-dev" + } + }, + "autoload": { + "files": [ + "lib/cli/cli.php" + ], + "psr-0": { + "cli": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Bachhuber", + "email": "daniel@handbuilt.co", + "role": "Maintainer" + }, + { + "name": "James Logsdon", + "email": "jlogsdon@php.net", + "role": "Developer" + } + ], + "description": "Console utilities for PHP", + "homepage": "http://github.com/wp-cli/php-cli-tools", + "keywords": [ + "cli", + "console" + ], + "support": { + "issues": "https://github.com/wp-cli/php-cli-tools/issues", + "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.12.9" + }, + "time": "2026-03-29T11:12:54+00:00" + }, + { + "name": "wp-cli/wp-cli", + "version": "v2.12.0", + "source": { + "type": "git", + "url": "https://github.com/wp-cli/wp-cli.git", + "reference": "03d30d4138d12b4bffd8b507b82e56e129e0523f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/03d30d4138d12b4bffd8b507b82e56e129e0523f", + "reference": "03d30d4138d12b4bffd8b507b82e56e129e0523f", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": "^5.6 || ^7.0 || ^8.0", + "symfony/finder": ">2.7", + "wp-cli/mustache": "^2.14.99", + "wp-cli/mustangostang-spyc": "^0.6.3", + "wp-cli/php-cli-tools": "~0.12.4" + }, + "require-dev": { + "wp-cli/db-command": "^1.3 || ^2", + "wp-cli/entity-command": "^1.2 || ^2", + "wp-cli/extension-command": "^1.1 || ^2", + "wp-cli/package-command": "^1 || ^2", + "wp-cli/wp-cli-tests": "^4.3.10" + }, + "suggest": { + "ext-readline": "Include for a better --prompt implementation", + "ext-zip": "Needed to support extraction of ZIP archives when doing downloads or updates" + }, + "bin": [ + "bin/wp", + "bin/wp.bat" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.12.x-dev" + } + }, + "autoload": { + "psr-0": { + "WP_CLI\\": "php/" + }, + "classmap": [ + "php/class-wp-cli.php", + "php/class-wp-cli-command.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WP-CLI framework", + "homepage": "https://wp-cli.org", + "keywords": [ + "cli", + "wordpress" + ], + "support": { + "docs": "https://make.wordpress.org/cli/handbook/", + "issues": "https://github.com/wp-cli/wp-cli/issues", + "source": "https://github.com/wp-cli/wp-cli" + }, + "time": "2025-05-07T01:16:12+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.4" + }, + "platform-dev": {}, + "plugin-api-version": "2.9.0" +} diff --git a/package.json b/package.json index 4f5bc7a..1c3d354 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,10 @@ "build": "tsc -p tsconfig.json", "browsers:install": "playwright install chromium", "dev": "tsx src/cli.ts", - "docs:build": "npm run build --prefix website", - "docs:dev": "npm run start --prefix website", - "docs:serve": "npm run serve --prefix website", + "check-docs": "node -e \"const fs=require('fs');if(!fs.existsSync('website/node_modules')){console.error('\\x1b[31mError: Please run \\x1b[33mnpm install --prefix website\\x1b[31m first.\\x1b[0m');process.exit(1)}\"", + "docs:build": "npm run check-docs && npm run build --prefix website", + "docs:dev": "npm run check-docs && npm run start --prefix website", + "docs:serve": "npm run check-docs && npm run serve --prefix website", "test": "vitest run", "typecheck": "tsc -p tsconfig.json --noEmit" }, diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.ts index c21cb9c..ad32de4 100644 --- a/website/docusaurus.config.ts +++ b/website/docusaurus.config.ts @@ -65,6 +65,10 @@ const config: Config = { position: "left", label: "Docs" }, + { + type: "custom-installMethod", + position: "right" + }, { href: "https://github.com/f/pressship", label: "GitHub", diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsx index 8342195..650dfaf 100644 --- a/website/src/pages/index.tsx +++ b/website/src/pages/index.tsx @@ -1,5 +1,6 @@ import { useEffect, useState, useCallback, type ReactNode } from "react"; import Link from "@docusaurus/Link"; +import { useInstallMethod, type InstallMethod } from "@site/src/theme/Root"; import useBaseUrl from "@docusaurus/useBaseUrl"; import Layout from "@theme/Layout"; import Heading from "@theme/Heading"; @@ -27,9 +28,9 @@ type Block = { output: ReactNode; }; -const session: Block[] = [ +const getSession = (prefix: string): Block[] => [ { - command: "npx pressship status ./my-plugin", + command: `${prefix} status ./my-plugin`, output: ( <> slug @@ -44,7 +45,7 @@ const session: Block[] = [ ) }, { - command: "npx pressship pack ./my-plugin", + command: `${prefix} pack ./my-plugin`, output: ( <> readme.txt @@ -59,7 +60,7 @@ const session: Block[] = [ ) }, { - command: "npx pressship publish ./my-plugin", + command: `${prefix} publish ./my-plugin`, output: ( <> Detected @@ -75,30 +76,30 @@ const session: Block[] = [ } ]; -const workflow = [ +const getWorkflow = (prefix: string) => [ { icon: faMagnifyingGlassChart, title: "Inspect", description: "Read local plugin metadata and WordPress.org review state at a glance.", - command: "npx pressship info ./my-plugin" + command: `${prefix} info ./my-plugin` }, { icon: faBoxArchive, title: "Package", description: "Validate readme.txt, run Plugin Check, build an installable zip.", - command: "npx pressship pack ./my-plugin" + command: `${prefix} pack ./my-plugin` }, { icon: faCloudArrowUp, title: "Publish", description: "Route to new submission, pending reupload, or SVN release with setup checks.", - command: "npx pressship publish ./my-plugin" + command: `${prefix} publish ./my-plugin` }, { icon: faPlay, title: "Demo", description: "Boot the plugin in WordPress Playground using its own requirements.", - command: "npx pressship demo ./my-plugin" + command: `${prefix} demo ./my-plugin` } ]; @@ -230,8 +231,10 @@ function commandDocPath(name: string): string { return name; } + function InstallStrip(): ReactNode { - const [active, setActive] = useState(0); + const { method, setMethod } = useInstallMethod(); + const active = installMethods.findIndex((m) => m.label === method) === -1 ? 0 : installMethods.findIndex((m) => m.label === method); const [copiedInstall, setCopiedInstall] = useState(false); const copyInstall = useCallback(async () => { @@ -254,7 +257,7 @@ function InstallStrip(): ReactNode { role="tab" aria-selected={i === active} className={`${styles.installTab} ${i === active ? styles.installTabActive : ""}`} - onClick={() => setActive(i)}> + onClick={() => setMethod(installMethods[i].label as InstallMethod)}> {method.label} ))} @@ -279,6 +282,7 @@ export default function Home(): ReactNode { const logoDarkUrl = useBaseUrl("/img/pressship-square-dark.png"); const filigranLogoUrl = useBaseUrl("/img/pressship-square-dark.png"); const [copied, setCopied] = useState(false); + const { method, prefix } = useInstallMethod(); const copySkill = async () => { try { @@ -290,6 +294,9 @@ export default function Home(): ReactNode { } }; + const currentSession = getSession(prefix); + const currentWorkflow = getWorkflow(prefix); + return (
- {session.map((block, index) => ( + {currentSession.map((block, index) => (
$ {block.command}
{block.output}
- {index < session.length - 1 &&
} + {index < currentSession.length - 1 &&
}
))}
@@ -414,7 +421,7 @@ export default function Home(): ReactNode {
    - {workflow.map((step, index) => ( + {currentWorkflow.map((step, index) => (