diff --git a/renovate.json b/.github/renovate.json similarity index 100% rename from renovate.json rename to .github/renovate.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..1ab376f5 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,36 @@ +name: build +on: + # run on push but only for the master branch + push: + branches: + - master + # run for every pull request + pull_request: {} +jobs: + main: + runs-on: ubuntu-latest + strategy: + matrix: + node: [10.13, 12, 14] + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: ⎔ Setup node + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: ▶️ Run flow-typed script + run: npm run flow-typed + + - name: ▶️ Run build script + run: npm run build + + - name: ⬆️ Upload coverage report + uses: codecov/codecov-action@v1 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a194d64f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: node_js -node_js: - - "lts/*" -before_install: - - sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget -before_script: - - npm run flow-typed -script: - - npm run build -sudo: required -dist: xenial -addons: - chrome: stable diff --git a/LICENSE.txt b/LICENSE similarity index 93% rename from LICENSE.txt rename to LICENSE index a20bbb15..95932c71 100644 --- a/LICENSE.txt +++ b/LICENSE @@ -1,6 +1,6 @@ Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -175,24 +175,13 @@ END OF TERMS AND CONDITIONS - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - Copyright 2016 PayPal Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/README.md b/README.md index 905f53ca..54060128 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,19 @@ PayPal Common Components ------------------------ -[![npm version](https://img.shields.io/npm/v/@paypal/common-components.svg?style=flat-square)](https://www.npmjs.com/package/@paypal/common-components) [![build status](https://img.shields.io/travis/paypal/paypal-common-components/master.svg?style=flat-square)](https://travis-ci.org/paypal/paypal-common-components) - -[![dependencies Status](https://david-dm.org/paypal/paypal-common-components/status.svg)](https://david-dm.org/paypal/paypal-common-components) [![devDependencies Status](https://david-dm.org/paypal/paypal-common-components/dev-status.svg)](https://david-dm.org/paypal/paypal-common-components?type=dev) +[![build status][build-badge]][build] +[![code coverage][coverage-badge]][coverage] +[![npm version][version-badge]][package] +[![apache license][license-badge]][license] + +[build-badge]: https://img.shields.io/github/workflow/status/paypal/paypal-common-components/build?logo=github&style=flat-square +[build]: https://github.com/paypal/paypal-common-components/actions?query=workflow%3Abuild +[coverage-badge]: https://img.shields.io/codecov/c/github/paypal/paypal-common-components.svg?style=flat-square +[coverage]: https://codecov.io/github/paypal/paypal-common-components/ +[version-badge]: https://img.shields.io/npm/v/@paypal/common-components.svg?style=flat-square +[package]: https://www.npmjs.com/package/@paypal/common-components +[license-badge]: https://img.shields.io/npm/l/@paypal/common-components.svg?style=flat-square +[license]: https://github.com/paypal/paypal-common-components/blob/master/LICENSE Common components for the PayPal JavaScript SDK diff --git a/jest.config.js b/jest.config.js index 2843c01e..52e3b699 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,7 @@ /* @flow */ /* eslint import/no-commonjs: off */ +// $FlowFixMe module.exports = { - + }; diff --git a/src/interface.js b/src/interface.js index c1652e97..dec9e60f 100644 --- a/src/interface.js +++ b/src/interface.js @@ -13,9 +13,11 @@ function protectedExport(xport : T) : ?T { } export const ThreeDomainSecure = { + // $FlowFixMe __get__: () => protectedExport(getThreeDomainSecureComponent()) }; export const postRobot = { + // $FlowFixMe __get__: () => protectedExport(postRobotModule) }; diff --git a/test/globals.js b/test/globals.js index fce8f029..1f872b5b 100644 --- a/test/globals.js +++ b/test/globals.js @@ -76,12 +76,12 @@ export const fundingEligibility = { export const testGlobals = { __paypal_checkout__: { serverConfig: { - fundingEligibility: () => `window.__TEST_FUNDING_ELIGIBILITY__ || ${ JSON.stringify(fundingEligibility) }` + fundingEligibility: () : string => `window.__TEST_FUNDING_ELIGIBILITY__ || ${ JSON.stringify(fundingEligibility) }` } }, __PAYPAL_CHECKOUT__: { - __REMEMBERED_FUNDING__: () => 'window.__TEST_REMEMBERED_FUNDING__ || []' + __REMEMBERED_FUNDING__: () : string => 'window.__TEST_REMEMBERED_FUNDING__ || []' }, __PORT__: 8000, diff --git a/webpack.config.js b/webpack.config.js index 30d5d8a3..af38766f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,7 @@ /* @flow */ /* eslint import/no-nodejs-modules: off, import/no-default-export: off */ +import type { WebpackConfig } from 'grumbler-scripts/config/types'; import { getWebpackConfig } from 'grumbler-scripts/config/webpack.config'; import { testGlobals } from './test/globals'; @@ -8,7 +9,7 @@ import globals from './globals'; const MODULE_NAME = 'paypal'; -export const WEBPACK_CONFIG_UI = getWebpackConfig({ +export const WEBPACK_CONFIG_UI : WebpackConfig = getWebpackConfig({ context: __dirname, entry: './src/ui', filename: 'ui', @@ -19,7 +20,7 @@ export const WEBPACK_CONFIG_UI = getWebpackConfig({ vars: globals }); -export const WEBPACK_CONFIG_UI_MIN = getWebpackConfig({ +export const WEBPACK_CONFIG_UI_MIN : WebpackConfig = getWebpackConfig({ context: __dirname, entry: './src/ui', filename: 'ui', @@ -29,7 +30,7 @@ export const WEBPACK_CONFIG_UI_MIN = getWebpackConfig({ vars: globals }); -export const WEBPACK_CONFIG_TEST = getWebpackConfig({ +export const WEBPACK_CONFIG_TEST : WebpackConfig = getWebpackConfig({ entry: './test/paypal.js', libraryTarget: 'window',