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

Fix the last updates #8

Merged
merged 2 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"sourceMaps": true,
"plugins": ["@babel/plugin-transform-runtime"],
"presets": [
"@babel/typescript",
[
"@babel/preset-env",
{
"corejs": 3,
"loose": true,
"shippedProposals": true,
"targets": {
"browsers": "> 0.25%, not dead",
"node": "9"
},
"useBuiltIns": "usage"
"loose": true,
"useBuiltIns": "usage",
"corejs": 2,
"shippedProposals": true
},
"minify"
]
],
"plugins": ["@babel/plugin-transform-runtime"]
]
}
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"plugin:@typescript-eslint/recommended",
"airbnb-base",
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
Expand All @@ -25,7 +24,7 @@
"no-console": "warn",
"no-await-in-loop": "off",
"import/order": [
"error",
"warn",
{
"groups": [
"builtin",
Expand Down
8 changes: 8 additions & 0 deletions .npm-upgrade.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ignore": {
"core-js": {
"versions": ">=3",
"reason": "Using version 2 for compact output"
}
}
}
21 changes: 9 additions & 12 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "yup-phone-lite",
"version": "1.1.1",
"description": "Adds a phone number validation check to yup validator using libphonenumber-js.",
"description": "Adds a phone number validation check to yup using libphonenumber-js.",
"license": "MIT",
"author": "Chris Sandvik <[email protected]> (https://github.com/csandman)",
"repository": {
Expand Down Expand Up @@ -54,7 +54,7 @@
"@typescript-eslint/eslint-plugin": "^5.30.6",
"@typescript-eslint/parser": "^5.30.6",
"babel-jest": "^28.1.3",
"core-js": "^3.23.4",
"core-js": "^2.6.12",
"eslint": "^8.19.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
Expand Down
21 changes: 14 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import compiler from "@ampproject/rollup-plugin-closure-compiler";
import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import resolve from "@rollup/plugin-node-resolve";
import analyze from "rollup-plugin-analyzer";
import filesize from "rollup-plugin-filesize";
import progress from "rollup-plugin-progress";
Expand All @@ -23,20 +23,27 @@ const webConfig = {
progress(),
filesize(),
analyze(),
nodeResolve({
resolve({
browser: true,
dedupe: ["yup"],
}), // so Rollup can find `yup`
commonjs({
include: /node_modules/,
include: "node_modules/**",
}), // so Rollup can convert `yup` to an ES module
typescript({
transpiler: "babel",
}),
compiler(),
],
};

// browser-friendly UMD build
const webMinConfig = Object.assign({}, webConfig, {
output: {
...webConfig.output,
file: pkg.browser.replace(/(\.js)$/, ".min$1"), // yup-phone.umd.js → yup-phone.umd.min.js
},
plugins: [...webConfig.plugins, compiler()],
});

// CommonJS (for Node) and ES module (for bundlers) build.
// (We could have three entries in the configuration array
// instead of two, but it's quicker to generate multiple
Expand All @@ -45,7 +52,7 @@ const webConfig = {
// `file` and `format` for each target)
const nodeConfig = {
input: "src/yup-phone-lite.ts",
external: ["yup", "libphonenumber-js"],
external: ["yup"],
output: [
{ file: pkg.main, format: "cjs", sourcemap: true },
{ file: pkg.module, format: "es", sourcemap: true },
Expand All @@ -63,4 +70,4 @@ const nodeConfig = {

export default process.env.NODE_ENV === "test"
? nodeConfig
: [webConfig, nodeConfig];
: [webConfig, webMinConfig, nodeConfig];