Giter Site home page Giter Site logo

training4developers / mastering-angular-starter Goto Github PK

View Code? Open in Web Editor NEW
22.0 5.0 23.0 984 KB

Starter Files for the Mastering Angular Series on WintellectNOW

Home Page: https://www.wintellectnow.com/Home/SeriesDetail?seriesId=mastering-angular

License: MIT License

JavaScript 88.82% HTML 1.35% CSS 0.72% TypeScript 9.11%
angular webpack typescript

mastering-angular-starter's Introduction

Mastering Angular Application

Overview

This is a simple CRUD (create, read, update & delete) application starter project the Angular framework. The base project configuration was originally adapted from the Angular Webpack Starter project, and has been updated to Webpack 2 with help from this project Angular Class - Angular Webpack Stater.

Application Setup

Step 1. Install Node.js version 7 or higher. To install Node.js click here.

Step 2. Download this repository from here. Extract the zip file to a working folder on your system.

Step 3. Open a terminal window, change to the folder where you extracted the zip file. You should see a package.json file in the folder.

On Windows, the terminal is called "Node.js Command Prompt". This will command prompt will contain the proper paths for Node.js development. DO NOT RUN the Node.js program. Click the icon named "Node.js Command Prompt". For Mac users, the Mac terminal is all you need.

Step 4. From the terminal, run the following command:

$ npm i && npm start

It could take a few minutes for this command to complete. If you have connection issues due to a proxy server, please edit the .npmrc file per the instructions in those files. Then re-run the command above.

This set has been completed successfully when you receive the following message:

[0] Child html-webpack-plugin for "index.html":
[0]     chunk    {0} index.html 541 kB [entry] [rendered]
[0]         [0] ./~/lodash/lodash.js 540 kB {0} [built]
[0]         [1] (webpack)/buildin/global.js 509 bytes {0} [built]
[0]         [2] (webpack)/buildin/module.js 517 bytes {0} [built]
[0]         [3] ./~/html-webpack-plugin/lib/loader.js!./src/index.html 644 bytes {0} [built]
[0] webpack: Compiled successfully.

This terminal window is now running the web server, a second terminal window will need to be opened to run additional terminal commands.

Step 5. Open a web browser, and navigate to http://localhost:5000. The Angular web application should load and be usable.

To Modify the Web Application

Step 6. Open your favorite text editor (such as Atom or Visual Studio Code), and modify the files in the src folder. When file changes are saved, webpack will automatically transpile and bundle the application code and assets, and deploy it to the dist folder. To see the changes, reload your web browser.

The solution is preconfigured for IntelliJ IDEA and Webstorm for ESLint and TSLint. Also, automatic transpilation for TypeScript and SASS has been disabled. All transpilation should be performed via Webpack from the command line.

Visual Studio Code supports TypeScript out of the box, but several additional extensions will greatly enhance the development experience. Install the following extensions:

  • ESLint: dbaeumer.vscode-eslint
  • HTMLHint: mkaufman.HTMLHint
  • MarkDown Lint: DavidAnson.vscode-markdownlint
  • Sass Lint: glen-84.sass-lint
  • TSLint: eg2.tslint

Atom does not support TypeScript out of the box. Please install the following packages to enhance the development experience. To install an extension from the menu bar, go to Packages -> Settings View -> Install Packages/Themes. Search for the following packages individually, and install them.

  • atom-typescript
  • linter
  • linter-eslint
  • linter-htmlhint
  • linter-sass-lint
  • linter-tslint
  • platformio-ide-terminal
apm config set proxy "http://localhost:8080"

apm config set https_proxy "http://localhost:8080"

apm config set strict-ssl false

Restart Atom, then re-attempt to install the atom-typescript package again.

Running Unit Tests

From a terminal run the following command:

npm test

The results of the unit tests and code coverage report will be displayed in the terminal window.

To view the HTML version of the code coverage report, open the index.html in the reports/coverage/browser-name folder with a web browser.

NPM Scripts Command Reference

