Skip to content

Composer install includes test/dev files that aren't needed #141

Description

@csemazharul

What happens

When I install this package with Composer, my vendor/ folder gets a bunch of files that aren't used at runtime:

  • tests/
  • bin/
  • Makefile
  • phpunit.xml
  • .phpcs.xml
  • .circleci/
  • .github/
  • composer.lock

The library only needs classes/ (autoloaded), wp-background-processing.php, composer.json, and license.txt.

Why it happens

The repo has no .gitattributes. Packagist builds the download from git archive, which includes every tracked file — so dev files come along too.

How to fix

Add a .gitattributes that marks dev files as export-ignore. Then Composer downloads only the runtime files.

Example:

/tests          export-ignore
/bin            export-ignore
/Makefile       export-ignore
/phpunit.xml    export-ignore
/.phpcs.xml     export-ignore
/.circleci      export-ignore
/.github        export-ignore
/composer.lock  export-ignore

I tested this locally and the install shrinks to just the runtime files. Glad to send a PR if helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions