From 77cddebeb9968ae8d367371d8e81a7a76a9feea7 Mon Sep 17 00:00:00 2001 From: Sandeep Rawat <61680562+sandeep-r-bharatpe@users.noreply.github.com> Date: Thu, 2 May 2024 16:33:04 +0530 Subject: [PATCH] publish repo to private registry (#12) * feat(private-registry): publish repo to private registry * feat(private-registry): publish to private reigstry * chore(log): delete log files --------- Co-authored-by: Sandeep Rawat <> --- .gitignore | 1 + README.md | 8 +- dist/README.md | 271 ++++++++++++++++++++++++++++++++++ dist/index.d.ts | 2 +- dist/index.umd.js | 2 +- dist/package.json | 121 +++++++++++++++ dist/types/src/constants.d.ts | 2 +- package.json | 29 ++-- rollup.config.js | 12 +- stats.html | 2 +- yarn.lock | 135 ++++++++++++++++- 11 files changed, 559 insertions(+), 26 deletions(-) create mode 100644 dist/README.md create mode 100644 dist/package.json diff --git a/.gitignore b/.gitignore index fd4f2b0..f3cbe26 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules .DS_Store +yarn-error.log diff --git a/README.md b/README.md index fd8ebe6..6d4c7b1 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ A mini regex library for most commonly used patterns # Getting Started (Installation) ```javascript -yarn add valiy +yarn add @bp/valiy or -npm i valiy +npm i @bp/valiy ``` -------------------------------------------------------------------------------- @@ -59,7 +59,7 @@ npm i valiy ## Usage ```javascript -import { Validator, Regex } from 'valiy'; +import { Validator, Regex } from '@bp/valiy'; // PAN Validation Validator.validatePan('BUFPP9037C') // True @@ -87,7 +87,7 @@ Validator.validate(SOME_REGEX, 'VALUE1234'); // True or False // Can import individual function or regex -import { validate, PAN_REGEX, validateFullname } from 'valiy'; +import { validate, PAN_REGEX, validateFullname } from '@bp/valiy'; // Full name validation Validator.validateFullname('ABDUL KALAM AZAAD') // True diff --git a/dist/README.md b/dist/README.md new file mode 100644 index 0000000..fd8ebe6 --- /dev/null +++ b/dist/README.md @@ -0,0 +1,271 @@ +# Valiy [![NPM version](https://img.shields.io/npm/v/valiy.svg)](https://www.npmjs.com/package/valiy) [![Downloads](http://img.shields.io/npm/dm/valiy.svg)](https://npmjs.org/package/valiy) + +A mini regex library for most commonly used patterns + +![Valiy](/assets/valiy.png) + +## Regex + - Pan Card + - Aadhaar Card + - GST Number + - Passport + - Voter ID + - Phone number, + - Pincode, + - Pure numbers, + - Pure string, + - Alphanumeric, + - Alphanumeric with spaces, + - Username, + - Fullname + - Email + - Web URL + + + # Getting Started (Installation) + +```javascript +yarn add valiy + +or + +npm i valiy +``` + +-------------------------------------------------------------------------------- +## Validate Methods + + Method | Params | Description +----------------------------------|--------------------------|---------------------------- + validate | regex, value[string] | Custom validation - validate(regex, value) returns boolean + validatePan | value[string] | Pan validation - validatePan(value) returns boolean + validateAadhaar | value[string] | Aadhar validation - validateAadhaar(value) returns boolean + validateGST | value[string] | GST validation - validateGST(value) returns boolean + validatePassport | value[string] | Passport validation - validatePassport(value) returns boolean + validateVoterId | value[string] | VoterID validation - validateVoterId(value) returns boolean + validatePhone | value[string] | Phone number validation - validatePhone(value) returns boolean + validatePincode | value[string] | Pincode validation - validatePincode(value) returns boolean + validateOnlyString | value[string] | String validation - validateOnlyString(value) returns boolean + validateOnlyNumber | value[string] | Number validation - validateOnlyNumber(value) returns boolean + validateAlphanumeric | value[string] | Alphanumeric validation - validateAlphanumeric(value) returns boolean + validateAlphanumericWithSpace | value[string] | Alphanumeric with space validation - validateAlphanumericWithSpace(value) returns boolean + validateFullname | value[string] | Full name validation - validateFullname(value) returns boolean + validateUsername | value[string] | Username validation - validateUsername(value) returns boolean + validateEmail | value[string] | Email validation - validateEmail(value) returns boolean + validateWebUrl | value[string] | Web URL validation - validateWebUrl(value) returns boolean + +-------------------------------------------------------------------------------------------------- + + +## Usage +```javascript +import { Validator, Regex } from 'valiy'; + +// PAN Validation +Validator.validatePan('BUFPP9037C') // True +Validator.validatePan('BUFPP90_37CS') // False + +// AADHAR Validation +Validator.validateAadhaar('5858 5119 3566') // True + + +// Full name validation +Validator.validateFullname('ABDUL KALAM AZAAD') // True +Validator.validateFullname('0345_KRISH') // False + + +// Validate GST +Validator.validateGST('07CQZCD1111I4Z7') // True + + +// Can get Regex directly +Regex.PAN_REGEX; // /[A-Z]{5}[0-9]{4}[A-Z]{1}$/ + + +// Custom validation +Validator.validate(SOME_REGEX, 'VALUE1234'); // True or False + + +// Can import individual function or regex +import { validate, PAN_REGEX, validateFullname } from 'valiy'; + +// Full name validation +Validator.validateFullname('ABDUL KALAM AZAAD') // True +Validator.validateFullname('0345_KRISH') // False + +// Custom validation +Validator.validate(PAN_REGEX, 'BUFPP9037C'); // True +Validator.validate(PAN_REGEX, 'BUFPP90_37CS'); // False + +// Custom validation +Validator.validate(SOME_REGEX, 'VALUE1234'); // True or False + +``` + + +### Regex Conditions + +#### PAN +```javascript +/** + * @name PAN_REGEX + * @example BUFPP9037C + * @description + * - First 5 alphabets + * - followed by 4 numberals + * - followed by one alphabets + */ +``` + +#### Aadhar +```javascript +/** + * @name AADHAAR_REGEX + * @example 585851193566 + * @description: 12 Digits + */ +``` + +#### GST +```javascript +/** + * @name GST_REGEX + * @example 27AAPFU0939F1ZV + * @description Total 15 characters + * - First 2 digits of the GST Number will represent State Code as per the Census (2011). + - Next 10 digits will be same as in the PAN number of the taxpayer. + - First five will be alphabets + - Next four will be numbers + - Last will be check code + - The 13th digit will be the number of registration you take within a state i.e. after 9, A to Z is considered as 10 to 35 . + - 14th digit will be Z by default. + - Last would be the check code. + */ +``` + +#### Passport +```javascript +/** + * @name PASSPORT_REGEX + * @example A2096457 + * @description It should be eight characters long. + * - The first character should be an upper case alphabet. + * - The next two characters should be a number, but the first character should be any number from 1-9 and the second character should be any number from 0-9. + * - It should be zero or one white space character. + * - The next four characters should be any number from 0-9. + * - The last character should be any number from 1-9. + */ +``` + +#### Voter ID +```javascript +/** + * @name VOTER_ID_REGEX + * @example GDN0225185 + * @description It should be 10 characters long + * - First 3 alphabets + * - Followed by 7 numbers + */ +``` + +#### Phone number +```javascript +/** + * @name PHONE_NUMBER_REGEX + * @example 8880344456 | +918880344456 | +91 8880344456 | +91-8880344456 | 08880344456 | 918880344456 + * @description Mobile number validation with all cases +91,0,Without prefix. + */ +``` + +#### Pincode +```javascript +/** + * @name PINCODE_REGEX + * @example 770018 + * @description It should be 6 digit number + * - First digit cannot be 0 + */ +``` + +#### Only strings +```javascript +/** + * @name ONLY_STRING_REGEX + * @example Bharatpe + * @description All string regex + */ +``` + +#### Numbers +```javascript +/** + * @name ONLY_NUMBERS_REGEX + * @example 1234 + * @description All numbers regex + */ +``` + +#### Alphanumeric +```javascript +/** + * @name ALPHANUMERIC_REGEX + * @example abcDeF124 + * @description Alpanumeric contains mix of numbers and alpahbets + */ +``` + +#### Alphanumeric with string +```javascript +/** + * @name ALPHANUMERIC_WITH_SPACE_REGEX + * @example abcD eF 124 + * @description Alpanumeric contains mix of numbers and alpahbets with spaces in between + */ +``` + +#### Username +```javascript +/** + * @name USERNAME_REGEX + * @example abcDe_F124 + * @description Alpanumeric contains mix of numbers and alpahbets + */ +``` + +#### Fullname +```javascript +/** + * @name FULL_NAME_REGEX + * @example MOHANA KRISHNA PADDA + * @description Alpanumeric contains mix of numbers and alpahbets + */ +``` + +#### Email +```javascript +/** + * @name EMAIL_REGEX + * @example krish@bharatpe.com | tech@geek.io.in | hack_12RT.Y56_RT@hc.st.io + * @description Common email validator + * - Start with alphanumeric + * - Followed by alphanumeric with underscore, dot allowed + * - With @ followed by domain name + */ +``` + +#### Web URL +```javascript +/** + * @name WEB_URL_REGEX + * @example bharatpe.com | www.bharatpe.io | https://bharatpe.com | http://bharatpe.com?file=jus_.F-filename_ + * @description Common Web url format + */ + ``` + + +## Contributors +Here [Contributors](https://github.com/bharatpe/validator/graphs/contributors) + + +## License +MIT @[bharatpe](https://bharatpe.in) diff --git a/dist/index.d.ts b/dist/index.d.ts index b710c2f..c59456c 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -199,7 +199,7 @@ declare namespace validator_d { declare const PAN_REGEX: RegExp; /** * @name AADHAAR_REGEX - * @example 5858 5119 3566 + * @example 585851193566 * @description: 12 Digits */ declare const AADHAAR_REGEX: RegExp; diff --git a/dist/index.umd.js b/dist/index.umd.js index 9bc17ad..57d3f0f 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1,2 +1,2 @@ -!function(a,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((a="undefined"!=typeof globalThis?globalThis:a||self).valiy={})}(this,(function(a){"use strict";var e=/[A-Z]{5}[0-9]{4}[A-Z]{1}$/,t=/^\d{4}\d{4}\d{4}?$/,E=/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/,n=/^(?!^0+$)[a-zA-Z0-9]{3,20}$/,i=/^([a-zA-Z]){3}([0-9]){7}?$/,l=/^(\+91[-\s]?)?[0]?(91[-\s]?)?[56789]\d{9}$/,r=/^[1-9][0-9]{5}$/,_=/^[0-9]+$/,A=/^[a-zA-Z]+$/,d=/^[a-zA-Z0-9]+$/,R=/^[a-zA-Z0-9 ]+$/,u=/^[a-zA-Z][a-zA-Z0-9_-]+$/,o=/^[a-zA-Z][a-zA-Z ]+$/,G=/^([a-zA-Z0-9][a-zA-Z0-9_.]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/,v=/(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/,c=Object.freeze({__proto__:null,PAN_REGEX:e,AADHAAR_REGEX:t,GST_REGEX:E,PASSPORT_REGEX:n,VOTER_ID_REGEX:i,PHONE_NUMBER_REGEX:l,PINCODE_REGEX:r,ONLY_NUMBERS_REGEX:_,ONLY_STRING_REGEX:A,ALPHANUMERIC_REGEX:d,ALPHANUMERIC_WITH_SPACE_REGEX:R,USERNAME_REGEX:u,FULL_NAME_REGEX:o,EMAIL_REGEX:G,WEB_URL_REGEX:v}),f=function(a,e){return a.test(e)},X=function(a){return f(e,a)},N=function(a){return f(t,a)},P=function(a){return f(E,a)},Z=function(a){return f(n,a)},S=function(a){return f(i,a)},s=function(a){return f(l,a)},p=function(a){return f(r,a)},z=function(a){return f(_,a)},O=function(a){return f(A,a)},U=function(a){return f(d,a)},I=function(a){return f(R,a)},L=function(a){return f(u,a)},$=function(a){return f(o,a)},h=function(a){return f(G,a)},m=function(a){return f(v,a)},M=Object.freeze({__proto__:null,validate:f,validatePan:X,validateAadhaar:N,validateGST:P,validatePassport:Z,validateVoterId:S,validatePhone:s,validatePincode:p,validateOnlyNumber:z,validateOnlyString:O,validateAlphanumeric:U,validateAlphanumericWithSpace:I,validateUsername:L,validateFullname:$,validateEmail:h,validateWebUrl:m});a.AADHAAR_REGEX=t,a.ALPHANUMERIC_REGEX=d,a.ALPHANUMERIC_WITH_SPACE_REGEX=R,a.EMAIL_REGEX=G,a.FULL_NAME_REGEX=o,a.GST_REGEX=E,a.ONLY_NUMBERS_REGEX=_,a.ONLY_STRING_REGEX=A,a.PAN_REGEX=e,a.PASSPORT_REGEX=n,a.PHONE_NUMBER_REGEX=l,a.PINCODE_REGEX=r,a.Regex=c,a.USERNAME_REGEX=u,a.VOTER_ID_REGEX=i,a.Validator=M,a.WEB_URL_REGEX=v,a.validate=f,a.validateAadhaar=N,a.validateAlphanumeric=U,a.validateAlphanumericWithSpace=I,a.validateEmail=h,a.validateFullname=$,a.validateGST=P,a.validateOnlyNumber=z,a.validateOnlyString=O,a.validatePan=X,a.validatePassport=Z,a.validatePhone=s,a.validatePincode=p,a.validateUsername=L,a.validateVoterId=S,a.validateWebUrl=m})); +!function(a,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((a="undefined"!=typeof globalThis?globalThis:a||self)["@bp/valiy"]={})}(this,(function(a){"use strict";var e=/[A-Z]{5}[0-9]{4}[A-Z]{1}$/,t=/^\d{4}\d{4}\d{4}?$/,E=/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/,n=/^(?!^0+$)[a-zA-Z0-9]{3,20}$/,i=/^([a-zA-Z]){3}([0-9]){7}?$/,l=/^(\+91[-\s]?)?[0]?(91[-\s]?)?[56789]\d{9}$/,r=/^[1-9][0-9]{5}$/,_=/^[0-9]+$/,A=/^[a-zA-Z]+$/,d=/^[a-zA-Z0-9]+$/,R=/^[a-zA-Z0-9 ]+$/,u=/^[a-zA-Z][a-zA-Z0-9_-]+$/,o=/^[a-zA-Z][a-zA-Z ]+$/,G=/^([a-zA-Z0-9][a-zA-Z0-9_.]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})*$/,v=/(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/,c=Object.freeze({__proto__:null,PAN_REGEX:e,AADHAAR_REGEX:t,GST_REGEX:E,PASSPORT_REGEX:n,VOTER_ID_REGEX:i,PHONE_NUMBER_REGEX:l,PINCODE_REGEX:r,ONLY_NUMBERS_REGEX:_,ONLY_STRING_REGEX:A,ALPHANUMERIC_REGEX:d,ALPHANUMERIC_WITH_SPACE_REGEX:R,USERNAME_REGEX:u,FULL_NAME_REGEX:o,EMAIL_REGEX:G,WEB_URL_REGEX:v}),f=function(a,e){return a.test(e)},X=function(a){return f(e,a)},N=function(a){return f(t,a)},P=function(a){return f(E,a)},Z=function(a){return f(n,a)},S=function(a){return f(i,a)},p=function(a){return f(l,a)},s=function(a){return f(r,a)},z=function(a){return f(_,a)},O=function(a){return f(A,a)},U=function(a){return f(d,a)},I=function(a){return f(R,a)},L=function(a){return f(u,a)},$=function(a){return f(o,a)},h=function(a){return f(G,a)},m=function(a){return f(v,a)},M=Object.freeze({__proto__:null,validate:f,validatePan:X,validateAadhaar:N,validateGST:P,validatePassport:Z,validateVoterId:S,validatePhone:p,validatePincode:s,validateOnlyNumber:z,validateOnlyString:O,validateAlphanumeric:U,validateAlphanumericWithSpace:I,validateUsername:L,validateFullname:$,validateEmail:h,validateWebUrl:m});a.AADHAAR_REGEX=t,a.ALPHANUMERIC_REGEX=d,a.ALPHANUMERIC_WITH_SPACE_REGEX=R,a.EMAIL_REGEX=G,a.FULL_NAME_REGEX=o,a.GST_REGEX=E,a.ONLY_NUMBERS_REGEX=_,a.ONLY_STRING_REGEX=A,a.PAN_REGEX=e,a.PASSPORT_REGEX=n,a.PHONE_NUMBER_REGEX=l,a.PINCODE_REGEX=r,a.Regex=c,a.USERNAME_REGEX=u,a.VOTER_ID_REGEX=i,a.Validator=M,a.WEB_URL_REGEX=v,a.validate=f,a.validateAadhaar=N,a.validateAlphanumeric=U,a.validateAlphanumericWithSpace=I,a.validateEmail=h,a.validateFullname=$,a.validateGST=P,a.validateOnlyNumber=z,a.validateOnlyString=O,a.validatePan=X,a.validatePassport=Z,a.validatePhone=p,a.validatePincode=s,a.validateUsername=L,a.validateVoterId=S,a.validateWebUrl=m})); //# sourceMappingURL=index.umd.js.map diff --git a/dist/package.json b/dist/package.json new file mode 100644 index 0000000..0fe46c6 --- /dev/null +++ b/dist/package.json @@ -0,0 +1,121 @@ +{ + "name": "@bp/valiy", + "version": "3.0.0", + "description": "Validator - A mini regex library for most commonly used patterns", + "main": "index.js", + "types": "index.d.ts", + "module": "index.esm.js", + "unpkg": "index.umd.js", + "jsdelivr": "index.umd.js", + "umd:main": "index.umd.js", + "cdn": "index.umd.js", + "publishConfig": { + "registry": "https://npm.bharatpe.in" + }, + "scripts": { + "build": "rollup -c", + "watch": "rollup -cw", + "test": "jest", + "clean-build": "rimraf ./test-react-app/node_modules/valiy", + "push-build": "cp -R ./dist ./test-react-app/node_modules/valiy", + "test-build": "yarn build && yarn clean-build && yarn push-build", + "clean-build-ts": "rimraf ./test-react-app-ts/node_modules/valiy", + "push-build-ts": "cp -R ./dist ./test-react-app-ts/node_modules/valiy", + "test-build-ts": "yarn build && yarn clean-build-ts && yarn push-build-ts", + "test-builds": "yarn build && yarn clean-build && yarn push-build && yarn clean-build-ts && yarn push-build-ts", + "fix": "prettier-eslint --write $PWD/'src/**/*.{ts,tsx}'", + "lint": "eslint $PWD/'src/**/*.{ts,tsx}' --config .eslintrc", + "commit": "git-cz", + "release": "standard-version", + "release:patch": "npm run release -- --release-as patch", + "release:minor": "npm run release -- --release-as minor", + "release:major": "npm run release -- --release-as major", + "publish:fix": "npm publish dist --tag fix", + "publish:latest": "npm publish dist --tag latest" + }, + "jest": { + "rootDir": "src", + "collectCoverage": true, + "modulePathIgnorePatterns": [ + "test-react-app", + "index.ts", + "constants.ts" + ], + "transform": { + "^.+\\.ts$": "ts-jest" + }, + "collectCoverageFrom": [ + "**/*.ts" + ], + "coverageDirectory": "../coverage" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/bharatpe/valiy.git" + }, + "author": "WebChapter, BharatPe", + "license": "ISC", + "bugs": { + "url": "https://github.com/bharatpe/valiy/issues" + }, + "homepage": "https://github.com/bharatpe/valiy#readme", + "devDependencies": { + "@babel/core": "^7.12.3", + "@babel/preset-env": "^7.12.1", + "@babel/preset-react": "^7.12.5", + "@commitlint/cli": "^12.0.1", + "@commitlint/config-conventional": "^12.0.1", + "@rollup/plugin-commonjs": "^17.1.0", + "@rollup/plugin-node-resolve": "^11.2.0", + "@types/jest": "^28.1.8", + "@types/react": "^17.0.3", + "@types/react-dom": "^17.0.2", + "babel-eslint": "^10.1.0", + "babel-preset-react-app": "^10.0.0", + "commitizen": "^4.2.3", + "cz-conventional-changelog": "^3.3.0", + "eslint": "^7.22.0", + "eslint-config-airbnb": "^18.2.1", + "eslint-config-prettier": "^8.1.0", + "eslint-plugin-compat": "^3.9.0", + "eslint-plugin-extra-rules": "0.0.0-development", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-jsx-a11y": "^6.4.1", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-react": "^7.22.0", + "eslint-plugin-react-hooks": "^4.2.0", + "jest": "^29.0.1", + "prettier": "^2.2.1", + "prettier-eslint-cli": "^5.0.1", + "rimraf": "^3.0.2", + "rollup": "^2.41.2", + "rollup-plugin-babel": "^4.4.0", + "rollup-plugin-dts": "^4.2.2", + "rollup-plugin-peer-deps-external": "^2.2.4", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-typescript2": "^0.30.0", + "rollup-plugin-visualizer": "^4.2.0", + "rollup-plugin-copy": "^3.5.0", + "standard-version": "^9.1.1", + "ts-jest": "^28.0.8", + "typescript": "^4.2.3" + }, + "peerDependencies": { + "babel-loader": "^8.1.0", + "jest": "^29.0.1", + "react": "^18.0.0", + "ts-jest": "^28.0.8" + }, + "prettier": {}, + "eslintConfig": { + "extends": [ + "react-app" + ] + }, + "config": { + "commitizen": { + "path": "cz-conventional-changelog" + } + }, + "dependencies": {} +} diff --git a/dist/types/src/constants.d.ts b/dist/types/src/constants.d.ts index 627cb42..0d95f0a 100644 --- a/dist/types/src/constants.d.ts +++ b/dist/types/src/constants.d.ts @@ -9,7 +9,7 @@ export declare const PAN_REGEX: RegExp; /** * @name AADHAAR_REGEX - * @example 5858 5119 3566 + * @example 585851193566 * @description: 12 Digits */ export declare const AADHAAR_REGEX: RegExp; diff --git a/package.json b/package.json index 587bf53..0fe46c6 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,17 @@ { - "name": "valiy", - "version": "2.0.0", + "name": "@bp/valiy", + "version": "3.0.0", "description": "Validator - A mini regex library for most commonly used patterns", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "module": "dist/index.esm.js", - "unpkg": "dist/index.umd.js", - "jsdelivr": "dist/index.umd.js", - "umd:main": "dist/index.umd.js", - "cdn": "dist/index.umd.js", - "files": [ - "dist" - ], + "main": "index.js", + "types": "index.d.ts", + "module": "index.esm.js", + "unpkg": "index.umd.js", + "jsdelivr": "index.umd.js", + "umd:main": "index.umd.js", + "cdn": "index.umd.js", + "publishConfig": { + "registry": "https://npm.bharatpe.in" + }, "scripts": { "build": "rollup -c", "watch": "rollup -cw", @@ -29,7 +29,9 @@ "release": "standard-version", "release:patch": "npm run release -- --release-as patch", "release:minor": "npm run release -- --release-as minor", - "release:major": "npm run release -- --release-as major" + "release:major": "npm run release -- --release-as major", + "publish:fix": "npm publish dist --tag fix", + "publish:latest": "npm publish dist --tag latest" }, "jest": { "rootDir": "src", @@ -93,6 +95,7 @@ "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.30.0", "rollup-plugin-visualizer": "^4.2.0", + "rollup-plugin-copy": "^3.5.0", "standard-version": "^9.1.1", "ts-jest": "^28.0.8", "typescript": "^4.2.3" diff --git a/rollup.config.js b/rollup.config.js index ebc170a..f9d93b7 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,6 +6,7 @@ import { terser } from 'rollup-plugin-terser'; import typescript from 'rollup-plugin-typescript2'; import visualizer from 'rollup-plugin-visualizer'; import dts from 'rollup-plugin-dts'; +import copy from 'rollup-plugin-copy'; const packageJson = require('./package.json'); @@ -54,7 +55,10 @@ const plugins = [ modulesOnly: true, }), visualizer(), - terser() + terser(), + copy({ + targets: [{ src: ['package.json', 'README.md'], dest: 'dist/' }], + }), ]; export default [ @@ -63,7 +67,7 @@ export default [ input: 'src/index.ts', output: { esModule: false, - file: packageJson.unpkg, + file: `dist/${packageJson.unpkg}`, format: 'umd', name: packageJson.name, exports: 'named', @@ -76,9 +80,9 @@ export default [ input: 'src/index.ts', output: [ { - file: packageJson.module, format: 'esm', name: packageJson.name, exports: 'named', sourcemap: true }, + file: `dist/${packageJson.module}`, format: 'esm', name: packageJson.name, exports: 'named', sourcemap: true }, { - file: packageJson.main, + file: `dist/${packageJson.main}`, format: 'cjs', name: packageJson.name, exports: 'named', diff --git a/stats.html b/stats.html index b776926..4ae6981 100644 --- a/stats.html +++ b/stats.html @@ -2694,7 +2694,7 @@