react-recaptcha-x
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -0,1 +1,12 @@ | ||
## [1.0.7](https://github.com/antokara/react-recaptcha-x/compare/v1.0.6...v1.0.7) (2019-10-25) | ||
### Bug Fixes | ||
* **provider:** avoid script multi inject ([a94d9f9](https://github.com/antokara/react-recaptcha-x/commit/a94d9f94bf5c38fd61618990252fae78584b1478)) | ||
* **provider:** avoid script/style multi inject ([1e2e87e](https://github.com/antokara/react-recaptcha-x/commit/1e2e87e3df04b4735ed3cdcc1023b2f613acb8fa)) | ||
* **provider:** multiple style tag injection ([1e215c0](https://github.com/antokara/react-recaptcha-x/commit/1e215c0351d989d4ceeee4bfcda437c9673159dd)) | ||
* **provider:** style tag inject ([1b25669](https://github.com/antokara/react-recaptcha-x/commit/1b25669502fac4d25c2a485fdd96035165a3f6e0)) | ||
* **recaptcha provider:** properly set script attrs ([8d857f9](https://github.com/antokara/react-recaptcha-x/commit/8d857f92056abe88966125d9f941a88309be9467)) | ||
## [1.0.6](https://github.com/antokara/react-recaptcha-x/compare/v1.0.5...v1.0.6) (2019-09-15) | ||
@@ -2,0 +13,0 @@ |
@@ -1,1 +0,1 @@ | ||
module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t){e.exports=require("react")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0).createContext({siteKeyV2:"",siteKeyV3:"",loaded:!1});t.Context=o},function(e,t,r){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Normal="normal",e.Compact="compact"}(o||(o={})),t.ESize=o},function(e,t,r){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Light="light",e.Dark="dark"}(o||(o={})),t.ETheme=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0),n=r(1);t.withContext=e=>(class extends o.Component{render(){return o.createElement(n.Context.Consumer,null,((e,t)=>r=>o.createElement(e,Object.assign({},t,{providerContext:r})))(e,this.props))}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(6);t.ReCaptchaProvider=o.ReCaptchaProvider;const n=r(2);t.EReCaptchaV2Size=n.ESize;const i=r(3);t.EReCaptchaV2Theme=i.ETheme;const s=r(7);t.ReCaptchaV2=s.ReCaptchaV2;const a=r(9);t.ReCaptchaV3=a.ReCaptchaV3},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0),n=r(1);t.ReCaptchaProvider=class extends o.Component{constructor(e){super(e),this.state={loaded:!1},this.onLoadHandler=this.onLoadHandler.bind(this),window.GoogleReCaptcha_onload=this.onLoadHandler}componentDidMount(){const{siteKeyV3:e="explicit",langCode:t="",hideV3Badge:r=!1}=this.props;if("undefined"==typeof grecaptcha){const r=document.createElement("script");r.src=`https://www.google.com/recaptcha/api.js?render=${e}&onload=GoogleReCaptcha_onload&hl=${t}`,r.async=!0,r.defer=!0,document.body.appendChild(r)}if(r){const e=document.createElement("style");e.innerHTML=".grecaptcha-badge{display: none;}",document.body.appendChild(e)}}render(){const{children:e,siteKeyV3:t,siteKeyV2:r}=this.props,{loaded:i}=this.state,s={siteKeyV2:r,siteKeyV3:t,loaded:i};return o.createElement(n.Context.Provider,{value:s},e)}onLoadHandler(){delete window.GoogleReCaptcha_onload,this.setState({loaded:!0})}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(4),n=r(8),i=o.withContext(n.ReCaptchaV2);t.ReCaptchaV2=i},function(e,t,r){"use strict";var o=this&&this.__rest||function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r};Object.defineProperty(t,"__esModule",{value:!0});const n=r(0),i=r(2),s=r(3);class a extends n.Component{constructor(e){super(e);const{siteKeyV2:t}=this.props.providerContext;if(!t)throw new Error('The prop "siteKeyV2" must be set on the ReCaptchaProvider before using the ReCaptchaV2 component');this.state={ref:n.createRef(),widgetId:void 0,token:void 0,expired:!1,error:!1},this.successCallback=this.successCallback.bind(this),this.expiredCallback=this.expiredCallback.bind(this),this.errorCallback=this.errorCallback.bind(this)}componentDidUpdate(e){const{ref:t}=this.state,{loaded:r,siteKeyV2:o}=this.props.providerContext,{theme:n,size:i,tabindex:s}=this.props;e.providerContext.loaded!==r&&r&&t.current&&o&&this.setState({expired:!1,error:!1,widgetId:grecaptcha.render(t.current,{sitekey:o,callback:this.successCallback,"expired-callback":this.expiredCallback,"error-callback":this.errorCallback,theme:n,size:i,tabindex:s})})}render(){const{ref:e}=this.state,t=this.props,{theme:r,callback:i,size:s,tabindex:a,providerContext:c}=t,d=o(t,["theme","callback","size","tabindex","providerContext"]);return n.createElement("div",Object.assign({ref:e},d))}successCallback(e){const{callback:t}=this.props;this.setState({token:e,expired:!1,error:!1},()=>{t(e)})}expiredCallback(){const{callback:e}=this.props;this.setState({expired:!0},()=>{e(!1)})}errorCallback(){const{callback:e}=this.props;this.setState({error:!0},()=>{e(new Error)})}}t.ReCaptchaV2=a,a.defaultProps={theme:s.ETheme.Light,size:i.ESize.Normal,tabindex:0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(4),n=r(10),i=o.withContext(n.ReCaptchaV3);t.ReCaptchaV3=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0);t.ReCaptchaV3=class extends o.Component{constructor(e){super(e);const{siteKeyV3:t}=this.props.providerContext;if(!t)throw new Error('The prop "siteKeyV3" must be set on the ReCaptchaProvider before using the ReCaptchaV3 component');this.state={token:void 0,retrieving:!1},this.getToken=this.getToken.bind(this),this.getToken()}componentDidUpdate(e){const{loaded:t}=this.props.providerContext;e.providerContext.loaded!==t&&t&&this.getToken()}render(){return!1}getToken(){const{loaded:e,siteKeyV3:t}=this.props.providerContext,{retrieving:r}=this.state,{action:o,callback:n}=this.props;e&&!r&&t&&this.setState({token:void 0,retrieving:!0},()=>{n(),grecaptcha.execute(t,{action:o}).then(e=>{this.setState({token:e,retrieving:!1},()=>{n(e)})})})}}}]); | ||
module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t){e.exports=require("react")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0).createContext({siteKeyV2:"",siteKeyV3:"",loaded:!1});t.Context=o},function(e,t,r){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Normal="normal",e.Compact="compact"}(o||(o={})),t.ESize=o},function(e,t,r){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Light="light",e.Dark="dark"}(o||(o={})),t.ETheme=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0),n=r(1);t.withContext=e=>(class extends o.Component{render(){return o.createElement(n.Context.Consumer,null,((e,t)=>r=>o.createElement(e,Object.assign({},t,{providerContext:r})))(e,this.props))}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(6);t.ReCaptchaProvider=o.ReCaptchaProvider;const n=r(2);t.EReCaptchaV2Size=n.ESize;const i=r(3);t.EReCaptchaV2Theme=i.ETheme;const a=r(7);t.ReCaptchaV2=a.ReCaptchaV2;const s=r(9);t.ReCaptchaV3=s.ReCaptchaV3},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0),n=r(1);class i extends o.Component{constructor(e){super(e),this.state={loaded:!1},this.onLoadHandler=this.onLoadHandler.bind(this),window.GoogleReCaptcha_onload=this.onLoadHandler}componentDidMount(){const{siteKeyV3:e="explicit",langCode:t="",hideV3Badge:r=!1}=this.props;if(null===document.querySelector('script[data-id="react-recaptcha-v3-v2-script"]')){const r=document.createElement("script");r.setAttribute("data-id","react-recaptcha-v3-v2-script"),r.setAttribute("src",`https://www.google.com/recaptcha/api.js?render=${e}&onload=GoogleReCaptcha_onload&hl=${t}`),r.setAttribute("async","true"),r.setAttribute("defer","true"),document.body.appendChild(r)}if(r&&null===document.querySelector('style[data-id="react-recaptcha-v3-v2-style"]')){const e=document.createElement("style");e.innerHTML=".grecaptcha-badge{display: none;}",e.setAttribute("data-id","react-recaptcha-v3-v2-style"),document.body.appendChild(e)}}render(){const{children:e,siteKeyV3:t,siteKeyV2:r}=this.props,{loaded:i}=this.state,a={siteKeyV2:r,siteKeyV3:t,loaded:i};return o.createElement(n.Context.Provider,{value:a},e)}onLoadHandler(){delete window.GoogleReCaptcha_onload,this.setState({loaded:!0})}}t.ReCaptchaProvider=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(4),n=r(8),i=o.withContext(n.ReCaptchaV2);t.ReCaptchaV2=i},function(e,t,r){"use strict";var o=this&&this.__rest||function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r};Object.defineProperty(t,"__esModule",{value:!0});const n=r(0),i=r(2),a=r(3);class s extends n.Component{constructor(e){super(e);const{siteKeyV2:t}=this.props.providerContext;if(!t)throw new Error('The prop "siteKeyV2" must be set on the ReCaptchaProvider before using the ReCaptchaV2 component');this.state={ref:n.createRef(),widgetId:void 0,token:void 0,expired:!1,error:!1},this.successCallback=this.successCallback.bind(this),this.expiredCallback=this.expiredCallback.bind(this),this.errorCallback=this.errorCallback.bind(this),this.checkComponentDidUpdate=this.checkComponentDidUpdate.bind(this)}componentDidUpdate(e){this.checkComponentDidUpdate(this.state.ref,this.props,e)}checkComponentDidUpdate(e,t,r){const{loaded:o,siteKeyV2:n}=t.providerContext,{theme:i,size:a,tabindex:s}=t;r.providerContext.loaded!==o&&o&&e.current&&n&&this.setState({expired:!1,error:!1,widgetId:grecaptcha.render(e.current,{sitekey:n,callback:this.successCallback,"expired-callback":this.expiredCallback,"error-callback":this.errorCallback,theme:i,size:a,tabindex:s})})}render(){const{ref:e}=this.state,t=this.props,{theme:r,callback:i,size:a,tabindex:s,providerContext:c}=t,d=o(t,["theme","callback","size","tabindex","providerContext"]);return n.createElement("div",Object.assign({ref:e},d))}successCallback(e){const{callback:t}=this.props;this.setState({token:e,expired:!1,error:!1},()=>{t(e)})}expiredCallback(){const{callback:e}=this.props;this.setState({expired:!0},()=>{e(!1)})}errorCallback(){const{callback:e}=this.props;this.setState({error:!0},()=>{e(new Error)})}}t.ReCaptchaV2=s,s.defaultProps={theme:a.ETheme.Light,size:i.ESize.Normal,tabindex:0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(4),n=r(10),i=o.withContext(n.ReCaptchaV3);t.ReCaptchaV3=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0);class n extends o.Component{constructor(e){super(e);const{siteKeyV3:t}=this.props.providerContext;if(!t)throw new Error('The prop "siteKeyV3" must be set on the ReCaptchaProvider before using the ReCaptchaV3 component');this.state={token:void 0,retrieving:!1},this.getToken=this.getToken.bind(this),this.getToken()}componentDidUpdate(e){const{loaded:t}=this.props.providerContext;e.providerContext.loaded!==t&&t&&this.getToken()}render(){return!1}getToken(){const{loaded:e,siteKeyV3:t}=this.props.providerContext,{retrieving:r}=this.state,{action:o,callback:n}=this.props;e&&!r&&t&&this.setState({token:void 0,retrieving:!0},()=>{n(),grecaptcha.execute(t,{action:o}).then(e=>{this.setState({token:e,retrieving:!1},()=>{n(e)})})})}}t.ReCaptchaV3=n}]); |
@@ -9,2 +9,3 @@ import * as React from 'react'; | ||
componentDidUpdate(prevProps: IProps & IConsumer): void; | ||
checkComponentDidUpdate(ref: React.RefObject<HTMLDivElement>, props: IProps & IConsumer, prevProps: IProps & IConsumer): void; | ||
render(): JSX.Element; | ||
@@ -11,0 +12,0 @@ private successCallback; |
@@ -6,4 +6,5 @@ const { pathsToModuleNameMapper } = require('ts-jest/utils'); | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths), | ||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { | ||
prefix: '<rootDir>/' | ||
}), | ||
testURL: 'http://localhost', | ||
@@ -19,3 +20,7 @@ coverageDirectory: '<rootDir>/reports/coverage', | ||
} | ||
} | ||
}, | ||
setupFiles: ['<rootDir>/jest.setup.ts'], | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.afterEnv.ts'], | ||
clearMocks: true, | ||
errorOnDeprecated: true | ||
}; |
{ | ||
"name": "react-recaptcha-x", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "a React component for Google's reCAPTCHA v3 and v2 (checkbox) component", | ||
@@ -9,2 +9,3 @@ "main": "./dist/index.js", | ||
"test:cov": "TZ=UTC jest --coverage", | ||
"coveralls": "cat ./reports/coverage/lcov.info | coveralls", | ||
"prettier": "npx prettier --check 'src/**/*.ts?(x)'", | ||
@@ -14,5 +15,5 @@ "lint": "tslint 'src/**/*.ts?(x)' -c tslint.json", | ||
"build:clean": "rm dist/* -rf", | ||
"build:types": "tsc --emitDeclarationOnly", | ||
"build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly", | ||
"build:js": "webpack --config ./webpack.config.js --env.NODE_ENV=production --env.production --progress", | ||
"build:tscpaths": "tscpaths -p tsconfig.json -s ./src -o ./dist", | ||
"build:tscpaths": "tscpaths -p tsconfig.build.json -s ./src -o ./dist", | ||
"cl": "commitlint --from=HEAD~1", | ||
@@ -47,30 +48,31 @@ "ts:validate": "tsc --outDir /tmp" | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.1.0", | ||
"@commitlint/config-conventional": "^8.1.0", | ||
"@commitlint/cli": "^8.2.0", | ||
"@commitlint/config-conventional": "^8.2.0", | ||
"@semantic-release/changelog": "^3.0.4", | ||
"@semantic-release/git": "^7.0.16", | ||
"@semantic-release/github": "^5.4.3", | ||
"@semantic-release/npm": "^5.1.15", | ||
"@testing-library/dom": "^6.2.0", | ||
"@types/jest": "^24.0.18", | ||
"@types/react-test-renderer": "^16.9.0", | ||
"@semantic-release/github": "^5.5.4", | ||
"@semantic-release/npm": "^5.2.0", | ||
"@testing-library/dom": "^6.8.1", | ||
"@testing-library/jest-dom": "^4.1.2", | ||
"@testing-library/react": "^9.3.0", | ||
"@types/jest": "^24.0.19", | ||
"coveralls": "^3.0.7", | ||
"jest": "^24.9.0", | ||
"prettier": "^1.18.2", | ||
"react-dom": "^16.9.0", | ||
"react-test-renderer": "^16.9.0", | ||
"semantic-release": "^15.13.24", | ||
"react-dom": "^16.10.2", | ||
"semantic-release": "^15.13.27", | ||
"ts-jest": "^24.1.0", | ||
"ts-loader": "^6.1.0", | ||
"ts-loader": "^6.2.0", | ||
"tscpaths": "0.0.9", | ||
"tslint": "^5.20.0", | ||
"tslint-consistent-codestyle": "^1.15.1", | ||
"tslint-consistent-codestyle": "^1.16.0", | ||
"tslint-microsoft-contrib": "^6.2.0", | ||
"tslint-react": "^4.0.0", | ||
"typescript": "^3.6.3", | ||
"webpack": "^4.40.2", | ||
"webpack-cli": "^3.3.8" | ||
"tslint-react": "^4.1.0", | ||
"typescript": "^3.6.4", | ||
"webpack": "^4.41.2", | ||
"webpack-cli": "^3.3.9" | ||
}, | ||
"dependencies": { | ||
"@types/react": "^16.9.2", | ||
"react": "^16.9.0" | ||
"@types/react": "^16.9.9", | ||
"react": "^16.10.2" | ||
}, | ||
@@ -86,3 +88,3 @@ "prettier": { | ||
"publishConfig": { | ||
"tag": "stable" | ||
"tag": "latest" | ||
}, | ||
@@ -89,0 +91,0 @@ "release": { |
103
README.md
@@ -8,2 +8,3 @@ # react-recaptcha-x | ||
[![Last Commit][last-commit]][last-commit-url] | ||
[![Coverage][coveralls]][coveralls-url] | ||
@@ -31,2 +32,15 @@ [![Dependencies][deps]][deps-url] | ||
## why I created another one of those reCAPTCHA wrappers | ||
Using the Google reCAPTCHA v3, can be an issue if your human user, | ||
gets a low score and is falsely identified as a bot. There is nothing the user can do to proceed, in that case. | ||
This can be especially troublesome, if it happens during an important action, such as signing up. | ||
Chances are, your human user will not be able to proceed and won't retry either. | ||
Using this component, you can chose to fallback to the Google reCAPTCHA v2 checkbox, if the user scored low and was identified as a bot. This will allow the user to attempt to pass the checkbox and | ||
perhaps, solve the more difficult image reCAPTCHA. | ||
Most reCAPTCHA wrappers do not support both v3 and v2 at the same time properly. This component was created to solve that case, so that you would never lose a human user again. | ||
## usage | ||
@@ -236,2 +250,89 @@ | ||
### Code Quality / Linting | ||
#### Code Quality / Linting - Packages / References | ||
1. [Commitlint](https://commitlint.js.org/) | ||
1. [conventional changelog](https://github.com/conventional-changelog/commitlint#readme) | ||
1. [Prettier](https://prettier.io/) | ||
1. [TSLint](https://palantir.github.io/tslint/) | ||
1. [consistent codestyle](https://github.com/ajafff/tslint-consistent-codestyle#rules) | ||
1. [microsoft contrib](https://github.com/microsoft/tslint-microsoft-contrib#supported-rules) | ||
1. [tslint react](https://github.com/palantir/tslint-react#rules) | ||
#### Code Quality / Linting - Commands | ||
1. for Commitlint run `$npm run cl` | ||
1. for Prettier run `$npm run prettier` | ||
1. for TSLint run `$npm run lint` | ||
1. for Typescript compilation validation run `$npm run ts:validate` | ||
### Unit Testing | ||
#### Unit Testing - Packages / References | ||
1. [Jest](https://jestjs.io) | ||
1. [TS Jest](https://github.com/kulshekhar/ts-jest) | ||
1. [React Testing Library](https://testing-library.com/) | ||
1. [Jest DOM](https://github.com/testing-library/jest-dom) | ||
#### Unit Testing - Commands | ||
- for unit tests run `$npm test` | ||
- for unit tests plus code coverage report run `$npm run test:cov` | ||
#### Unit Testing - Reports | ||
- code coverage `/reports/coverage/lcov-report/index.html` | ||
### Build / Deployment / Release | ||
#### Build / Deployment / Release - Packages / References | ||
1. [Typescript compiler](http://www.typescriptlang.org/docs/handbook/compiler-options.html) | ||
1. [Webpack](https://webpack.js.org/) | ||
1. [ts loader](https://github.com/TypeStrong/ts-loader) | ||
1. [Semantic Release](https://semantic-release.gitbook.io/semantic-release/) | ||
1. [commit analyzer](https://github.com/semantic-release/commit-analyzer) | ||
1. [release notes generator](https://github.com/semantic-release/release-notes-generator) | ||
1. [changelog](https://github.com/semantic-release/changelog) | ||
1. [git](https://github.com/semantic-release/git) | ||
1. [github](https://github.com/semantic-release/github) | ||
1. [npm](https://github.com/semantic-release/npm) | ||
1. [Semantic Versioning](https://semver.org/) | ||
1. [Travis CI](https://docs.travis-ci.com/) | ||
1. [builds](https://travis-ci.org/antokara/react-recaptcha-x) | ||
#### Build / Deployment / Release - Commands | ||
For the complete build sequence run: | ||
- `$npm run build` | ||
Alternatively, if you want more control: | ||
- to clean the `dist/` directory, run `$npm run build:clean` | ||
- for _declaration files_ generation, run `$npm run build:types` | ||
- for _javascript files_ generation, run `$npm run build:js` | ||
- for _tsc paths_ resolution, run `$npm run build:tscpaths` | ||
Travis CI lints, tests and builds any GitHub branch and PR. | ||
Once the PR gets merged to **master**, Travis CI runs again | ||
and this time, additionally to lint, test and build, the **deploy** stage runs which executes the `semantic-release`. | ||
When Semantic Release runs, it analyzes the git commits and if applicable, it: | ||
1. generates the updated changelog | ||
1. creates a git (release) tag with the appropriate semantic release | ||
version | ||
1. updates the version in `package.json` | ||
1. commits the file changes and new tag, to the GitHub master branch | ||
1. publishes the new version, to the npm repository with the `latest` tag | ||
There's one final step that needs to be done manually, after we verify the published npm: | ||
- run `$npm dist-tag add react-recaptcha-x@{version} stable` | ||
this will add the `stable` distribution tag, marking the latest release, as the stable one. | ||
## other credits | ||
@@ -262,1 +363,3 @@ | ||
[last-release-url]: https://github.com/antokara/react-recaptcha-x/releases | ||
[coveralls]: https://coveralls.io/repos/github/antokara/react-recaptcha-x/badge.svg?branch=master | ||
[coveralls-url]: https://coveralls.io/github/antokara/react-recaptcha-x?branch=master |
43595
30
330
362
25
Updated@types/react@^16.9.9
Updatedreact@^16.10.2