buildozer icon indicating copy to clipboard operation
buildozer copied to clipboard

RFC: Feature/asset versioning

Open JanDC opened this issue 5 years ago • 0 comments

Q A
Branch? feature/asset-versioning -> master
Bug fix? no
New feature? yes
Deprecations? no, optional superset of current features
Passes tests? Yes, current and new tests (versioned subtasks are not yet covered)
Additional dependencies? Yes, 'hasha' to simplify file hashing

This PR consists of a first draft of generating versioned assets in buildozer. This feature works as such:

  • Addition of optional 'manifest_source' entry in root config:
    • Relative path to the dest_base_path, pointing to the assets being versioned
    • Defaults to the dest_base_path entry
  • Addition of optional 'manifest' entry in root config, which can be a:
    • string value: location of the manifest file, relative to the provided manifest_source (or dest_base_path when the former is ommitted). I.e. './dist/manifest.json'
    • A list of subtasks: a list of manifest locations, indexed by subtask. The manifest will be placed relative to the subtask's 'dest' location. I.e. css: './manifest.json'
  • Versions are based on file hashes and should remain unchanged if no content has changed.
  • if the 'manifest' entry is missing, no versioning will occur. A config with solely a manifest_source will not result in any changes in output.
  • This feature is completely optional, current projects shouldn't be affected by the changes in this PR.

Notes:

  • The versioned assets are copies of the original, keeping the source files in place.
  • Only .js and .css will be versioned, other file types could be added should the need arise.
  • Versioning will only occur on builds, not when runnning the watch task.

Checklist

  • [x] First draft
  • [x] Tests
  • [ ] Documentation
  • [ ] Integration in watch tasks
  • [ ] Peer review :smiley:

JanDC avatar Jan 26 '21 19:01 JanDC