Include a raw js library in my ember cli project - ember-cli

I would like to simply download this library and include it in my ember cli project.
It is not available as a bower package, what should I do?
https://github.com/appendto/jquery-mockjax.git
thanks

Something like this should do:
bower install --save appendto/jquery-mockjax
You may notice this uses github-user/repository-name
Brocfile.js:
app.import( 'bower_components/jquery-mockjax/jquery.mockjax.js' );

Related

What is the difference between plugins ion2-calendar and ionic2-calendar

I found both ion2-calendar and ionic2-calendar plugins in a same project
what is the difference between the two of them.
Also, I wish to know, these plugins are not listed by the command
ionic cordova plugin list
How to get the list of plugins installed other than cordova?
Below is the portion of package.json of that project.
"ion2-calendar": "^3.0.0-rc.0",
"ionic-angular": "^3.9.9",
"ionic2-calendar": "^0.5.7",
Found both are different
ion2-calendar is a plugin installed as below:
npm install ion2-calendar moment --save
Documentation :
https://www.npmjs.com/package/ion2-calendar
ionic2 calendar is a plugin installed as below:
npm install ionic2-calendar --save
Documentation:
http://www.codeexpertz.com/blog/mobile/ionic-2-calendar
both are having lot of different workaround
but both plugins are working in a same project without any clash.
This will help who are having some confusion about which one to be used.

Difference between "ionic cordova plugin add" and "npm install #ionic-native/plugin --save"

I have been trying to use the ionic-native plugins provided by Ionic 3. When I read the install instructions, there are always 2 command lines instead of one.
ionic cordova plugin add cordova-plugin-camera
npm install --save #ionic-native/camera
If my memory serves me right, only a single command similar to ionic plugin add somepluginhere will get the job done in the old days.
What are the differences here?
The difference is they are different packages.
ionic cordova plugin add
This command will download the cordova plugin - in this case, camera and set the config.xml , package.json, save in plugins folder and set it for each of your platforms.
Ionic leverages the cordova CLI to do this.
ionic-native
Ionic Native is simply a wrapper to the corresponding plugin.
npm install --save #ionic-native/camera
It installs the package #ionic-native/camera to your node-modules folder and sets that in package.json and nothing more.
This wrapper allows you to inject the corresponding cordova plugin as an Angular provider wherever you need instead of trying to declare the global variable and other workarounds.

How to import ionic.native.js in Ionic V1/Angular 1.x

It's getting hard to see documents or examples now that Ionic 2 is out.
I want to use ionic.native.js in the old Ionic V1 project.
Thing is that the installation is with npm
npm install ionic-native --save
But now I have tons of npm modules under node_modules/ as a dependency. Ionic documentation say:
If you are using Angular 1.x or plain ES5 JavaScript, you need to add
ionic.native.js to your index.html
but they don't give example on "how" to place it in the index.html - and that is my question.
Currently my file is located in:
> find . -name ionic.native.js
./node_modules/ionic-native/dist/ionic.native.js
There's no gulp task for the node_modules/ dir ... so how do I import it into index.html ? or maybe I used the npm command in the wrong place ? ( currently it's in the root dir of the project, where gulpfile.js lives )
I was having the same problem as you.
In the end, what ended up solving it was using:
bower install ionic-native --save
This adds the files to the lib/ directory, which is accessible from the index page.
Then in the index.html file, add:
<script src="lib/ionic-native/ionic.native.js"></script>
Hopefully this helps!
If you want to use npm instead of bower, you can add a path to desired location when installing the plugin:
npm install ionic-native --save --prefix www/lib
Copy ionic.native.js in js folder and add <script src="js/ionic.native.js"></script> to your index.html
I was frustrated by this, too. I eventually just copied the ionic.native.js file into the lib folder, and imported it there like this:
<script src="lib/ionic.native.js"></script>
That worked, but I worry that now it'll be a hassle to handle it and it's dependencies.

How can I update to the not yet officially released Ionic 1.2?

Ionic 1.2 has been announced:
http://blog.ionic.io/announcing-ionic-1-2/
The source code is availible here:
https://github.com/driftyco/ionic/releases/tag/v1.2.0
But I haven't been able to install with with some shell commands that I have attempted:
$ bower install --save ionic#1.2.0
$ bower install https://github.com/driftyco/ionic/archive/v1.2.0.tar.gz
$ bower install driftyco/ionic-bower#v1.2.0 --force
I can download the source code but don't know how to use it to update my ionic framework
You can install it with bower using:
$ bower install ionic#1.2.0 --force
Anyway, you should take into account that this will only download libraries and source code, but not a CLI tool.
So in my opinion, if you want to test ionic 1.2, you should
Create an ionic project (as usual)
Perform bower install ionic#1.2.0 --force, in order to get the new ionic libs
Replace in your project the content of www/lib/ionic/ with the content of the recently downloaded bower_components/ionic/release/.
DETAIL: Ionic uses to include a .bowerrc file that causes bower packages to be placed in www/lib, instead of inside bower_components, so maybe you'll simply need to replace the content of www/lib/ionic/ with www/lib/ionic/release (--force is need because www/lib/ionic already exists).

ember-cli ignores my coffeescript test files

I'm an ember-cli newbie and I'm trying to start testing my dumb app with some dumb tests. It seems that ember-cli ignores any *test.js.coffee files in tests directory.
I'm using version 0.0.44 and installed coffescript adapter with npm install --save-dev ember-cli-coffeescript
Any idea why?
Did you install the coffeescript module?
npm install --save-dev ember-cli-coffeescript