-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted from class to namespace, Add JSDocs to namespace, Add prett…
…ifier, Improve showcase website
- Loading branch information
1 parent
2a97645
commit 506567f
Showing
12 changed files
with
190 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": true, | ||
"printWidth": 160 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,41 @@ | ||
import dts from 'bun-plugin-dts'; | ||
import Logger from '@rabbit-company/logger'; | ||
import fs from 'fs/promises'; | ||
import dts from "bun-plugin-dts"; | ||
import Logger from "@rabbit-company/logger"; | ||
import fs from "fs/promises"; | ||
|
||
await fs.rm('./module', {recursive: true, force: true}); | ||
await fs.rm('./dist', {recursive: true, force: true}); | ||
await fs.rm("./module", { recursive: true, force: true }); | ||
await fs.rm("./dist", { recursive: true, force: true }); | ||
|
||
Logger.info('Start bulding module...'); | ||
Logger.info("Start bulding module..."); | ||
let moduleBuild = await Bun.build({ | ||
entrypoints: ['./src/password-generator.ts'], | ||
outdir: './module', | ||
target: 'browser', | ||
format: 'esm', | ||
plugins: [ | ||
dts({output: {noBanner: true}}) | ||
], | ||
entrypoints: ["./src/password-generator.ts"], | ||
outdir: "./module", | ||
target: "browser", | ||
format: "esm", | ||
plugins: [dts({ output: { noBanner: true } })], | ||
}); | ||
|
||
if(moduleBuild.success){ | ||
Logger.info('Bulding module complete'); | ||
}else{ | ||
Logger.error('Bulding module failed'); | ||
if (moduleBuild.success) { | ||
Logger.info("Bulding module complete"); | ||
} else { | ||
Logger.error("Bulding module failed"); | ||
} | ||
|
||
fs.cp('./src/index.html', './dist/index.html', {recursive: true, force: true}); | ||
fs.cp("./src/index.html", "./dist/index.html", { recursive: true, force: true }); | ||
|
||
Logger.info('Start bundling dist...'); | ||
Logger.info("Start bundling dist..."); | ||
let distBuild = await Bun.build({ | ||
entrypoints: ['./src/index.ts'], | ||
outdir: './dist', | ||
target: 'browser', | ||
format: 'esm', | ||
entrypoints: ["./src/index.ts"], | ||
outdir: "./dist", | ||
target: "browser", | ||
format: "esm", | ||
minify: true, | ||
sourcemap: 'none', // Bun still generates incorrect sourcemaps | ||
plugins: [], | ||
sourcemap: "none", | ||
plugins: [], | ||
}); | ||
|
||
if(distBuild.success){ | ||
Logger.info('Bundling dist complete'); | ||
}else{ | ||
Logger.error('Bundling dist failed'); | ||
if (distBuild.success) { | ||
Logger.info("Bundling dist complete"); | ||
} else { | ||
Logger.error("Bundling dist failed"); | ||
Logger.error(distBuild.logs); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>PasswordGenerator-JS</title> | ||
</head> | ||
<body> | ||
<h1><a href="https://github.com/Rabbit-Company/PasswordGenerator-JS" target="_blank">PasswordGenerator-JS</a></h1> | ||
<head> | ||
<title>PasswordGenerator-JS</title> | ||
</head> | ||
<body> | ||
<h1><a href="https://github.com/Rabbit-Company/PasswordGenerator-JS" target="_blank">PasswordGenerator-JS</a></h1> | ||
|
||
<input type="checkbox" id="upperCase" checked /> | ||
<label>Uppercase</label></br> | ||
<input type="checkbox" id="upperCase" checked /> | ||
<label for="upperCase">Uppercase</label><br /> | ||
|
||
<input type="checkbox" id="numbers" checked /> | ||
<label>Numbers</label></br> | ||
<input type="checkbox" id="numbers" checked /> | ||
<label for="numbers">Numbers</label><br /> | ||
|
||
<input type="checkbox" id="symbols" checked /> | ||
<label>Symbols</label></br></br> | ||
<input type="checkbox" id="symbols" checked /> | ||
<label for="symbols">Symbols</label><br /><br /> | ||
|
||
<label>Length: </label> | ||
<input id="length" type="range" min="8" max="50" value="20" placeholder="Length" /><label id="label-length">20</label></br></br> | ||
<label for="length">Length: </label> | ||
<input id="length" type="range" min="8" max="50" value="20" placeholder="Length" /><label id="label-length">20</label><br /><br /> | ||
|
||
<button id="generate">Generate</button> | ||
<button id="generate">Generate</button> | ||
|
||
<p>Password: <b id="result"></b></p> | ||
<p>Password: <b id="result"></b></p> | ||
|
||
<h1>Performance Test</h1> | ||
<div> | ||
<label>Number of executions:</label> | ||
<input id="amount" type="number" min="1" max="100000" placeholder="Amount" value="1000" /> | ||
<button id="btn-start">Start</button> | ||
</div> | ||
<p id="perf"></p> | ||
<h1>Performance Test</h1> | ||
<div> | ||
<label for="amount">Number of executions:</label> | ||
<input id="amount" type="number" min="1" max="100000" placeholder="Amount" value="1000" /> | ||
<button id="btn-start">Start</button> | ||
</div> | ||
<p id="perf"></p> | ||
|
||
<script type="module" src="index.js"></script> | ||
</body> | ||
</html> | ||
<script type="module" src="index.js"></script> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "@rabbit-company/password-generator", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"exports": "./src/password-generator.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,56 @@ | ||
export default class PasswordGenerator { | ||
/** | ||
* The `PasswordGenerator` namespace provides utilities for generating random, secure passwords. | ||
* | ||
* Developers can customize the characters used for generating passwords by modifying | ||
* the properties `lcase`, `ucase`, `numb`, and `symbols`. | ||
*/ | ||
declare namespace PasswordGenerator { | ||
/** | ||
* Lowercase letters used for password generation. Developers can customize this string. | ||
* Default: "abcdefghijklmnopqrstuvwxyz". | ||
* @type {string} | ||
*/ | ||
static lcase: string; | ||
*/ | ||
let lcase: string; | ||
/** | ||
* Uppercase letters used for password generation. Developers can customize this string. | ||
* Default: "ABCDEFGHIJKLMNOPQRSTUVWXYZ". | ||
* @type {string} | ||
*/ | ||
static ucase: string; | ||
*/ | ||
let ucase: string; | ||
/** | ||
* Numbers used for password generation. Developers can customize this string. | ||
* Default: "1234567890". | ||
* @type {string} | ||
*/ | ||
static numb: string; | ||
*/ | ||
let numb: string; | ||
/** | ||
* Symbols used for password generation. Developers can customize this string. | ||
* Default: "!@#$%?&*". | ||
* @type {string} | ||
*/ | ||
static symbols: string; | ||
*/ | ||
let symbols: string; | ||
/** | ||
* Generates a cryptographically secure random number within a specified range. | ||
* | ||
* @param {number} [min=0] - The minimum value of the range (inclusive). | ||
* @param {number} [max=100] - The maximum value of the range (exclusive). | ||
* @returns {number} A random number within the specified range. | ||
*/ | ||
static randRange(min?: number, max?: number): number; | ||
*/ | ||
function randRange(min?: number, max?: number): number; | ||
/** | ||
* Generates a random password based on specified criteria. | ||
* | ||
* @param {number} [length=10] - The length of the password. | ||
* @param {number} [length=20] - The length of the password. | ||
* @param {boolean} [upperCase=true] - Include uppercase letters in the password. | ||
* @param {boolean} [numbers=true] - Include numbers in the password. | ||
* @param {boolean} [specials=true] - Include special characters in the password. | ||
* @returns {string} The generated password. | ||
*/ | ||
static generate(length?: number, upperCase?: boolean, numbers?: boolean, specials?: boolean): string; | ||
*/ | ||
function generate(length?: number, upperCase?: boolean, numbers?: boolean, specials?: boolean): string; | ||
} | ||
|
||
export { | ||
PasswordGenerator as default, | ||
}; | ||
|
||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>PasswordGenerator-JS</title> | ||
</head> | ||
<body> | ||
<h1><a href="https://github.com/Rabbit-Company/PasswordGenerator-JS" target="_blank">PasswordGenerator-JS</a></h1> | ||
<head> | ||
<title>PasswordGenerator-JS</title> | ||
</head> | ||
<body> | ||
<h1><a href="https://github.com/Rabbit-Company/PasswordGenerator-JS" target="_blank">PasswordGenerator-JS</a></h1> | ||
|
||
<input type="checkbox" id="upperCase" checked /> | ||
<label>Uppercase</label></br> | ||
<input type="checkbox" id="upperCase" checked /> | ||
<label for="upperCase">Uppercase</label><br /> | ||
|
||
<input type="checkbox" id="numbers" checked /> | ||
<label>Numbers</label></br> | ||
<input type="checkbox" id="numbers" checked /> | ||
<label for="numbers">Numbers</label><br /> | ||
|
||
<input type="checkbox" id="symbols" checked /> | ||
<label>Symbols</label></br></br> | ||
<input type="checkbox" id="symbols" checked /> | ||
<label for="symbols">Symbols</label><br /><br /> | ||
|
||
<label>Length: </label> | ||
<input id="length" type="range" min="8" max="50" value="20" placeholder="Length" /><label id="label-length">20</label></br></br> | ||
<label for="length">Length: </label> | ||
<input id="length" type="range" min="8" max="50" value="20" placeholder="Length" /><label id="label-length">20</label><br /><br /> | ||
|
||
<button id="generate">Generate</button> | ||
<button id="generate">Generate</button> | ||
|
||
<p>Password: <b id="result"></b></p> | ||
<p>Password: <b id="result"></b></p> | ||
|
||
<h1>Performance Test</h1> | ||
<div> | ||
<label>Number of executions:</label> | ||
<input id="amount" type="number" min="1" max="100000" placeholder="Amount" value="1000" /> | ||
<button id="btn-start">Start</button> | ||
</div> | ||
<p id="perf"></p> | ||
<h1>Performance Test</h1> | ||
<div> | ||
<label for="amount">Number of executions:</label> | ||
<input id="amount" type="number" min="1" max="100000" placeholder="Amount" value="1000" /> | ||
<button id="btn-start">Start</button> | ||
</div> | ||
<p id="perf"></p> | ||
|
||
<script type="module" src="index.js"></script> | ||
</body> | ||
</html> | ||
<script type="module" src="index.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.