p2-theme-core icon indicating copy to clipboard operation
p2-theme-core copied to clipboard

Reduce dependencies initiative

Open EvanLovely opened this issue 8 years ago • 2 comments

I'd like to get less dependencies in so we can have quicker npm installs. We can look for tasks that can be done with vanilla JS that don't need a plugin and also look for dependencies that our dependencies pull in that can be used. Here's a few ideas:

  • [ ] del - Used for clean tasks; couldn't we just rm -rf?
  • [ ] gulp-cached - Used for only validating files that have changed. Gulp 4 now let's use a since option in gulp.src that can be coupled with gulp.lastRun that should be able to do this.
  • [ ] gulp-flatten - We should be able to use this approach.
  • [ ] gulp-if - Could we just use if? I know this helps mid-pipe, but still...
  • [ ] Using both gulp-sass and gulp-postcss - Could we get just PostCSS?
  • [x] ~~js-yaml - Used just for our config parsing; I already want to move our config over to js files.~~ Nevermind: we need it for parsing the Pattern Lab config file.
  • [ ] lodash - Used to help us in pre-ES6 land when we supported node v0.12. We should be able to get rid of all of our uses of it. I know that our icons templates use lodash as a templating, so we couldn't completely drop it until the next major version, but we could get everything else out.
  • [ ] Using both node-notifier and gulp-notifier? Let's consolidate.

Additionally, I'd like to move more towards plain node & JS and less gulp. I still think gulp is fantastic for the command line execution of tasks and all of it's watches, but those commands just fire functions, so we shouldn't need to abstract them away unless there's a benefit. One benefit is the use of in-memory streams via .pipe() for multiple transformation of files; like CSS and JS.

EvanLovely avatar Oct 06 '16 19:10 EvanLovely

Avoid she'll commands for filesystem, node.js fs package helps with portability.

You could potentially use vinyl directly for memory filesystem, but at that point you're creating your own lightweight task runner.

grayside avatar Oct 09 '16 22:10 grayside

Regarding removing lodash... You could always just include a subset of this dependency such as https://www.npmjs.com/package/lodash.templatesettings.

I'm personally a fan of including something like lodash, because while you can always write stuff yourself, it can make your own code cleaner to use something like lodash instead.

Having said that, I'm just trying to contribute.

RedLucas avatar Jun 06 '17 21:06 RedLucas