BREAKING CHANGE(core): switch to esm

This commit is contained in:
Philipp Kunz 2022-05-17 18:28:09 +02:00
parent e01d09e40a
commit 3381163a0d
7 changed files with 2577 additions and 19510 deletions

21992
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
"description": "create a local mongodb for testing", "description": "create a local mongodb for testing",
"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,18 +13,16 @@
"build": "(tsbuild --web)" "build": "(tsbuild --web)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.61",
"@gitzone/tsbundle": "^1.0.78", "@gitzone/tsbundle": "^2.0.3",
"@gitzone/tstest": "^1.0.44", "@gitzone/tstest": "^1.0.71",
"@pushrocks/tapbundle": "^3.2.9", "@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^14.11.2", "@types/node": "^17.0.34"
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartdata": "^4.0.27", "@pushrocks/smartdata": "^4.0.27",
"@pushrocks/smartpromise": "^3.1.6", "@pushrocks/smartpromise": "^3.1.7",
"mongodb-memory-server": "^8.0.4" "mongodb-memory-server": "^8.5.2"
}, },
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"

View File

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

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/smartmongo', name: '@pushrocks/smartmongo',
version: '1.0.9', version: '2.0.0',
description: 'create a local mongodb for testing' description: 'create a local mongodb for testing'
} }

View File

@ -1,10 +1,11 @@
import * as plugins from './smartmongo.plugins'; import { commitinfo } from './00_commitinfo_data.js';
import * as plugins from './smartmongo.plugins.js';
export class SmartMongo { export class SmartMongo {
// STATIC // STATIC
public static async createAndStart() { public static async createAndStart(replCountArg: number = 1) {
const smartMongoInstance = new SmartMongo(); const smartMongoInstance = new SmartMongo();
await smartMongoInstance.start(); await smartMongoInstance.start(replCountArg);
return smartMongoInstance; return smartMongoInstance;
} }
@ -16,10 +17,11 @@ export class SmartMongo {
constructor() { constructor() {
} }
public async start(countArg: number = 4) { public async start(countArg: number = 1) {
this.mongoReplicaSet = await plugins.mongoPlugin.MongoMemoryReplSet.create({ replSet: { count: countArg } }); this.mongoReplicaSet = await plugins.mongoPlugin.MongoMemoryReplSet.create({ replSet: { count: countArg } });
this._readyDeferred.resolve(); this._readyDeferred.resolve();
console.log(`mongoReplicaSet with ${countArg} replicas started.`); console.log(`mongoReplicaSet with ${countArg} replicas started.`);
console.log(`@pushrocks/smartmongo version ${commitinfo.version}`);
} }
public async getMongoDescriptor(): Promise<plugins.smartdata.IMongoDescriptor> { public async getMongoDescriptor(): Promise<plugins.smartdata.IMongoDescriptor> {

9
tsconfig.json Normal file
View File

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

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