-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build front-end dependencies locally #755
Comments
Oh yes, NodeJS. If any, we should probably go for a PHP based solution, to avoid installing additional software to the system. I've never used any, but a quick search gave me
While it may seems like using a sledgehammer to crack a nut, both solutions can be integrated to grab front end dependencies when running |
I'd rather keep PHP & front-end dependency management a separate step, and am not too fond of declaring front-end libs within
The following sequence would be convenient:
|
It sounds good, it takes one additional step to install the dev version, but without adding a manual installation. I'll wait for @nodiscc opinion, and look into it. PS: your meme level is highly improving 👍 |
Why not use simple Otherwise BowerPHP looks like a good compromise. The process stays automatic and the dev environment stays clear of Nodejs. (btw on debian the proper installation method would be |
Mainly 'cause dependencies come with dependencies that come with dep... Hence a dependency manager ;-)
which would leave you with quite an old NPM distribution on Debian hosts, and an okay one on recent Ubuntu versions ^^ |
eww ok, I had no idea. @ArthurHoaro did you use bower for #754? (hence my question about using wget, I thought you had manually downloaded the libs). Ok for BowerPHP. |
No I didn't, that's why all dependencies appear in the diff. I'll look into it then. |
Bower clones git repos. PureCSS repo don't include a compiled version. To build it, you need npm + grunt. I think we should drop this. There is not much gain, anyway. |
npm/bower/grunt/gulp builds can be automated, but it's a bit of a pain (and downloads the whole Internet. twice. or more?) and requires a recent NodeJS distribution; I'm OK for versioning 3rd-party frontend deps as long as we have an entrypoint to easily upgrade and rebuild them (e.g. gruntfile or gulpfile) |
While I'd prefer to have front end dependencies handled by a dependency manager, my issue with this approach is that installing Shaarli from git source would then require the whole npm stack. For instance, we won't be able to use the current demo as it is hosted on a shared PHP server. |
I've been thinking about this issue and I have a few propositions. While it seems to be a good practice to do so, PureCSS is the only front dependency we have which doesn't provide a compiled/minified version within its repo. So suggestions, we keep our idea of using BowerPHP and either:
Or we go for a proper grunt build as @virtualtam suggested. This solution is cleaner, but keep in mind that it increases complexity for eventual contributors. |
We could start by introducing lint and test tools in the development process, document the installation and usage process and caveats, and eventually use it to manage frontend assets (as we did with Composer: first as a testing tool, then for production dependencies). This might change how people manage their Shaarli installation:
|
Bower is not a good idea, |
@virtualtam OK, you've convinced me. I've no experience in front end tests, but it seems interesting. As I said, it'll be a bit more complicated for people wanting to contribute to the code, but yes as you said, they're developers and likely able to install packages. I'd like @nodiscc validation. @nicolasdanelon I thought that |
Please read the following links about yarn (:
This is way we dont need to add gulp (or grunt). TL;DR Yarn (with the lock file) allow us to lock dependencies in a specific version. beyond 0.2.3 =P @ArthurHoaro |
@ArthurHoaro I've got a (very) limited experience with frontend testing, here are some useful tools I was recommended / know of / wrote Gulp tasks and Jenkins integration for:
AFAIK projects use either Grunt or Gulp to script tasks, both tools provide similar functionality and have their pros and cons:
Yarn is a package management alternative to NPM. Though it has a myriad stargazers on Github, it is still quite new to the dev scene and has limitations compared to vanilla NPM. @nicolasdanelon Does yarn provide easy integration with CI tools? I remember writing tasks to get Checkstyle or XUnit/JUnit formatted reports being quite tedious...
|
yarn is for us. yarn use the package.json file as npm. yarn.lock file will help to lock dependencies (: we avoid to use wrapped packages. take a look to the source code of every gulp or grunt plugin and you'll find out that all the plug-ins are wrappers of one, two or six thousand of npm packages. |
BTW gulp-stylelint-checkstyle is deprecated :/ |
I'm ok with either solution, but I'd prefer something that doesn't require adding third-party repositories to my APT sources.list, or installing a whole new stack of tools to build CSS/JS that we will essentially never edit/customize. Downloading prebuilt assets from upstream git repos/CDNs seems to be the simplest approach, so in the first time I think we should implement that method (keep it simple), and as @virtualtam suggested, implement a more complex approach, using a frontend dev toolchain over time (tests first, then fetching deps - if it actually has benefits for maintenance/dev?) To summarize, back to this:
So why not download prebuilt versions (from git repos/CDNs) of all frontend libs/files/dependencies introduced in https://github.com/shaarli/Shaarli/pull/754/files from upstream from the Makefile? Does this method have drawbacks ? |
@nodiscc if you want to install nodejs you can simply use https://github.com/creationix/nvm and add the version you want to your local enviroment. this will add node and npm without touch you APT sources. |
If you're going this way you might as well do it fully from the start with the following stack : Dependencies management : yarn. Faster than npm, locking dependencies, etc. Hard to find something on bower that's not on the npm directory these days anyway. Tasks are done through npm scripts. Add js & css linting to the travis jobs and you're good to go. |
Relates to shaarli#755 - move default theme assets to /assets/default - asset folders in default template are now git ignored - handle assets dependencies with yarn (and fixed version with yarn.lock) - handle assets compilation with webpack 2 JS: - use ES6 syntax - compile it with babel - minify it using babel-minify-webpack-plugin - initiate splitting JS files into separate modules (base/picwall/[todo]) - dependencies are now bundled with Shaarli's JS file (awesomplete and blazy) CSS: - move Shaarli's pure CSS to SASS - dependencies are now bundled with Shaarli's CSS file (awesomplete/purecss/fontawesome) - CSS is now minified Images: - compressed at compilation by image-webpack-loader
Relates to shaarli#755 Relates to shaarli#1072 See: - https://docs.docker.com/develop/develop-images/multistage-build/ - https://hub.docker.com/r/library/composer/ - https://github.com/composer/docker - https://github.com/docker-library/docs/tree/master/composer Signed-off-by: VirtualTam <[email protected]>
Relates to shaarli#755 - move default theme assets to /assets/default - asset folders in default template are now git ignored - handle assets dependencies with yarn (and fixed version with yarn.lock) - handle assets compilation with webpack 2 JS: - use ES6 syntax - compile it with babel - minify it using babel-minify-webpack-plugin - initiate splitting JS files into separate modules (base/picwall/[todo]) - dependencies are now bundled with Shaarli's JS file (awesomplete and blazy) CSS: - move Shaarli's pure CSS to SASS - dependencies are now bundled with Shaarli's CSS file (awesomplete/purecss/fontawesome) - CSS is now minified Images: - compressed at compilation by image-webpack-loader
TODO:
|
I've started to work on SASSLint, but it takes forever. |
Closing as resolved, thanks everyone for the feedback on JS tooling, and @ArthurHoaro for working on this! :) |
You're welcome, and yes, thanks everyone, I learnt a bunch of things in the process. :) |
This is a follow-up to #754.
@nodiscc wrote:
@ArthurHoaro wrote:
I have a mixed opinion regarding Bower:
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - sudo apt-get install -y nodejs
Nice, ain't it?
curl | sudo
... When the shell script merely adds the appropriate new APT entry and PGP key.I wrote an Ansible task a while back to automate this for Debian-based systems:
This would be easy to add to Docker images and Shaarli Wiki, but I fear users will have a hard time to get it working, whether they install Node on a global- or user-scope.
The text was updated successfully, but these errors were encountered: