Skip to content

Commit

Permalink
initialized prest-client
Browse files Browse the repository at this point in the history
  • Loading branch information
KnockOutEZ committed Feb 28, 2024
0 parents commit d88c2e9
Show file tree
Hide file tree
Showing 35 changed files with 782 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Settings for editors and IDEs.
root = true

# Settings for any file.
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Unlinted files and folders.

# Generated docs, bundles and type definitions.
docs/
dist/
types/
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// @ts-check
/* eslint-env node */

'use strict';

/**
* An object with ESLint options.
* @type {import('eslint').Linter.Config}
*/
const options = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2021,
},
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
};

module.exports = options;
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# File attributes for Git repository.
# References at https://git-scm.com/docs/gitattributes.

# Handle files as text and ensure Unix line endings.
* text=auto eol=lf

# Ignore differences on NPM's lockfile.
# Since version 5.7.0, NPM automatically handles merge conflicts.
package-lock.json -diff
23 changes: 23 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Setup'
description: "Setups Node.js and npm to run GitHub Actions' jobs."
runs:
using: 'composite'
steps:
- name: 'Setup Node.js'
uses: 'actions/setup-node@v3'
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: 'Keep npm cache for future workflows'
uses: 'actions/cache@v3'
with:
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
path: '~/.npm'
restore-keys: |
${{ runner.os }}-node-
- name: 'Install dependencies'
run: 'npm ci'
shell: 'bash'
46 changes: 46 additions & 0 deletions .github/workflows/continuous-integrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'Continuous Integrations'

on:
push:
branches: ['main']

jobs:
lint:
name: 'Run ESLint and Prettier'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout the repository'
uses: 'actions/checkout@v3'

- name: 'Setup Node.js and npm'
uses: './.github/actions/setup'

- name: 'Execute the lint script'
run: 'npm run lint'


test:
name: 'Run unit tests with Jest'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout the repository'
uses: 'actions/checkout@v3'

- name: 'Setup Node.js and npm'
uses: './.github/actions/setup'

- name: 'Execute the test script'
run: 'npm run test'

bundle:
name: 'Bundle package with Rollup.js'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout the repository'
uses: 'actions/checkout@v3'

- name: 'Setup Node.js and npm'
uses: './.github/actions/setup'

- name: 'Execute the build script'
run: 'npm run build'
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Unversioned files and folders.

.DS_Store
node_modules/
npm-shrinkwrap.json
yarn.lock
.pnp.*
.yarn/
.yarnrc
.yarnrc.yaml
pnpm-lock.yaml
pnpm-workspace.yaml
pnpmfile.js
*.log
*.log.*
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Unlinted files and folders.

# Generated docs, bundles and type definitions.
docs/
dist/
types/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 pgEdge

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Prest Client

[![Continuous Integrations](https://github.com/pgEdge/prest-client/actions/workflows/continuous-integrations.yaml/badge.svg?branch=main)](https://github.com/pgEdge/prest-client/actions/workflows/continuous-integrations.yaml)
[![License](https://badgen.net/github/license/pgEdge/prest-client)](./LICENSE)
[![Package tree-shaking](https://badgen.net/bundlephobia/tree-shaking/prest-client)](https://bundlephobia.com/package/prest-client)
[![Package minified & gzipped size](https://badgen.net/bundlephobia/minzip/prest-client)](https://bundlephobia.com/package/prest-client)
[![Package dependency count](https://badgen.net/bundlephobia/dependency-count/reactprest-client)](https://bundlephobia.com/package/prest-client)

## Installation

This library is published in the NPM registry and can be installed using any compatible package manager.

```sh
npm install prest-client --save

# For Yarn, use the command below.
yarn add prest-client
```

### Installation from CDN

This module has an UMD bundle available through JSDelivr and Unpkg CDNs.

```html
<!-- For UNPKG use the code below. -->
<script src="https://unpkg.com/prest-client"></script>

<!-- For JSDelivr use the code below. -->
<script src="https://cdn.jsdelivr.net/npm/prest-client"></script>

<script>
// UMD module is exposed through the "prestClient" global variable.
console.log(prestClient);
</script>
```

## Documentation

[Documentation generated from source files by Typedoc](./docs/README.md).

## License

Released under [MIT License](./LICENSE).
33 changes: 33 additions & 0 deletions dist/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*!
* prest-client v0.0.0
* (c) pgEdge
* Released under the MIT License.
*/

'use strict';

/**
* Check if a string is a valid username based on the defined criteria.
* @param value - The string to be validated.
* @returns Whether the string is a valid username.
*/
var isValidUsername = function (value) {
var usernameRegex = /^[a-zA-Z][\w_]+$/;
return usernameRegex.test(value) && value.length >= 3 && value.length <= 15;
};
/**
* Parse a string into a safe integer, throwing an error if the parsing fails.
* @param value - The string to be parsed.
* @returns The parsed integer value.
*/
var parseSafeInt = function (value) {
var parsedValue = parseInt(value, 10);
if (Number.isNaN(parsedValue)) {
throw new Error("Invalid integer: ".concat(value));
}
return parsedValue;
};

exports.isValidUsername = isValidUsername;
exports.parseSafeInt = parseSafeInt;
//# sourceMappingURL=index.cjs.map
1 change: 1 addition & 0 deletions dist/index.cjs.map

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

30 changes: 30 additions & 0 deletions dist/index.esm.js

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

1 change: 1 addition & 0 deletions dist/index.esm.js.map

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

33 changes: 33 additions & 0 deletions dist/index.js

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

1 change: 1 addition & 0 deletions dist/index.js.map

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

30 changes: 30 additions & 0 deletions dist/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*!
* prest-client v0.0.0
* (c) pgEdge
* Released under the MIT License.
*/

/**
* Check if a string is a valid username based on the defined criteria.
* @param value - The string to be validated.
* @returns Whether the string is a valid username.
*/
var isValidUsername = function (value) {
var usernameRegex = /^[a-zA-Z][\w_]+$/;
return usernameRegex.test(value) && value.length >= 3 && value.length <= 15;
};
/**
* Parse a string into a safe integer, throwing an error if the parsing fails.
* @param value - The string to be parsed.
* @returns The parsed integer value.
*/
var parseSafeInt = function (value) {
var parsedValue = parseInt(value, 10);
if (Number.isNaN(parsedValue)) {
throw new Error("Invalid integer: ".concat(value));
}
return parsedValue;
};

export { isValidUsername, parseSafeInt };
//# sourceMappingURL=index.mjs.map
1 change: 1 addition & 0 deletions dist/index.mjs.map

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

39 changes: 39 additions & 0 deletions dist/index.umd.js

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

Loading

0 comments on commit d88c2e9

Please sign in to comment.