fix(core): update
This commit is contained in:
parent
9935396f2d
commit
f221e9c0fa
19
.gitignore
vendored
19
.gitignore
vendored
@ -1,5 +1,22 @@
|
||||
.nogit/
|
||||
node_modules/
|
||||
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
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
|
||||
|
||||
cache:
|
||||
@ -78,19 +78,11 @@ release:
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
image: docker:stable
|
||||
allow_failure: true
|
||||
services:
|
||||
- docker:stable-dind
|
||||
script:
|
||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||
- docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
--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]
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
@ -109,10 +101,10 @@ pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npm install -g typedoc typescript
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- docker
|
||||
- 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)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.8",
|
||||
"@gitzone/tsrun": "^1.2.5",
|
||||
"@gitzone/tstest": "^1.0.20",
|
||||
"@gitzone/tsbuild": "^2.1.11",
|
||||
"@gitzone/tsrun": "^1.2.6",
|
||||
"@gitzone/tstest": "^1.0.24",
|
||||
"@pushrocks/tapbundle": "^3.0.9",
|
||||
"@types/node": "^11.13.2",
|
||||
"tslint": "^5.15.0",
|
||||
"@types/node": "^12.0.8",
|
||||
"tslint": "^5.17.0",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@types/cron": "^1.7.0",
|
||||
"@types/luxon": "^1.12.0",
|
||||
"cron": "^1.7.0",
|
||||
"luxon": "^1.12.1"
|
||||
}
|
||||
"@types/cron": "^1.7.1",
|
||||
"@types/luxon": "^1.15.1",
|
||||
"cron": "^1.7.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.
|
||||
|
||||
### 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
|
||||
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);
|
||||
});
|
||||
|
||||
tap.test('should create a valid cronJon', async (tools) => {
|
||||
tap.test('should create a valid cronJon', async tools => {
|
||||
const done = tools.defer();
|
||||
let counter = 0;
|
||||
testCronManager.addCronjob('* * * * * *', () => {
|
||||
if(counter === 10) {
|
||||
if (counter === 10) {
|
||||
done.resolve();
|
||||
}
|
||||
counter ++;
|
||||
counter++;
|
||||
console.log(`hey ${counter}`);
|
||||
});
|
||||
testCronManager.start();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as plugins from './smarttime.plugins';
|
||||
|
||||
export * from './smarttime.classes.cronmanager';
|
||||
export * from './smarttime.classes.date';
|
||||
export * from './smarttime.classes.extendeddate';
|
||||
export * from './smarttime.classes.hrtmeasurement';
|
||||
export * from './smarttime.classes.timer';
|
||||
export * from './smarttime.classes.timestamp';
|
||||
|
@ -6,12 +6,12 @@ export class CronManager {
|
||||
public cronjobs: plugins.cron.CronJob[] = [];
|
||||
|
||||
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') {
|
||||
newCronJob.start();
|
||||
}
|
||||
this.cronjobs.push(newCronJob);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* starts the cronjob
|
||||
|
@ -4,8 +4,8 @@ import * as process from 'process';
|
||||
* easy high resolution time measurement
|
||||
*/
|
||||
export class HrtMeasurement {
|
||||
nanoSeconds: number = null;
|
||||
milliSeconds: number = null;
|
||||
public nanoSeconds: number = null;
|
||||
public milliSeconds: number = null;
|
||||
private _hrTimeStart = null;
|
||||
private _hrTimeStopDiff = null;
|
||||
private _started: boolean = false;
|
||||
@ -13,7 +13,7 @@ export class HrtMeasurement {
|
||||
/**
|
||||
* start the measurement
|
||||
*/
|
||||
start() {
|
||||
public start() {
|
||||
this._started = true;
|
||||
this._hrTimeStart = process.hrtime();
|
||||
}
|
||||
@ -21,7 +21,7 @@ export class HrtMeasurement {
|
||||
/**
|
||||
* stop the measurement
|
||||
*/
|
||||
stop() {
|
||||
public stop() {
|
||||
if (this._started === false) {
|
||||
console.log("Hasn't started yet");
|
||||
return;
|
||||
@ -35,7 +35,7 @@ export class HrtMeasurement {
|
||||
/**
|
||||
* reset the measurement
|
||||
*/
|
||||
reset() {
|
||||
public reset() {
|
||||
this.nanoSeconds = null;
|
||||
this.milliSeconds = null;
|
||||
this._hrTimeStart = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user