Like you can use
import { Meteor } from 'meteor/meteor';
and
import { Mongo } from 'meteor/mongo';
within a meteor project.
I'm wondering If there is anyway to add this functionality to an NPM package?
If you want to use MongoDB in an NPM project you're better off using something like the NPM mongodb package.
Meteor is working on migrating it's core to NPM, but for the time being sometimes you have to Depend on Atmosphere packages:
Atmosphere packages are packages written specifically for Meteor and have several advantages over npm when used with Meteor. In particular, Atmosphere packages can:
Depend on core Meteor packages, such as ddp and blaze
...
Other Sources
With the upgrade, Meteor 1.3 offers better integration and support for JavaScript specs
Related
I have a meteor application with the following packages:
$ meteor list
accounts-password 1.5.3 Password support for accounts
accounts-ui 1.3.1 Simple templates to add login widget...
blaze-html-templates 1.1.2 Compile HTML templates into reactive...
ecmascript 0.14.2 Compiler plugin that supports ES201...
es5-shim 4.8.0 Shims and polyfills to improve ECMAS...
fourseven:scss 4.12.0 Style with attitude. Sass and SCSS ...
iron:router 1.1.2 Routing specifically designed for Me...
jquery 1.11.11* Manipulate the DOM using CSS selec...
meteor-base 1.4.0 Packages that every Meteor app needs
mobile-experience 1.0.5 Packages for a great mobile user exp...
mongo 1.8.1 Adaptor for using MongoDB and Minimo...
reactive-var 1.0.11 Reactive variable
shell-server 0.4.0 Server-side component of the `meteor...
standard-minifier-css 1.6.0 Standard css minifier used with Mete...
standard-minifier-js 2.6.0 Standard javascript minifiers used w...
tracker 1.2.0 Dependency tracker to allow reactive...
typescript 3.7.5 Compiler plugin that compiles TypeSc...
* New versions of these packages are available! Run 'meteor update'
to try to update those packages to their latest versions. If your
packages cannot be updated further, try typing
`meteor add <package>#<newVersion>` to see more information.
The atmosphere package jquery is available with version 3.0.0. I had that until installing iron-router. I was able to successfully get iron-router installed by following this advice: https://forums.meteor.com/t/iron-router-jquery-dependency/51374 (specifically meteor add iron:router --allow-incompatible-update).
I'd like to use the newer 3.0.0. I don't get the impression there is any true incompatibility within iron-router.
However, if I try to add it, I get:
$ meteor add jquery#3.0.0
-error: Conflict: Constraint jquery#1.0.0 is not satisfied by jquery
3.0.0.
Constraints on package "jquery":
* jquery#3.0.0 <- top level
* jquery#1.11.9 || 3.0.0 <- blaze 2.3.4 <- accounts-base 1.5.0 <-
accounts-password 1.5.3
* jquery#1.11.9 || 3.0.0 <- blaze 2.3.4 <- blaze-html-templates
1.1.2
* jquery#1.0.0 <- iron:dynamic-template 1.0.12 <- iron:controller
1.0.12 <- iron:router 1.1.2
* jquery#1.0.0 <- iron:location 1.0.11 <- iron:router 1.1.2
Initially, I had a hard time seeing where it was getting 1.0.0 from for the iron:* dependencies since there was no explicit version listed:
https://github.com/iron-meteor/iron-dynamic-template/blob/devel/package.js#L14
https://github.com/iron-meteor/iron-location/blob/master/package.js#L13
Then I found this in the documentation for api.versionsFrom(meteorRelease):
Use versions of core packages from a release. Unless provided, all packages will default to the versions released along with meteorRelease. This will save you from having to figure out the exact versions of the core packages you want to use. For example, if the newest release of meteor is `METEOR#0.9.0 and it includes jquery#1.0.0, you can write api.versionsFrom('METEOR#0.9.0') in your package, and when you later write api.use('jquery'), it will be equivalent to api.use('jquery#1.0.0').
So that seems to be what is happening -- jquery#1.0.0 was tied to METEOR#0.9.2.
So... aside from the option of checking out the iron-* packages into my local project as custom packages to override the api.versionsFrom(meteorRelease) in a custom fork to a modern release (or rather specify a specific jquery version since I believe it is no longer a core package)... is there any way forcefully update to jquery#3.0.0 despite what it thinks is a conflict?
Unfortunately --allow-incompatible-update does not seem to work in this instance.
This a bit of opinionated but if you want to have a router without dependencies to outdated packages you should go with ostrio:flow-router-extra which allows you even to omit jQuery or install jQuery using the npm package.
Since Meteor 1.8.3 there is also no hard dependency between Blaze and jQuery, allowing to install the latest jQuery from npm registry, which is important from a security perspective.
Check out:
https://github.com/VeliovGroup/flow-router
https://github.com/meteor/meteor/blob/devel/History.md
Use #= to install a specific pkg version. You'll need to remove the npm jquery pkg if you downgrade.
meteor add jquery#=1.11.11
meteor npm remove jquery
meteor add iron:router
I've started playing with urigo/angular2-meteor-base, followed the official tutorial and now want to test a frontend css framework. After some googling I chose poetic:materialize-scss but I'm having some issue importing the scss file.
Installation from the official docs:
meteor add fourseven:scss
meteor add poetic:materialize-scss
Then import the scss in client/styles/main.scss:
#import "{poetic:materialize-scss}/sass/materialize.scss";
After running meteor in the project folder and I get the following error:
Errors prevented startup:
While determining active plugins:
error: conflict: two packages included in the app (fourseven:scss and angular2-compilers) are both trying to handle *.scss
error: conflict: two packages included in the app (fourseven:scss and angular2-compilers) are both trying to handle *.sass
So I've tried removing fourseven:scss and running meteor again:
Errors prevented startup:
While processing files with angular2-compilers (for target web.browser):
/client/styles/main.scss: Scss compiler error:
File to import {poetic:materialize-scss}/sass/materialize.scss not found in file:
/home/vagrant/Projects/NgMeteor/{}/client/styles/main.scss
This is a list of packages installed:
angular2-compilers 0.6.6
autopublish 1.0.7
dispatch:mocha-phantomjs 0.1.9
es5-shim 4.6.15
hwillson:stub-collections 1.0.3
insecure 1.0.7
meteor-base 1.0.4
mobile-experience 1.0.4
mongo 1.1.14
poetic:materialize-scss 1.97.6_1
practicalmeteor:mocha 2.4.5_6
reactive-var 1.0.11
shell-server 0.2.1
standard-minifier-css 1.3.2
standard-minifier-js 1.2.1
tracker 1.1.1
xolvio:cleaner 0.3.1
Not sure if I'm importing the scss file from the right location... does anyone having the same issue?
I am not sure how to include a meteor package scss but I do know how to include a npm package so as a solution you could just install it via npm npm install materialize-css and then include it. Seems to be located here https://github.com/Dogfalo/materialize/blob/master/sass/materialize.scss so you should be able to do
#import "{}/node_modules/materialize/sass/materialize.scss";
Also, do you know about https://github.com/angular/material2 ? I'd recommend using that instead.
I use TypeScript and Meteor and Webstorm as my IDE.
Now when I install a package from Atmosphere I get a lot of warnings in the IDE and CLI when I import modules from it.
E.g. when I call in my code
import {MeteorGriddle} from 'meteor/utilities:meteor-griddle';
the app runs just fine but I get:
Cannot find module 'meteor/utilities:meteor-griddle'.
in CLI and in the IDE:
Cannot resolve directory 'meteor'
URL: http://www.angular-meteor.com/tutorials/socially/angular2/search-sort-pagination-and-reactive-vars
While I am following the tutorial to section 12.4, the compiler always complains:
[web.browser] client/parties-list/parties-list.ts (28, 40): Cannot find name 'ReactiveVar
Then, I type "meteor list" in my command line and I have the following:
accounts-password 1.1.4 Password support for accounts
anti:fake 0.4.1 Random text and data generator
barbatus:ng2-meteor-accounts 0.1.6 Meteor Accounts for Angular2
barbatus:ng2-meteor-accounts-ui 0.1.3 Meteor Accounts UI for Angular2
barbatus:ng2-pagination 0.1.3 Angular2 Pagination Components
es5-shim 4.1.14 Shims and polyfills to improve ECMAScr...
jquery 1.11.4 Manipulate the DOM using CSS selectors
meteor-base 1.0.1 Packages that every Meteor app needs
mobile-experience 1.0.1 Packages for a great mobile user experi...
mongo 1.1.3 Adaptor for using MongoDB and Minimongo...
reactive-var 1.0.6 Reactive variable
session 1.1.1 Session variable
standard-minifiers 1.0.2 Standard minifiers used with Meteor app...
tracker 1.0.9 Dependency tracker to allow reactive ca...
urigo:angular2-meteor 0.4.4 Angular2 and Meteor integration
The reactive-var is clearly installed. But why the compiler still complain cannot find 'ReactiveVar'?
Make sure your typings are referenced correctly and are up to date.
I am using Meteor 1.2.1 and ionic2-meteor, so I have a typings folder.
Make sure you have typings NPM module installed.
npm install typings -g
And then install the typings for meteor
typings install meteor --ambient
typings install es6-promise --ambient
typings install es6-shim --ambient
Include the main.d.ts file in your tsconfig.json
"typings": [
"typings/ionic2-meteor/ionic-framework/ionic.d.ts",
"typings/ionic2-meteor/ionic2-meteor.d.ts",
"typings/angular2-meteor/angular2-meteor.d.ts",
"typings/main.d.ts"
]
Make sure the meteor.d.ts files installed contain the following:
declare var ReactiveVar: ReactiveVarStatic;
interface ReactiveVarStatic {
new<T>(initialValue: T, equalsFunc?: Function): ReactiveVar<T>;
}
interface ReactiveVar<T> {
get(): T;
set(newValue: T): void;
}
In my case I had to update my meteor.d.ts files (main and browser) because they did not contain the ReactiveVar declaration and interface.
I'm wanting to try out the "gm" node package. I've currently got node-gd installed and want to see what gm offers.
I'm using Meteor 0.9.0.1 and this is my packages.json file:
{
"node-gd":"0.2.3",
"gm" :"1.16.0"
}
I ran "meteor update" .... It didn't install, so I guess I've done something wrong.
me#ubuntu:~/myapp$ meteor update
Refreshing package metadata. This may take a moment.
Refreshing package metadata. This may take a moment.
upgraded autoupdate from version 1.0.4 to version 1.0.5
upgraded less from version 1.0.5 to version 1.0.6
myapp: updated to Meteor 0.9.0.1.
All your package dependencies are already up to date.
Can anyone advise how to install this?
I think you need meteorhacks:npm
meteor add meteorhacks:npm
meteor
This should trigger the installation of the npm modules. Of note may be the new notation is Meteor.npmRequire and no longer Meteor.require