Closed parhelium closed 8 years ago
Yes there is PR waiting for merge https://github.com/jagi/meteor-astronomy-validators/pull/7. I will merge it this weekend and publish new package version.
@jagi it looks like #7 is really easy fix. Is there any chance you will merge it today or tomorrow ?
Sorry for late response. I've merged it today and I will post new version to Atmosphere tomorrow.
Thanks! Please let me know, when it will be published.
Published! v 0.10.8
I'm developing a package; astronomy-validators is a dependency. I get the error ReferenceError: Validators is not defined
. The error doesn't occur if I use simple-validators. Meteor 1.2.0.2.
When using the astronomy-validators
package inside another package you have also to imply it to access package level variable.
api.use('jagi:astronomy-validators@1.0.4');
api.imply('jagi:astronomy-validators');
If it works with the simple-validators
package without implying then it may mean that there is a bug in Meteor packages system.
Here is package.js
Package.describe({
name: 'adigiovanni:one-way-accounts',
version: '0.0.1',
summary: 'One Way Accounts',
git: '',
documentation: 'README.md',
});
Package.onUse(function (api) {
api.versionsFrom('1.2.0.2');
// module deps
api.use('ecmascript');
api.use('underscore');
api.use('mongo');
api.use('jagi:astronomy');
api.use('jagi:astronomy-validators');
api.imply('jagi:astronomy-validators');
// api.use('jagi:astronomy-simple-validators');
// file deps
api.addFiles('lib/collections/Accounts.js');
api.addFiles('lib/models/Account.js');
api.addFiles('lib/methods.js');
api.addFiles('lib/server/publications.js', 'server');
api.addFiles('lib/OneWayAccounts.js');
api.export('OneWayAccounts');
});
Package.onTest(function (api) {
// module deps
api.use('ecmascript');
api.use('underscore');
api.use('mongo');
api.use('jagi:astronomy');
api.use('jagi:astronomy-validators');
// api.use('jagi:astronomy-simple-validators');
api.use('sanjo:jasmine@0.20.2');
api.use('velocity:console-reporter');
api.use('velocity:html-reporter');
api.use('adigiovanni:one-way-accounts');
api.imply('adigiovanni:one-way-accounts');
// file deps
api.addFiles('lib/server/fixtures.js', 'server');
api.addFiles('tests/server/setup.js', 'server');
api.addFiles('tests/server/OneWayAccounts.js', 'server');
// api.addFiles('tests/client/OneWayAccounts.js', 'client');
});
Here is the code using Astronomy and Validators.
/* eslint new-cap: 0 */
Account = Astro.Class({
name: 'Account',
collection: Accounts,
fields: {
// issuerId: 'object',
// holderId: 'object',
issuerId: {
type: 'object',
validator: Validators.required(),
},
holderId: {
type: 'object',
validator: Validators.required(),
},
balance: {
type: 'number',
'default': 0,
},
},
indexes: {
parties: {
fields: {
issuerId: 1,
holderId: 1,
},
options: {
unique: true,
},
},
},
// simpleValidators: {
// issuerId: 'required()',
// holderId: 'required()',
// },
});
I added api.imply
but I still get ReferenceError: Validators is not defined
Maybe, there is a bug in Meteor package system because I encountered a similar dependency problem using Mongo. Please, find my question on StackOverflow
Ok, I changed api.use('jagi:astronomy')
to api.use('jagi:astronomy@1.1.4')
and it seems to work.
This is from the console
jagi:astronomy* upgraded from 0.2.0 to 1.1.4
jagi:astronomy-validators* upgraded from 0.3.0 to 1.0.4
jagi:reactive-map added, version 2.0.0
So, it seems that Meteor selects the wrong version if not specified.
Does it make sense to you?
Yes, you always have to provide precise version number, however if not it should throw error. So it seems like a bug in Meteor.
Cannot use package jagi:astronomy-validators inside other package
Error:
ReferenceError: Match is not defined
Do you have idea why ?
I believe adding package
check
should solve the problem.