fix(core): update
This commit is contained in:
parent
9935396f2d
commit
f221e9c0fa
19
.gitignore
vendored
19
.gitignore
vendored
@ -1,5 +1,22 @@
|
|||||||
.nogit/
|
.nogit/
|
||||||
node_modules/
|
|
||||||
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_web/
|
||||||
|
dist_serve/
|
||||||
|
dist_ts_web/
|
||||||
|
|
||||||
|
# custom
|
@ -1,4 +1,4 @@
|
|||||||
# gitzone standard
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
@ -78,19 +78,11 @@ release:
|
|||||||
# ====================
|
# ====================
|
||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
image: docker:stable
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
services:
|
|
||||||
- docker:stable-dind
|
|
||||||
script:
|
script:
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
- npmci command npm install -g tslint typescript
|
||||||
- docker run
|
- npmci npm install
|
||||||
--env SOURCE_CODE="$PWD"
|
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||||
--volume "$PWD":/code
|
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
|
||||||
artifacts:
|
|
||||||
paths: [codeclimate.json]
|
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- priv
|
- priv
|
||||||
@ -109,10 +101,10 @@ pages:
|
|||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-node:npmci
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g typedoc typescript
|
- npmci command npm install -g @gitzone/tsdoc
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
- npmci command tsdoc
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
724
package-lock.json
generated
724
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@ -12,19 +12,29 @@
|
|||||||
"build": "(tsbuild)"
|
"build": "(tsbuild)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.8",
|
"@gitzone/tsbuild": "^2.1.11",
|
||||||
"@gitzone/tsrun": "^1.2.5",
|
"@gitzone/tsrun": "^1.2.6",
|
||||||
"@gitzone/tstest": "^1.0.20",
|
"@gitzone/tstest": "^1.0.24",
|
||||||
"@pushrocks/tapbundle": "^3.0.9",
|
"@pushrocks/tapbundle": "^3.0.9",
|
||||||
"@types/node": "^11.13.2",
|
"@types/node": "^12.0.8",
|
||||||
"tslint": "^5.15.0",
|
"tslint": "^5.17.0",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartpromise": "^3.0.2",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
"@types/cron": "^1.7.0",
|
"@types/cron": "^1.7.1",
|
||||||
"@types/luxon": "^1.12.0",
|
"@types/luxon": "^1.15.1",
|
||||||
"cron": "^1.7.0",
|
"cron": "^1.7.1",
|
||||||
"luxon": "^1.12.1"
|
"luxon": "^1.16.0"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"ts/*",
|
||||||
|
"ts_web/*",
|
||||||
|
"dist/*",
|
||||||
|
"dist_web/*",
|
||||||
|
"assets/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
15
readme.md
15
readme.md
@ -22,9 +22,20 @@ Use TypeScript for best in class instellisense.
|
|||||||
|
|
||||||
Smarttime offers smart ways to deal with time.
|
Smarttime offers smart ways to deal with time.
|
||||||
|
|
||||||
### class ExtendedDate
|
### class CronManager
|
||||||
|
This class provides scheduling of functions with a cron syntax
|
||||||
|
|
||||||
This class offers static functions to create zone speicific JavaScript dates from European formated time strings.
|
```typescript
|
||||||
|
import { CronManager } from '@pushrocks/smarrtime';
|
||||||
|
const cronManagerInstance = new CronManager();
|
||||||
|
cronManagerInstance.addConrjob('* * * * * *', async () => {
|
||||||
|
console.log('hello'); // will log 'hello' to console once every second;
|
||||||
|
})
|
||||||
|
cronManagerInstance.start();
|
||||||
|
```
|
||||||
|
|
||||||
|
### class ExtendedDate
|
||||||
|
This class offers static functions to create zone specific JavaScript dates from European formated time strings.
|
||||||
|
|
||||||
```TypeScript
|
```TypeScript
|
||||||
import { ExtendedDate } from '@pushrocks/smarttime'
|
import { ExtendedDate } from '@pushrocks/smarttime'
|
||||||
|
@ -9,14 +9,14 @@ tap.test('should create a valid instance of cronmanager', async () => {
|
|||||||
expect(testCronManager).to.be.instanceOf(smarttime.CronManager);
|
expect(testCronManager).to.be.instanceOf(smarttime.CronManager);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should create a valid cronJon', async (tools) => {
|
tap.test('should create a valid cronJon', async tools => {
|
||||||
const done = tools.defer();
|
const done = tools.defer();
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
testCronManager.addCronjob('* * * * * *', () => {
|
testCronManager.addCronjob('* * * * * *', () => {
|
||||||
if(counter === 10) {
|
if (counter === 10) {
|
||||||
done.resolve();
|
done.resolve();
|
||||||
}
|
}
|
||||||
counter ++;
|
counter++;
|
||||||
console.log(`hey ${counter}`);
|
console.log(`hey ${counter}`);
|
||||||
});
|
});
|
||||||
testCronManager.start();
|
testCronManager.start();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as plugins from './smarttime.plugins';
|
import * as plugins from './smarttime.plugins';
|
||||||
|
|
||||||
export * from './smarttime.classes.cronmanager';
|
export * from './smarttime.classes.cronmanager';
|
||||||
export * from './smarttime.classes.date';
|
export * from './smarttime.classes.extendeddate';
|
||||||
export * from './smarttime.classes.hrtmeasurement';
|
export * from './smarttime.classes.hrtmeasurement';
|
||||||
export * from './smarttime.classes.timer';
|
export * from './smarttime.classes.timer';
|
||||||
export * from './smarttime.classes.timestamp';
|
export * from './smarttime.classes.timestamp';
|
||||||
|
@ -6,12 +6,12 @@ export class CronManager {
|
|||||||
public cronjobs: plugins.cron.CronJob[] = [];
|
public cronjobs: plugins.cron.CronJob[] = [];
|
||||||
|
|
||||||
public addCronjob(cronIdentifierArg: string, cronFunctionArg: plugins.cron.CronCommand) {
|
public addCronjob(cronIdentifierArg: string, cronFunctionArg: plugins.cron.CronCommand) {
|
||||||
const newCronJob = new plugins.cron.CronJob(cronIdentifierArg,cronFunctionArg);
|
const newCronJob = new plugins.cron.CronJob(cronIdentifierArg, cronFunctionArg);
|
||||||
if (this.status === 'started') {
|
if (this.status === 'started') {
|
||||||
newCronJob.start();
|
newCronJob.start();
|
||||||
}
|
}
|
||||||
this.cronjobs.push(newCronJob);
|
this.cronjobs.push(newCronJob);
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* starts the cronjob
|
* starts the cronjob
|
||||||
|
@ -4,8 +4,8 @@ import * as process from 'process';
|
|||||||
* easy high resolution time measurement
|
* easy high resolution time measurement
|
||||||
*/
|
*/
|
||||||
export class HrtMeasurement {
|
export class HrtMeasurement {
|
||||||
nanoSeconds: number = null;
|
public nanoSeconds: number = null;
|
||||||
milliSeconds: number = null;
|
public milliSeconds: number = null;
|
||||||
private _hrTimeStart = null;
|
private _hrTimeStart = null;
|
||||||
private _hrTimeStopDiff = null;
|
private _hrTimeStopDiff = null;
|
||||||
private _started: boolean = false;
|
private _started: boolean = false;
|
||||||
@ -13,7 +13,7 @@ export class HrtMeasurement {
|
|||||||
/**
|
/**
|
||||||
* start the measurement
|
* start the measurement
|
||||||
*/
|
*/
|
||||||
start() {
|
public start() {
|
||||||
this._started = true;
|
this._started = true;
|
||||||
this._hrTimeStart = process.hrtime();
|
this._hrTimeStart = process.hrtime();
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ export class HrtMeasurement {
|
|||||||
/**
|
/**
|
||||||
* stop the measurement
|
* stop the measurement
|
||||||
*/
|
*/
|
||||||
stop() {
|
public stop() {
|
||||||
if (this._started === false) {
|
if (this._started === false) {
|
||||||
console.log("Hasn't started yet");
|
console.log("Hasn't started yet");
|
||||||
return;
|
return;
|
||||||
@ -35,7 +35,7 @@ export class HrtMeasurement {
|
|||||||
/**
|
/**
|
||||||
* reset the measurement
|
* reset the measurement
|
||||||
*/
|
*/
|
||||||
reset() {
|
public reset() {
|
||||||
this.nanoSeconds = null;
|
this.nanoSeconds = null;
|
||||||
this.milliSeconds = null;
|
this.milliSeconds = null;
|
||||||
this._hrTimeStart = null;
|
this._hrTimeStart = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user