Skip to content

Commit

Permalink
1.0.0 -- Init package
Browse files Browse the repository at this point in the history
  • Loading branch information
Elschnagoo committed Jul 30, 2024
0 parents commit b33a059
Show file tree
Hide file tree
Showing 19 changed files with 760 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/*.js
**/*.d.ts
tests
61 changes: 61 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"extends": [
"airbnb",
"airbnb-typescript",
"airbnb/hooks",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:prettier/recommended"
],
"plugins": [
"react",
"@typescript-eslint"
],
"env": {
"browser": true,
"es6": true,
"jest": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"no-plusplus": "warn",
"no-restricted-syntax": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"no-underscore-dangle": "warn",
"no-await-in-loop": "warn",
"class-methods-use-this": "warn",
"linebreak-style": "off",
"no-restricted-properties": "warn",
"import/extensions": [
"warn",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never",
"d.ts": "never"
}
],
"react/no-unused-state": "warn",
"prettier/prettier": [
"error",
{
"endOfLine": "auto",
"singleQuote": true
}
]
}
}
32 changes: 32 additions & 0 deletions .github/workflows/typedoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ci.yml file for GitHub Actions
name: CI

on:
push:
branches:
- main

jobs:
build_and_lint:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2

- name: Install dependencies
run: npm install

- name: Create the docs directory locally in CI
run: npm run makeDocs

- name: Add testreport to docs folder
run: npm run doc-converage

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages
folder: docs
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
dist
node_modules
.idea
package-lock.json
out
export
*.js
*.d.ts
dev.patch
.scannerwork
certs
update.key
docs
.env
coverage
data
junit.xml
/sonar-project.properties
openapi.yaml
/openapi.yml
!jest.config.js
*.tgz
*.iml
17 changes: 17 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
include:
- project: 'grandlinex/templates'
file: '/stages.yml'
- project: 'grandlinex/templates'
file: '/prod/core-bundle.yml'
- project: 'grandlinex/templates'
file: '/build/core-bundle.yml'
- project: 'grandlinex/templates'
file: '/sonar/core-sonar.yml'
- project: 'grandlinex/templates'
file: '/deploy/npm-deploy.yml'
- project: 'grandlinex/templates'
file: '/update/update-glx.yml'
- project: 'grandlinex/templates'
file: '/deploy/npm-gitlab-deploy.yml'
- project: 'grandlinex/templates'
file: '/test/sast.yml'
4 changes: 4 additions & 0 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"upgrade": true,
"reject": []
}
27 changes: 27 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.gitlab-ci.yml
.eslintrc
node_modules
docs
.idea
.env
docker-compose.yml
jest.config.js
package-lock.json
data
src
tests
scripts
glconf.json
site
.eslintignore
.env.example
tsconfig.json
.scannerwork
sonar-project.properties
coverage
*.tgz
*.iml
.ncurc.json
.npmrc
junit.xml
.github
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2024, GrandLineX
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# GrandLineX Cron Bundle

> Cron support for GrandLineX
## Description

<img alt="img" height="24" src="https://img.shields.io/static/v1?label=&amp;message=CORE&amp;color=black&amp;logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAAAAACPAi4CAAABJWlDQ1BJQ0MgcHJvZmlsZQAAKJGdkL9KxEAQxr/EQ0XORsVCLLawPbAxlY1/MFgcnLkIRqvcbg4PszFk9zh8A9/Ee5grBME38AUUrP02Wli4jQvD/Bhmvm9mgVCUUpvOPqAr28TJUXaVXYuVN3TRwQYOEObS1P3hWQrv+3xF4PJLz2n5+/58y6owknnBqGTdWCA4JEczWztmYOsuTU7Ij2ShdKXIc/Ke0sqxm010OZU/mm6bbl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KXTW9DGJvGmJg8zZ39P6gB0B6qOviy0uwiBHCLkgeMl6hB/Daf2jEDQuD4taO5+qri25zng9p1W1UuABTBsaR+INPne33D3pCIjQQAt13CnSEfxmyOtpv3hFQqrh0/YDTS26YoKoleOJrji8VurUQlCfBK9HRKdomnj/NSyfA+0PyhJFFJovCKkrX87Tfgru4kPFmeHTNUZwi/lKGvt0GzOXmkNdk0mdbbQrL0dWNhOQk9vyV3WYwaAgx3Z9ia1kdemNJuHm5CQk7I9avCo+0c92UIAPfRuoesmWVqAGgsof/YTLaZJAD09V/mDjBu30oCADoZ7ey4KAIg60q4OV57NpGF6vzRgfLnJh4Au1rfNduQwUVvht67662VAZj0ZKkAKJI3Ro0zrCqEz3238P778wDmU6aaNbuVANikxH0jTqqJ1CoJILHypU0oDc9TAAAbHj5rk+qyVfLVeezw1346JjWcmF6MvI8dPdLpmVP9zrPFVuei1NldVV9gTIhgCKGQxjuqfhS0ZjWAcdnqDIDTJz0ZqRLttzoHXQDhNQAm7IsABE5pAUAA8D8D/AUp6ovNs1/7jgAAAABJRU5ErkJggg==" />