From a terminal, in the root project folder (where the package.json file exists), the following commands can be executed to perform various project development tasks.

  • npm start - removes the dist folder, builds and deploys the web app, and starts the web app and the rest app in production mode
  • npm test - starts karma to run the unit tests once
  • npm run clean - removes the dist folder
  • npm run dev - starts the web app in development mode
  • npm run prod - starts the web app in production mode
  • npm run web-dev - starts the webpack dev server in development mode (JSON server is not started)
  • npm run web-prod - starts the webpack dev server in production mode (JSON server is not started)
  • npm run rest - starts the rest server
  • npm run webpack-dev:w - runs webpack in development mode under watch mode so web app file changes are automatically processed, and deployed to the dist folder
  • npm run webpack-dev - runs webpack in development mode so web app file changes are processed once, and deployed to the dist folder
  • npm run webpack-prod - runs webpack in production mode so web app file changes are processed once, and deployed to the dist folder
  • npm run webpack-test - runs webpack in test mode so web app file changes are processed once, and deployed to the dist folder
  • npm run tdd - run application in test driven development mode, karma will re-run tests on each file save

To learn more about the Angular/WebPack/TypeScript/Karma configuration, click here.

Useful Resources

mastering-angular-starter's People

Contributors

ericwgreene avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mastering-angular-starter's Issues

Issues running "npm install"

I am starting the "Mastering Angular, Part 1: Components" course and after getting the repo from GitHub and opening it in VS Code I open a terminal and run "npm install" the following errors occur, claiming Python cannot be found, even though the output below reports Python found and then says it cannot find it:

gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "C:\Users\Sid\Python\python.exe" in the PATH
gyp verb which succeeded C:\Users\Sid\Python\python.exe C:\Users\Sid\Python\python.exe
gyp verb check python version C:\Users\Sid\Python\python.exe -c "import platform; print(platform.python_version());" returned: "3.6.1\r\n"
gyp verb could not find "C:\Users\Sid\Python\python.exe". checking python launcher
gyp verb could not find "C:\Users\Sid\Python\python.exe". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\Sid\Python\python.exe", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\DataRoot\Projects\mastering-angular-starter\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\DataRoot\Projects\mastering-angular-starter\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\DataRoot\Projects\mastering-angular-starter\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\DataRoot\Projects\mastering-angular-starter\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "-
-libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\DataRoot\Projects\mastering-angular-starter\node_modules\node-sass
gyp ERR! node -v v8.1.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1

Sid

npm start . webpack compile error

Hello ! This problem :
] [1104] .//zone.js/dist/zone.js 88.7 kB {2} [built]
[0] [1106] multi (webpack)-dev-server/client?http://localhost:5000 ./polyfills.ts 40 bytes {2} [built]
[0] + 336 hidden modules
[0]
[0] ERROR in polyfills.d12e0a60b879580541c7.js from UglifyJs
[0] Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:5000:24,0][polyfills.d12e0a60b879580541c7.js:2954,4]
[0] Child html-webpack-plugin for "index.html":
[0] chunk {0} index.html 541 kB [entry] [rendered]
[0] [0] ./
/lodash/lodash.js 540 kB {0} [built]
[0] [1] ./~/html-webpack-plugin/lib/loader.js!./src/index.html 642 bytes {0} [built]
[0] [2] (webpack)/buildin/global.js 509 bytes {0} [built]
[0] [3] (webpack)/buildin/module.js 517 bytes {0} [built]
[0] webpack: Failed to compile.
npm i && npm start running in environment https://github.com/bitnami/bitnami-docker-express
through connect to terminal docker exec -it "IdContainer" /bin/bash
bitnami@500e8f424294:/app/MasteringAngular$ npm view
npm ERR! Linux 4.4.0-91-generic
npm ERR! argv "/opt/bitnami/node/bin/node" "/opt/bitnami/node/bin/npm" "view"
npm ERR! node v7.7.4
npm ERR! npm v4.2.0
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/ng2-widgets-app
npm ERR! 404
npm ERR! 404 'ng2-widgets-app' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR! /home/bitnami/.npm/_logs/2017-09-30T18_57_14_872Z-debug.log

Can you help, Eric ?

errors occurred during "npm i"

E:\mastering-angular-starter>npm i
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated [email protected]: Use uuid module instead

[email protected] install E:\mastering-angular-starter\node_modules\phantomjs-prebuilt
node install.js

PhantomJS not found on PATH
Download already available at C:\Users\livnat_d\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip
Verified checksum of previously downloaded file
Extracting zip contents
Removing E:\mastering-angular-starter\node_modules\phantomjs-prebuilt\lib\phantom
Copying extracted folder C:\Users\livnat_d\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip-extract-1503487576408\phantomjs-2.1.1-windows -> E:\mastering-angular-starter\node_modu
les\phantomjs-prebuilt\lib\phantom
Writing location.js file
Done. Phantomjs binary available at E:\mastering-angular-starter\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe

[email protected] install E:\mastering-angular-starter\node_modules\node-sass
node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.0/win32-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.0/win32-x64-57_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.

  export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

  npm config set proxy http://example.com:8080

