Hey All,
So I am trying to create my own packages from the code I have written for easy install into future projects.
I am having an issue when including the collections as the package through :
api.addFiles([
'collections/blog-collections.js',
], 'server')
When done this way i get an error when trying to insert an object into the collection when one of the fields is an object:
Exception while invoking method 'publishPost' { Error: Data is required (body.0.0.data) in blog insert
Schema Example:
DataSchema = new SimpleSchema({
name:{
type:String
},
data:{
type: Object,
blackbox: true,
}
})
When I do not include the files with the package but instead import directly into the programs server and client files it works with out issue.
This is my entire package.js
Package.describe({
name: 'bearly:blog',
version: '0.0.1',
// Brief, one-line summary of the package.
summary: '',
// URL to the Git repository containing the source code for this package.
git: '',
// By default, Meteor will default to using README.md for documentation.
// To avoid submitting documentation, set this field to null.
documentation: 'README.md'
});
Package.onUse(function(api) {
api.versionsFrom('1.8.0.2');
api.use([
'ecmascript',
'meteor-base',
'summernote:standalone',
'mongo',
'kadira:blaze-layout',
'fourseven:scss',
'blaze-html-templates',
'kadira:flow-router',
'aldeed:collection2-core',
'aldeed:autoform',
'aldeed:autoform-bs-datepicker',
'check',
'underscore',
'manuel:reactivearray',
'reactive-var',
'manuel:reactivearray',
'tracker',
'peerlibrary:aws-sdk',
'raix:handlebar-helpers',
'http',
]);
api.addFiles([
'collections/blog-collections.js',
'server/blog.js',
], 'server')
api.addFiles([
'client/blog.js',
'client/blog.html',
'client/blog.scss',
'client/bootblog.html',
'client/bootblog.js',
'client/bootblog.scss',
'client/index.js',
'client/page.html',
'client/page.js',
'client/switch.scss',
'collections/blog-collections.js',
], 'client')
Npm.depends({ 'simpl-schema': "1.4.2" });
});
Package.onTest(function(api) {
api.use('ecmascript');
api.use('tinytest');
api.use('blog');
api.mainModule('blog-tests.js');
});
Has anyone ran into this in the past? Struggling to solve this issue, should I not be putting collections in packages like this?