Incorrect version of alanning:roles getting installed from external package

When including alanning:roles, in a package, Meteor installs the wrong version?

(1) Create new meteor project
(2) Add custom package which has dependency on alanning:roles

FROM CONSOLE
Tathagats-iMac:meteor tathagatbanerjee$ meteor create errortest1
Created a new Meteor app in ‘errortest1’.

To run your new app:
cd errortest1
meteor

If you are new to Meteor, try some of the learning resources here:
https://www.meteor.com/learn

Tathagats-iMac:meteor tathagatbanerjee$ cd errortest1
Tathagats-iMac:errortest1 tathagatbanerjee$ meteor add tbanerjee:admin-1

Changes to your project’s package version selections:

accounts-base added, version 1.2.2
accounts-password added, version 1.1.4
alanning:roles added, version 1.0.6
aldeed:collection2 added, version 0.1.7
coffeescript added, version 1.0.11
cosmos:browserify added, version 0.5.1
ddp-rate-limiter added, version 1.0.0
email added, version 1.0.8
kadira:flow-router added, version 2.0.2
localstorage added, version 1.0.5
npm-bcrypt added, version 0.7.8_2
rate-limit added, version 1.0.0
service-configuration added, version 1.0.5
sha added, version 1.0.4
srp added, version 1.0.4
tbanerjee:admin-1 added, version 0.0.1

tbanerjee:admin-1
Tathagats-iMac:errortest1 tathagatbanerjee$
END CONSOLE

As you can see the wrong version of alanning:roles is getting installed. I have to manually update with a meteor update. I’d like to understand why.

The relevant onUse below -

Package.onUse(function(api) {
api.versionsFrom(‘1.2.1’);

//let both = [‘client’, ‘server’];

// Dependencies
api.use(‘ecmascript’);
api.use(‘aldeed:collection2’, [‘client’, ‘server’]);
api.use([‘accounts-base’, ‘accounts-password’], [‘client’, ‘server’]);
api.use(‘kadira:flow-router’, [‘client’, ‘server’]);
api.use(‘alanning:roles’, [‘client’, ‘server’]);

//api.use(‘kadira:blaze-layout’, ‘client’);
//
//api.use(‘alanning:roles’, both)
//api.use(‘random’, both);
//api.use(‘email’, both);
//api.use(‘momentjs:moment’, both);
//api.use(‘templating’, both);

// Package Files
// Collections
api.addFiles(‘lib/collections/invitations.js’, [‘client’, ‘server’]);

// Routing
api.addFiles(‘lib/both/startup.js’, [‘client’, ‘server’]);
api.addFiles(‘lib/both/modules/_modules.js’, [‘client’, ‘server’]);
api.addFiles(‘lib/both/modules/startup.js’, [‘client’, ‘server’]);
api.addFiles(‘lib/both/modules/redirect-users.js’, [‘client’, ‘server’]);

api.addFiles(‘lib/both/routes/configure.js’, [‘client’, ‘server’]);
api.addFiles(‘lib/both/routes/public.js’, [‘client’, ‘server’]);
api.addFiles(‘lib/both/routes/authenticated.js’, [‘client’, ‘server’]);
});

Additionally, not sure why, but using let both as opposed to var both (its commented out above) also caused it to shit itself. Not sure if related…

Any clarification is much appreciated. Thanks so much.

tat

This may help regarding the version of alanning:roles.

As far as let vs var - the package.js file is processed before the ecmascript build pass, so (currently) must be ES5 syntax.

Ah… this makes much more sense. When i was googling around, kept searching for alanning specific issues, while the solution is to do with api.use itself.

Will add in versioning going forward on api.use in packages. Many thanks for your response.

1 Like