@p8ec/shared 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Xorde Labs
4
+ Copyright (c) 2022 Xander Tovski
5
+ Copyright (c) 2023 Alexander Mochkin
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # P(8) Global Shared Library for Node.js and TypeScript/JavaScript.
2
+
3
+ This repository contains the shared library for all P(8) products.
4
+
5
+ ## Javascript Shared Configuration
6
+
7
+ This repository contains the shared configuration for all P(8) products.
8
+
9
+ ### Usage
10
+
11
+ #### **`.eslintrc.js`**
12
+
13
+ ```javascript
14
+ // .eslintrc.js
15
+ module.exports = require('@p8ec/shared').eslintConfigRecommended;
16
+ ```
17
+
18
+ #### **`.prettierrc.js`**
19
+
20
+ ```javascript
21
+ // .prettierrc.js
22
+ module.exports = require('@p8ec/shared').prettierConfigRecommended;
23
+ ```
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /**
3
+ * 2023 Copyright P8 Enterprise Components, Inc.
4
+ * All Rights Reserved.
5
+ * Private and Confidential.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ /**
9
+ * Recommended ESLint configuration for TypeScript projects.
10
+ */
11
+ const eslintConfigRecommended = {
12
+ parser: '@typescript-eslint/parser',
13
+ parserOptions: {
14
+ project: 'tsconfig.json',
15
+ sourceType: 'module',
16
+ },
17
+ ignorePatterns: ['.eslintrc.js', '.prettierrc.js', 'dist/', 'node_modules/'],
18
+ plugins: ['@typescript-eslint/eslint-plugin', 'header'],
19
+ extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
20
+ root: true,
21
+ env: {
22
+ node: true,
23
+ jest: true,
24
+ },
25
+ rules: {
26
+ '@typescript-eslint/interface-name-prefix': 'off',
27
+ '@typescript-eslint/explicit-function-return-type': 'off',
28
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
29
+ '@typescript-eslint/no-explicit-any': 'off',
30
+ '@typescript-eslint/no-unused-vars': [
31
+ 'error',
32
+ {
33
+ varsIgnorePattern: '^_',
34
+ },
35
+ ],
36
+ 'header/header': [
37
+ 2,
38
+ 'block',
39
+ [
40
+ '*',
41
+ ' * 2023 Copyright P8 Enterprise Components, Inc.',
42
+ ' * All Rights Reserved.',
43
+ ' * Private and Confidential.',
44
+ ' ',
45
+ ],
46
+ 2,
47
+ ],
48
+ },
49
+ };
50
+ exports.default = eslintConfigRecommended;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * 2023 Copyright P8 Enterprise Components, Inc.
4
+ * All Rights Reserved.
5
+ * Private and Confidential.
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.prettierConfigRecommended = exports.eslintConfigRecommended = void 0;
12
+ const eslintConfigRecommended_1 = __importDefault(require("./eslintConfigRecommended"));
13
+ exports.eslintConfigRecommended = eslintConfigRecommended_1.default;
14
+ const prettierConfigRecommended_1 = __importDefault(require("./prettierConfigRecommended"));
15
+ exports.prettierConfigRecommended = prettierConfigRecommended_1.default;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * 2023 Copyright P8 Enterprise Components, Inc.
4
+ * All Rights Reserved.
5
+ * Private and Confidential.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.prettierConfigRecommended = void 0;
9
+ /**
10
+ * Recommended Prettier configuration.
11
+ */
12
+ exports.prettierConfigRecommended = {
13
+ singleQuote: true,
14
+ trailingComma: 'all',
15
+ tabWidth: 2,
16
+ useTabs: true,
17
+ printWidth: 120,
18
+ bracketSpacing: true,
19
+ };
20
+ exports.default = exports.prettierConfigRecommended;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * 2023 Copyright P8 Enterprise Components, Inc.
3
+ * All Rights Reserved.
4
+ * Private and Confidential.
5
+ */
6
+ /**
7
+ * Recommended ESLint configuration for TypeScript projects.
8
+ */
9
+ const eslintConfigRecommended = {
10
+ parser: '@typescript-eslint/parser',
11
+ parserOptions: {
12
+ project: 'tsconfig.json',
13
+ sourceType: 'module',
14
+ },
15
+ ignorePatterns: ['.eslintrc.js', '.prettierrc.js', 'dist/', 'node_modules/'],
16
+ plugins: ['@typescript-eslint/eslint-plugin', 'header'],
17
+ extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
18
+ root: true,
19
+ env: {
20
+ node: true,
21
+ jest: true,
22
+ },
23
+ rules: {
24
+ '@typescript-eslint/interface-name-prefix': 'off',
25
+ '@typescript-eslint/explicit-function-return-type': 'off',
26
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
27
+ '@typescript-eslint/no-explicit-any': 'off',
28
+ '@typescript-eslint/no-unused-vars': [
29
+ 'error',
30
+ {
31
+ varsIgnorePattern: '^_',
32
+ },
33
+ ],
34
+ 'header/header': [
35
+ 2,
36
+ 'block',
37
+ [
38
+ '*',
39
+ ' * 2023 Copyright P8 Enterprise Components, Inc.',
40
+ ' * All Rights Reserved.',
41
+ ' * Private and Confidential.',
42
+ ' ',
43
+ ],
44
+ 2,
45
+ ],
46
+ },
47
+ };
48
+ export default eslintConfigRecommended;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 2023 Copyright P8 Enterprise Components, Inc.
3
+ * All Rights Reserved.
4
+ * Private and Confidential.
5
+ */
6
+ import eslintConfigRecommended from './eslintConfigRecommended';
7
+ import prettierConfigRecommended from './prettierConfigRecommended';
8
+ export { eslintConfigRecommended, prettierConfigRecommended };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 2023 Copyright P8 Enterprise Components, Inc.
3
+ * All Rights Reserved.
4
+ * Private and Confidential.
5
+ */
6
+ /**
7
+ * Recommended Prettier configuration.
8
+ */
9
+ export const prettierConfigRecommended = {
10
+ singleQuote: true,
11
+ trailingComma: 'all',
12
+ tabWidth: 2,
13
+ useTabs: true,
14
+ printWidth: 120,
15
+ bracketSpacing: true,
16
+ };
17
+ export default prettierConfigRecommended;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 2023 Copyright P8 Enterprise Components, Inc.
3
+ * All Rights Reserved.
4
+ * Private and Confidential.
5
+ */
6
+ import { ClassicConfig } from '@typescript-eslint/utils/ts-eslint';
7
+ /**
8
+ * Recommended ESLint configuration for TypeScript projects.
9
+ */
10
+ declare const eslintConfigRecommended: ClassicConfig.Config;
11
+ export default eslintConfigRecommended;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 2023 Copyright P8 Enterprise Components, Inc.
3
+ * All Rights Reserved.
4
+ * Private and Confidential.
5
+ */
6
+ import eslintConfigRecommended from './eslintConfigRecommended';
7
+ import prettierConfigRecommended from './prettierConfigRecommended';
8
+ export { eslintConfigRecommended, prettierConfigRecommended };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 2023 Copyright P8 Enterprise Components, Inc.
3
+ * All Rights Reserved.
4
+ * Private and Confidential.
5
+ */
6
+ import { Options } from 'prettier';
7
+ /**
8
+ * Recommended Prettier configuration.
9
+ */
10
+ export declare const prettierConfigRecommended: Options;
11
+ export default prettierConfigRecommended;
package/package.json ADDED
@@ -0,0 +1,120 @@
1
+ {
2
+ "name": "@p8ec/shared",
3
+ "version": "1.0.0",
4
+ "description": "P(8) Global Shared Library",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/p8ec/p8-shared.git"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/p8ec/p8-shared/issues"
11
+ },
12
+ "homepage": "https://github.com/p8ec/p8-shared",
13
+ "scripts": {
14
+ "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:types",
15
+ "build:esm": "tsc -p configs/tsconfig.esm.json",
16
+ "build:cjs": "tsc -p configs/tsconfig.cjs.json",
17
+ "build:types": "tsc -p configs/tsconfig.types.json",
18
+ "clean": "rimraf dist docs coverage",
19
+ "reset": "npm run clean && rimraf node_modules && npm install",
20
+ "prepare": "husky install",
21
+ "test": "jest --no-cache --runInBand",
22
+ "test:cov": "jest --coverage --no-cache --runInBand",
23
+ "lint": "eslint --cache \"src/**/*.{js,jsx,ts,tsx}\"",
24
+ "lint:fix": "eslint --cache --fix \"src/**/*.{js,jsx,ts,tsx}\"",
25
+ "docs:build": "typedoc --name 'P(8) Global Shared Library' --includeVersion --readme README_GENERATED.md --out docs src",
26
+ "docs:patch": "mv docs/functions docs/funcs && sed -i'.bak' 's/href=\\\"functions/href=\\\"funcs/g' docs/*.html",
27
+ "docs:clean": "rimraf docs"
28
+ },
29
+ "main": "dist/cjs/index.js",
30
+ "module": "dist/esm/index.js",
31
+ "types": "dist/types/index.d.ts",
32
+ "devDependencies": {
33
+ "@commitlint/cli": "^19.2.1",
34
+ "@commitlint/config-conventional": "^19.1.0",
35
+ "@swc/cli": "^0.3.12",
36
+ "@swc/core": "^1.4.11",
37
+ "@swc/jest": "^0.2.36",
38
+ "@types/jest": "^29.5.11",
39
+ "@typescript-eslint/eslint-plugin": "^7.5.0",
40
+ "@typescript-eslint/parser": "^7.5.0",
41
+ "eslint": "^8.56.0",
42
+ "eslint-config-prettier": "^9.1.0",
43
+ "eslint-plugin-header": "^3.1.1",
44
+ "eslint-plugin-prettier": "^5.1.0",
45
+ "husky": "^9.0.11",
46
+ "jest": "^29.7.0",
47
+ "lint-staged": "^15.2.0",
48
+ "prettier": "3.2.5",
49
+ "rimraf": "^5.0.5",
50
+ "ts-node": "^10.9.2",
51
+ "typedoc": "^0.25.4",
52
+ "typescript": "^5.3.3"
53
+ },
54
+ "eslintConfig": {
55
+ "env": {
56
+ "node": true,
57
+ "jest": true
58
+ },
59
+ "parser": "@typescript-eslint/parser",
60
+ "plugins": [
61
+ "@typescript-eslint",
62
+ "header"
63
+ ],
64
+ "extends": [
65
+ "eslint:recommended",
66
+ "plugin:@typescript-eslint/recommended",
67
+ "plugin:prettier/recommended"
68
+ ],
69
+ "ignorePatterns": [
70
+ "node_modules",
71
+ "build",
72
+ "dist",
73
+ "docs"
74
+ ],
75
+ "rules": {
76
+ "@typescript-eslint/interface-name-prefix": "off",
77
+ "@typescript-eslint/explicit-function-return-type": "off",
78
+ "@typescript-eslint/explicit-module-boundary-types": "off",
79
+ "@typescript-eslint/no-explicit-any": "off",
80
+ "@typescript-eslint/no-unused-vars": [
81
+ "error",
82
+ {
83
+ "varsIgnorePattern": "^_"
84
+ }
85
+ ],
86
+ "header/header": [
87
+ 2,
88
+ "block",
89
+ [
90
+ "*",
91
+ " * 2023 Copyright P8 Enterprise Components, Inc.",
92
+ " * All Rights Reserved.",
93
+ " * Private and Confidential.",
94
+ " "
95
+ ],
96
+ 2
97
+ ]
98
+ }
99
+ },
100
+ "lint-staged": {
101
+ "*.{js,jsx,ts,tsx}": "npm run lint:fix"
102
+ },
103
+ "prettier": {
104
+ "singleQuote": true,
105
+ "trailingComma": "all",
106
+ "tabWidth": 2,
107
+ "useTabs": true,
108
+ "printWidth": 120,
109
+ "bracketSpacing": true
110
+ },
111
+ "commitlint": {
112
+ "extends": [
113
+ "@commitlint/config-conventional"
114
+ ]
115
+ },
116
+ "license": "MIT",
117
+ "lint-staged1": {
118
+ "*.{js,jsx,ts,tsx}": "npm run lint:fix"
119
+ }
120
+ }