BREAKING CHANGE(core): switch to esm

This commit is contained in:
Philipp Kunz 2022-10-24 07:14:17 +02:00
parent 85d958e424
commit 60da639d69
13 changed files with 4489 additions and 26248 deletions

View File

@ -12,29 +12,25 @@ stages:
- release
- metadata
before_script:
- pnpm install -g pnpm
- pnpm install -g @shipzone/npmci
- npmci npm prepare
# ====================
# security stage
# ====================
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --prod
tags:
- lossless
- docker
allow_failure: true
@ -42,11 +38,10 @@ auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- 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:
- lossless
- docker
allow_failure: true
@ -57,7 +52,6 @@ auditDevDependencies:
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
@ -68,7 +62,6 @@ testStable:
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
@ -97,10 +90,9 @@ codequality:
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci command npm install -g typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
@ -120,11 +112,9 @@ trigger:
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command tsdoc
- npmci command npm run buildDocs
tags:
- lossless
- docker

View File

@ -5,7 +5,7 @@
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartjwt",
"shortDescription": "a package for handling jwt",
"description": "a package for handling jwt",
"npmPackagename": "@pushrocks/smartjwt",
"license": "MIT",
"projectDomain": "push.rocks"

26187
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,18 +10,18 @@
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild)",
"format": "(gitzone format)"
"format": "(gitzone format)",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.27",
"@gitzone/tstest": "^1.0.57",
"@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^16.9.6",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
"@gitzone/tsbuild": "^2.1.28",
"@gitzone/tsrun": "^1.2.39",
"@gitzone/tstest": "^1.0.59",
"@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.11.4"
},
"dependencies": {
"@pushrocks/smartcrypto": "^1.0.11",
"@pushrocks/smartcrypto": "^2.0.1",
"@types/jsonwebtoken": "^8.5.5",
"jsonwebtoken": "^8.5.1"
},
@ -39,5 +39,6 @@
],
"browserslist": [
"last 1 chrome versions"
]
}
],
"type": "module"
}

4437
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,6 @@ Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20W
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
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). :)

View File

@ -1,5 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartjwt from '../ts/index';
import * as smartjwt from '../ts/index.js';
let smartjwtInstance: smartjwt.SmartJwt;
let testJwt: string;
@ -22,7 +22,7 @@ tap.test('should create a new jwt', async () => {
tap.test('should verify a jwt', async () => {
const data = await smartjwtInstance.verifyJWTAndGetData(testJwt);
// tslint:disable-next-line: no-unused-expression
expect(data).to.not.be.null;
expect(data).not.toBeNull();
console.log(data);
console.log(smartjwtInstance.publicKey.toPemString());
});
@ -38,7 +38,7 @@ tap.test('should not verify a wrong jwt', async () => {
} catch (e: any) {
error = e;
}
expect(error).to.be.instanceOf(Error);
expect(error).toBeInstanceOf(Error);
});
tap.test('should verify a jwt on another instance', async () => {

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartjwt',
version: '2.0.0',
description: 'a package for handling jwt'
}

View File

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

View File

@ -1,4 +1,4 @@
import * as plugins from './smartjwt.plugins';
import * as plugins from './smartjwt.plugins.js';
export interface ISmartJWTJSONKeypair {
privatePem: string;

View File

@ -4,5 +4,5 @@ import * as smartcrypto from '@pushrocks/smartcrypto';
export { smartcrypto };
// thirdparty scope
import * as jsonwebtoken from 'jsonwebtoken';
import jsonwebtoken from 'jsonwebtoken';
export { jsonwebtoken };

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