Skip to content

Commit 1817de4

Browse files
committed
Base
0 parents  commit 1817de4

File tree

16 files changed

+506
-0
lines changed

16 files changed

+506
-0
lines changed

.babelrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [
3+
"es2015",
4+
"react",
5+
"stage-0",
6+
"flow"
7+
],
8+
"plugins": [
9+
"remove-comments",
10+
"add-react-displayname"
11+
]
12+
}

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.{json,js,jsx,html,css}]
11+
indent_style = space
12+
indent_size = 2
13+
14+
[.eslintrc]
15+
indent_style = space
16+
indent_size = 2
17+
18+
[*.md]
19+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{
2+
"parser" : "babel-eslint",
3+
"extends" : [
4+
"standard",
5+
"airbnb",
6+
"plugin:flowtype/recommended",
7+
"plugin:jest/recommended"
8+
],
9+
"plugins": [
10+
"babel",
11+
"promise",
12+
"flowtype",
13+
"jest"
14+
],
15+
"env" : {
16+
"jest/globals": true
17+
},
18+
"settings": {
19+
"import/resolver": {
20+
"node": {
21+
"paths": ["src"]
22+
}
23+
}
24+
},
25+
"rules": {
26+
// ESLint Rules
27+
"no-console": 2,
28+
"no-extra-semi": 2,
29+
"no-multi-spaces": 0,
30+
"key-spacing": 0,
31+
"no-return-assign": 0,
32+
"curly": 0,
33+
"padded-blocks": 0,
34+
"brace-style": 0,
35+
"space-before-function-paren": [2, "never"],
36+
"semi" : [2, "never"],
37+
"max-len": [2, 120, 2],
38+
"no-trailing-spaces": 0,
39+
40+
41+
// Babel Rules
42+
"babel/generator-star-spacing": 2,
43+
"babel/new-cap": 2,
44+
"babel/array-bracket-spacing": 2,
45+
"babel/object-curly-spacing": [2, "always"],
46+
"babel/object-shorthand": 2,
47+
"babel/arrow-parens": [0, "as-needed"],
48+
"babel/no-await-in-loop": 2,
49+
"babel/flow-object-type": 2,
50+
"babel/func-params-comma-dangle": 2,
51+
52+
// Jest
53+
"jest/no-disabled-tests": "warn",
54+
"jest/no-focused-tests": "error",
55+
"jest/no-identical-title": "error",
56+
"jest/valid-expect": "error",
57+
58+
// React Rules
59+
"react/forbid-component-props": [0],
60+
"react/forbid-prop-types": [0],
61+
"react/no-children-prop": [2],
62+
"react/no-danger": [0],
63+
"react/no-danger-with-children": [2],
64+
"react/no-deprecated": [2],
65+
"react/no-did-mount-set-state": [2],
66+
"react/no-did-update-set-state": [2],
67+
"react/no-direct-mutation-state": [2],
68+
"react/no-find-dom-node": [2],
69+
"react/no-is-mounted": [2],
70+
"react/no-multi-comp": [2],
71+
"react/no-set-state": [0],
72+
"react/no-string-refs": [2],
73+
"react/no-unescaped-entities": [2],
74+
"react/no-unknown-property": [2],
75+
"react/no-unused-prop-types": [0],
76+
"react/prefer-es6-class": [2, "always"],
77+
"react/prefer-stateless-function": [2],
78+
"react/prop-types": [2],
79+
"react/react-in-jsx-scope": [2],
80+
"react/require-optimization": [1],
81+
"react/require-render-return": [2],
82+
"react/self-closing-comp": [2],
83+
"react/sort-comp": [2, {
84+
"order": [
85+
"static-methods",
86+
"state",
87+
"lifecycle",
88+
"/^on.+$/",
89+
"/^handle.+$/",
90+
"everything-else",
91+
"/^get.+$/",
92+
"rendering"
93+
],
94+
"groups": {
95+
"rendering": [
96+
"/^render.+$/",
97+
"render"
98+
]
99+
}
100+
}],
101+
"react/sort-prop-types": [0],
102+
"react/style-prop-object": [2],
103+
104+
// React JSX Rules
105+
"react/jsx-boolean-value": [0],
106+
"react/jsx-closing-bracket-location": [0],
107+
"react/jsx-curly-spacing": [2],
108+
"react/jsx-equals-spacing": [2],
109+
"react/jsx-filename-extension": [2, { "extensions": [".js"] }],
110+
"react/jsx-first-prop-new-line": [2, "multiline-multiprop"],
111+
"react/jsx-handler-names": [2],
112+
"react/jsx-indent": [2, 2],
113+
"react/jsx-indent-props": [0, 2],
114+
"react/jsx-key": [2],
115+
"react/jsx-no-bind": [1],
116+
"react/jsx-no-comment-textnodes": [2],
117+
"react/jsx-no-duplicate-props": [2],
118+
"react/jsx-no-literals": [0],
119+
"react/jsx-no-target-blank": [2],
120+
"react/jsx-no-undef": [2],
121+
"react/jsx-pascal-case": [2],
122+
"react/jsx-space-before-closing": [2],
123+
"react/jsx-uses-react": [2],
124+
"react/jsx-uses-vars": [2],
125+
"react/jsx-wrap-multilines": [2],
126+
127+
// a11y Rules
128+
"jsx-a11y/img-has-alt": [0],
129+
"jsx-a11y/img-redundant-alt": [2],
130+
"jsx-a11y/aria-role": [2],
131+
"jsx-a11y/no-access-key": [2],
132+
"jsx-a11y/href-no-hash": "off"
133+
134+
}
135+
}

.flowconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[ignore]
2+
.*/node_modules/fbjs/.*
3+
.*/git/.*
4+
5+
[include]
6+
src
7+
8+
[libs]
9+
10+
[options]
11+
esproposal.class_static_fields=enable
12+
esproposal.class_instance_fields=enable
13+
esproposal.export_star_as=enable
14+
experimental.strict_type_args=true
15+
16+
suppress_type=$FlowIssue
17+
suppress_type=$FlowFixMe
18+
suppress_type=$FixMe
19+
20+
munge_underscores=true
21+
22+
[lints]

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*
2+
3+
!__mocks__
4+
!__mocks__/*
5+
!types/**/*
6+
!types
7+
!.babelrc
8+
!.editorconfig
9+
!.eslintrc
10+
!.flowconfig
11+
!.gitignore
12+
!.npmignore
13+
!package.json
14+
!package-lock.json
15+
!readme.md
16+
!src/**/*
17+
!src

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node-modules
2+
.idea
3+
src
4+
__mocks__

package.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"name": "react-tagmanager",
3+
"version": "0.0.1",
4+
"description": "Google Tag Manager for React",
5+
"homepage": "https://github.com/TriPss/react-gtm#readme",
6+
"bugs": {
7+
"url": "https://github.com/TriPSs/gtm/issues"
8+
},
9+
"author": {
10+
"name": "Tycho Bokdam",
11+
"email": "[email protected]"
12+
},
13+
"main": "index.js",
14+
"repository": {
15+
"type": "git",
16+
"url": "git+https://github.com/TriPSs/react-gtm.git"
17+
},
18+
"scripts": {
19+
"build": "NODE_ENV=production babel src -d ./ --copy-files --ignore __tests__/*",
20+
"build:watch": "npm run build -- --watch",
21+
"cleanup": "rimraf index TagManager GTM utils Snippets",
22+
"flow": "flow",
23+
"flow:copy": "./node_modules/flow-copy-source/bin/flow-copy-source.js src ./ --ignore __tests__/*",
24+
"lint:js": "eslint --format=node_modules/eslint-formatter-pretty src/**/*.js",
25+
"lint:js:fix": "npm run lint:js -- --fix",
26+
"lint:styles": "stylelint src/*.css src/**/*.css --syntax scss",
27+
"lint:styles:fix": "stylefmt -r src/*.css src/**/*.css",
28+
"prepublish": "npm run build && npm run flow:copy",
29+
"test": "jest .spec.js",
30+
"test:update": "npm test -- -u",
31+
"test:watch": "npm test -- --watch --coverage=false",
32+
"preversion": "npm run test",
33+
"postversion": "git push && git push --tags && npm publish"
34+
},
35+
"dependencies": {
36+
"debug": "^3.1.0",
37+
"react": "^16.1.1",
38+
"react-router": "^4.2.0"
39+
},
40+
"devDependencies": {
41+
"babel-cli": "^6.26.0",
42+
"babel-eslint": "^8.0.2",
43+
"babel-jest": "^21.2.0",
44+
"babel-plugin-add-react-displayname": "0.0.4",
45+
"babel-plugin-remove-comments": "^2.0.0",
46+
"babel-preset-es2015": "^6.24.1",
47+
"babel-preset-flow": "^6.23.0",
48+
"babel-preset-react": "^6.24.1",
49+
"babel-preset-stage-0": "^6.24.1",
50+
"eslint": "^4.11.0",
51+
"eslint-config-airbnb": "^16.1.0",
52+
"eslint-config-standard": "^10.2.1",
53+
"eslint-formatter-pretty": "^1.3.0",
54+
"eslint-plugin-babel": "^4.1.2",
55+
"eslint-plugin-flowtype": "^2.39.1",
56+
"eslint-plugin-import": "^2.8.0",
57+
"eslint-plugin-jest": "^21.3.2",
58+
"eslint-plugin-jsx-a11y": "^6.0.2",
59+
"eslint-plugin-node": "^5.2.1",
60+
"eslint-plugin-promise": "^3.6.0",
61+
"eslint-plugin-react": "^7.4.0",
62+
"eslint-plugin-standard": "^3.0.1",
63+
"flow-bin": "^0.59.0",
64+
"flow-copy-source": "^1.2.1",
65+
"jest": "^21.2.1",
66+
"nock": "^9.1.0",
67+
"react-test-renderer": "^16.1.1",
68+
"redux": "^3.7.2",
69+
"redux-mock-store": "^1.3.0",
70+
"redux-thunk": "^2.2.0"
71+
},
72+
"jest": {
73+
"modulePaths": [
74+
"src"
75+
],
76+
"collectCoverage": true,
77+
"collectCoverageFrom": [
78+
"src/**/*.{js}",
79+
"!**/node_modules/**"
80+
],
81+
"moduleNameMapper": {
82+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
83+
"\\.(css|less|scss)$": "<rootDir>/__mocks__/styleMock.js"
84+
}
85+
}
86+
}

