AIP Science App Generator
To use the generator you'll need to have Node.js and npm installed. Install Yeoman and the app generator from npm using:
$ npm install -g yo generator-aip-science-app
Then, to create a science app in the current directory, initiate the generator:
$ yo aip-science-app
Your application code is in the
app/ directory inside the generated
. +-- app/ | +-- app.html | +-- scripts/ | +-- app.js | +-- styles/ | +-- app.css
The main application HTML file is
app.html. You can customize this file
to control how your application looks. You can add custom CSS styles in
styles/app.css. Finally, your application logic should be in
The generated application includes a "test runner" that provides a similar, albeit stripped down environment as the main AIP apps page. This allows you to easily develop your science app on your local development machine before needing to deploy it to the AIP application workspace.
You can run the test runner application with the command:
This will build your application and start a server on http://localhost:9000. It will also watch your application source files for changes and automatically reload the browser when changes are saved.
Adding third-party libraries
Third-party libraries are managed by Bower. Due to how we build AIP
science apps, libraries must use a valid bower.json and must have
defined in the bower.json. This allows the apps environment to determine
dependencies at runtime.
You can search for bower packages online or using the command line:
$ bower search <keyword>
To add a library:
$ bower install <package name> --save
Make sure that you include the
--save so it's added to your application's
own bower.json. Otherwise, the build tools won't know it's been added!
To remove a library:
$ bower uninstall <package name> --save
What about libraries not in the Bower registry?
Okay, okay, we know that not every library out there is going to have a bower package. Not to worry, there is still hope!
For libraries that don't have a bower package (or have an incomplete one) there are a couple of options:
If the bower package exists but
mainis missing, the best thing to do is probably to contact the maintainer and ask them to fix it. Submit a pull request!
Alternatively, you can fork the repo and add the
Bower doesn't require that a bower package actually be registered. You can use bower to include any library available from a Git endpoint, e.g., Github. But you will still need a bower.json for the app build.
Fork the repository to your own Git repo and create a bower.json!
Compatibility and Best Practices
- Be careful using HTML IDs!
- Use closures!
More coming soon!
Packaging for deployment
- Pin lodash version to 3.x.
- Added Araport App Manifest:
araport-app.json. Declare your apps assets!
- added exclude rules for wiredep; exclude jQuery, already provided by the test runner environment
- added ADAMA API spec
- integrated mrhanlon/swagger-js/tree/feature/arbitrary-query-params
- updated fix for wiredep and missing
- client generation was not using jQuery in the SwaggerApi init
- properly URI encode values in token calls
- fix issue with Gruntfile not being properly escaped
- create a bower_components dir even when no dependencies so that wiredep is happy
- updated documentation
- fixed tests
- Added serve:dist config
- Upgraded dependency handling to use wiredep
- removed CDN-served files from bower (bower should only be app dependencies, not env dependencies)
- Using Swagger Api using jQuery instead of Shred.js
/meendpoint to profiles spec
- Updated files spec to include uploading a file directly
- Updated swagger.js with better support for uploading files
- include a README in the generated app
- Breaking changes to dependency handling related to upcoming changes in apps environment
- added tests
- Initial release