Skip to content
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

Updating Kitto static assets #39

Closed
zorbash opened this issue Nov 26, 2016 · 10 comments
Closed

Updating Kitto static assets #39

zorbash opened this issue Nov 26, 2016 · 10 comments
Milestone

Comments

@zorbash
Copy link
Member

zorbash commented Nov 26, 2016

The installer generates a few files (see: https://github.com/kittoframework/kitto/tree/master/installer/templates/new/assets/javascripts) which are required by all widgets. There has to be a simple way for the user to get the latest version of those assets.

@davejlong
Copy link
Member

davejlong commented Nov 26, 2016 via email

@JanStevens
Copy link
Contributor

Sounds like a good idea, preferable the application.js file only contains imports to other files (so it never needs to be overwritten). The template could then only import the npm module.

Then they never need to update their application.js

@zorbash
Copy link
Member Author

zorbash commented Dec 20, 2016

Sorry for taking so long to respond to this one.

I think we should split the current application.js in two files.

On containing the Kitto core functionality (https://github.com/kittoframework/kitto/blob/master/installer/templates/new/assets/javascripts/application.js#L3:L63)

and keep generating an application.js containing:

import '../stylesheets/application.scss';
import 'kitto';

// This file acts as a manifest to require your dependencies but you may also
// place code specific to you dashboard.

The only reason I didn't initially follow the above practice is to keep compatibility with nodejs version <= 5.0.

You need node >= 5.0 to define local dependencies like:

// File: package.json in a dashboard app
"dependencies": {
  "kitto": "file:deps/kitto"
}

and have a package.json in Kitto like:

// File: package.json of Kitto
"main": "./priv/static/kitto.js"

Which is what phoenix does to package and update its static js assets.

@davejlong
Copy link
Member

What if we packaged the kitto JS and SCSS as an NPM package? Would that allow us to still support Node v4 LTS?

@zorbash
Copy link
Member Author

zorbash commented Dec 20, 2016

@davejlong right but then the user would have to update both mix and npm dependencies to be up-to-date.

My thoughs are, judging from the release plan of nodejs

node-releases

v4 is to be considered LTS till Apr.2017 and it's also the packaged version in Debian Stretch, same applies to Debian derivatives (Ubuntu, Mint, ..).

So, dropping support for nodejs 4 seems like a bold move. Phoenix already chose this direction so I feel we can afford to do so now that it's still early (we haven't reached an 1.0 version).

@davejlong
Copy link
Member

Looking at the expected developer base for Kitto, I think dropping v4 support would be fine. I would expect that we have 2 types of developers currently: JS devs and Elixir devs. JS devs will have enough understanding of JS to know how to run v5+ and Elixir devs will already be used to it given that Phoenix is so prominent.

@mackenza
Copy link
Contributor

isn't this loading of local dependencies an NPM >= 2.x thing rather than a Node >= 5.x thing?

https://docs.npmjs.com/files/package.json#local-paths or am I not understanding the issue?

@zorbash
Copy link
Member Author

zorbash commented Dec 24, 2016

@mackenza Your observation seems valid. I think that most people though, get npm packaged with their nodejs installation. So nodejs@4.6.1 seems to package npm@2.15.9

Debian though (my Linux distro of preference) has npm as a separate package at version 1.4.21, where local dependencies aren't supported. I was led to believe (:alien:) it's a nodejs@4_x issue and a higher version is required.

I'd be great if we can move with this issue without dropping support for some nodejs versions but rather specify the required npm version.

@mackenza
Copy link
Contributor

while it doesn't surprise me that Debian ships NPM 1.x (sigh), it's definitely not the norm. There is certainly no problem with separating Node version requirements from NPM as NPM is not even the only Node package manager in town anymore (yarn.

My recommendation is we do as per above and simply state that NPM >= 2 or a package manager capable to local dependencies is required.

@zorbash zorbash added this to the 0.5.0 milestone Jan 13, 2017
@zorbash
Copy link
Member Author

zorbash commented Feb 19, 2017

I just released 0.5.0 which now packages kitto.js, widget.js and helpers.js.
A user now with each kitto hex package update can also get the changes of the core JavaScript assets by running npm install.

@zorbash zorbash closed this as completed Feb 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants