Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mtejedorwolox committed Oct 30, 2017
0 parents commit 0a4b13e
Show file tree
Hide file tree
Showing 78 changed files with 9,132 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["transform-object-rest-spread"],
"presets": ["es2015"]
}
19 changes: 19 additions & 0 deletions .codestats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
config:
token: <%= ENV['CODE_STATS_TOKEN'] %>
ci: 'JENKINS'
url: 'http://codestats.wolox.com.ar/'
metrics:
escomplex:
name: 'Js Maintainability'
location: 'code-quality-report/stats.json'
enabled: true
minimum: 75
build_base_url: 'http://ci.wolox.com.ar/job'
build_report_file_url: 'Code_Quality_Report'
karma_coverage:
name: 'Code Coverage'
location: 'test/unit/coverage/cobertura-coverage.xml'
enabled: true
minimum: 20
build_base_url: 'http://ci.wolox.com.ar/job'
build_report_file_url: 'cobertura'
Empty file added .eslintignore
Empty file.
177 changes: 177 additions & 0 deletions .eslintrc

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# npm dependencies
node_modules

# npm log file
npm-debug.log

# build files
build

# aws keys file
config/aws.js

# config keys
config/secrets.js

# mac files
.DS_Store

# unit tests coverage report
test/unit/coverage

# unit tests results report
test/unit/test-results.xml

# protractor test results report
protractor-results.xml

# static analysis report
code-quality-report

# deploy cache
.awspublish*

#Backstopjs images
backstop_data

#IDE files
.vscode
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
44 changes: 44 additions & 0 deletions .pug-lintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"disallowAttributeConcatenation": true,
"disallowAttributeInterpolation": true,
"disallowAttributeTemplateString": "all",
"disallowBlockExpansion": true,
"disallowClassAttributeWithStaticValue": true,
"disallowClassLiteralsBeforeAttributes": null,
"disallowClassLiteralsBeforeIdLiterals": true,
"disallowClassLiterals": null,
"disallowDuplicateAttributes": true,
"disallowHtmlText": null,
"disallowIdAttributeWithStaticValue": true,
"disallowIdLiteralsBeforeAttributes": null,
"disallowIdLiterals": null,
"disallowLegacyMixinCall": true,
"disallowMultipleLineBreaks": true,
"disallowSpaceAfterCodeOperator": true,
"disallowSpacesInsideAttributeBrackets": true,
"disallowSpecificAttributes": null,
"disallowSpecificTags": null,
"disallowStringConcatenation": true,
"disallowStringInterpolation": true,
"disallowTagInterpolation": true,
"disallowTemplateString": true,
"maximumNumberOfLines": null,
"requireClassLiteralsBeforeAttributes": true,
"requireClassLiteralsBeforeIdLiterals": null,
"requireIdLiteralsBeforeAttributes": true,
"requireLineFeedAtFileEnd": true,
"requireLowerCaseAttributes": true,
"requireLowerCaseTags": true,
"requireSpaceAfterCodeOperator": true,
"requireSpacesInsideAttributeBrackets": null,
"requireSpecificAttributes": [ { "img": [ "alt" ] } ],
"requireStrictEqualityOperators": true,
"validateAttributeQuoteMarks": true,
"validateAttributeSeparator": { "separator": " ", "multiLineSeparator": "\n " },
"validateDivTags": true,
"validateExtensions": true,
"validateIndentation": 2,
"validateLineBreaks": null,
"validateSelfClosingTags": true,
"validateTemplateString": true
}
67 changes: 67 additions & 0 deletions .sass-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
files:
include:
- 'src/**/*.scss'
ignore:
- 'src/scss/overrides/**/*.scss'
rules:
border-zero: 2
brace-style: 2
empty-line-between-blocks:
- 2
- include: true
allow-single-line-rulesets: true
extends-before-declarations: 2
final-newline: 2
force-element-nesting: false
force-pseudo-nesting: false
function-name-format:
- 2
- allow-leading-underscore: false
convention: camelcase
hex-length: 2
hex-notation:
- 2
- style: uppercase
indentation: 2
leading-zero:
- 2
- include: true
mixin-name-format:
- 2
- allow-leading-underscore: false
convention: camelcase
mixins-before-declarations: 2
nesting-depth:
- 2
- max-depth: 5
no-color-keywords: 2
no-color-literals: 2
no-css-comments: 2
no-debug: 2
no-duplicate-properties: 2
no-empty-rulesets: 2
no-ids: 1
no-important: 1
no-invalid-hex: 2
no-mergeable-selectors: 2
no-misspelled-properties: 2
no-trailing-zero: 2
no-vendor-prefixes: 2
no-warn: 2
one-declaration-per-line: 2
quotes: 2
shorthand-values: 2
single-line-per-selector: 2
space-after-bang: 2
space-after-colon: 2
space-after-comma: 2
space-before-bang: 2
space-before-brace: 2
space-before-colon: 2
space-between-parens: 2
trailing-semicolon: 2
url-quotes: 2
variable-name-format:
- 2
- allow-leading-underscore: false
zero-unit: 2
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: node_js
node_js:
- "0.12"


install:
- npm install

script:
- ./node_modules/.bin/gulp ci:js
- ./node_modules/.bin/gulp ci:sass
- ./node_modules/.bin/gulp ci:pug

cache:
directories:
- node_modules
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM node:4

# add chrome packages to apt and update
RUN apt-get clean
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
RUN apt-get update

