p2-theme-core
p2-theme-core copied to clipboard
Reduce dependencies initiative
I'd like to get less dependencies in so we can have quicker npm install
s. 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 forclean
tasks; couldn't we justrm -rf
? - [ ]
gulp-cached
- Used for only validating files that have changed. Gulp 4 now let's use asince
option ingulp.src
that can be coupled withgulp.lastRun
that should be able to do this. - [ ]
gulp-flatten
- We should be able to use this approach. - [ ]
gulp-if
- Could we just useif
? I know this helps mid-pipe, but still... - [ ] Using both
gulp-sass
andgulp-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
andgulp-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.
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.
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.