Why does zip work differently than composer archive in pipelines?

I'm trying to understand why (and how) creating zip files which include composer's vendor directory works differently in pipelines depending on if I use `composer archive` or `zip`.

With the following `bitbucket-pipelines.yml` script, I can successfully create a zip file for my project that includes composer's vendor directory with all of its contents.

develop:
- step:
script:
- composer install --no-dev
- zip -FSr ${BITBUCKET_REPO_SLUG}-develop.zip ./ -x@exclude.lst
- curl -u ${BB_AUTH_STRING} -X POST "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"${BITBUCKET_REPO_SLUG}-develop.zip"

However, if I replace the `zip` command with 

composer archive --format=zip --file ${BITBUCKET_REPO_SLUG}-develop

the vendor directory is sometimes either not created at all in the zip file, or it is, but doesn't include any files. There doesn't seem to be any pattern as to why it includes these directories or not.

For reference, my composer.json file includes this

"archive": {
"exclude": [
".*",
"*.yml",
"node_modules/",
"www/",
"sass/",
"yarn.lock"
]
}

The exclude.lst file includes the same list but with a different syntax.

 
 
 

1 answer

1 accepted

Never mind. The key was to explicitly include the vendor directory and all its contents with 

"archive": {
"exclude": [
"!vendor/*" //etc...
]
}

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,505 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you