# java is necessary for xvfb
RUN apt-get install openjdk-7-jdk -y
# Define commonly used JAVA_HOME variable
ENV JAVA_HOME /usr/lib/jvm/java-7-oracle

# xvfb creates a virtual display so that chrome can run
RUN apt-get install xvfb x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps -y
# install chrome for protractor tests to run
RUN apt-get install google-chrome-stable -y

# configure logging
RUN npm config set loglevel error --global

# project dependencies
ADD package.json /tmp/package.json
RUN cd /tmp && npm install
RUN ./tmp/node_modules/.bin/webdriver-manager update
RUN mkdir -p /myapp && cp -a /tmp/node_modules /myapp

ADD . /myapp
WORKDIR /myapp
144 changes: 144 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
AM Comunications
===============

Kickoff for web applications.

## Main Tools
+ [Babel](https://babeljs.io/)
+ [Sass](http://sass-lang.com)
+ [Pug](https://pugjs.org)
+ [Gulp](http://gulpjs.com/)
+ [BrowserSync](http://www.browsersync.io/)
+ [ESLint](http://eslint.org/)

## First steps
#### Installing node
Get the latest version of node from the [official website](https://nodejs.org/) or using [nvm](https://github.com/creationix/nvm)
Nvm approach is preferred. Also, you may find this [tool](https://github.com/wbyoung/avn) useful to automate version changing between projects.

#### Getting the dev dependencies
Run `npm install` from rootpath of the project.

#### Gulp. The right way
During the project development you will probably use gulp every day, so let's use it in the right way.
A very popular way of getting these kind of packages is simply tell npm to install them globally using the `-g` flag.
That's needless as gulp is already included in this project dependencies. A big problem can have place if the version of the packages that were installed globally do not match the versions that each project require.
The right way to execute these tools is using the binaries in the node_modules folder, that is `node_modules/.bin/`.
To execute gulp just use the following in your terminal: `./node_modules/.bin/gulp`. The same applies for other dependencies that have command line tools.
Adding an alias in your .bashrc/.bash_profile for these tools is highly recommended:
```bash
alias gulp='node_modules/.bin/gulp'
```

#### Gulp
To start your app run `gulp` in the rootpath of the project. Then access your app at **localhost:port**. The port is logged in the console where you ran gulp.

## Development

#### Environments
By default, the environment will be **development**, but you can easily change it using the **env** param in your gulp tasks: ```gulp --env production```

#### SCSS
When creating SCSS files you don't need to import other files inside yours to use properties from them. There's a specific file called `application.scss` where every SCSS file should be imported in the desired priority order. This works just like the stylesheet elements in the head of an html, when repeated rules are present the rule that was imported last will override the other.

#### Vendors
To add a vendor simply install and save it using npm. Then add the path of the source files relative to the **node_modules** folder, to **vendorJs.js** or **vendorCss.js** depending on what you are adding.
i.e: Adding jquery
```bash
npm install --save jquery
```
This will generate the **jquery** folder inside **node_modules** and add the register the dependency in the `package.json` file. Then, add the source file of jquery to **vendorJs.js**. It should look like this:
```
module.exports = [
'jquery/dist/jquery.js',
];
```

#### Testing

##### Unit testing
We combine the power of [Karma](http://karma-runner.github.io/) and [Jasmine](http://jasmine.github.io/) frameworks to develop our unit testing. You can find the configuration files in the `test/unit` folder and you can find the tests inside the `test/unit/specs` folder.
To run these specs execute the following: `npm run test`

##### End to end tests

We combine the power of Protractor and Jasmine frameworks to develop our end to end tests. You can find the configuration files in the test/e2e folder and you can find the tests inside the test/e2e/specs folder.

The first time you are running the tests, you probably need to update webdriver. Use the following: `./node_modules/.bin/webdriver-manager update`
To run these specs against the url in the protractor conf execute the following: `npm run protractor`
To run these specs against your development environment, execute the following: `npm run protractor-local`. This will hit the app in `localhost:3000`.

## Deploy

#### S3
In order to deploy you must first create **config/aws.js** file with the credentials of the Amazon S3 bucket for each environment.
The file needs to have to follow the format specified in *config/aws.js.example*

Then just run `gulp s3 --env <environment name>` with your desired env as parameter.

Finally, you need to add a custom routing rule so that s3 handles the 404 (or 403 depending or the bucket policy) to the s3 properties. In the **Static Website Hosting** panel, check the **Enable website hosting** option and complete the form with the following:
```
Index document: index.html
```
And add this redirect rule (Depending on the bucket policy the error code to handle can be either 404 or 403)
```
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<ReplaceKeyPrefixWith>#/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
```

## Further reading
Check the docs folder for extra help on usual tasks or issues:
- [Adding new vendors](docs/ADDING_NEW_VENDORS.md)
- [Adding google analytics](docs/ADDING_GOOGLE_ANALYTICS.md)
- [Troubleshooting](docs/TROUBLESHOOTING.md)
- [Maintenance mode](docs/MAINTENANCE_MODE.md)
- [Webp assets](docs/WEBP.md)
- [Css regression testing](docs/CSS_REGRESSION_TESTING.md)


## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## About

This project is maintained by [Sebastian Balay](https://github.com/sbalay) and it was written by [Wolox](http://www.wolox.com.ar).

![Wolox](https://raw.githubusercontent.com/Wolox/press-kit/master/logos/logo_banner.png)


## License

**am-communications** is available under the MIT [license](LICENSE).

Copyright (c) 2015 Sebastián Balay <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit 0a4b13e

Please sign in to comment.