These are chat archives for stealjs/steal

17th
Jul 2015
Matthew Phillips
@matthewp
Jul 17 2015 00:06
Hello
Paulius
@paulius005
Jul 17 2015 00:24
Hey, we were at the done.js meetup and asked about steal.js upgrading. Basically we upgraded to the latest steal, and had to upgrade funcunit (from v1.0.0), after getting rid of all the .thens and getting most of the dependencies to work, when running tests we get GET http://localhost:8000/syn.js 404 (Not Found) I've went up and down the stack traces and haven't found anything that useful other than that it can't seem to import the library from a require. I've put in debugger anywhere where funcunit has var syn = require("syn"); but they never seem to be hit. After looking under 'sources' in dev console I noticed that the folder for funcunit doesn't actually show up, it has all the normal folders: can, jquery, steal, and then instead of funcunit, it's funcunit/node_modules/...qunit, so I think that funcunit isn't being loaded but I have no idea why
Any ideas?
Justin Meyer
@justinbmeyer
Jul 17 2015 15:43
@paulius005 so you are importing FuncUnit, which should be importing syn, but it's not working
what do you mean by instead of " funcunit, it's funcunit/node_modules/...qunit"
could you take a screen shot of your node_modules folder expanded? maybe include funcunit's node_module folder too?
Matthew Phillips
@matthewp
Jul 17 2015 16:25
@paulius005 you need to set the path for syn
FuncUnit doesn't include it internally any more
Justin Meyer
@justinbmeyer
Jul 17 2015 16:37
@matthewp but it is a dependency right?
and it seems like he is using npm
Matthew Phillips
@matthewp
Jul 17 2015 16:43
I think he's upgrading from a stealconfig.js
so he needs to set the path to syn.js and it should work
Paulius
@paulius005
Jul 17 2015 17:11
Screen Shot 2015-07-17 at 10.08.48 AM.png
I am updating from a stealconfig.js. Resolved the syn.js dependency issue, apparently it needed to be added our stealconfig.js. Got most of our other modules to work as well, by modifying our paths. Here is the screenshot of what I was talking about
before the update, if would be just funcunit/
No debuggers are being hit inside of funcunit.js or in dist/funcunit.js
So it doesn
t seem to be running, even though we import it in nearly all of our tests
Paulius
@paulius005
Jul 17 2015 17:17
Currently working on not getting any 404's on all of our less files, once there is no more 404's then I'm going to see why the tests still aren't starting. Very unclear to me why the tests wouldn't start running now, unless we're still somehow importing funcunit incorrectly
Do hashbangs have to go after .mustache files as well as .less files?
Matthew Phillips
@matthewp
Jul 17 2015 17:31
yes, any plugin
Paulius
@paulius005
Jul 17 2015 17:53
I should have really read your message before I started working this morning, lol, woulda saved me at least a half hour
Matthew Phillips
@matthewp
Jul 17 2015 17:54
heh, no problem
Paulius
@paulius005
Jul 17 2015 18:00
If lessfiles are not found, would funcunit consider the modules broken and not run the tests for them?
Matthew Phillips
@matthewp
Jul 17 2015 18:03
yes, if the app doesn't load then it won't run the tests
you should fix all of the import problems first
saireddy
@saireddy
Jul 17 2015 18:33
Hi @matthewp , we(paulius005) are working on migrating to new stealJs, we talked briefly about this at DoneJS meetup
the problem we are facing currently is we have a lot of .then() which we are not sure how to refactor
in migration doc we see "If you need a module to load before loading another, specify this with deps inside of the meta configuration for that module." what does it mean?
Justin Meyer
@justinbmeyer
Jul 17 2015 18:34
if you authored the modules, add their dependencies to the file themselves
if you didn't author the module (something like a 3rd party jquery plugin), add to meta: {moduleName: {deps: ["jquery", ...]}}
saireddy
@saireddy
Jul 17 2015 18:36

for example: ```// ** Application entry point ** //
steal('can', 'brightroll/can/polyfills.js', 'brx/features', 'brightroll/events.js').
then(function () {
'use strict';
var params = can.route.deparam(window.location.search.substr(1));
var channel = params.channel;
var roles = window.auth.all_roles;
if (roles.indexOf('Console:alpha') !== -1 && channel) {
// Allow alpha users to switch channels
window.auth.all_roles = roles = roles.filter(function (element) {
return element !== 'Console:alpha' && element !== 'Console:beta';
});

if (channel === 'beta') {
  roles.push('Console:beta');
}
if (channel === 'alpha') {
  roles.push('Console:alpha');
}

}
Brx.features = new Brx.Features(roles, window.optInFeatures);
}).
then(
'can/view/ejs',
'steal/less',
'canui/fills',
'analytics.js',
'brx/helpers/polyfills.js',
'brightroll/helpers/mustache.js',
'accounting.js',
'lodash.js',
'rollbar.js',
'vendor/es6-shim.js'
).
then(
development ? 'brx/styles/brx_dev.less' : 'brx/styles/brx.less',
'styleguide'
).
then(
'brx/views/layout.mustache',
'brx/views/shortcuts/help.mustache',
'brightroll',
'brightroll/ajax_errors',
'brightroll/unsaved_changes_warnings',
'brightroll/tooltips',
'brightroll/helpers/user_prefs.js',
'brx/models',
'brightroll/localizer.js',
'locales/default.js',
'brightroll/shortcuts.js'
).
/ eslint-disable spaced-line-comment /
//!steal-remove-start
then('brx/fixtures').
//!steal-remove-end
/ eslint-enable spaced-line-comment /
then(setupLocalization).
then(setupAnalytics).
then('brx/controls').
then('brx/controls/shared').
then(checkAuth).
then('brx/router.js').
then(steal.isRhino ? launch : prefetchAndLaunch);
```

Justin Meyer
@justinbmeyer
Jul 17 2015 18:38
With that, you would make a module named something like brx/features
Paulius
@paulius005
Jul 17 2015 18:38
As you can see out whole app depends on these .then statements, some of them being just functions. (we got rid of most of them from our independent modules, but this is the core of the app), there's not other way to get rid of all of these other than to go through each file and make sure that it has the deps that are .thened?
Justin Meyer
@justinbmeyer
Jul 17 2015 18:38
yes
that's is what should be done
move those functions into a module
and make everything depend on them
or you can simplify it somewhat by having a "core" module that depends on those modules, canjs / etc
and everything imports that "core" module
saireddy
@saireddy
Jul 17 2015 18:42
thanks @justinbmeyer we are going to give it a shot after lunch
Justin Meyer
@justinbmeyer
Jul 17 2015 18:43
I've gone through this process on a few apps (.then was discouraged for JMVC 3.3). The process sucks, but is mostly straightforward
took me a day or two on some pretty huge apps
and it results in every module having well defined dependencies
which helped me identify some code that wasn't being used anymore
so well worth it in the end
makes things a lot easier to test
Matthew Phillips
@matthewp
Jul 17 2015 18:46
you might think about using the npm plugin while you're going through the trouble of upgrading, a lot of new things we are working on will be published in npm
you can get rid of most of your config if you do so
the way i'd do it is
get everything working with the stealconfig.js and then switch to the npm plugin
then over time you can get rid of the config entirely
Paulius
@paulius005
Jul 17 2015 19:53
Yeah, we are rethinking how we're gonna do this upgrade. It makes more sense for us to get rid of most of the .then statements (especially in the code that we just showed you) with old steal, to make sure everything is working and only then upgrade, then get rid of most of our config?
no question mark*