BREAKING CHANGE(switch to esm): update

This commit is contained in:
Philipp Kunz 2023-03-20 12:26:43 +01:00
parent 411516befc
commit 5a3ccf6f4f
17 changed files with 4398 additions and 11253 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,10 +62,9 @@ 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 npm build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
@ -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": "apiglobal", "gitscope": "apiglobal",
"gitrepo": "sdk", "gitrepo": "sdk",
"shortDescription": "an sdk package for api.global", "description": "an sdk package for api.global",
"npmPackagename": "@apiglobal/sdk", "npmPackagename": "@apiglobal/sdk",
"license": "MIT", "license": "MIT",
"projectDomain": "api.global" "projectDomain": "api.global"

11153
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,20 +9,19 @@
"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.24", "@gitzone/tsbuild": "^2.1.24",
"@gitzone/tstest": "^1.0.33", "@gitzone/tstest": "^1.0.33",
"@pushrocks/tapbundle": "^3.0.7", "@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^14.0.14", "@types/node": "^18.15.3"
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@apiglobal/typedrequest": "^1.0.38", "@apiglobal/typedrequest": "^2.0.12",
"@pushrocks/smartfile": "^8.0.0", "@pushrocks/smartfile": "^10.0.7",
"@tsclass/tsclass": "^3.0.18" "@tsclass/tsclass": "^4.0.34"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
@ -38,5 +37,6 @@
], ],
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
] ],
} "type": "module"
}

4325
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,6 @@ Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](htt
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@apiglobal/sdk)](https://lossless.cloud) PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@apiglobal/sdk)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@apiglobal/sdk)](https://lossless.cloud) PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@apiglobal/sdk)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@apiglobal/sdk)](https://lossless.cloud) BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@apiglobal/sdk)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage
@ -33,7 +32,6 @@ We are always happy for code contributions. If you are not the code contributing
For further information read the linked docs at the top of this readme. For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) ## Legal
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -1,6 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as sdk from '../ts/index'; import * as sdk from '../ts/index.js';
import { ISimpleRequest } from '@tsclass/tsclass/dist_ts/network';
import { TypedRouter } from '@apiglobal/typedrequest'; import { TypedRouter } from '@apiglobal/typedrequest';
tap.test('should create a valid Handler', async () => { tap.test('should create a valid Handler', async () => {
@ -36,7 +35,7 @@ tap.test('should create a valid Handler', async () => {
const myHandlerInstance = new MyHandler(new AgEnvironement()); const myHandlerInstance = new MyHandler(new AgEnvironement());
expect(myHandlerInstance).to.be.instanceOf(sdk.AAgHandler); expect(myHandlerInstance).toBeInstanceOf(sdk.AAgHandler);
}); });
tap.start(); tap.start();

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@apiglobal/sdk',
version: '2.0.0',
description: 'an sdk package for api.global'
}

View File

@ -1,5 +1,5 @@
export * from './sdk.classes.agenvironment'; export * from './sdk.classes.agenvironment.js';
export * from './sdk.classes.aghandler'; export * from './sdk.classes.aghandler.js';
export * from './sdk.classes.authinfo'; export * from './sdk.classes.authinfo.js';
export * from './interfaces'; export * from './interfaces/index.js';

View File

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

View File

@ -1,8 +1,8 @@
import * as plugins from './sdk.plugins'; import * as plugins from './sdk.plugins.js';
/** /**
* AgEnvironment handles the provision of environment variables to handlers * AgEnvironment handles the provision of environment variables to handlers
*/ */
export abstract class AgEnvironment { export abstract class AgEnvironment {
public abstract async getEnvVar(envVarName: string): Promise<string>; public abstract getEnvVar(envVarName: string): Promise<string>;
} }

View File

@ -1,6 +1,6 @@
import * as plugins from './sdk.plugins'; import * as plugins from './sdk.plugins.js';
import { AuthInfo } from './sdk.classes.authinfo'; import { AuthInfo } from './sdk.classes.authinfo.js';
import { AgEnvironment } from './sdk.classes.agenvironment'; import { AgEnvironment } from './sdk.classes.agenvironment.js';
export interface IRequirementResult { export interface IRequirementResult {
allOk: boolean; allOk: boolean;
@ -18,8 +18,10 @@ export abstract class AAgHandler<TClaim> {
public abstract checkRequirements(): Promise<IRequirementResult>; public abstract checkRequirements(): Promise<IRequirementResult>;
public async checkQenvFile(pathToQenvFileArg: string) { public async checkQenvFile(pathToQenvFileArg: string) {
if(!(await plugins.smartfile.fs.fileExists(pathToQenvFileArg))) { if (!(await plugins.smartfile.fs.fileExists(pathToQenvFileArg))) {
throw new Error(`AgHandler with slug '${this.slug}': qenv file does not exists at ${pathToQenvFileArg}`); throw new Error(
`AgHandler with slug '${this.slug}': qenv file does not exists at ${pathToQenvFileArg}`
);
} }
const qenvFile = plugins.smartfile.fs.toObjectSync(pathToQenvFileArg); const qenvFile = plugins.smartfile.fs.toObjectSync(pathToQenvFileArg);
const missingEnvironmentVariables: string[] = []; const missingEnvironmentVariables: string[] = [];
@ -30,7 +32,9 @@ export abstract class AAgHandler<TClaim> {
} }
} }
if (missingEnvironmentVariables.length > 0) { if (missingEnvironmentVariables.length > 0) {
console.log(`AgHandler with slug '${this.slug}': There are ${missingEnvironmentVariables.length} missing environment variables`); console.log(
`AgHandler with slug '${this.slug}': There are ${missingEnvironmentVariables.length} missing environment variables`
);
const errorMessage = `AgHandler with slug '${this.slug}': The missing env Varibles are ${missingEnvironmentVariables}`; const errorMessage = `AgHandler with slug '${this.slug}': The missing env Varibles are ${missingEnvironmentVariables}`;
console.log(errorMessage); console.log(errorMessage);
throw new Error(errorMessage); throw new Error(errorMessage);

View File

@ -1,4 +1,4 @@
import * as plugins from './sdk.plugins'; import * as plugins from './sdk.plugins.js';
/** /**
* AuthInfo is created for every single incoming request * AuthInfo is created for every single incoming request

View File

@ -9,9 +9,7 @@ export { typedrequest };
// pushrocks scope // pushrocks scope
import * as smartfile from '@pushrocks/smartfile'; import * as smartfile from '@pushrocks/smartfile';
export { export { smartfile };
smartfile
};
// @tsclass scope // @tsclass scope
import * as tsclass from '@tsclass/tsclass'; import * as tsclass from '@tsclass/tsclass';

10
tsconfig.json Normal file
View File

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

View File

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