BREAKING CHANGE(core): switch to esm

This commit is contained in:
Philipp Kunz 2022-10-19 19:27:42 +02:00
parent 7067826a4e
commit 451daec7b4
19 changed files with 4303 additions and 11517 deletions

View File

@ -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
View File

@ -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"
} }
] ]
} }

View File

@ -5,7 +5,7 @@
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "pushrocks",
"gitrepo": "smartdaemon", "gitrepo": "smartdaemon",
"shortDescription": "start scripts as long running daemons and manage them", "description": "start scripts as long running daemons and manage them",
"npmPackagename": "@pushrocks/smartdaemon", "npmPackagename": "@pushrocks/smartdaemon",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks" "projectDomain": "push.rocks"

11436
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,24 +9,24 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/ --web)", "test": "(tstest test/ --web)",
"build": "(tsbuild --web)" "build": "(tsbuild --web)",
"buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.52", "@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.2.10", "@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^14.14.22", "@types/node": "^18.11.2"
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/lik": "^4.0.20", "@pushrocks/lik": "^6.0.0",
"@pushrocks/smartfile": "^8.0.8", "@pushrocks/smartfile": "^10.0.5",
"@pushrocks/smartfm": "^2.0.4", "@pushrocks/smartfm": "^2.0.4",
"@pushrocks/smartlog": "^2.0.39", "@pushrocks/smartlog": "^3.0.1",
"@pushrocks/smartlog-destination-local": "^8.0.8", "@pushrocks/smartlog-destination-local": "^8.0.8",
"@pushrocks/smartpath": "^5.0.5",
"@pushrocks/smartshell": "^2.0.26", "@pushrocks/smartshell": "^2.0.26",
"@pushrocks/smartsystem": "^2.0.9" "@pushrocks/smartsystem": "^3.0.1"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
@ -42,5 +42,6 @@
], ],
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
] ],
"type": "module"
} }

4216
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,9 @@ Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20W
## Usage ## Usage
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
## Contribution ## Contribution

5
test/plugins.ts Normal file
View File

@ -0,0 +1,5 @@
import * as smartpath from '@pushrocks/smartpath';
export {
smartpath
};

View File

@ -1,11 +1,16 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as smartdaemon from '../ts/index';
import * as plugins from './plugins.js';
import * as smartdaemon from '../ts/index.js';
let testSmartdaemon: smartdaemon.SmartDaemon; let testSmartdaemon: smartdaemon.SmartDaemon;
tap.test('should create an instance of smartdaemon', async () => { tap.test('should create an instance of smartdaemon', async () => {
testSmartdaemon = new smartdaemon.SmartDaemon(); testSmartdaemon = new smartdaemon.SmartDaemon();
expect(testSmartdaemon).to.be.instanceOf(smartdaemon.SmartDaemon); expect(testSmartdaemon).toBeInstanceOf(smartdaemon.SmartDaemon);
}); });
tap.test('should create a service', async () => { tap.test('should create a service', async () => {
@ -14,7 +19,7 @@ tap.test('should create a service', async () => {
version: 'x.x.x', version: 'x.x.x',
command: 'npm -v', command: 'npm -v',
description: 'displays the npm version', description: 'displays the npm version',
workingDir: __dirname, workingDir: plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
}); });
}); });

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartdaemon',
version: '2.0.0',
description: 'start scripts as long running daemons and manage them'
}

View File

@ -1 +1 @@
export * from './smartdaemon.classes.smartdaemon'; export * from './smartdaemon.classes.smartdaemon.js';

View File

@ -1,6 +1,6 @@
import * as plugins from './smartdaemon.plugins'; import * as plugins from './smartdaemon.plugins.js';
import * as paths from './smartdaemon.paths'; import * as paths from './smartdaemon.paths.js';
import { SmartDaemon } from './smartdaemon.classes.smartdaemon'; import { SmartDaemon } from './smartdaemon.classes.smartdaemon.js';
export interface ISmartDaemonServiceConstructorOptions { export interface ISmartDaemonServiceConstructorOptions {
name: string; name: string;

View File

@ -1,10 +1,10 @@
import * as plugins from './smartdaemon.plugins'; import * as plugins from './smartdaemon.plugins.js';
import { SmartDaemonTemplateManager } from './smartdaemon.classes.templatemanager'; import { SmartDaemonTemplateManager } from './smartdaemon.classes.templatemanager.js';
import { import {
SmartDaemonService, SmartDaemonService,
ISmartDaemonServiceConstructorOptions, ISmartDaemonServiceConstructorOptions,
} from './smartdaemon.classes.service'; } from './smartdaemon.classes.service.js';
import { SmartDaemonSystemdManager } from './smartdaemon.classes.systemdmanager'; import { SmartDaemonSystemdManager } from './smartdaemon.classes.systemdmanager.js';
export class SmartDaemon { export class SmartDaemon {
public templateManager: SmartDaemonTemplateManager; public templateManager: SmartDaemonTemplateManager;

View File

@ -1,10 +1,10 @@
import * as plugins from './smartdaemon.plugins'; import * as plugins from './smartdaemon.plugins.js';
import * as paths from './smartdaemon.paths'; import * as paths from './smartdaemon.paths.js';
import { SmartDaemon } from './smartdaemon.classes.smartdaemon'; import { SmartDaemon } from './smartdaemon.classes.smartdaemon.js';
import { import {
ISmartDaemonServiceConstructorOptions, ISmartDaemonServiceConstructorOptions,
SmartDaemonService, SmartDaemonService,
} from './smartdaemon.classes.service'; } from './smartdaemon.classes.service.js';
export class SmartDaemonSystemdManager { export class SmartDaemonSystemdManager {
// STATIC // STATIC

View File

@ -1,6 +1,6 @@
import * as plugins from './smartdaemon.plugins'; import * as plugins from './smartdaemon.plugins.js';
import { SmartDaemon } from './smartdaemon.classes.smartdaemon'; import { SmartDaemon } from './smartdaemon.classes.smartdaemon.js';
import { SmartDaemonService } from './smartdaemon.classes.service'; import { SmartDaemonService } from './smartdaemon.classes.service.js';
export class SmartDaemonTemplateManager { export class SmartDaemonTemplateManager {
public smartdaemonRef: SmartDaemon; public smartdaemonRef: SmartDaemon;

View File

@ -1,4 +1,4 @@
import * as plugins from './smartdaemon.plugins'; import * as plugins from './smartdaemon.plugins.js';
export const packageDir = plugins.path.join(__dirname, '../'); export const packageDir = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
export const systemdDir = plugins.path.join('/lib/systemd/system/'); export const systemdDir = plugins.path.join('/lib/systemd/system/');

View File

@ -9,9 +9,10 @@ import * as smartfile from '@pushrocks/smartfile';
import * as smartfm from '@pushrocks/smartfm'; import * as smartfm from '@pushrocks/smartfm';
import * as smartlog from '@pushrocks/smartlog'; import * as smartlog from '@pushrocks/smartlog';
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local'; import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
import * as smartpath from '@pushrocks/smartpath';
import * as smartshell from '@pushrocks/smartshell'; import * as smartshell from '@pushrocks/smartshell';
import * as smartsystem from '@pushrocks/smartsystem'; import * as smartsystem from '@pushrocks/smartsystem';
export { lik, smartfile, smartfm, smartlog, smartlogDestinationLocal, smartshell, smartsystem }; export { lik, smartfile, smartfm, smartlog, smartlogDestinationLocal, smartpath, smartshell, smartsystem };
// third party // third party

View File

@ -1,4 +1,4 @@
import * as plugins from './smartdaemon.plugins'; import * as plugins from './smartdaemon.plugins.js';
export const logger = new plugins.smartlog.Smartlog({ export const logger = new plugins.smartlog.Smartlog({
logContext: { logContext: {

10
tsconfig.json Normal file
View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true
}
}