Skip to content

Instantly share code, notes, and snippets.

@twolfson
Last active November 22, 2015 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twolfson/d303342301cd7a1c0b4b to your computer and use it in GitHub Desktop.
Save twolfson/d303342301cd7a1c0b4b to your computer and use it in GitHub Desktop.
spritesmith vinyl and streams game plan

We feel like it's time to clean up some more technical debt in spritesmith. Here are the tasks we want to take care of:

Phase 1 - Clean up distractions 🚿

  • Add foundry
  • Update all package.json to use node>=0.10.0
  • Update all Travis CI to use node>=0.10.0
    • grunt-spritesmith
    • gulp.spritesmith
    • spritesmith
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
  • Add deprecation notice to pngsmith and remove it from any READMEs

Phase 1.5 - Clean up code-based distractions 📝

  • Add twolfson-style to each part of our system
    • grunt-spritesmith
    • gulp.spritesmith
    • spritesmith
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
  • Clean up technical debt (e.g. sloppy exec, undesired sync calls, usage of shell-quote)
  • Get rid of exporters logic -- it is unnecessary -_-;;
    • grunt-spritesmith
    • gulp.spritesmith
    • spritesmith
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
  • Evaluate and clean up READMEs
    • grunt-spritesmith
    • gulp.spritesmith
    • spritesmith
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
  • Go back and fix up spritesmith-engine-test as well -_-;;
    • foundry
    • twolfson-style
    • README
    • Travis CI/node version?
    • Maybe break down jpeg and png tests into their own sets?
    • Also pull over gif tests from pixelsmith?
    • Break up repo into -spec and -test repos (don't forget to release -spec)
  • Document -spec in all READMEs
    • grunt-spritesmith
    • gulp.spritesmith
    • spritesmith
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
  • Add newsletter to spritesmith family

Phase 1.6 - Add spec assertion to spritesmith 🎱

  • Add specVersion assertion to -test repo
  • Add specVersion/upgrade -test to each engine in patch release
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
  • Add specVersion assertion to spritesmith in minor release
  • Upgrade to latest spritesmith in grunt-/gulp.
  • Document spritesmith-engine keyword in -spec
  • Add spritesmith-engine to all engines
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith

Phase 2.0a - Update spec to be less hackish around engine settings ♻️

  • Update -spec to use constructor for Engine (and maybe Canvas)
  • Transition engines to using new -spec variation
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
    • -test
    • spritesmith
  • Update documentation on engines to state new spec version
    • grunt-spritesmith
    • gulp.spritesmith
    • spritesmith
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
    • -spec
    • -test

Phase 2.0b - Add streaming output ✨

  • Move all spritesmith engine to use stream as output
    • Allows for faster writes to disk
    • Gets off of our original binary string hack
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
    • -spec
    • -test
    • spritesmith (move to buffer only via concat-stream for now -- see 2.1 for future notes)
    • gulp.
    • grunt-

Phase 2.0c - Add vinyl as input 🔨

  • Update all engines to accept either filepath or vinyl
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
    • -spec
    • -test
    • spritesmith (need to see how cross/compatible we can handle paths vs vinyl)
    • gulp. (move to always pass vinyl through)
    • grunt- (always pass through filepaths -- can't make assumptions about content as received on other side -- maybe we could always do null?)
  • Document in each engine's README about what they support from vinyl (e.g. require filepath vs choose filepath, buffer, or stream)
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
    • spritesmith
    • gulp. (document read: false?)
    • grunt-
  • Add console.warn to each engine when we encounter a vinyl file with extra buffer/stream when we only need filepath
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
  • Build spritesmith-engine-base or spritesmith-engine-util repo (prob the latter) so we can get format coercion for jpg and get grunt- passing
    • Wound up using vinyl-file and one-offs for each engine but have unifying test
  • Update -spec with note about -base/-util
  • Probably re-use spritesmith-engine-util for String -> vinyl coercion but need to see if spritesmith needs raw names or notes
    • Be sure to use options provided by engine (e.g. buffer: null)
    • Wound up using vinyl-file

Phase 2.0d - Ship all the things :shipit:

  • Remove git+ssh URLs from all repos (I think only spritesmith had these)
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
    • -spec
    • -test
    • spritesmith
    • gulp.
    • grunt-
  • Remove all TODOs
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
    • -spec
    • -test
    • spritesmith
    • gulp.
    • grunt-
  • Review diffs of all repos
    • pixelsmith
    • gmsmith
    • phantomjssmith
    • canvassmith
    • -spec
    • -test
    • spritesmith
    • gulp.
    • grunt-
  • Document breaking changes in grunt-, gulp., and spritesmith
    • spritesmith is buffer callback (not binary string)
    • gulp. people should be aware of buffer: null or whatever the syntax is
    • All should have "Upgrade to v2 spec" as a major heading
  • Publish -spec and -test
  • Upgrade -test in each of the engines and verify Travis CI passes
  • Publish engines
  • Upgrade engines in spritesmith and publish
  • Upgrade spritesmith in grunt- and gulp. and publish

Phase 2.1 - Update spritesmith to leverage streams ▶️

  • To properly leverage streams, we are going to need to either: break down spritesmith into reusable parts or move the retina logic into spritesmith (leaning towards the latter)
  • Without streams, we will have a chance of opening a disk stream without knowing if retina images properly correlate
  • Move to returning object with streams on it
    • spritesmith
    • gulp.
    • grunt-
  • Ship all the libraries

Bonus

  • Define a keyword for spritesmith-engine and document it
  • Relocate engineOpts from a singleton pattern to part of the engine constructor
    • Actually, that's terrible for instanceof and what not -- Maybe expose gmsmith.gm and gmsmith.im with gmsmith being same but autoinvokes the right one
  • Remove png fallback from all engines
    • Deciding not to since it complicates logic in spritesmith
  • If we create a util repo, then maybe define default format there?
    • We have decided to not create this repo for now
  • Remove exporters coercion from all engines -- we should define only jpeg, gif, and png in our specification and perform normalization within spritesmith
    • We have chosen to allow jpg as a one-off in each repo for now
  • Update save-pixels to use latest release with options.quality support
    • Deferring for now -- almost burned out on spritesmith
  • Close twolfson/gulp.spritesmith#53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment