Node.js and npm are essential to Angular development.
Get it now if it's not already installed on your machine.Verify that you are running at least node v4.x.x
and npm 3.x.x
by running node -v
and npm -v
in a terminal/console window.
Older versions produce errors.
Clone this repo into new project folder (e.g., my-proj
).
git clone https://github.com/M2JS/1.angular2-protractor-jasmine-ts-seed.git my-proj
cd my-proj
Discard everything "git-like" by deleting the .git
folder.
rm -rf .git # non-Windows
rd .git /S/Q # windows
You could start writing code now and throw it all away when you're done. If you'd rather preserve your work under source control, consider taking the following steps.
Initialize this project as a local git repo and make the first commit:
git init
git add .
git commit -m "Initial commit"
Create a remote repository for this project on the service of your choice.
Grab its address (e.g. https://github.com/<my-org>/my-proj.git
) and push the local repo to the remote.
git remote add origin <repo-address>
git push -u origin master
See npm and nvm version notes above
Install the npm packages described in the package.json
and verify that it works:
npm install
npm start
The npm start
command first compiles the application,
then simultaneously re-compiles and runs the lite-server
.
Both the compiler and the server watch for file changes.
Shut it down manually with Ctrl-C
.
You're ready to write your application.
We've captured many of the most useful commands in npm scripts defined in the package.json
:
npm start
- runs the compiler and a server at the same time, both in "watch mode".npm run tsc
- runs the TypeScript compiler once.npm run tsc:w
- runs the TypeScript compiler in watch mode; the process keeps running, awaiting changes to TypeScript files and re-compiling when it sees them.npm run lite
- runs the lite-server, a light-weight, static file server, written and maintained by John Papa and Christopher Martin with excellent support for Angular apps that use routing.
Here are the test related scripts:
npm run e2e
- run protractor e2e tests
E2E tests are in the e2e
directory, side by side with the app
folder.
Thereafter, run them with npm run e2e
.
That command first compiles, then simultaneously starts the Http-Server at localhost:8080
and launches protractor.