|
19 | 19 | 1. [Methods](#methods)
|
20 | 20 | 1. [Ordering](#ordering)
|
21 | 21 | 1. [`isMounted`](#ismounted)
|
| 22 | + 1. [Project configuration files](#project-configuration-files) |
| 23 | + |
22 | 24 |
|
23 | 25 | ## Basic Rules
|
24 | 26 |
|
|
617 | 619 |
|
618 | 620 | [anti-pattern]: https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html
|
619 | 621 |
|
| 622 | + |
| 623 | +## Project configuration files |
| 624 | +Environment configuration files should be placed into: `src/environmenjs/` directory (following Angular CLI pattern). |
| 625 | + |
| 626 | +Environment configuration directory should contains 4 files: |
| 627 | + |
| 628 | +``` |
| 629 | +├── environment.js - localhost config |
| 630 | +├── environment.dev.js - development server config |
| 631 | +├── environment.stag.js - stagging server config |
| 632 | +├── environment.prod.js - production server config |
| 633 | +``` |
| 634 | + |
| 635 | +Which will be used for providing suitable data for every environment. |
| 636 | + |
| 637 | +Example of configuration file: |
| 638 | +``` |
| 639 | +export const environment = { |
| 640 | + production: false, |
| 641 | + apiUrl: 'http://example.com/api/', |
| 642 | +}; |
| 643 | +``` |
| 644 | + |
| 645 | +#### Repository |
| 646 | +Configuration files used for build process should not be stored in remote repository (should be added to `.gitignore` |
| 647 | +file) owing to the possibility of including sensitive data. |
| 648 | + |
| 649 | +All configuration files should be replaced with matching `*.js.example` file. |
| 650 | + |
| 651 | +Files stored in remote reposition: |
| 652 | + |
| 653 | +``` |
| 654 | +├── environment.js.example |
| 655 | +├── environment.dev.js.example |
| 656 | +├── environment.stag.js.example |
| 657 | +├── environment.prod.js.example |
| 658 | +``` |
| 659 | + |
| 660 | +Example of `environment.dev.js.example`: |
| 661 | +``` |
| 662 | +export const environment = { |
| 663 | + production: false, |
| 664 | + apiUrl: 'http://example.com/api/', |
| 665 | + gcmKey: 'ADD_GCM_KEY_HERE' |
| 666 | +}; |
| 667 | +``` |
| 668 | + |
| 669 | +Generating files under `src/environmenjs/` should be done automatically using: |
| 670 | + |
| 671 | +``` |
| 672 | + npm run init |
| 673 | +``` |
| 674 | +bash command triggered after `npm run init` should be implemented additionally by developer |
| 675 | + |
620 | 676 | ## Translation
|
621 | 677 |
|
622 | 678 | This JSX/React style guide is also available in other languages:
|
|
0 commit comments