npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular2-universal-starter

v0.5.0

Published

Enjoy Server Side rendering and Web Workers in your Angular2 Application

Downloads

10

Readme

Angular2 Universal Starter Kit

Build Status Dependency Status devDependency Status Issue Stats Issue Stats Join the chat at https://gitter.im/alexpods/angular2-universal-starter

Enjoy Server Side rendering and Web Workers in your Angular2 Application

#What we've got here

  • Server Side rendering for instant page loading
  • Entire Angular2 application is running in a Web Worker (UI always will be smooth)
  • Preboot to catch browser events before Angular2 is ready to work (you can experiment with its options here)
  • Webpack and its awesome Code Splitting feature which allows us to lazy load parts of an application.
  • Live Reloading, a browser will be reloaded on any change in server or browser code. It works well for both a main thread and web workers.
  • Typescript with Typings
  • Linting with TSLint
  • Express - de facto standard for Node.js web apps.
  • PM2 - most advanced Node.js process manager
  • Unit testing with Karma
  • End-to-End testing with Protractor

##Requirements

  • node >= 4.2.0
  • npm >= 3.0.0

#Quick start

# clone the repo without git history
git clone --depth 1 https://github.com/alexpods/angular2-universal-starter.git

# change current directory to angular2-universal-starter
cd angular2-universal-starter

# install dependencies
npm install

# run the production server
npm start

Go to http://localhost:3000 in your browser.

You may want to stop or restart the production server:

# stop the production server
npm stop

# restart the production server
npm restart

Development with Live Reloading

# make sure that the production server is not running
npm stop

# run the development server with live reloading support
npm run dev

The development server will watch for any changes, make rebuilds and reload a browser. All built code will be kept in memory, so dist folder will not be generated (all means code for both client and server sides).

##Turning server side rendering and web workers on/off You can optionally turn server side rendering or web workers suport on/off. You just need to change HAS_SS and HAS_WW in constants.js here:

// ...

// Server side rendering. Set it to `false` to turn it of.
exports.HAS_SS = 'NG2_SS' in process.env ? process.env.NG2_SS === 'true' : true;
// For example:
// exports.HAS_SS = false;

// Web workers support. Set it to `false` to turn it of.
exports.HAS_WW = 'NG2_WW' in process.env ? process.env.NG2_WW === 'true' : true;
// For example:
// exports.HAS_WW = 'NG2_WW' in process.env ? process.env.NG2_WW === 'true' : false;

//...

If you're using a development server, you don't need to restart it. The development server will just make rebuild and apply new changes.

If you're using a production server (npm start), you also don't need to restart it. Just rebuild your sources (npm run build, if npm run build:watch is running you don't need to do anything).

#Building

# build the project
npm run build

# build the project and start watching for its changes
npm run build:watch

#Linting

# check the project (source files)
npm run lint

# check the project and start watching for its changes
npm run lint:watch

If you're not agree with the default rules (tslint.json), feel free to tell me about it.

#Testing The next command will run both unit and end-to-end tests.

For end-to-end tests you need to start Selenium Server first (see End-to-End Testing).

# run all tests (single run)
npm test

##Unit Testing

# run unit tests (single run)
npm run unit

# run unit tests and start watch for changes
npm run unit:watch

# run unit tests for specified directory (path must be relative to root directory)
# currently you can specify paths only for "src" directory
npm run unit src/app

# run unit tests for specified file and start watch for changes
npm run unit:watch src/app/home.spec.ts

##End-to-End Testing For end-to-end tests you nedd to start Selenium Server (webdriver) first.

# start Selenium Server (webdriver)
npm run webdriver:start

# run end-to-end test (single run)
npm run e2e

#Cleaning

# remove "dist" and "logs" folders
npm run clean

# remove "dist" folder
npm run clean:dist

# remove "logs" folder
npm run clean:logs

#License The MIT License (MIT)

Copyright (c) 2016 Aleksey Podskrebyshev

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.