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 - 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 allow_failure: true
@ -42,11 +38,10 @@ 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
@ -57,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
@ -68,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
@ -97,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
@ -120,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

View File

@ -5,7 +5,7 @@
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "pushrocks",
"gitrepo": "smartjwt", "gitrepo": "smartjwt",
"shortDescription": "a package for handling jwt", "description": "a package for handling jwt",
"npmPackagename": "@pushrocks/smartjwt", "npmPackagename": "@pushrocks/smartjwt",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks" "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": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild)", "build": "(tsbuild)",
"format": "(gitzone format)" "format": "(gitzone format)",
"buildDocs": "tsdoc"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.27", "@gitzone/tsbuild": "^2.1.28",
"@gitzone/tstest": "^1.0.57", "@gitzone/tsrun": "^1.2.39",
"@pushrocks/tapbundle": "^3.2.14", "@gitzone/tstest": "^1.0.59",
"@types/node": "^16.9.6", "@pushrocks/tapbundle": "^5.0.4",
"tslint": "^6.1.3", "@types/node": "^18.11.4"
"tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartcrypto": "^1.0.11", "@pushrocks/smartcrypto": "^2.0.1",
"@types/jsonwebtoken": "^8.5.5", "@types/jsonwebtoken": "^8.5.5",
"jsonwebtoken": "^8.5.1" "jsonwebtoken": "^8.5.1"
}, },
@ -39,5 +39,6 @@
], ],
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
] ],
} "type": "module"
}

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

View File

@ -4,5 +4,5 @@ import * as smartcrypto from '@pushrocks/smartcrypto';
export { smartcrypto }; export { smartcrypto };
// thirdparty scope // thirdparty scope
import * as jsonwebtoken from 'jsonwebtoken'; import jsonwebtoken from 'jsonwebtoken';
export { 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"
}