• Stars
    star
    183
  • Rank 210,154 (Top 5 %)
  • Language
    JavaScript
  • Created almost 10 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SystemJS + ES6 + Angular + React

npm version npm dependencies Build Status Gitter

SystemJS + ES6 + AngularJS + React

Seed project for ES6 modules via SystemJS with ES6 syntax using Babel (was: 6to5) that lazy-load and bundle build with AngularJS and React.

Note!

This project is a bit out of date now due to jspm being a bit of a moving target. I've been slammed with starting a new business and haven't had a chance to keep things up to date. PR's welcome!

Motivation

For a long time now, I've wanted to create a JavaScript single page app seed project that has the following qualities:

  • Treats both unit and e2e testing as first class citizens
  • Build file that was easy to understand (more configuration, less code)
  • Package manager for installing dependencies, regardless of whether they live on npm or github
  • Transpiles code
  • Debugging shows me exactly where the error is
  • Automatic reloading of the browser when files change
  • Minify across routes instead of as a single giant file (with cross route dependencies in their own files)
  • Can run in production / minified mode locally for testing
  • Ablility to plug in whatever framework of the week
  • Imports for everything

Thankfully, after a long wait for the technology to catch up and a lot of blood sweat and tears, this project is alive.

If you like the project, please star / watch it to show your support!

Features

Based heavily off the excellent angular-systemjs-seed project.

This project does everything the parent project does:

  • ES6 Syntax via Babel (was: 6to5) with source maps
  • ES6 Modules via SystemJS - No more requirejs!
  • Karma / Jasmine unit tests with coverage report
  • Lazy-loading modules via routes with AngularJS
  • Easy watch/browser-sync/lint/test/build setup via Gulp
  • LESS CSS Support with source maps and minification
  • AngularJS Template Compilation
  • AngularJS ngAnnotate
  • Bundle builds via SystemJS Builder
  • Cache Busting with SystemJS
  • Demonstrates on-demand CSS theme loading
  • Demonstrates the systemjs-route-bundler route bundler

But wait, there's more!

  • Built from a Yeoman generator for reproducible project builds
  • Adds example TodoMVC app (with unit and e2e tests!)
  • Adds support for CoffeeScript (optional)
  • Adds support for Facebook React (through ngReact)
  • Adds example React app
  • Uses gulp-helpers to DRY the gulpfile
  • Adds run and default gulp targets
  • Project is served from the dist folder for security
  • Fixes a bunch of misc small build file and lint issues
  • Override of port number with environment
  • index.html is based on a template
  • Templates are exported modules and can be referred to by name
  • Enables Angular html5Mode by default
  • Uses the karma-babel-preprocessor to ES6 compile tests inline
  • Moves all tests to a separate folder to prevent leakage into dist
  • Minifies HTML in production
  • Runs tests on Travis CI using Karma / PhantomJS and Protractor

Examples

How to use this project

Use the Yeoman generator to create your own seed project. This project is based off the generator. You can use this project as an example to see how all the pieces fit together for your own application.

Layout

This should give you an idea of how to get started with building your own project. Most of the effort required will be actually deleting the existing app examples and building your own.

  • package.json::jspm -- Location of our library dependencies, such as angular. Manage with jspm install [DEP].
  • src/system.config.js -- Where jspm manages all of its installed dependencies.
  • src/index.tpl.html -- The main entrypoint for the application. This loads system.js, system.config.js and the application.
  • src/app/routes.json -- Declare all of your top level routes here.
  • src/app/app.js -- Bootstraps angular and is the top level module.
  • src/app/FOLDER -- Each component of your application should have its own folder.
  • src/app/todo/todo.js -- Main entrypoint for the todo application. Sets up all the routes directly related to this app, imports the controller, templates, css, etc.
  • src/app/react/exampleApplication.jsx -- Main entrypoint for the example React application.
  • test-unit -- Unit tests using Karma/Jasmine/ES6. It has been hard to find examples of good testing practices (especially for angular), so the todo application has very thorough tests for directives and controllers.
  • test-e2e -- e2e tests using Protractor/Jasmine/ES6.

