fix(core): update
This commit is contained in:
parent
d3dd03534a
commit
b2a5cda468
@ -12,40 +12,36 @@ stages:
|
|||||||
- release
|
- release
|
||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- pnpm install -g pnpm
|
||||||
|
- pnpm install -g @shipzone/npmci
|
||||||
|
- npmci npm prepare
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# security stage
|
||||||
|
# ====================
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
# ====================
|
# ====================
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
auditProductionDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
- npmci command npm install --production --ignore-scripts
|
- npmci command pnpm audit --audit-level=high --prod
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
tags:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
auditDevDependencies:
|
auditDevDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
- npmci command npm audit --audit-level=high --only=dev
|
- npmci command pnpm audit --audit-level=high --dev
|
||||||
tags:
|
tags:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
@ -56,7 +52,6 @@ auditDevDependencies:
|
|||||||
testStable:
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -67,7 +62,6 @@ testStable:
|
|||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command npm run build
|
- npmci command npm run build
|
||||||
@ -96,10 +90,9 @@ codequality:
|
|||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
@ -119,11 +112,9 @@ trigger:
|
|||||||
pages:
|
pages:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci node install lts
|
- npmci node install stable
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command tsdoc
|
- npmci command npm run buildDocs
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "pushrocks",
|
||||||
"gitrepo": "smarttime",
|
"gitrepo": "smarttime",
|
||||||
"shortDescription": "handle time in smart ways",
|
"description": "handle time in smart ways",
|
||||||
"npmPackagename": "@pushrocks/smarttime",
|
"npmPackagename": "@pushrocks/smarttime",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
26916
package-lock.json
generated
26916
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@ -9,26 +9,25 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest ./test)",
|
"test": "(tstest ./test)",
|
||||||
"build": "(tsbuild --web && tsbundle npm)"
|
"build": "(tsbuild --web && tsbundle npm)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.29",
|
"@gitzone/tsbuild": "^2.1.29",
|
||||||
"@gitzone/tsbundle": "^1.0.89",
|
"@gitzone/tsbundle": "^2.0.7",
|
||||||
"@gitzone/tsrun": "^1.2.18",
|
"@gitzone/tsrun": "^1.2.18",
|
||||||
"@gitzone/tstest": "^1.0.60",
|
"@gitzone/tstest": "^1.0.60",
|
||||||
"@pushrocks/tapbundle": "^4.0.3",
|
"@pushrocks/tapbundle": "^5.0.4",
|
||||||
"@types/node": "^17.0.14",
|
"@types/node": "^18.11.9"
|
||||||
"tslint": "^6.1.3",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^5.0.4",
|
"@pushrocks/lik": "^6.0.0",
|
||||||
"@pushrocks/smartdelay": "^2.0.13",
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartpromise": "^3.1.6",
|
"@pushrocks/smartpromise": "^3.1.6",
|
||||||
"croner": "^4.0.86",
|
"croner": "^5.3.4",
|
||||||
"dayjs": "^1.10.7",
|
"dayjs": "^1.10.7",
|
||||||
"is-nan": "^1.3.2",
|
"is-nan": "^1.3.2",
|
||||||
"pretty-ms": "^7.0.1"
|
"pretty-ms": "^8.0.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
@ -44,5 +43,6 @@
|
|||||||
],
|
],
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
]
|
],
|
||||||
}
|
"type": "module"
|
||||||
|
}
|
4344
pnpm-lock.yaml
generated
Normal file
4344
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
// tslint:disable-next-line:no-implicit-dependencies
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import * as smarttime from '../ts/index';
|
import * as smarttime from '../ts/index.js';
|
||||||
|
|
||||||
// Test TimeStamp class
|
// Test TimeStamp class
|
||||||
let testTimeStamp: smarttime.TimeStamp;
|
let testTimeStamp: smarttime.TimeStamp;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { tap, expect } from '@pushrocks/tapbundle';
|
import { tap, expect } from '@pushrocks/tapbundle';
|
||||||
|
|
||||||
import * as smarttime from '../ts/index';
|
import * as smarttime from '../ts/index.js';
|
||||||
|
|
||||||
let testCronManager: smarttime.CronManager;
|
let testCronManager: smarttime.CronManager;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
|
|
||||||
import * as smarttime from '../ts/index';
|
import * as smarttime from '../ts/index.js';
|
||||||
|
|
||||||
tap.test('should create a valid JavaScript Date', async () => {
|
tap.test('should create a valid JavaScript Date', async () => {
|
||||||
const extendedDate = new smarttime.ExtendedDate(Date.now());
|
const extendedDate = new smarttime.ExtendedDate(Date.now());
|
||||||
@ -29,6 +29,6 @@ tap.test('should create a European date string', async () => {
|
|||||||
tap.test('should format a date', async () => {
|
tap.test('should format a date', async () => {
|
||||||
const extendedDate = new smarttime.ExtendedDate(Date.now());
|
const extendedDate = new smarttime.ExtendedDate(Date.now());
|
||||||
console.log(extendedDate.format('YYYY-MM-DD - hh:mm'));
|
console.log(extendedDate.format('YYYY-MM-DD - hh:mm'));
|
||||||
})
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// tslint:disable-next-line:no-implicit-dependencies
|
// tslint:disable-next-line:no-implicit-dependencies
|
||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
|
|
||||||
import { Timer } from '../ts/index';
|
import { Timer } from '../ts/index.js';
|
||||||
|
|
||||||
let testTimer: Timer;
|
let testTimer: Timer;
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smarttime',
|
name: '@pushrocks/smarttime',
|
||||||
version: '3.0.46',
|
version: '3.0.47',
|
||||||
description: 'handle time in smart ways'
|
description: 'handle time in smart ways'
|
||||||
}
|
}
|
||||||
|
16
ts/index.ts
16
ts/index.ts
@ -1,8 +1,8 @@
|
|||||||
export * from './smarttime.classes.cronmanager';
|
export * from './smarttime.classes.cronmanager.js';
|
||||||
export * from './smarttime.classes.cronjob';
|
export * from './smarttime.classes.cronjob.js';
|
||||||
export * from './smarttime.classes.extendeddate';
|
export * from './smarttime.classes.extendeddate.js';
|
||||||
export * from './smarttime.classes.hrtmeasurement';
|
export * from './smarttime.classes.hrtmeasurement.js';
|
||||||
export * from './smarttime.classes.interval';
|
export * from './smarttime.classes.interval.js';
|
||||||
export * from './smarttime.classes.timer';
|
export * from './smarttime.classes.timer.js';
|
||||||
export * from './smarttime.classes.timestamp';
|
export * from './smarttime.classes.timestamp.js';
|
||||||
export * from './smarttime.units';
|
export * from './smarttime.units.js';
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import * as plugins from './smarttime.plugins';
|
import * as plugins from './smarttime.plugins.js';
|
||||||
import { CronManager } from './smarttime.classes.cronmanager';
|
import { CronManager } from './smarttime.classes.cronmanager.js';
|
||||||
|
|
||||||
import { CronParser } from './smarttime.classes.cronparser';
|
import { CronParser } from './smarttime.classes.cronparser.js';
|
||||||
|
|
||||||
export type TJobFunction = ((triggerTimeArg?: number) => void) | ((triggerTimeArg?: number) => Promise<any>);
|
export type TJobFunction =
|
||||||
|
| ((triggerTimeArg?: number) => void)
|
||||||
|
| ((triggerTimeArg?: number) => Promise<any>);
|
||||||
|
|
||||||
export class CronJob {
|
export class CronJob {
|
||||||
public cronParser: typeof plugins.croner;
|
public cronParser: typeof plugins.croner;
|
||||||
@ -28,7 +30,7 @@ export class CronJob {
|
|||||||
if (Date.now() > this.nextExecutionUnix) {
|
if (Date.now() > this.nextExecutionUnix) {
|
||||||
const maybePromise = this.jobFunction(this.nextExecutionUnix);
|
const maybePromise = this.jobFunction(this.nextExecutionUnix);
|
||||||
if (maybePromise instanceof Promise) {
|
if (maybePromise instanceof Promise) {
|
||||||
maybePromise.catch(e => console.log(e));
|
maybePromise.catch((e) => console.log(e));
|
||||||
}
|
}
|
||||||
this.nextExecutionUnix = this.getNextExecutionTime();
|
this.nextExecutionUnix = this.getNextExecutionTime();
|
||||||
}
|
}
|
||||||
@ -36,7 +38,7 @@ export class CronJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getNextExecutionTime() {
|
public getNextExecutionTime() {
|
||||||
return this.nextExecutionUnix = Date.now() + this.getTimeToNextExecution();
|
return (this.nextExecutionUnix = Date.now() + this.getTimeToNextExecution());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as plugins from './smarttime.plugins';
|
import * as plugins from './smarttime.plugins.js';
|
||||||
import { CronJob } from './smarttime.classes.cronjob';
|
import { CronJob } from './smarttime.classes.cronjob.js';
|
||||||
import { getMilliSecondsAsHumanReadableString } from './smarttime.units';
|
import { getMilliSecondsAsHumanReadableString } from './smarttime.units.js';
|
||||||
|
|
||||||
export class CronManager {
|
export class CronManager {
|
||||||
public executionTimeout: plugins.smartdelay.Timeout<void>;
|
public executionTimeout: plugins.smartdelay.Timeout<void>;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './smarttime.plugins';
|
import * as plugins from './smarttime.plugins.js';
|
||||||
|
|
||||||
export class CronParser {
|
export class CronParser {
|
||||||
public cronExpression: string;
|
public cronExpression: string;
|
||||||
@ -62,7 +62,7 @@ export class CronParser {
|
|||||||
if (targetHour < currentHour) {
|
if (targetHour < currentHour) {
|
||||||
currentDay = (currentDay + 1) % 30;
|
currentDay = (currentDay + 1) % 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetDay = currentDay;
|
const targetDay = currentDay;
|
||||||
if (targetDay < currentDay) {
|
if (targetDay < currentDay) {
|
||||||
currentMonth = (currentMonth + 1) % 11;
|
currentMonth = (currentMonth + 1) % 11;
|
||||||
@ -70,7 +70,7 @@ export class CronParser {
|
|||||||
|
|
||||||
const targetMonth = currentMonth;
|
const targetMonth = currentMonth;
|
||||||
if (targetMonth < currentMonth) {
|
if (targetMonth < currentMonth) {
|
||||||
currentYear = (currentYear + 1);
|
currentYear = currentYear + 1;
|
||||||
}
|
}
|
||||||
const targetYear = currentYear;
|
const targetYear = currentYear;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as plugins from './smarttime.plugins';
|
import * as plugins from './smarttime.plugins.js';
|
||||||
import * as units from './smarttime.units';
|
import * as units from './smarttime.units.js';
|
||||||
|
|
||||||
export type TAvailableZone = 'Europe/Berlin';
|
export type TAvailableZone = 'Europe/Berlin';
|
||||||
|
|
||||||
@ -128,14 +128,14 @@ export class ExtendedDate extends Date {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public format (formatArg: string) {
|
public format(formatArg: string) {
|
||||||
return plugins.dayjs(this.getTime()).format(formatArg);
|
return plugins.dayjs(this.getTime()).format(formatArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* boolean checks
|
* boolean checks
|
||||||
*/
|
*/
|
||||||
public isToday () {
|
public isToday() {
|
||||||
return plugins.dayjs(this.getTime()).isToday();
|
return plugins.dayjs(this.getTime()).isToday();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './smarttime.plugins';
|
import * as plugins from './smarttime.plugins.js';
|
||||||
|
|
||||||
export class Interval {
|
export class Interval {
|
||||||
public status: 'started' | 'stopped' | 'initial' = 'initial';
|
public status: 'started' | 'stopped' | 'initial' = 'initial';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as plugins from './smarttime.plugins';
|
import * as plugins from './smarttime.plugins.js';
|
||||||
|
|
||||||
import { TimeStamp } from './smarttime.classes.timestamp';
|
import { TimeStamp } from './smarttime.classes.timestamp.js';
|
||||||
|
|
||||||
export type TimerState = 'initiated' | 'started' | 'paused' | 'completed';
|
export type TimerState = 'initiated' | 'started' | 'paused' | 'completed';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './smarttime.plugins';
|
import * as plugins from './smarttime.plugins.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TimeStamp
|
* TimeStamp
|
||||||
|
@ -6,9 +6,9 @@ import * as smartpromise from '@pushrocks/smartpromise';
|
|||||||
export { lik, smartdelay, smartpromise };
|
export { lik, smartdelay, smartpromise };
|
||||||
|
|
||||||
// third parties;
|
// third parties;
|
||||||
const croner: any = require('croner');
|
import croner from 'croner';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import isToday from 'dayjs/plugin/isToday';
|
import isToday from 'dayjs/plugin/isToday.js';
|
||||||
import prettyMs from 'pretty-ms';
|
import prettyMs from 'pretty-ms';
|
||||||
|
|
||||||
dayjs.extend(isToday);
|
dayjs.extend(isToday);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './smarttime.plugins';
|
import * as plugins from './smarttime.plugins.js';
|
||||||
|
|
||||||
export let units = {
|
export let units = {
|
||||||
years: (timesArg = 1): number => {
|
years: (timesArg = 1): number => {
|
||||||
@ -59,4 +59,4 @@ export let getMilliSecondsFromUnits = (combinationArg: IUnitCombinationArg) => {
|
|||||||
|
|
||||||
export const getMilliSecondsAsHumanReadableString = (milliSecondsArg: number): string => {
|
export const getMilliSecondsAsHumanReadableString = (milliSecondsArg: number): string => {
|
||||||
return plugins.prettyMs(milliSecondsArg);
|
return plugins.prettyMs(milliSecondsArg);
|
||||||
}
|
};
|
||||||
|
10
tsconfig.json
Normal file
10
tsconfig.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "nodenext",
|
||||||
|
"esModuleInterop": true
|
||||||
|
}
|
||||||
|
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user