johnpbloch / wordpress-core

Other
169 stars 40 forks source link

Package without wp-content #15

Closed szepeviktor closed 5 years ago

szepeviktor commented 5 years ago

Do you plan to generate a package that does not include wp-content?

https://wordpress.org/wordpress-4.9.8-no-content.zip

johnpbloch commented 5 years ago

@szepeviktor thanks for the question. To be honest I hadn't considered it. Also, after the last time I made a sweeping change to the packages I'm pretty hesitant to make changes to the repository. 😉

I haven't ever played around with Composer's support for build modifiers in version constraints either, so I'd like to see how it behaves in that regard (e.g. would *+no-content@stable work for always installing the latest release with no content?) before deciding to add this. For back-compat reasons, the standard release tags would stay the same as they are now and the no-content packages would get the +no-content build modifier.

It's an interesting idea, and one I hadn't considered before. I could probably be talked into it with more understanding of how build modifiers work with Composer's resolver.

szepeviktor commented 5 years ago

Okay @johnpbloch, I set up a test repo!

szepeviktor commented 5 years ago

It keeps installing plain-old 4.9.8

{
  "name": "szepeviktor/wordpress-core-test",
  "description": "Let's test!",
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/szepeviktor/wordpress-core.git",
      "vendor-alias": "johnpbloch"
    }
  ],
  "require": {
    "php": ">=7.0",
    "johnpbloch/wordpress-core": "4.9.8+nocontent"
  }
}

See https://github.com/szepeviktor/wordpress-core/releases

Stability is from a fixed list: https://getcomposer.org/doc/articles/versions.md#stability-constraints thus we cannot add a custom @nocontent

Do you have any idea?

szepeviktor commented 5 years ago

No success with "johnpbloch/wordpress-core": "4.9.8+nocontent !=4.9.8"

But the funny thing is it lists +nocontent as a version:

  Problem 1
    - The requested package johnpbloch/wordpress-core 4.9.8+nocontent !=4.9.8 exists as johnpbloch/wordpress-core[1.5.0, 1.5.1, ...  4.9.5, 4.9.6, 4.9.7, 4.9.8+nocontent, 4.9.x-dev, 5.0.x-dev, dev-clean, dev-master, dev-tag-1.5,
johnpbloch commented 5 years ago

Looks like Composer strips build metadata out of tags when adding versions to the repository object. Using that composer.json and running composer install -vvv I saw this:

Reading composer.json of johnpbloch/wordpress-core (4.9.8)
Reading C:/Users/johnpbloch/AppData/Local/Composer/repo/https---github.com-szepeviktor-wordpress-core.git/50323f9b91d7689d615b4af02caf9d80584b1cfc from cache
Importing tag 4.9.8 (4.9.8.0)
Reading composer.json of johnpbloch/wordpress-core (4.9.8+nocontent)
Reading C:/Users/johnpbloch/AppData/Local/Composer/repo/https---github.com-szepeviktor-wordpress-core.git/df52f392fa0b8fcc4488f924a8511f1d792a2f92 from cache
Importing tag 4.9.8+nocontent (4.9.8.0)
szepeviktor commented 5 years ago

Yes. https://github.com/composer/semver/blob/master/src/VersionParser.php#L123-L126

Does it seem that this no-content thing doesn't fit into the same repo?

vinkla commented 5 years ago

I think this would benefit most people using this package. Frameworks like Bedrock and WordPlate are using custom wp-content directories.

What can one do to help to make this feature possible?

peter-walter commented 5 years ago

@szepeviktor, You could alway add a script to your composer.json to delete the default wp-content, something like

  "scripts" : {
    "post-autoload-dump": [
      "rm -rf path/to/wp-content"
    ]
  }
szepeviktor commented 5 years ago

Thank you.

johnpbloch commented 5 years ago

I'm going to go ahead and close this. The consensus seemed to be that we couldn't make it work within this repository.

szepeviktor commented 5 years ago

@johnpbloch Okay.

Have you seen my experiment speeding up core with 10%? https://github.com/szepeviktor/wordpress-autoloaded