BREAKING CHANGE(core): switch to esm

This commit is contained in:
Philipp Kunz 2022-05-28 12:33:10 +02:00
parent dac5342a19
commit 7fa246e0e4
13 changed files with 2463 additions and 19392 deletions

View File

@ -12,6 +12,9 @@ stages:
- release
- metadata
before_script:
- npm install -g @shipzone/npmci
# ====================
# security stage
# ====================
@ -97,10 +100,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

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"args": [
"${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"
"type": "node-terminal"
}
]
}

View File

@ -5,7 +5,7 @@
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "webstore",
"shortDescription": "high performance storage in the browser using indexed db",
"description": "high performance storage in the browser using indexed db",
"npmPackagename": "@pushrocks/webstore",
"license": "MIT",
"projectDomain": "push.rocks"

21753
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
"description": "high performance storage in the browser using indexed db",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
@ -12,20 +13,20 @@
"build": "(tsbuild --web)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.29",
"@gitzone/tstest": "^1.0.60",
"@pushrocks/tapbundle": "^4.0.0",
"@types/node": "^17.0.10",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
"@gitzone/tsbuild": "^2.1.63",
"@gitzone/tstest": "^1.0.71",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.36"
},
"dependencies": {
"@apiglobal/typedrequest-interfaces": "^1.0.15",
"@pushrocks/lik": "^5.0.0",
"@pushrocks/lik": "^6.0.0",
"@pushrocks/smartenv": "^5.0.1",
"@pushrocks/smartjson": "^4.0.6",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.20",
"idb": "^7.0.0"
"@pushrocks/smartrx": "^2.0.25",
"fake-indexeddb": "^3.1.7",
"idb": "^7.0.1"
},
"browserslist": [
"last 1 chrome versions"

View File

@ -1,10 +1,10 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as webstore from '../ts/index';
import * as webstore from '../ts/index.js';
let testTypedrequestcache: webstore.TypedrequestCache;
tap.test('first test', async () => {
testTypedrequestcache = new webstore.TypedrequestCache('https://test.lossless.com/typedrequest')
testTypedrequestcache = new webstore.TypedrequestCache('https://test.lossless.com/typedrequest');
expect(testTypedrequestcache).toBeInstanceOf(webstore.TypedrequestCache);
});

View File

@ -1,5 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as webstore from '../ts/index';
import * as webstore from '../ts/index.js';
let testWebstore: webstore.WebStore;

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/webstore',
version: '2.0.0',
description: 'high performance storage in the browser using indexed db'
}

View File

@ -1,2 +1,2 @@
export * from './webstore.classes.typedrequestcache';
export * from './webstore.classes.webstore';
export * from './webstore.classes.typedrequestcache.js';
export * from './webstore.classes.webstore.js';

View File

@ -1,5 +1,5 @@
import { WebStore } from './webstore.classes.webstore';
import * as plugins from './webstore.plugins';
import { WebStore } from './webstore.classes.webstore.js';
import * as plugins from './webstore.plugins.js';
/**
* a cache that can be used to store and retrieve typedrequests

View File

@ -1,4 +1,4 @@
import * as plugins from './webstore.plugins';
import * as plugins from './webstore.plugins.js';
export interface IWebStoreOptions {
dbName: string;
@ -22,6 +22,13 @@ export class WebStore<T = any> {
return;
}
this.initCalled = true;
const smartenv = new plugins.smartenv.Smartenv();
if (!smartenv.isBrowser) {
const fetch = await smartenv.getSafeNodeModule('fake-indexeddb/auto.js');
globalThis.fetch = fetch.default;
}
this.db = await plugins.idb.openDB(this.options.dbName, 1, {
upgrade: (db) => {
db.createObjectStore(this.options.storeName);

View File

@ -1,10 +1,11 @@
// pushrocks scope
import * as lik from '@pushrocks/lik';
import * as smartenv from '@pushrocks/smartenv';
import * as smartjson from '@pushrocks/smartjson';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrx from '@pushrocks/smartrx';
export { lik, smartjson, smartpromise, smartrx };
export { lik, smartenv, smartjson, smartpromise, smartrx };
// apiglobal scope
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';

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