bufferapp / buffer-static-upload

📁→☁️🤘 Making it easy to upload your static assets
MIT License
4 stars 4 forks source link

Remove shared directory by default or w/ flag #15

Open djfarrelly opened 5 years ago

djfarrelly commented 5 years ago

Purpose

Inspired by the discussion in this PR, we can remove the shared directory prefix to allow for cleaner manifests and easier usage. This would make the @bufferapp/static-assets library simpler and custom solutions to be cleaner as well.

Idea

Given a generated manifest:

{
  "public/js/bundle.js": "https://static.buffer.com/my-app/public/js/bundle.123456789.js"
}

It would become:

{
  "js/bundle.js": "https://static.buffer.com/my-app/js/bundle.123456789.js"
}

Since most apps are never referencing ./public in their code, it makes sense to remove it, potentially by default. To do this we could:

philippemiguet commented 5 years ago

@djfarrelly, one potential issue with this is, if someone uploads 2 files with the same name, one from the root dire ./ and the other from ./public, it will result in conflicting keys. That's a edge case those and shouldn't happen.

Usually the files in the root dir are gulp generated files. We could share a good practice to generate those files in a specific directory ./build for instance, and never upload files from the root directory :)

djfarrelly commented 5 years ago

Good call @philippemiguet, that will likely be another check we should add in a function like EnsureUniqueKeys that throws and error if there are duplicates.