I just tried to add packages to my meteor project using smart.json like this:
{
"packages": {
"scss": {},
"iron-router": {},
"normalize.css": {
"git": "https://github.com/rithis/meteor-normalize.css"
},
"Meteor.cron": {
"git": "https://github.com/alexsuslov/Meteor.cron"
}
}
In this case I've manually added normalize.css and Meteor.cron. Now when I do
$> mrt update
These packages are installed into the packages directory. So far no problems, but I don't think they are used. I didn't see a normalize.css in my browser and to test for Meteor.cron I added a test file in the server directory with
console.log(Meteor.Cron)
which prints undefined
Any suggestions what I'm doing wrong here ?
you are using incorrect git clone URLs. try this in your smart.json
{
"packages": {
"scss": {},
"iron-router": {},
"normalize.css": {
"git": "https://github.com/rithis-archive/meteor-normalize.css.git"
},
"Meteor.cron": {
"git": "https://github.com/alexsuslov/Meteor.cron.git"
}
}
Related
So I followed the instructions at guide.meteor.com to set up my package.json eslintConfig.
"eslintConfig": {
"plugins": [
"meteor"
],
"extends": [
"airbnb/base",
"plugin:meteor/recommended"
],
"rules": {
"meteor/eventmap-params": [
2,
{
"templateInstanceParamName": "instance"
}
],
"import/no-unresolved": [
2,
{
"ignore": [
"^meteor/"
]
}
],
"semi": [
"error",
"never"
]
}
}
It works fine until I try and use React.
main.js:
Meteor.startup(() => {
render(<App />, document.getElementById('render-target'))
})
That throws the error: [eslint] Parsing error: Unexpected token <
I have the react plugin:
"devDependencies": {
"eslint": "^2.9.0",
"eslint-config-airbnb": "^8.0.0",
"eslint-plugin-import": "^1.6.1",
"eslint-plugin-jsx-a11y": "^1.0.4",
"eslint-plugin-meteor": "^3.5.2",
"eslint-plugin-react": "^5.0.1"
}
I've tried following examples from Google but none of them helped. I've tried adding 'react' and 'eslint-plugin-react' to the plugins bit and nothing changed. I'm gobsmacked the solution wasn't provided in the ESLint section of the meteor guide. Any assistance would be appreciated.
Install babel-eslint and to your .eslintrc add "parser": "babel-eslint". You're missing the ES6 transpiling so eslint just crashes.
You don't need to install babel-eslint. Espree (native ESLint parser) fully supports ES6, ES7 and Object Rest/Spread.
The reason ESLint stopped parsing your file is because you haven't enabled jsx, so it will consider it as an incorrect syntax.
{
"ecmaFeatures": {
"ecmaVersion": 6,
"sourceType": "module",
"jsx": true
}
}
Add the above snippet to your config file and it should start working. For more information, you can read Specifying Parser Options
I've got a project that I started on an older version of Meteor and I've now installed the most recent version. I cloned my project code and ran into problems as soon as I ran meteor so I deleted all the files except the smart.json, smart.lock and packages.json
I ran meteor add meteorhacks:npm then meteor to install the node modules I require. It looks like all the packages I need are in the smart.lock file.
This should be really simple, how do I install the most recent version of these packages? I thought just running meteor would pick them up but apparently not. I checked by by doing meteor list and I don't see all the packages I need.
smart.json:
{
"packages": {
"loading": {},
"jquery-jcrop": {},
"accounts-admin-ui-bootstrap-3": {},
"accounts-ui-bootstrap-3": {},
"font-awesome-4-less": {}
}
}
smart.lock
{
"meteor": {},
"dependencies": {
"basePackages": {
"loading": {},
"jquery-jcrop": {},
"accounts-admin-ui-bootstrap-3": {},
"accounts-ui-bootstrap-3": {},
"font-awesome-4-less": {}
},
"packages": {
"loading": {
"git": "https://github.com/bitIO/meteor-loading.git",
"tag": "v0.0.1",
"commit": "48840a828a614e25d0e19c124494b16f255a902e"
},
"jquery-jcrop": {
"git": "https://github.com/waltyuyu/meteor-jquery-jcrop.git",
"tag": "v0.0.3",
"commit": "45a62562f3d13cbc72a7710472a76cf9c3c589cd"
},
"accounts-admin-ui-bootstrap-3": {
"git": "https://github.com/hharnisc/meteor-accounts-admin-ui-bootstrap-3.git",
"tag": "v0.2.6",
"commit": "fe74692303daf73d440f2729010bcf1557af62ca"
},
"accounts-ui-bootstrap-3": {
"git": "https://github.com/mangasocial/meteor-accounts-ui-bootstrap-3.git",
"tag": "v0.3.5",
"commit": "bbd0a8a46ae02526c2ebfee05fa8075d8d04a9ba"
},
"font-awesome-4-less": {
"git": "https://github.com/svub/fontawesome4-less.git",
"tag": "v4.4.0",
"commit": "250d2336a217c18eb70e9d074784a7db3ca38472"
},
"roles": {
"git": "https://github.com/alanning/meteor-roles.git",
"tag": "v1.2.8",
"commit": "68844ba216c348d332bdb840825850f497f515bb"
}
}
}
}
For meteor packages, the one you install using meteor add package:name
Their version are be stored in the .meteor/versions
Running meteor update will update them the last available version
Typing meteor list will list the used packages, their version and a comment if a new version is available.
For pure NPM packages, the one you install through meteorhacks:npm listing them into a root based packages.json file
Their version is and must be defined in the file directly
Example of a packages.json file:
{
"redis": "0.8.2",
"github": "0.1.8"
}
i.e. "NPMModuleName":"releaseVersion", the alternative being to directly poing to the aModule.tar.gz file.
Manually finding the version can be a bit boring but just go to the project's git, and browse to the release path, for example: https://github.com/user/projectName/releases/
My advise in your case, as you do not have a lot of packages to
reinstall, is to manually find their new name on
http://www.atmospherejs.com and reinstall them manually. You could
attempt manually editing the .meteor/packages file but as the
packages name are now (since meteor v0.9) prefixed with the contributor's name, meteor might
not be able to find them back. By the way, unclaimed migrated packages takes the prefix mrt per default For example font-awesome-4-less is now mrt:font-awesome-4-less
I had a problem when trying install client packages using Bower in ASP.NET 5 application. I defined some packages I want to install to my application in bower.json file, like this:
{
"name": "bower",
"license": "Apache-2.0",
"private": true,
"dependencies": {
"jquery": "1.11.2",
"modernizr": "2.8.3",
"bootstrap": "3.3.4",
"jquery.uniform": "2.1.2",
"fluidbox": "1.4.3",
"owl-carousel": "1.3.2",
"photo.swipe": "4.0.8",
"magnific-popup": "1.0.0",
"slippry": "1.2.9",
"fastclick": "1.0.6",
"imagesloaded": "3.1.8",
"jquery-validate": "1.13.1",
"fitvids": "1.1.0",
"jquery-gridrotator": "0.1.0" }
After saving, I saw in the hidden bower_components folder there were some other packages I didn't defined in the bower.json file, like this:
After running grunt task, I saw some strange packages installed to my application.
My simple gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
bower: {
install: {
options: {
targetDir: "wwwroot/lib",
layout: "byComponent",
cleanTargetDir: true
}
}
}
});
grunt.registerTask("default", ["bower:install"]);
grunt.loadNpmTasks("grunt-bower-task");
};
So, how can I only install packages I want to my ASP.NET 5 application? Thank you so much.
They are dependencies installed by bower by example Masonry use this dependencies
{
"name": "masonry",
"version": "3.3.0",
"description": "Cascading grid layout library",
"main": "masonry.js",
"dependencies": {
"get-size": "~1.2.2",
"outlayer": "~1.4.0",
"fizzy-ui-utils": "~1.0.1"
}
}
I recomend you to use the dest,js_dest, css_dest and font_dest to split the files by type and set the option keepExpandedHierarchy to false something like this
{
dest: "wwwroot/lib",
js_dest: "wwwroot/lib/js",
css_dest: "wwwroot/lib/css",
fonts_dest: "wwwroot/lib/font",
options: {
keepExpandedHierarchy: false
}
}
and use some module like includeSource to add all the files in your cshtml file
includeSource: {
layout: {
files: {
'Views/Shared/_Layout.cshtml': 'Views/Shared/_Layout.cshtml'
}
},
options: {
basePath: "wwwroot/lib/js",
baseUrl: '~/lib/',
}
}
and you must add the markup in your page
<!-- include: "type": "js", "files":"**/*.js", "ordering": "top-down" -->
<!-- /include -->
hope it helps
I've created a asp.net 5 project and am trying to add a reference to an older package from NuGet (Mysql.Data). From what I've read, I should be able to do this to add pre-vnext packages:
{
"version": "1.0.0-*",
"dependencies": {
},
"commands": {
"run": "run"
},
"frameworks": {
"net45": {
"dependencies": {
"MySql.Data": "6.9.4"
}
},
"aspnet50": { },
"aspnetcore50": {
"dependencies": {
"System.Console": "4.0.0-beta-22416"
}
}
}
}
But all that happens is I get a reference to it in the project browser but there is a yellow triangle next to it. I have seen other similar questions on here but they all suggest the above, but I'm not sure why this doesn't work?
That means that the MySQL library is not supported in aspnetcore5, you can remove the aspnetcore50 JSON node and that will get rid of the warning. Not all libraries are supported in core. See this Question
In addition to what Son_of_Sam said, you need to put this in the dependencies section at the top.
How do i specify or change the version of a package i want to use with atmosphere? Can i pass in the git branch to my smart.json file as an option ? Something like this in the smart.json file ? I would like to run off of a git version and have meteor grab and use that version when running the application.
Here is what i have tried doing which errors with version does not exist
"packages": {
iron-router: {
version: {"https://github.com/EventedMind/iron-router/tree/dev"}
}
}
Edited per comment below (don't leave this on dev!!! but things are changing quickly):
iron-router: {
"git": "https://github.com/EventedMind/iron-router" ,
"branch": "dev"
}
}
Have you tried this syntax?
iron-router: {
"git": "https://github.com/EventedMind/iron-router/tree/dev" ,
"branch": "master"
}
}
wanted to install iron-router-progess too, didn't allow me to do that with the master branch so I had to remove iron-router, change smart.json to
{
"packages": {
"bootstrap-3": {},
"iron-router": {
"git": "https://github.com/EventedMind/iron-router",
"branch": "dev"
},
"dimsum": {},
"iron-router-progress": {}
}
}
and run mrt update again. Works fine now.