Skip to content

Commit

Permalink
feat: Addition of webpack, library now working via cdn in pure html
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-logan committed Mar 25, 2024
1 parent 28ff334 commit ec041a3
Show file tree
Hide file tree
Showing 9 changed files with 611 additions and 97 deletions.
1 change: 1 addition & 0 deletions packages/typescript/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ dist/
node_modules/
tests/**/*
types/
webpack.config.js
1 change: 1 addition & 0 deletions packages/typescript/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
.npmignore
BackupCopia/
todo.txt
teste.html
22 changes: 22 additions & 0 deletions packages/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@ If you want to help me, you can buy me a coffee (:
</a>
</p>


## CDNs

jsDelivr:
```bash
https://cdn.jsdelivr.net/npm/multiform-validator@1.0.39/dist/bundle.min.js
```
```html
<scritp src="https://cdn.jsdelivr.net/npm/multiform-validator@1.0.39/dist/bundle.min.js"></script>
```

unpkg:
```bash
https://unpkg.com/multiform-validator@1.0.39/dist/bundle.js
```
```html
<scritp src="https://unpkg.com/multiform-validator@1.0.39/dist/bundle.js"></script>
```




## Installation

```bash
Expand Down
1 change: 1 addition & 0 deletions packages/typescript/dist/bundle.js

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions packages/typescript/dist/src/isValidImage.js

This file was deleted.

15 changes: 0 additions & 15 deletions packages/typescript/dist/src/isValidPdf.js

This file was deleted.

117 changes: 61 additions & 56 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,64 @@
{
"name": "multiform-validator",
"version": "1.0.36",
"description": "Javascript library made to validate, several form fields, such as: email, phone, password, cpf etc.",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
"scripts": {
"test": "jest --coverage",
"test:file": "jest tests/src/isValidImage.test --watch",
"test:watch": "jest --watch",
"build": "npx tsc",
"build:types": "tsc -p tsconfig.types.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gabriel-logan/multiform-validator.git"
},
"keywords": [
"validator",
"multiform",
"validação",
"email-validator",
"multiform-validator",
"javascript",
"npm",
"security",
"safe",
"pentest",
"security-tools",
"Validator",
"validate"
],
"author": "Gabriel Logan",
"license": "MIT",
"bugs": {
"url": "https://github.com/gabriel-logan/multiform-validator/issues"
},
"homepage": "https://github.com/gabriel-logan/multiform-validator#readme",
"contributors": [
"Gabriel Logan",
"name": "multiform-validator",
"version": "1.0.40",
"description": "Javascript library made to validate, several form fields, such as: email, phone, password, cpf etc.",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
"unpkg": "./dist/bundle.js",
"scripts": {
"test": "jest --coverage",
"test:file": "jest tests/src/isValidImage.test --watch",
"test:watch": "jest --watch",
"build": "npx tsc",
"build:types": "tsc -p tsconfig.types.json",
"build:browser": "webpack"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gabriel-logan/multiform-validator.git"
},
"keywords": [
"validator",
"multiform",
"validação",
"email-validator",
"multiform-validator",
"javascript",
"npm",
"security",
"safe",
"pentest",
"security-tools",
"Validator",
"validate"
],
"author": "Gabriel Logan",
"license": "MIT",
"bugs": {
"url": "https://github.com/gabriel-logan/multiform-validator/issues"
},
"homepage": "https://gabriel-logan.github.io/multiform-validator/",
"contributors": [
"Gabriel Logan",
"Breno A"
],
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/mocha": "^10.0.6",
"@types/node": "^20.5.1",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.6.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.2"
},
"dependencies": {}
],
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/mocha": "^10.0.6",
"@types/node": "^20.5.1",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.6.4",
"prettier": "^3.2.5",
"ts-jest": "^29.1.1",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.2",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {}
}
24 changes: 24 additions & 0 deletions packages/typescript/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const path = require('path');

module.exports = {
mode: 'production', // production mode
entry: './index.ts', // entry point of your application
output: {
filename: 'bundle.js', // output file name
path: path.resolve(__dirname, 'dist'), // output folder
libraryTarget: 'umd', // this allows your module to be used via require() and as a global
globalObject: 'this' // this ensures that 'this' is 'window' in a browser environment
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts'],
},
};
Loading

0 comments on commit ec041a3

Please sign in to comment.