Install & Run

  1. npm install -g gulp jspm
  2. npm install
  3. gulp run
  4. Browse to http://localhost:9000

Tasks

  • gulp test -- run karma tests using Chrome
  • npm test -- run karma tests using PhantomJS (for Travis CI)
  • npm run-script protractor-setup; npm run-script protractor-run -- setup and run protractor (for Travis CI)
  • gulp lint -- run jshint
  • export SITUATION=production && gulp run -- bundle, cache bust, minify and run in production mode (great for Heroku)

Tooling

Best Practices

Research & Resources

FAQ

Q: I use bower, what happened to it? Can I still use it?

A: jspm is an alternative to bower that is just as functional, but integrates nicely with SystemJS. You can still use bower if you like, but there is no need for it anymore. Bower was originally part of this project, but it has been removed. If you'd like to see what it was like to use it, please see this commit and this commit.

Q: What about integrating other frameworks like Ember or Riot?

A: Sure! It is just a matter of including the dependencies (using jspm) and using them as you normally would. I'm a fan of Angular, but I realize that React is getting popular too. ngReact is the perfect combination of the DI/Service system of Angular and the component model of React. If you like other frameworks, you are free to use those as well. Pull requests for examples are welcome!

More Repositories

1

sardine

an easy to use webdav client for java
Java
553
star
2

mui-rff

MUI 5 / Material UI + React Final Form
TypeScript
488
star
3

gulp-helpers

A set of tasks and helpers for gulp
JavaScript
35
star
4

convert

alternative appengine conversion api - pdf->image & image->image
HTML
32
star
5

generator-systemjs

Yeoman generator for SystemJS / ES6 / jspm / Angular / React
JavaScript
19
star
6

WePay-Java-SDK

A wonderful Java SDK for developing with WePay.
Java
15
star
7

ocLazyLoad-SystemJS-Router

Dynamically load angular modules via routes
JavaScript
13
star
8

fallback

A good basis for spring framework projects running on top of tomcat. Uses simple configuration to highlight many of the features one would expect from a Java Application Server.
Java
11
star
9

bittrex-typescript

Sorry for yet another client, I didn't like what else was out there
TypeScript
9
star
10

systemjs-material-start

SystemJS Material Start example
JavaScript
9
star
11

history-api-fallback

Fallback to index.html for applications that are using the HTML 5 history API
Java
8
star
12

strava-auto-upload

Plug your device in and it'll email the latest .fit files to [email protected]
Shell
7
star
13

monker

The money maker machine.
Python
4
star
14

angular-bower-gulp-requirejs-seed

A happy place
CoffeeScript
4
star
15

btc

A super minimal cgminer install on a raspberry pi
Shell
3
star
16

message

Implementation of postMessage
JavaScript
3
star
17

jmxtrans

The repository has moved to our new organization at: http://github.com/jmxtrans/jmxtrans
3
star
18

heroku-buildpack-apache

heroku-buildpack-apache
Shell
2
star
19

bitfinex-promise

node.js wrapper for bitfinex cryptocurrency exchange api using promises
CoffeeScript
2
star
20

retry-promise-typescript

Retry Promise for TypeScript
TypeScript
2
star
21

fileshare

1
star
22

geocoder-java

mirror of geocoder-java with my own changes (jackson)
Java
1
star
23

electron-skeleton

Super simple Electron, TypeScript, VueJS skeleton
TypeScript
1
star
24

kaptcha

Automatically exported from code.google.com/p/kaptcha
Java
1
star
25

mikro-example

TypeScript
1
star
26

enumerate-angular

Simple little angular directive that shows a nice number.
CSS
1
star
27

dirtyform

track changes to form elements
CoffeeScript
1
star