Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts migration #107

Open
wants to merge 46 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b2acffc
feat!: ts-migration
xuanwan05 Nov 7, 2022
5f5a6a6
simplify the code
xuanwan05 Nov 7, 2022
9d5e402
replace const with enum
xuanwan05 Nov 8, 2022
3ce2a63
update package.json
xuanwan05 Nov 8, 2022
cd92808
remove flow script
xuanwan05 Nov 8, 2022
15ef42e
remove flow-script script from main.yml
xuanwan05 Nov 8, 2022
c410463
feat: upgrade to grumbler scripts 8 (#109)
dtjones404 Nov 10, 2022
7ac0bbd
feat: upgrade to grumbler scripts 8.0.4
dtjones404 Nov 15, 2022
aa53d85
Revert "replace const with enum"
xuanwan05 Nov 18, 2022
3f5e138
revert enum to const
xuanwan05 Nov 18, 2022
d79d086
Update package.json
dtjones404 Nov 18, 2022
2357405
feat!: ts-migration
xuanwan05 Nov 7, 2022
1bd5691
simplify the code
xuanwan05 Nov 7, 2022
ee7169f
replace const with enum
xuanwan05 Nov 8, 2022
14eeaca
update package.json
xuanwan05 Nov 8, 2022
588336c
remove flow script
xuanwan05 Nov 8, 2022
50492ce
remove flow-script script from main.yml
xuanwan05 Nov 8, 2022
4e01e7d
Revert "replace const with enum"
xuanwan05 Nov 18, 2022
b4ef21f
revert enum to const
xuanwan05 Nov 18, 2022
0a2ffc4
Merge branch 'ts-migration' of https://github.com/paypal/paypal-sdk-c…
xuanwan05 Nov 28, 2022
2593b4e
Delete babel.config.json
xuanwan05 Nov 28, 2022
a8c65e9
remove presets
xuanwan05 Nov 28, 2022
dfcc018
Update tsconfig.json
xuanwan05 Nov 28, 2022
411129d
Update babel.config.js
xuanwan05 Nov 28, 2022
f043a87
Merge pull request #110 from paypal/grumbler-scripts-8.0.4
dtjones404 Nov 28, 2022
c5004e4
PPoF - New FPTI Keys (#113)
nbierdeman Nov 28, 2022
f242896
feat: Adding Paidy as New APM (#112)
sathyashyam2406 Nov 29, 2022
5f87d89
Dist
wsbrunson Nov 29, 2022
046e801
1.0.128
wsbrunson Nov 29, 2022
c0a1906
feat!: ts-migration
xuanwan05 Nov 7, 2022
b096a11
simplify the code
xuanwan05 Nov 7, 2022
1f3dd40
replace const with enum
xuanwan05 Nov 8, 2022
22345f2
update package.json
xuanwan05 Nov 8, 2022
d5532b3
remove flow script
xuanwan05 Nov 8, 2022
86d9e1d
remove flow-script script from main.yml
xuanwan05 Nov 8, 2022
47f685f
Revert "replace const with enum"
xuanwan05 Nov 18, 2022
558758c
revert enum to const
xuanwan05 Nov 18, 2022
f26c6e0
feat!: ts-migration
xuanwan05 Nov 7, 2022
66db722
simplify the code
xuanwan05 Nov 7, 2022
3668271
replace const with enum
xuanwan05 Nov 8, 2022
6677256
update package.json
xuanwan05 Nov 8, 2022
9d92174
Revert "replace const with enum"
xuanwan05 Nov 18, 2022
d223385
revert enum to const
xuanwan05 Nov 18, 2022
f8554ff
Delete babel.config.json
xuanwan05 Nov 28, 2022
4c1af2f
resolve commit conflicts
xuanwan05 Dec 2, 2022
561e5b5
Merge branch 'ts-migration' of https://github.com/paypal/paypal-sdk-c…
xuanwan05 Dec 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
/* @flow */

module.exports = {
extends: require.resolve(
"@krakenjs/grumbler-scripts/config/.eslintrc-browser"
),
extends:
"./node_modules/@krakenjs/eslint-config-grumbler/eslintrc-typescript.js",

globals: {
__TEST__: true,
},

rules: {
"no-mixed-operators": "off",
// off for initial ts conversion
"@typescript-eslint/no-implicit-any-catch": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/prefer-for-of": "off",
},
};
15 changes: 0 additions & 15 deletions .flowconfig

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,5 @@ jobs:
with:
useLockFile: false

- name: ▶️ Run flow-typed script
run: npm run flow-typed

- name: ▶️ Run build script
run: npm run build
4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
extends: "@krakenjs/babel-config-grumbler/babelrc-browser",
presets: ["@krakenjs/babel-config-grumbler/flow-ts-babel-preset"],
};
3 changes: 0 additions & 3 deletions babel.config.json

This file was deleted.

4 changes: 1 addition & 3 deletions dist/module/apm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions dist/module/defaults.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


import { COUNTRY } from "./locale";
import { CURRENCY, INTENT, COMMIT, VAULT } from "./order";
import { COMPONENTS, DEBUG } from "./params";
Expand Down
2 changes: 0 additions & 2 deletions dist/module/env.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


export var ENV = {
LOCAL: "local",
STAGE: "stage",
Expand Down
2 changes: 0 additions & 2 deletions dist/module/error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


export var ERROR_CODE = {
VALIDATION_ERROR: "validation_error"
};
4 changes: 2 additions & 2 deletions dist/module/fpti.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


export var FPTI_KEY = {
FEED: "feed_name",
STATE: "state_name",
Expand Down Expand Up @@ -53,6 +51,8 @@ export var FPTI_KEY = {
PAYMENT_FLOW: "payment_flow",
BUTTON_VERSION: "button_version",
FI_LIST: "fi_list",
FI_ID: "fi_id",
PRODUCT: "product",
CHOSEN_FI_TYPE: "chosen_fi_type",
SELECTED_FI: "merchant_selected_funding_source",
POTENTIAL_PAYMENT_METHODS: "potential_payment_methods",
Expand Down
5 changes: 2 additions & 3 deletions dist/module/funding.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


export var FUNDING = {
PAYPAL: "paypal",
VENMO: "venmo",
Expand Down Expand Up @@ -28,7 +26,8 @@ export var FUNDING = {
WECHATPAY: "wechatpay",
MERCADOPAGO: "mercadopago",
MULTIBANCO: "multibanco",
SATISPAY: "satispay"
SATISPAY: "satispay",
PAIDY: "paidy"
};
export var FUNDING_BRAND_LABEL = {
PAYPAL: "PayPal",
Expand Down
2 changes: 0 additions & 2 deletions dist/module/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


export * from "./defaults";
export * from "./env";
export * from "./error";
Expand Down
3 changes: 0 additions & 3 deletions dist/module/locale.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

/* eslint max-lines: 0 */

export var COUNTRY = {
AD: "AD",
AE: "AE",
Expand Down
2 changes: 0 additions & 2 deletions dist/module/order.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


export var INTENT = {
CAPTURE: "capture",
AUTHORIZE: "authorize",
Expand Down
2 changes: 0 additions & 2 deletions dist/module/params.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


export var SDK_PATH = "/sdk/js";
export var SDK_SETTINGS = {
NAMESPACE: "data-namespace",
Expand Down
2 changes: 0 additions & 2 deletions dist/module/platform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


export var PLATFORM = {
DESKTOP: "desktop",
MOBILE: "mobile"
Expand Down
2 changes: 0 additions & 2 deletions dist/module/types.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@


export var TYPES = true;
2 changes: 1 addition & 1 deletion dist/paypal-sdk-constants.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/paypal-sdk-constants.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/paypal-sdk-constants.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/paypal-sdk-constants.min.js.map

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions index.js → index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
/* @flow */

// $FlowFixMe
module.exports = require("./dist/paypal-sdk-constants"); // eslint-disable-line import/no-commonjs
module.exports = require("./dist/paypal-sdk-constants"); // eslint-disable-line import/no-commonjs
41 changes: 28 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
{
"name": "@paypal/sdk-constants",
"version": "1.0.127",
"version": "1.0.128",
"description": "Utilities.",
"main": "index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"sideEffects": [
"./src/styles/*.scss"
],
"scripts": {
"setup": "npm install && npm run flow-typed",
"lint": "eslint src/ *.js",
"flow-typed": "rm -rf ./flow-typed && flow-typed install",
"flow": "flow",
"karma": "cross-env NODE_ENV=test babel-node --plugins=transform-es2015-modules-commonjs ./node_modules/.bin/karma start",
"babel": "babel src/ --out-dir dist/module",
"build": "npm run babel && npm run webpack && npm run build:types",
"build:tsc": "tsc src/*.ts --outDir ./dist/esm --declaration --emitDeclarationOnly",
"build:types": "npm run build:tsc",
"webpack": "babel-node --plugins=transform-es2015-modules-commonjs ./node_modules/.bin/webpack --progress",
"karma": "cross-env NODE_ENV=test babel-node --plugins=transform-es2015-modules-commonjs ./node_modules/.bin/karma start",
"babel": "babel src/ --out-dir ./dist/esm/ --extensions .ts,.tsx",
"tsc": "tsc",
"format": "prettier --write --ignore-unknown .",
"format:check": "prettier --check .",
"test": "npm run format:check && npm run lint && npm run flow-typed && npm run flow",
"build": "npm run test && npm run babel && npm run webpack",
"release": "./publish.sh",
"release:patch": "./publish.sh patch",
"release:minor": "./publish.sh minor",
"release:major": "./publish.sh major",
"lint": "eslint --ext ts,tsx,js,jsx src/",
"clean": "rimraf dist coverage",
"reinstall": "rimraf flow-typed && rimraf node_modules && npm install && flow-typed install",
"prerelease": "npm run clean && npm run build && git add dist && git commit -m 'ci: check in dist folder' || echo 'Nothing to distribute'",
"postrelease": "git push && git push --follow-tags && npm publish",
"debug": "cross-env NODE_ENV=debug",
"prepare": "husky install"
},
Expand All @@ -45,11 +50,21 @@
"license": "Apache-2.0",
"readmeFilename": "README.md",
"devDependencies": {
"@krakenjs/grumbler-scripts": "^7.0.0",
"flow-bin": "0.129.0",
"@krakenjs/grumbler-scripts": "^8.0.5",
"cross-env": "^7.0.3",
"@commitlint/cli": "^16.2.1",
"@commitlint/config-conventional": "^16.2.1",
"@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"c8": "^7.11.0",
"happy-dom": "^2.55.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"prettier": "2.7.1"
"prettier": "2.7.1",
"standard-version": "^9.3.2",
"ts-node": "^10.5.0",
"typescript": "4.8.4"
},
"dependencies": {
"hi-base32": "^0.5.0"
Expand Down
3 changes: 1 addition & 2 deletions src/apm.js → src/apm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* @flow */

import { FUNDING } from "./funding";

export const APM_LIST = [
Expand All @@ -22,4 +20,5 @@ export const APM_LIST = [
FUNDING.MERCADOPAGO,
FUNDING.MULTIBANCO,
FUNDING.SATISPAY,
FUNDING.PAIDY,
];
2 changes: 0 additions & 2 deletions src/defaults.js → src/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* @flow */

import { COUNTRY } from "./locale";
import { CURRENCY, INTENT, COMMIT, VAULT } from "./order";
import { COMPONENTS, DEBUG } from "./params";
Expand Down
14 changes: 0 additions & 14 deletions src/env.js

This file was deleted.

11 changes: 11 additions & 0 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const ENV = {
LOCAL: "local",
STAGE: "stage",
SANDBOX: "sandbox",
PRODUCTION: "production",
TEST: "test",
} as const;
export const MOBILE_ENV = {
ANDROID: "android",
IOS: "iOS",
} as const;
5 changes: 0 additions & 5 deletions src/error.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const ERROR_CODE = {
VALIDATION_ERROR: "validation_error",
} as const;
88 changes: 0 additions & 88 deletions src/fpti.js

This file was deleted.

Loading