diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ded37a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. + +# Compiled output +/dist +/tmp +/out-tsc +/bazel-out + +# Node +/node_modules +npm-debug.log +yarn-error.log + +# IDEs and editors +.idea/ +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# Visual Studio Code +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.history/* + +# Miscellaneous +/.angular/cache +.sass-cache/ +/connect.lock +/coverage +/libpeerconnection.log +testem.log +/typings + +# System files +.DS_Store +Thumbs.db +*.ignore +temp \ No newline at end of file diff --git a/README.md b/README.md index db2113b..75da9cd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,97 @@ -# core -Main package. + + +## typescript-package/core + +Core package. + + +[![npm version][typescript-package-npm-badge-svg]][typescript-package-npm-badge] +[![GitHub issues][typescript-package-badge-issues]][typescript-package-issues] +[![GitHub license][typescript-package-badge-license]][typescript-package-license] + +
+ +## Table of contents + +* [Installation](#installation) +* [Api](#api) +* [Git](#git) + * [Commit](#commit) + * [Versioning](#versioning) +* [License](#license) + +## Installation + +```bash +npm install @typescript-package/core +``` + +## Api + +```typescript +import { + resultCallback, + typeOf +} from '@typescript-package/core'; +``` + +## GIT + +### Commit + +* [AngularJS Git Commit Message Conventions][git-commit-angular] +* [Karma Git Commit Msg][git-commit-karma] +* [Conventional Commits][git-commit-conventional] + +### Versioning + +[Semantic Versioning 2.0.0][git-semver] + +**Given a version number MAJOR.MINOR.PATCH, increment the:** + +* MAJOR version when you make incompatible API changes, +* MINOR version when you add functionality in a backwards-compatible manner, and +* PATCH version when you make backwards-compatible bug fixes. + +Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format. + +**FAQ** +How should I deal with revisions in the 0.y.z initial development phase? + +> The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release. + +How do I know when to release 1.0.0? + +> If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0. + +## License + +MIT © angular-package ([license][typescript-package-license]) + + + + [typescript-package-badge-issues]: https://img.shields.io/github/issues/typescript-package/core + [typescript-package-badge-forks]: https://img.shields.io/github/forks/typescript-package/core + [typescript-package-badge-stars]: https://img.shields.io/github/stars/typescript-package/core + [typescript-package-badge-license]: https://img.shields.io/github/license/typescript-package/core + + [typescript-package-issues]: https://github.com/typescript-package/core/issues + [typescript-package-forks]: https://github.com/typescript-package/core/network + [typescript-package-license]: https://github.com/typescript-package/core/blob/master/LICENSE + [typescript-package-stars]: https://github.com/typescript-package/core/stargazers + + + + + [typescript-package-npm-badge-svg]: https://badge.fury.io/js/%40typescript-package%2Fcore.svg + [typescript-package-npm-badge]: https://badge.fury.io/js/%40typescript-package%2Fcore + + +[git-semver]: http://semver.org/ + + +[git-commit-angular]: https://gist.github.com/stephenparish/9941e89d80e2bc58a153 +[git-commit-karma]: http://karma-runner.github.io/0.10/dev/git-commit-msg.html +[git-commit-conventional]: https://www.conventionalcommits.org/en/v1.0.0/ diff --git a/ng-package.json b/ng-package.json new file mode 100644 index 0000000..a29fbbc --- /dev/null +++ b/ng-package.json @@ -0,0 +1,8 @@ +{ + "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/core", + "lib": { + "entryFile": "src/public-api.ts" + }, + "keepLifecycleScripts": true +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..a6a3453 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,19 @@ +{ + "name": "@testing-package/core", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@testing-package/core", + "version": "1.0.0", + "funding": [ + { + "type": "individual", + "url": "https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29" + } + ], + "license": "MIT" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..0de5a9b --- /dev/null +++ b/package.json @@ -0,0 +1,35 @@ +{ + "name": "@testing-package/core", + "version": "1.0.0", + "author": "wwwdev.io ", + "description": "Core package.", + "license": "MIT", + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org" + }, + "peerDependencies": {}, + "scripts": { + "prepublishOnly": "npm run pkg && npm run clean", + "pkg": "npm pkg delete dependencies", + "clean": "npm pkg delete scripts" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/typescript-package/core.git" + }, + "bugs": { + "url": "https://github.com/typescript-package/core/issues" + }, + "keywords": [ + "@typescript-package", + "@typescript-package/core" + ], + "funding": [ + { + "type": "individual", + "url": "https://checkout.revolut.com/pay/048b10a3-0e10-42c8-a917-e3e9cb4c8e29" + } + ], + "sideEffects": false +} diff --git a/src/lib/index.ts b/src/lib/index.ts new file mode 100644 index 0000000..f4b5f6d --- /dev/null +++ b/src/lib/index.ts @@ -0,0 +1,3 @@ +// Function. +export { resultCallback } from './result-callback.func'; +export { typeOf } from './type-of.func'; diff --git a/src/lib/result-callback.func.ts b/src/lib/result-callback.func.ts new file mode 100644 index 0000000..af861c5 --- /dev/null +++ b/src/lib/result-callback.func.ts @@ -0,0 +1,6 @@ +/** + * @description Default function to handle `callback` of functions. + * @param {boolean} result - A value of `boolean` type of the result of the check. + * @returns {boolean} The returned value is a `boolean` of the result of the check. + */ +export const resultCallback = (result: boolean): boolean => result; diff --git a/src/lib/type-of.func.ts b/src/lib/type-of.func.ts new file mode 100644 index 0000000..cd49ce4 --- /dev/null +++ b/src/lib/type-of.func.ts @@ -0,0 +1,8 @@ +/** + * @description Gets the specific object class type of any value. + * @param {*} value Any value to check its object class type. + * @returns {string} The return value is a `string` of the object class name. + * @author https://javascript.plainenglish.io/the-best-way-to-type-check-in-vanilla-js-55197b4f45ec + */ +export const typeOf = (value: any): string => + Object.prototype.toString.call(value).slice(8, -1).toLowerCase(); diff --git a/src/public-api.ts b/src/public-api.ts new file mode 100644 index 0000000..a2cadfd --- /dev/null +++ b/src/public-api.ts @@ -0,0 +1,4 @@ +/* + * Public API Surface of core + */ +export * from './lib'; \ No newline at end of file diff --git a/ts-package-barcode-logo-512.png b/ts-package-barcode-logo-512.png new file mode 100644 index 0000000..9705d19 Binary files /dev/null and b/ts-package-barcode-logo-512.png differ diff --git a/tsconfig.lib.json b/tsconfig.lib.json new file mode 100644 index 0000000..2359bf6 --- /dev/null +++ b/tsconfig.lib.json @@ -0,0 +1,15 @@ +/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ +/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/lib", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [] + }, + "exclude": [ + "**/*.spec.ts" + ] +} diff --git a/tsconfig.lib.prod.json b/tsconfig.lib.prod.json new file mode 100644 index 0000000..9215caa --- /dev/null +++ b/tsconfig.lib.prod.json @@ -0,0 +1,11 @@ +/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ +/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/tsconfig.spec.json b/tsconfig.spec.json new file mode 100644 index 0000000..254686d --- /dev/null +++ b/tsconfig.spec.json @@ -0,0 +1,15 @@ +/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ +/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "types": [ + "jasmine" + ] + }, + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +}