PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, January 21, 2022

[FIXED] Is it possible to use composer's archive feature to compress a project locally?

 January 21, 2022     bitbucket, bitbucket-pipelines, composer-php, php     No comments   

Issue

Is it possible to use composer's archive feature to compress a project locally (similar to using zip)? For instance, I tried composer archive my-repo/project --format=zip --file test-archive. It worked in the sense that it created a zip file called test-archive, but composer did it by first going to my satis repo and pulling down a copy of the project.

I also have this defined in my composer.json

"archive": {
        "exclude": [
            ".*",
            "!.gitignore",
            "node_modules/",
            "vendor/",
            "www/",
            "composer/",
            "*.lst",
            "*.yml"
        ]
    }

What I'm trying to do is use the archive feature as part of a bitbucket pipelines build process. The goal is to compress the project files (excluding some) and pass them to the Downloads page for the bitbucket repo. I have a working step using zip, but archive uses a better syntax for excluding files.


Solution

Ok - now I feel a little silly, but since someone kindly upvoted the question, I'll answer it. The documentation was slightly confusing to me. Composer doesn't actually need my-repo/project to compress the file correctly. So if you do composer archive --format=zip --file test-archive it will compress in place at the root of your project.



Answered By - aberkow
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing