Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 29d1a16

Browse files
committed
Merge pull request #703 from appirio-tech/readme-updates
Update readme for webpack
2 parents ad267b5 + 4c1f7fa commit 29d1a16

File tree

1 file changed

+52
-21
lines changed

1 file changed

+52
-21
lines changed

README.md

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,81 @@
22

33
This repository houses any new topcoder pages or refactored Angular apps/pages from the tc-site repository.
44

5-
The technologies used are Jade, SCSS, Angular, and Gulp.
5+
The technologies used are Jade, SCSS, Angular, and Webpack.
66

77
## Installation
88

9-
If you don't have compass installed, run the following:
10-
- Windows - gem install compass
11-
- Linux/OS X - sudo gem install compass
9+
We use node 5.x and npm 3.x, so you may need to download a new version of node. The easiest way is to download [nvm](https://github.com/creationix/nvm). We have a `.nvmrc` file in the root of the project, so you can just run `nvm use` to switch to the correct version of node.
1210

1311
Install dependencies by running the following in the root of the project:
14-
- npm install
15-
- bower install
12+
- `npm i`
13+
- **Note:** You must use npm 3. Type `npm -v` to ensure you have a 3.x version.
14+
- bower i
1615

1716
In order to test a logged in user, you must make an entry in your /etc/hosts file, pointing local.topcoder-dev.com to localhost. For example, open your /etc/hosts file with something like `vim /etc/hosts` and add `127.0.0.1 local.topcoder-dev.com`. After you run `gulp serve`, which launches a new window or tab, change `http://localhost:3000/sample/` to `http://local.topcoder-dev.com:3000/sample/`. You will then be able to login and pick up information from the cookies with `.topcoder-dev.com` as the domain.
1817

19-
## Gulpfile Commands
20-
- To run locally without minification: `gulp serve`
21-
- To create the build: `gulp build:topcoder`
22-
- To run the test runner and view specs.html: `gulp serve-specs`
18+
## NPM Commands
19+
- To run locally: `npm run dev` and head to `local.topcoder-dev.com:3000/my-dashboard`
20+
- To create the build: `npm run build`
21+
- To run the tests: `npm test`
22+
23+
## Recommended Developer Tools
24+
25+
Syntax highlighting for ES6 and React JSX
26+
- Install [babel](https://packagecontrol.io/packages/Babel) via the package manager in Sublime Text
27+
- **Note:** Sublime Text 3 is required for this plugin
28+
- Set the plugin as the default syntax for a particular extension
29+
- Open a file with the `.js` extension
30+
- Select `View` from the menu
31+
- Then `Syntax -> Open all with current extension as...`
32+
- Then `Babel -> JavaScript (Babel)`
33+
- Repeat for any other extensions, e.g. `.jsx`
34+
35+
Recommended Theme
36+
- Install [Oceanic Next Color Theme](https://github.com/voronianski/oceanic-next-color-scheme) via the Sublime Text package manager.
37+
- Add the following to `Sublime Text -> Preferences -> Settings-User` (`⌘ + ,` on Mac)
38+
```
39+
{
40+
"color_scheme": "Packages/Oceanic Next Color Scheme/Oceanic Next.tmTheme",
41+
"theme": "Oceanic Next.sublime-theme"
42+
}
43+
```
2344

24-
### Testing
45+
JavaScript linting
46+
- Install [ESLint](http://eslint.org/docs/user-guide/getting-started) with `npm i -g eslint`
47+
- For new projects, you can create a local `.eslintrc.json` file by running `eslint --init`
48+
- **Note:** If you're using ES6, make sure you add `"modules": true` to `"ecmaFeatures"` and `"node": true` to `"env"` in your `.eslintrc.json` file
49+
- **Note:** If you are using React, make sure you have `eslint` and `eslint-plugin-react` as `devDependencies` in your `package.json` file
50+
- **Optional**: Add `"lint": "eslint ."` to your `package.json` file to run linting at any time via `npm run lint`
2551

26-
Running `gulp test:topcoder` will perform a single run of the unit tests with Karma in the command line.
27-
Running `gulp autotest:topcoder` will keep the server running and watching files in the command line.
52+
Automatic JavaScript linting in Sublime Text
53+
- Install [SublimeLinter](http://sublimelinter.readthedocs.org/en/latest/installation.html) following the instructions under "Installing via Package Control"
54+
- Install [SublimeLinter-eslint](https://github.com/roadhump/SublimeLinter-eslint) with the package manager. The package is called `SublimeLinter-contrib-eslint`
55+
56+
### Testing
2857

2958
To read about the file and folder structure of tests, read [this section](https://github.com/appirio-tech/topcoder-app#tests)
3059

3160
### Description of Files and Folders
3261

3362
#### app
34-
This folder holds all of our Angular JavaScript and Jade files. Here you'll find the top level Angular app in topcoder.module.js. It has all of our submodules as dependencies (tc.peer-review, tc.account, etc.). Each submodule has its own folder, including its own Angular module declaration, e.g. 'peer-review/peer-review.module.js'. All files are named according to their Angular component, e.g. review-status.controller.js, peer-review.routes.js.
63+
This folder holds all of our Angular JavaScript and Jade files. Here you'll find the top level Angular app in `topcoder.module.js`. It has all of our submodules as dependencies (tc.peer-review, tc.account, etc.). Each submodule has its own folder, including its own Angular module declaration, e.g. 'peer-review/peer-review.module.js'. All files are named according to their Angular component, e.g. review-status.controller.js, peer-review.routes.js.
3564

3665
#### app/services
37-
Services live in their own folder. All services are part of the tc.services module, which is a dependency of topcoder.module.js.
66+
Services live in their own folder. All services are part of the tc.services module, which is a dependency of `topcoder.module.js`.
3867

3968
#### assets
4069
- The assets folder contains CSS, fonts, images, and scripts
4170
- CSS
4271
- Each Angular submodule has a CSS folder with the same name
4372
- All files are in the `.scss` format
4473
- Scripts
45-
- This folder contains any vendor JavaScript that does not come from bower. (Basically anything we've been using a CDN to get, but that we want to have a local copy of. This allows us to handle minification and concatenation ourselves and put it on our own CDN)
46-
47-
#### build
48-
This is the optimized code ready for production. In here we have minified, concatenated vendor.js and app.js as well as minified and concatenated app.css. Running `grunt build:topcoder` also creates a templates.js file which stores all our HTML in Angular's $templateCache. This is created in .tmp, injected in the index.html, and concatenated with the rest of the app JavaScript. The last step in creating the build folder is that all of our files are revved and rewritten to have a unique filename, allowing us to put them on our CDN.
74+
- This folder contains our analytics, e.g. Google, New Relic, etc.
4975

5076
#### tests
51-
The tests folder contains mock data (tests/test-helpers/mock-data.js). It also has a file for integration tests down the road, but this is not currently wired up (server-integration/someDataService.spec.js). To run tests, use the `gulp serve-specs` task. This serves up specs.html, where you can see all the tests passing. It will watch files and reload as you work on code and save.
77+
The tests folder contains mock data (tests/test-helpers/mock-data.js). To run tests, use `npm test`.
5278

53-
Spec files live alongside the code they are testing. For example, in peer-review you have review-status.controller.js and review-status.spec.js in the same review-status folder. If you want to see an example of tests, use review-status.spec.js as an example of controller tests and services/challenge.service.spec.js as an example of service tests.
79+
Spec files live alongside the code they are testing. For example, in peer-review you have review-status.controller.js and review-status.spec.js in the same review-status folder.
5480

5581
## UI-Router and States
5682
See any *.routes.js file as an example.
@@ -61,6 +87,10 @@ See any *.routes.js file as an example.
6187

6288
### Style Guide and Naming Conventions
6389

90+
- Please use ES2015 syntax whenever possible
91+
- Do not use semicolons
92+
- Use the Angular style guide mentioned below
93+
6494
In general, follow this [AngularJS style guide](https://github.com/johnpapa/angular-styleguide), which covers JavaScript code style, JavaScript variable naming, and file naming conventions. One deviation is in the naming of services, where we follow the same pattern as controllers, e.g. UserService, ProfileService.
6595

6696
### Pull Requests
@@ -110,6 +140,7 @@ SCSS Files
110140
- This repository uses flexbox for arranging content. The use of any extra CSS libraries should be discussed with the team
111141

112142
JavaScript
143+
- Use ES2015
113144
- See this section on [naming conventions and style guide](https://github.com/appirio-tech/topcoder-app/blob/dev/README.md#style-guide-and-naming-conventions)
114145

115146
Creating New Views/Pages

0 commit comments

Comments
 (0)