These are chat archives for ractivejs/ractive

24th
Sep 2017
lazylester
@lazylester
Sep 24 2017 01:43
taking my first steps with webpack+bin-loader... how is a component from a component file incorporated into a page?
Joseph
@fskreuz
Sep 24 2017 01:56
iirc, webpack looks for the component files (based on your config), then uses the loader to convert them to ES modules, which are then further processed by other things (transpiler, bundler, minifier). The end result is a JS file which you add to the page.
It's the usual transpile+concat+mangle+minify = js routine... but fancier. :grin:
Cerem Cem ASLAN
@ceremcem
Sep 24 2017 09:46
may anyone point a good resource for designing a "plugin" system (specifically for a webapp infrastructure (like Angular) which specifically uses Ractive)?
I'm simply lost here
kouts
@kouts
Sep 24 2017 10:15
what do you mean by "plugin system", can you give an example of what you're trying to achieve?
Cerem Cem ASLAN
@ceremcem
Sep 24 2017 10:58
while building https://github.com/aktos-io/scada.js, I've faced with dependency management problems. for example scada.js requires many npm modules and many git submodules, which require their own npm modules to be installed. "Install all of the dependencies whether or not you need" approach consumes a lot of setup time and affects usability in a negative way. Providing a way to select which components to use (thus which dependencies to be installed) becomes a challenge here.
as far as I know, npm does not provide a recursive/selective installation mechanizm, so I wrote a script for that: https://github.com/aktos-io/scada.js/blob/master/install-modules.sh
It simply searches for a directory that contains package.json and asks you if you want to install that modules in that package.json. but what if a dependency contains foo component that depends on barand baz component that depends on bar? That script will install bar dependency twice, which is not something we would want.
Cerem Cem ASLAN
@ceremcem
Sep 24 2017 11:06
I want to provide a plugin mechanizm so that when the user says "I need foo component", the dependency will be installed and tracked for updat.... Hmm. I need something like apt-get install?
kouts
@kouts
Sep 24 2017 11:56
Hmm I don't know much about node, I thought dependencies are managed independently for each package.
Joseph
@fskreuz
Sep 24 2017 12:48
I think the question is beyond Ractive and more of a package management issue.
Dependency management for any package manager (I know of) is an all or nothing game. If you declare it as a dependency, it will get loaded since technically you declared you need it.
Also, I don't see how something like a require or import would handle missing packages, unless there was some application-specific code that loads them dynamically instead of statically.
The closest you get to "optional packages" in npm are peer dependencies (https://nodejs.org/en/blog/npm/peer-dependencies/)
One use case I know of are QUnit plugins. They be like "Hey, I'm a QUnit plugin. But I don't have a declared dependency to QUnit. I'll depend on the QUnit you have."
Joseph
@fskreuz
Sep 24 2017 13:02
One way to go about it is to declare a package.json with scada and the select plugins you want to add, all of which have a peer dependency to scada. scada would not have a dependency to the plugins.
Joseph
@fskreuz
Sep 24 2017 13:13
Come to think of it... what you need is a scaffolding tool, not package management sorcery. http://yeoman.io/ comes into mind.
Chris Reeves
@evs-chris
Sep 24 2017 16:09
Have you tried npm link as a way to pull in plugins that exist as submodules? I think npm will handle recursive deps from linked modules too. Combine that with rollup, webpack, or browserify and you should be able to get stuff bundled into reasonable chunks.