GrandLineX is an out-of-the-box server framework.


[![GitHub](https://badge.fury.io/gh/grandlinex%2Fbundle-cron.svg)](https://github.com/GrandlineX/bundle-cron)
[![NPM](https://img.shields.io/static/v1?label=NPM&message=Package&color=red&logo=NPM)](https://www.npmjs.com/package/@grandlinex/bundle-cron)
![TS](https://img.shields.io/static/v1?label=Language&message=TypeScript&color=blue&logo=TypeScript)


### Status
![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GrandlineX_bundle-cron&metric=alert_status)
![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=GrandlineX_bundle-cron&metric=security_rating)
![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=GrandlineX_bundle-cron&metric=sqale_rating)
![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=GrandlineX_bundle-cron&metric=reliability_rating)
![Coverage](https://sonarcloud.io/api/project_badges/measure?project=GrandlineX_bundle-cron&metric=coverage)

### Issues
![Bugs](https://sonarcloud.io/api/project_badges/measure?project=GrandlineX_bundle-cron&metric=bugs)
![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=GrandlineX_bundle-cron&metric=vulnerabilities)
![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=GrandlineX_bundle-cron&metric=code_smells)



## Install

### Example

```typescript

class TestKernel extends CoreKernel<any> {
constructor(appName:string, appCode:string) {
super( { appName, appCode});

// ...

/**
* Add the module to the kernel
*/

this.addModule(new CronModule(this));

/**
* Define kernel event
*/

this.on("test-trigger",()=>{
console.log("test-trigger");
})

/**
* Add cron timer
*/
const mod = kernel.getChildModule('cron') as CronModule;

const client = mod.getClient() as CronClient;
client.registerCron({
trigger: 'test-trigger',
name: 'test',
cron: '0 * * * *',
});
}
}

```



## Documentation
- [Documentation](https://grandlinex.github.io/bundle-cron/)
- [GrandLineX Docs](https://grandlinex.github.io/docs/)
- [GrandLineX Project](https://grandlinex.github.io/)
22 changes: 22 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export default {
testRegex: "(/tests/*.test.ts|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
coverageReporters: ["html", "text", "text-summary", "cobertura", "lcov"],
collectCoverageFrom: ["**/*.ts", "!**/node_modules/**","!tests/**"],
testPathIgnorePatterns: ["/dist/", "/node_modules/"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
extensionsToTreatAsEsm: [".ts"],
setupFilesAfterEnv: ["./node_modules/@grandlinex/core/jest.pre.config.js"],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
transform: {
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
"^.+\\.tsx?$": [
"ts-jest",
{
"useESM": true
}
]
}
};
79 changes: 79 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "@grandlinex/bundle-cron",
"version": "1.0.0",
"description": "",
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
},
"types": "dist/cjs/index.d.ts",
"main": "dist/cjs/index.js",
"module": "dist/mjs/index.js",
"scripts": {
"buildprep": "npm run build-mjs && npm run build-cjs && npm run build-fix",
"build-mjs": "tsc",
"build-cjs": "tsc -p tsconfig-cjs.json",
"build-fix": "node ./node_modules/@grandlinex/core/fix.js",
"lint": "eslint src",
"test": "jest --runInBand ",
"run": "ts-node tests/run.ts",
"pack": "eslint && npm run buildprep && npm pack",
"test-converage": "jest --runInBand --ci --collectCoverage --coverageDirectory=\"./coverage\" --reporters=default --reporters=jest-junit",
"doc-converage": "jest --runInBand --ci --collectCoverage --coverageDirectory=\"./docs/coverage\" --reporters=default --reporters=jest-junit",
"makeDocs": "typedoc"
},
"keywords": [
"typescript",
"framework",
"bundle",
"grandlinex",
"orm",
"cron"
],
"author": {
"name": "Elschnagoo"
},
"license": "BSD-3-Clause",
"dependencies": {
"@grandlinex/core": "1.0.0",
"node-cron": "3.0.3"
},
"devDependencies": {
"@types/jest": "29.5.12",
"@types/node-cron": "3.0.11",
"@types/node": "22.0.0",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"eslint": "8.57.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "18.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jest": "28.6.0",
"eslint-plugin-jsx-a11y": "6.9.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"jest": "29.7.0",
"jest-junit": "16.0.0",
"prettier": "3.3.3",
"ts-jest": "29.1.5",
"ts-loader": "9.5.1",
"ts-node": "10.9.2",
"typedoc": "0.26.5",
"typescript": "5.5.4"
},
"repository": {
"type": "git",
"url": "https://github.com/GrandlineX/bundle-multilang"
}
}
Loading

0 comments on commit b33a059

Please sign in to comment.