Skip to content

Commit

Permalink
Base
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs committed Nov 19, 2017
0 parents commit 1817de4
Show file tree
Hide file tree
Showing 16 changed files with 506 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
"es2015",
"react",
"stage-0",
"flow"
],
"plugins": [
"remove-comments",
"add-react-displayname"
]
}
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{json,js,jsx,html,css}]
indent_style = space
indent_size = 2

[.eslintrc]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
135 changes: 135 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"parser" : "babel-eslint",
"extends" : [
"standard",
"airbnb",
"plugin:flowtype/recommended",
"plugin:jest/recommended"
],
"plugins": [
"babel",
"promise",
"flowtype",
"jest"
],
"env" : {
"jest/globals": true
},
"settings": {
"import/resolver": {
"node": {
"paths": ["src"]
}
}
},
"rules": {
// ESLint Rules
"no-console": 2,
"no-extra-semi": 2,
"no-multi-spaces": 0,
"key-spacing": 0,
"no-return-assign": 0,
"curly": 0,
"padded-blocks": 0,
"brace-style": 0,
"space-before-function-paren": [2, "never"],
"semi" : [2, "never"],
"max-len": [2, 120, 2],
"no-trailing-spaces": 0,


// Babel Rules
"babel/generator-star-spacing": 2,
"babel/new-cap": 2,
"babel/array-bracket-spacing": 2,
"babel/object-curly-spacing": [2, "always"],
"babel/object-shorthand": 2,
"babel/arrow-parens": [0, "as-needed"],
"babel/no-await-in-loop": 2,
"babel/flow-object-type": 2,
"babel/func-params-comma-dangle": 2,

// Jest
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/valid-expect": "error",

// React Rules
"react/forbid-component-props": [0],
"react/forbid-prop-types": [0],
"react/no-children-prop": [2],
"react/no-danger": [0],
"react/no-danger-with-children": [2],
"react/no-deprecated": [2],
"react/no-did-mount-set-state": [2],
"react/no-did-update-set-state": [2],
"react/no-direct-mutation-state": [2],
"react/no-find-dom-node": [2],
"react/no-is-mounted": [2],
"react/no-multi-comp": [2],
"react/no-set-state": [0],
"react/no-string-refs": [2],
"react/no-unescaped-entities": [2],
"react/no-unknown-property": [2],
"react/no-unused-prop-types": [0],
"react/prefer-es6-class": [2, "always"],
"react/prefer-stateless-function": [2],
"react/prop-types": [2],
"react/react-in-jsx-scope": [2],
"react/require-optimization": [1],
"react/require-render-return": [2],
"react/self-closing-comp": [2],
"react/sort-comp": [2, {
"order": [
"static-methods",
"state",
"lifecycle",
"/^on.+$/",
"/^handle.+$/",
"everything-else",
"/^get.+$/",
"rendering"
],
"groups": {
"rendering": [
"/^render.+$/",
"render"
]
}
}],
"react/sort-prop-types": [0],
"react/style-prop-object": [2],

// React JSX Rules
"react/jsx-boolean-value": [0],
"react/jsx-closing-bracket-location": [0],
"react/jsx-curly-spacing": [2],
"react/jsx-equals-spacing": [2],
"react/jsx-filename-extension": [2, { "extensions": [".js"] }],
"react/jsx-first-prop-new-line": [2, "multiline-multiprop"],
"react/jsx-handler-names": [2],
"react/jsx-indent": [2, 2],
"react/jsx-indent-props": [0, 2],
"react/jsx-key": [2],
"react/jsx-no-bind": [1],
"react/jsx-no-comment-textnodes": [2],
"react/jsx-no-duplicate-props": [2],
"react/jsx-no-literals": [0],
"react/jsx-no-target-blank": [2],
"react/jsx-no-undef": [2],
"react/jsx-pascal-case": [2],
"react/jsx-space-before-closing": [2],
"react/jsx-uses-react": [2],
"react/jsx-uses-vars": [2],
"react/jsx-wrap-multilines": [2],

// a11y Rules
"jsx-a11y/img-has-alt": [0],
"jsx-a11y/img-redundant-alt": [2],
"jsx-a11y/aria-role": [2],
"jsx-a11y/no-access-key": [2],
"jsx-a11y/href-no-hash": "off"

}
}
22 changes: 22 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[ignore]
.*/node_modules/fbjs/.*
.*/git/.*

[include]
src

[libs]

[options]
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
esproposal.export_star_as=enable
experimental.strict_type_args=true

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

munge_underscores=true

[lints]
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*

!__mocks__
!__mocks__/*
!types/**/*
!types
!.babelrc
!.editorconfig
!.eslintrc
!.flowconfig
!.gitignore
!.npmignore
!package.json
!package-lock.json
!readme.md
!src/**/*
!src
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node-modules
.idea
src
__mocks__
86 changes: 86 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"name": "react-tagmanager",
"version": "0.0.1",
"description": "Google Tag Manager for React",
"homepage": "https://github.com/TriPss/react-gtm#readme",
"bugs": {
"url": "https://github.com/TriPSs/gtm/issues"
},
"author": {
"name": "Tycho Bokdam",
"email": "[email protected]"
},
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/TriPSs/react-gtm.git"
},
"scripts": {
"build": "NODE_ENV=production babel src -d ./ --copy-files --ignore __tests__/*",
"build:watch": "npm run build -- --watch",
"cleanup": "rimraf index TagManager GTM utils Snippets",
"flow": "flow",
"flow:copy": "./node_modules/flow-copy-source/bin/flow-copy-source.js src ./ --ignore __tests__/*",
"lint:js": "eslint --format=node_modules/eslint-formatter-pretty src/**/*.js",
"lint:js:fix": "npm run lint:js -- --fix",
"lint:styles": "stylelint src/*.css src/**/*.css --syntax scss",
"lint:styles:fix": "stylefmt -r src/*.css src/**/*.css",
"prepublish": "npm run build && npm run flow:copy",
"test": "jest .spec.js",
"test:update": "npm test -- -u",
"test:watch": "npm test -- --watch --coverage=false",
"preversion": "npm run test",
"postversion": "git push && git push --tags && npm publish"
},
"dependencies": {
"debug": "^3.1.0",
"react": "^16.1.1",
"react-router": "^4.2.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^8.0.2",
"babel-jest": "^21.2.0",
"babel-plugin-add-react-displayname": "0.0.4",
"babel-plugin-remove-comments": "^2.0.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-flow": "^6.23.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"eslint": "^4.11.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-standard": "^10.2.1",
"eslint-formatter-pretty": "^1.3.0",
"eslint-plugin-babel": "^4.1.2",
"eslint-plugin-flowtype": "^2.39.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jest": "^21.3.2",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-standard": "^3.0.1",
"flow-bin": "^0.59.0",
"flow-copy-source": "^1.2.1",
"jest": "^21.2.1",
"nock": "^9.1.0",
"react-test-renderer": "^16.1.1",
"redux": "^3.7.2",
"redux-mock-store": "^1.3.0",
"redux-thunk": "^2.2.0"
},
"jest": {
"modulePaths": [
"src"
],
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.{js}",
"!**/node_modules/**"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less|scss)$": "<rootDir>/__mocks__/styleMock.js"
}
}
}
35 changes: 35 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<p align="center">
<a href="https://www.npmjs.com/package/react-tag-manager">
<img alt="Google Tag Manager" src="https://daks2k3a4ib2z.cloudfront.net/591c03efc7fff47e9216373a/591c03efc7fff47e9216377b_%5Badaptive%5Dlogo-tag-manager-min.png" width="400">
</a>
</p>

<p align="center">
<a href="https://www.npmjs.com/package/react-tag-manager" title="downloads"><img src="https://img.shields.io/npm/v/react-tag-manager.svg?maxAge=2592000&style=flat-square"/></a>
<a href="https://npm-stat.com/charts.html?package=react-tag-manager" title="downloads"><img src="https://img.shields.io/npm/dt/react-tag-manager.svg?maxAge=2592000&style=flat-square"/></a>
<a href="https://david-dm.org/tripss/react-tag-manager" title="dependencies status"><img src="https://david-dm.org/tripss/react-tag-manager/status.svg?style=flat-square"/></a>
<a href="https://david-dm.org/tripss/react-tag-manager?type=dev" title="devDependencies status"><img src="https://david-dm.org/tripss/react-tag-manager/dev-status.svg?style=flat-square"/></a>
</p>

---

## Installation
```shell
$ npm install --save react-tag-manager
```

## Development
If you'd like to contribute to this project, all you need to do is clone
this project and run:

```shell
$ npm install
$ npm run build
$ npm run build:watch // To recompile files on file change
```

### Using development version in local project
You can use `npm link` to use your development version in your own project:
- Go to `react-tag-manager` directory and execute command `npm link`
- Go to your project directory and execute command `npm link react-tag-manager`

21 changes: 21 additions & 0 deletions src/DataLayer/DataLayer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// @flow
import React from 'react'
import api from '../api'

export class DataLayer extends React.Component {

constructor(props) {
super(props)

api.setDataLayer(props)
}

componentWillReceiveProps(nextProps) {
api.setDataLayer(nextProps)
}

render() {
return null
}

}
1 change: 1 addition & 0 deletions src/DataLayer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './DataLayer'
Loading

0 comments on commit 1817de4

Please sign in to comment.