[email protected] postinstall E:\mastering-angular-starter\node_modules\node-sass
node scripts/build.js

Building: C:\Program Files\nodejs\node.exe E:\mastering-angular-starter\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsa
ss_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\Program Files\nodejs\node.exe',
gyp verb cli 'E:\mastering-angular-starter\node_modules\node-gyp\bin\node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which failed Error: not found: python2
gyp verb which failed at getNotFoundError (E:\mastering-angular-starter\node_modules\which\which.js:13:12)
gyp verb which failed at F (E:\mastering-angular-starter\node_modules\which\which.js:68:19)
gyp verb which failed at E (E:\mastering-angular-starter\node_modules\which\which.js:80:29)
gyp verb which failed at E:\mastering-angular-starter\node_modules\which\which.js:89:16
gyp verb which failed at E:\mastering-angular-starter\node_modules\isexe\index.js:42:5
gyp verb which failed at E:\mastering-angular-starter\node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb which failed python2 { Error: not found: python2
gyp verb which failed at getNotFoundError (E:\mastering-angular-starter\node_modules\which\which.js:13:12)
gyp verb which failed at F (E:\mastering-angular-starter\node_modules\which\which.js:68:19)
gyp verb which failed at E (E:\mastering-angular-starter\node_modules\which\which.js:80:29)
gyp verb which failed at E:\mastering-angular-starter\node_modules\which\which.js:89:16
gyp verb which failed at E:\mastering-angular-starter\node_modules\isexe\index.js:42:5
gyp verb which failed at E:\mastering-angular-starter\node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb which failed stack: 'Error: not found: python2\n at getNotFoundError (E:\mastering-angular-starter\node_modules\which\which.js:13:12)\n at F (E:\mastering-angular-
starter\node_modules\which\which.js:68:19)\n at E (E:\mastering-angular-starter\node_modules\which\which.js:80:29)\n at E:\mastering-angular-starter\node_modules\which\wh
ich.js:89:16\n at E:\mastering-angular-starter\node_modules\isexe\index.js:42:5\n at E:\mastering-angular-starter\node_modules\isexe\windows.js:36:5\n at FSReqWrap.oncomp
lete (fs.js:152:21)',
gyp verb which failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb which failed Error: not found: python
gyp verb which failed at getNotFoundError (E:\mastering-angular-starter\node_modules\which\which.js:13:12)
gyp verb which failed at F (E:\mastering-angular-starter\node_modules\which\which.js:68:19)
gyp verb which failed at E (E:\mastering-angular-starter\node_modules\which\which.js:80:29)
gyp verb which failed at E:\mastering-angular-starter\node_modules\which\which.js:89:16
gyp verb which failed at E:\mastering-angular-starter\node_modules\isexe\index.js:42:5
gyp verb which failed at E:\mastering-angular-starter\node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb which failed python { Error: not found: python
gyp verb which failed at getNotFoundError (E:\mastering-angular-starter\node_modules\which\which.js:13:12)
gyp verb which failed at F (E:\mastering-angular-starter\node_modules\which\which.js:68:19)
gyp verb which failed at E (E:\mastering-angular-starter\node_modules\which\which.js:80:29)
gyp verb which failed at E:\mastering-angular-starter\node_modules\which\which.js:89:16
gyp verb which failed at E:\mastering-angular-starter\node_modules\isexe\index.js:42:5
gyp verb which failed at E:\mastering-angular-starter\node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb which failed stack: 'Error: not found: python\n at getNotFoundError (E:\mastering-angular-starter\node_modules\which\which.js:13:12)\n at F (E:\mastering-angular-s
tarter\node_modules\which\which.js:68:19)\n at E (E:\mastering-angular-starter\node_modules\which\which.js:80:29)\n at E:\mastering-angular-starter\node_modules\which\whi
ch.js:89:16\n at E:\mastering-angular-starter\node_modules\isexe\index.js:42:5\n at E:\mastering-angular-starter\node_modules\isexe\windows.js:36:5\n at FSReqWrap.oncompl
ete (fs.js:152:21)',
gyp verb which failed code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (E:\mastering-angular-starter\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (E:\mastering-angular-starter\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at E:\mastering-angular-starter\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe" "E:\mastering-angular-starter\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags="
"--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:\mastering-angular-starter\node_modules\node-sass
gyp ERR! node -v v8.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN The package tslint is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\livnat_d\AppData\Roaming\npm-cache_logs\2017-08-23T11_26_22_311Z-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.