{"id":28619598,"url":"https://github.com/wp-cli/scaffold-package-command","last_synced_at":"2025-06-12T04:40:35.067Z","repository":{"id":51739341,"uuid":"53449635","full_name":"wp-cli/scaffold-package-command","owner":"wp-cli","description":"Scaffolds WP-CLI commands with functional tests, full README.md, and more.","archived":false,"fork":false,"pushed_at":"2025-05-13T09:08:06.000Z","size":1092,"stargazers_count":69,"open_issues_count":10,"forks_count":20,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-06-11T21:00:00.250Z","etag":null,"topics":["cli","hacktoberfest","package","scaffold","template","wordpress","wp-cli","wp-cli-package"],"latest_commit_sha":null,"homepage":null,"language":"Gherkin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-cli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-08T22:24:29.000Z","updated_at":"2025-05-13T09:08:09.000Z","dependencies_parsed_at":"2024-01-11T19:07:19.948Z","dependency_job_id":"a692341f-16d9-46ad-befc-546be195c68f","html_url":"https://github.com/wp-cli/scaffold-package-command","commit_stats":{"total_commits":329,"total_committers":19,"mean_commits":17.31578947368421,"dds":"0.47112462006079026","last_synced_commit":"d2b350c6ae7a15e5a26b29dd504ba58cae4b2ed2"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/wp-cli/scaffold-package-command","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fscaffold-package-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fscaffold-package-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fscaffold-package-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fscaffold-package-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-cli","download_url":"https://codeload.github.com/wp-cli/scaffold-package-command/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fscaffold-package-command/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259400347,"owners_count":22851795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","hacktoberfest","package","scaffold","template","wordpress","wp-cli","wp-cli-package"],"created_at":"2025-06-12T04:40:34.385Z","updated_at":"2025-06-12T04:40:35.051Z","avatar_url":"https://github.com/wp-cli.png","language":"Gherkin","readme":"wp-cli/scaffold-package-command\n===============================\n\nScaffolds WP-CLI commands with functional tests, full README.md, and more.\n\n[![Testing](https://github.com/wp-cli/scaffold-package-command/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/scaffold-package-command/actions/workflows/testing.yml) [![CircleCI](https://circleci.com/gh/wp-cli/scaffold-package-command/tree/main.svg?style=svg)](https://circleci.com/gh/wp-cli/scaffold-package-command/tree/main)\n\nQuick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)\n\n## Using\n\nThis package implements the following commands:\n\n### wp scaffold package\n\nGenerate the files needed for a basic WP-CLI command.\n\n~~~\nwp scaffold package \u003cname\u003e [--description=\u003cdescription\u003e] [--homepage=\u003chomepage\u003e] [--dir=\u003cdir\u003e] [--license=\u003clicense\u003e] [--require_wp_cli=\u003cversion\u003e] [--require_wp_cli_tests=\u003cversion\u003e] [--skip-tests] [--skip-readme] [--skip-github] [--skip-install] [--force]\n~~~\n\nDefault behavior is to create the following files:\n- command.php\n- composer.json (with package name, description, and license)\n- .gitignore, .editorconfig, and .distignore\n- README.md (via wp scaffold package-readme)\n- Test harness (via wp scaffold package-tests)\n\nUnless specified with `--dir=\u003cdir\u003e`, the command package is placed in the\nWP-CLI `packages/local/` directory.\n\n**OPTIONS**\n\n\t\u003cname\u003e\n\t\tName for the new package. Expects \u003cauthor\u003e/\u003cpackage\u003e (e.g. 'wp-cli/scaffold-package').\n\n\t[--description=\u003cdescription\u003e]\n\t\tHuman-readable description for the package.\n\n\t[--homepage=\u003chomepage\u003e]\n\t\tHomepage for the package. Defaults to 'https://github.com/\u003cname\u003e'\n\n\t[--dir=\u003cdir\u003e]\n\t\tSpecify a destination directory for the command. Defaults to WP-CLI's `packages/local/` directory.\n\n\t[--license=\u003clicense\u003e]\n\t\tLicense for the package.\n\t\t---\n\t\tdefault: MIT\n\t\t---\n\n\t[--require_wp_cli=\u003cversion\u003e]\n\t\tRequired WP-CLI version for the package.\n\t\t---\n\t\tdefault: ^2.11\n\t\t---\n\n\t[--require_wp_cli_tests=\u003cversion\u003e]\n\t\tRequired WP-CLI testing framework version for the package.\n\t\t---\n\t\tdefault: ^4.3.9\n\t\t---\n\n\t[--skip-tests]\n\t\tDon't generate files for integration testing.\n\n\t[--skip-readme]\n\t\tDon't generate a README.md for the package.\n\n\t[--skip-github]\n\t\tDon't generate GitHub issue and pull request templates.\n\n\t[--skip-install]\n\t\tDon't install the package after scaffolding.\n\n\t[--force]\n\t\tOverwrite files that already exist.\n\n\n\n### wp scaffold package-tests\n\nGenerate files for writing Behat tests for your command.\n\n~~~\nwp scaffold package-tests \u003cdir\u003e [--ci=\u003cprovider\u003e] [--force]\n~~~\n\nWP-CLI makes use of a Behat-based testing framework, which you should use\ntoo. This command generates all of the files you need. Functional tests\nare an integral ingredient of high-quality, maintainable commands.\nBehat is a great choice as a testing framework because:\n\n* It’s easy to write new tests, which means they’ll actually get written.\n* The tests interface with your command in the same manner as your users\ninterface with your command, and they describe how the command is\nexpected to work in human-readable terms.\n\nBehat tests live in the `features/` directory of your project. When you\nuse this command, it will generate a default test that looks like this:\n\n```\nFeature: Test that WP-CLI loads.\n\n  Scenario: WP-CLI loads for your tests\n    Given a WP install\n\n    When I run `wp eval 'echo \"Hello world.\";'`\n    Then STDOUT should contain:\n      \"\"\"\n      Hello world.\n      \"\"\"\n```\n\nFunctional tests typically follow this pattern:\n\n* **Given** some background,\n* **When** a user performs a specific action,\n* **Then** the end result should be X (and Y and Z).\n\nView all defined Behat steps available for use with `behat -dl`:\n\n```\nGiven /^an empty directory$/\nGiven /^an empty cache/\nGiven /^an? ([^\\s]+) file:$/\nGiven /^\"([^\"]+)\" replaced with \"([^\"]+)\" in the ([^\\s]+) file$/\n```\n\nThe files generated by this command include:\n\n* `.travis.yml` is the configuration file for Travis CI.\n* `bin/install-package-tests.sh` will configure your environment to run\nthe tests.\n* `bin/test.sh` is a test runner that respects contextual Behat tags.\n* `features/load-wp-cli.feature` is a basic test to confirm WP-CLI can\nload.\n* `features/bootstrap`, `features/steps`, `features/extra` are Behat\nconfiguration files.\n\nAfter running `bin/install-package-tests.sh`, you can run the tests with\n`./vendor/bin/behat`. If you find yourself using Behat on a number of\nprojects and don't want to install a copy with each one, you can\n`composer global require behat/behat` to install Behat globally on your\nmachine. Make sure `~/.composer/vendor/bin` has also been added to your\n`$PATH`. Once you've done so, you can run the tests for a project by\ncalling `behat`.\n\nFor Travis CI, specially-named files in the package directory can be\nused to modify the generated `.travis.yml`, where `\u003ctag\u003e` is one of\n'cache', 'env', 'matrix', 'before_install', 'install', 'before_script', 'script':\n* `travis-\u003ctag\u003e.yml` - contents used for `\u003ctag\u003e:` (if present following ignored)\n* `travis-\u003ctag\u003e-append.yml` - contents appended to generated `\u003ctag\u003e:`\n\nYou can also append to the generated `.travis.yml` with the file:\n* `travis-append.yml` - contents appended to generated `.travis.yml`\n\n**ENVIRONMENT**\n\nThe `features/bootstrap/FeatureContext.php` file expects the\nWP_CLI_BIN_DIR environment variable.\n\nWP-CLI Behat framework uses Behat ~2.5, which is installed with Composer.\n\n**OPTIONS**\n\n\t\u003cdir\u003e\n\t\tDirectory path to an existing package to generate tests for.\n\n\t[--ci=\u003cprovider\u003e]\n\t\tCreate a configuration file for a specific CI provider.\n\t\t---\n\t\tdefault: travis\n\t\toptions:\n\t\t  - travis\n\t\t  - circle\n\t\t  - github\n\t\t---\n\n\t[--force]\n\t\tOverwrite files that already exist.\n\n**EXAMPLES**\n\n    # Generate files for writing Behat tests.\n    $ wp scaffold package-tests /path/to/command/dir/\n    Success: Created package test files.\n\n\n\n### wp scaffold package-readme\n\nGenerate a README.md for your command.\n\n~~~\nwp scaffold package-readme \u003cdir\u003e [--force] [--branch=\u003cbranch\u003e]\n~~~\n\nCreates a README.md with Using, Installing, and Contributing instructions\nbased on the composer.json file for your WP-CLI package. Run this command\nat the beginning of your project, and then every time your usage docs\nchange.\n\nThese command-specific docs are generated based composer.json -\u003e 'extra'\n-\u003e 'commands'. For instance, this package's composer.json includes:\n\n```\n{\n  \"name\": \"wp-cli/scaffold-package-command\",\n   // [...]\n   \"extra\": {\n       \"commands\": [\n           \"scaffold package\",\n           \"scaffold package-tests\",\n           \"scaffold package-readme\"\n       ]\n   }\n}\n```\n\nYou can also customize the rendering of README.md generally with\ncomposer.json -\u003e 'extra' -\u003e 'readme'. For example, runcommand/hook's\ncomposer.json includes:\n\n```\n{\n    \"extra\": {\n        \"commands\": [\n            \"hook\"\n        ],\n        \"readme\": {\n            \"shields\": [\n                \"[![Build Status](https://travis-ci.org/runcommand/reset-password.svg?branch=master)](https://travis-ci.org/runcommand/reset-password)\"\n            ],\n            \"sections\": [\n                \"Using\",\n                \"Installing\",\n                \"Support\"\n            ],\n            \"support\": {\n                \"body\": \"https://raw.githubusercontent.com/runcommand/runcommand-theme/master/bin/readme-partials/support-open-source.md\"\n            },\n            \"show_powered_by\": false\n        }\n    }\n}\n```\n\nIn this example:\n\n* \"shields\" supports arbitrary images as shields to display.\n* \"sections\" permits defining arbitrary sections (instead of default Using, Installing and Contributing).\n* \"support\" -\u003e \"body\" uses a remote Markdown file as the section contents. This can also be a local file path, or a string.\n* \"show_powered_by\" shows or hides the Powered By mention at the end of the readme.\n\nFor sections, \"pre\", \"body\" and \"post\" are supported. Example:\n```\n\"support\": {\n  \"pre\": \"highlight.md\",\n  \"body\": \"https://raw.githubusercontent.com/runcommand/runcommand-theme/master/bin/readme-partials/support-open-source.md\",\n  \"post\": \"This is additional text to show after main body content.\"\n},\n```\nIn this example:\n\n* \"pre\" content is pulled from local highlight.md file.\n* \"body\" content is pulled from remote URL.\n* \"post\" is a string.\n\n**OPTIONS**\n\n\t\u003cdir\u003e\n\t\tDirectory path to an existing package to generate a readme for.\n\n\t[--force]\n\t\tOverwrite the readme if it already exists.\n\n\t[--branch=\u003cbranch\u003e]\n\t\tName of default branch of the underlying repository. Defaults to master.\n\n\n\n### wp scaffold package-github\n\nGenerate GitHub configuration files for your command.\n\n~~~\nwp scaffold package-github \u003cdir\u003e [--force]\n~~~\n\nCreates a variety of files to better manage your project on GitHub. These\nfiles include:\n\n* `.github/ISSUE_TEMPLATE` - Text displayed when a user opens a new issue.\n* `.github/PULL_REQUEST_TEMPLATE` - Text displayed when a user submits a pull request.\n* `.github/settings.yml` - Configuration file for the [Probot settings app](https://probot.github.io/apps/settings/).\n\n**OPTIONS**\n\n\t\u003cdir\u003e\n\t\tDirectory path to an existing package to generate GitHub configuration for.\n\n\t[--force]\n\t\tOverwrite files that already exist.\n\n## Installing\n\nInstalling this package requires WP-CLI v2.12 or greater. Update to the latest stable release with `wp cli update`.\n\nOnce you've done so, you can install the latest stable version of this package with:\n\n```bash\nwp package install wp-cli/scaffold-package-command:@stable\n```\n\nTo install the latest development version of this package, use the following command instead:\n\n```bash\nwp package install wp-cli/scaffold-package-command:dev-main\n```\n\n## Contributing\n\nWe appreciate you taking the initiative to contribute to this project.\n\nContributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.\n\nFor a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.\n\n### Reporting a bug\n\nThink you’ve found a bug? We’d love for you to help us get it fixed.\n\nBefore you create a new issue, you should [search existing issues](https://github.com/wp-cli/scaffold-package-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.\n\nOnce you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/scaffold-package-command/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/).\n\n### Creating a pull request\n\nWant to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/scaffold-package-command/issues/new) to discuss whether the feature is a good fit for the project.\n\nOnce you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See \"[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)\" for details specific to working on this package locally.\n\n## Support\n\nGitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support\n\n\n*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Fscaffold-package-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-cli%2Fscaffold-package-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Fscaffold-package-command/lists"}