readme.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<p align="center">
2+
<a href="https://www.npmjs.com/package/react-tag-manager">
3+
<img alt="Google Tag Manager" src="https://daks2k3a4ib2z.cloudfront.net/591c03efc7fff47e9216373a/591c03efc7fff47e9216377b_%5Badaptive%5Dlogo-tag-manager-min.png" width="400">
4+
</a>
5+
</p>
6+
7+
<p align="center">
8+
<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>
9+
<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>
10+
<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>
11+
<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>
12+
</p>
13+
14+
---
15+
16+
## Installation
17+
```shell
18+
$ npm install --save react-tag-manager
19+
```
20+
21+
## Development
22+
If you'd like to contribute to this project, all you need to do is clone
23+
this project and run:
24+
25+
```shell
26+
$ npm install
27+
$ npm run build
28+
$ npm run build:watch // To recompile files on file change
29+
```
30+
31+
### Using development version in local project
32+
You can use `npm link` to use your development version in your own project:
33+
- Go to `react-tag-manager` directory and execute command `npm link`
34+
- Go to your project directory and execute command `npm link react-tag-manager`
35+

src/DataLayer/DataLayer.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// @flow
2+
import React from 'react'
3+
import api from '../api'
4+
5+
export class DataLayer extends React.Component {
6+
7+
constructor(props) {
8+
super(props)
9+
10+
api.setDataLayer(props)
11+
}
12+
13+
componentWillReceiveProps(nextProps) {
14+
api.setDataLayer(nextProps)
15+
}
16+
17+
render() {
18+
return null
19+
}
20+
21+
}

src/DataLayer/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './DataLayer'

0 commit comments

Comments
 (0)