You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+52-21Lines changed: 52 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -2,55 +2,81 @@
2
2
3
3
This repository houses any new topcoder pages or refactored Angular apps/pages from the tc-site repository.
4
4
5
-
The technologies used are Jade, SCSS, Angular, and Gulp.
5
+
The technologies used are Jade, SCSS, Angular, and Webpack.
6
6
7
7
## Installation
8
8
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.
12
10
13
11
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
16
15
17
16
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.
18
17
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
+
```
23
44
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`
25
51
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
28
57
29
58
To read about the file and folder structure of tests, read [this section](https://github.com/appirio-tech/topcoder-app#tests)
30
59
31
60
### Description of Files and Folders
32
61
33
62
#### 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.
35
64
36
65
#### 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`.
38
67
39
68
#### assets
40
69
- The assets folder contains CSS, fonts, images, and scripts
41
70
- CSS
42
71
- Each Angular submodule has a CSS folder with the same name
43
72
- All files are in the `.scss` format
44
73
- 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.
49
75
50
76
#### 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`.
52
78
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.
54
80
55
81
## UI-Router and States
56
82
See any *.routes.js file as an example.
@@ -61,6 +87,10 @@ See any *.routes.js file as an example.
61
87
62
88
### Style Guide and Naming Conventions
63
89
90
+
- Please use ES2015 syntax whenever possible
91
+
- Do not use semicolons
92
+
- Use the Angular style guide mentioned below
93
+
64
94
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.
65
95
66
96
### Pull Requests
@@ -110,6 +140,7 @@ SCSS Files
110
140
- This repository uses flexbox for arranging content. The use of any extra CSS libraries should be discussed with the team
111
141
112
142
JavaScript
143
+
- Use ES2015
113
144
- 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)
0 commit comments