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

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": "webstore", "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", "npmPackagename": "@pushrocks/webstore",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks" "projectDomain": "push.rocks"

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

View File

@ -1,10 +1,10 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as webstore from '../ts/index'; import * as webstore from '../ts/index.js';
let testTypedrequestcache: webstore.TypedrequestCache; let testTypedrequestcache: webstore.TypedrequestCache;
tap.test('first test', async () => { 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); expect(testTypedrequestcache).toBeInstanceOf(webstore.TypedrequestCache);
}); });

View File

@ -1,5 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as webstore from '../ts/index'; import * as webstore from '../ts/index.js';
let testWebstore: webstore.WebStore; 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.typedrequestcache.js';
export * from './webstore.classes.webstore'; export * from './webstore.classes.webstore.js';

View File

@ -1,5 +1,5 @@
import { WebStore } from './webstore.classes.webstore'; import { WebStore } from './webstore.classes.webstore.js';
import * as plugins from './webstore.plugins'; import * as plugins from './webstore.plugins.js';
/** /**
* a cache that can be used to store and retrieve typedrequests * 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 { export interface IWebStoreOptions {
dbName: string; dbName: string;
@ -22,6 +22,13 @@ export class WebStore<T = any> {
return; return;
} }
this.initCalled = true; 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, { this.db = await plugins.idb.openDB(this.options.dbName, 1, {
upgrade: (db) => { upgrade: (db) => {
db.createObjectStore(this.options.storeName); db.createObjectStore(this.options.storeName);

View File

@ -1,10 +1,11 @@
// pushrocks scope // pushrocks scope
import * as lik from '@pushrocks/lik'; import * as lik from '@pushrocks/lik';
import * as smartenv from '@pushrocks/smartenv';
import * as smartjson from '@pushrocks/smartjson'; import * as smartjson from '@pushrocks/smartjson';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrx from '@pushrocks/smartrx'; import * as smartrx from '@pushrocks/smartrx';
export { lik, smartjson, smartpromise, smartrx }; export { lik, smartenv, smartjson, smartpromise, smartrx };
// apiglobal scope // apiglobal scope
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces'; 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"
}