Skip to content

Instantly share code, notes, and snippets.

@philcleveland
Last active November 16, 2015 16:36
Show Gist options
  • Save philcleveland/1d3f7b3b346f000dbef5 to your computer and use it in GitHub Desktop.
Save philcleveland/1d3f7b3b346f000dbef5 to your computer and use it in GitHub Desktop.
Create a directory for your angular2 project and then run this shell in that directory
echo Go check out angular.io for a really good tutorial!
mkdir src
cd src
#create base the index.html
awk 'BEGIN { print "<html>"
print "<head>"
print " <title>TitleHere</title>"
print " <script src=\"../node_modules/systemjs/dist/system.src.js\"></script>"
print " <script src=\"../node_modules/angular2/bundles/angular2.dev.js\"></script>"
print " <script>"
print " System.config({"
print " packages: {'\''app'\'': {defaultExtension: '\''js'\''}}"
print " });"
print " System.import('\''app/app'\'');"
print " </script>"
print "</head>"
print "<body>"
print " <my-app>Loading...</my-app>"
print "</body>"
print "</html>"
}' > index.html
#create base the typescript config
awk 'BEGIN { print "{"
print " \"compilerOptions\": {"
print " \"target\": \"ES5\","
print " \"module\": \"commonjs\","
print " \"sourceMap\": true,"
print " \"emitDecoratorMetadata\": true,"
print " \"experimentalDecorators\": true,"
print " \"removeComments\": false,"
print " \"noImplicitAny\": false"
print " }"
print "}"
}' > tsconfig.json
mkdir app
cd app
#create an Angular 2 App Component to bootstrap the application
awk 'BEGIN {
print "import {bootstrap, Component} from \"angular2/angular2\";"
print "@Component({"
print " selector: \"my-app\","
print " template: \"<h1>Angular 2 App</h1>\""
print "})"
print "class AppComponent { }"
print "bootstrap(AppComponent);"
}' > app.ts
cd ../../
#initialize npm and import dependencies
npm init -y
npm i angular2@2.0.0-alpha.44 systemjs@0.19.2 --save --save-exact
npm i typescript live-server --save-dev
sed -i 's/"test": "echo \\"Error: no test specified\\" && exit 1"/"tsc": "tsc -p src -w",\n "start": "live-server --open=src"/' package.json
awk 'BEGIN {
print "See https://angular.io/docs/ts/latest/quickstart.html for a full quick start"
print "Open a terminal window in the root of the application folder and enter: **npm run tsc**"
print "Open another terminal window in the root of the application folder and enter: **npm start**"
}' > readme.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment