Skip to content

Commit

Permalink
feat(engine): support cjs build
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm authored and AliMD committed Dec 25, 2023
1 parent 05be75d commit 87970d4
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 79 deletions.
45 changes: 0 additions & 45 deletions packages/engine/esbuild.mjs

This file was deleted.

63 changes: 39 additions & 24 deletions packages/engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@alwatr/storage-engine",
"version": "4.0.4",
"description": "Extremely fast and compact JSON-based database that operates in memory, includes a JSON file backup, and serve over the highly accelerated Nginx.",
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
"keywords": [
"database",
"storage",
Expand All @@ -15,55 +16,69 @@
"esm",
"alwatr"
],
"main": "storage-engine.js",
"type": "module",
"types": "storage-engine.d.ts",
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com> (https://ali.mihandoost.com)",
"main": "./dist/main.cjs",
"module": "./dist/main.mjs",
"types": "./dist/main.d.ts",
"exports": {
".": {
"import": "./dist/main.mjs",
"require": "./dist/main.cjs",
"types": "./dist/main.d.ts"
},
"./provider": {
"import": "./dist/provider.mjs",
"require": "./dist/provider.cjs",
"types": "./dist/provider.d.ts"
}
},
"license": "MIT",
"files": [
"**/*.{d.ts.map,d.ts,js.map,js,html,md}"
"**/*.{js,mjs,cjs,map,d.ts,html,md}",
"!demo/**/*"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/Alwatr/storage",
"url": "https://github.com/Alwatr/store",
"directory": "packages/engine"
},
"homepage": "https://github.com/Alwatr/storage/tree/next/packages/engine#readme",
"homepage": "https://github.com/Alwatr/store/tree/next/packages/engine#readme",
"bugs": {
"url": "https://github.com/Alwatr/storage/issues"
"url": "https://github.com/Alwatr/store/issues"
},
"esbuild": {
"nano-build": {
"entryPoints": [
"src/**/*.ts"
],
"outbase": "src",
"outdir": ".",
"minify": false,
"bundle": false,
"treeShaking": false,
"sourcemap": true,
"sourcesContent": true
"src/main.ts",
"src/provider.ts"
]
},
"prettier": "@alwatr/prettier-config",
"scripts": {
"b": "yarn run build",
"w": "yarn run watch",
"c": "yarn run clean",
"cb": "run-s clean build",
"build": "run-p -l 'build:*'",
"build:es": "yarn node ./esbuild.mjs",
"cb": "yarn run clean && yarn run build",
"d": "yarn run build:es && ALWATR_DEBUG=1 yarn node",
"build": "yarn run build:ts & yarn run build:es",
"build:es": "nano-build --preset=module",
"build:ts": "tsc --build",
"clean": "rm -rfv *.js *.d.ts *.d.ts.map *.js.map .tsbuildinfo",
"watch:es": "yarn run build --watch"
"watch": "yarn run watch:ts & yarn run watch:es",
"watch:es": "yarn run build:es --watch",
"watch:ts": "yarn run build:ts --watch --preserveWatchOutput",
"clean": "rm -rfv dist *.tsbuildinfo"
},
"dependencies": {
"@alwatr/logger": "^2.4.1",
"@alwatr/util": "^1.4.1",
"exit-hook": "^4.0.0",
"tslib": "^2.6.2"
"exit-hook": "^4.0.0"
},
"devDependencies": {
"@alwatr/nano-build": "^1.2.1",
"@alwatr/prettier-config": "^1.0.4",
"@alwatr/tsconfig-base": "^1.0.5",
"@alwatr/type": "^1.2.4",
"@types/node": "^20.10.5",
"esbuild": "^0.19.10",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/engine/src/provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {createLogger} from '@alwatr/logger';

import {AlwatrStorageEngine} from './storage-engine.js';
import {AlwatrStorageEngine} from './main.js';

import type {AlwatrStorageEngineConfig, AlwatrStorageEngineProviderConfig} from './type.js';
import type {AlwatrDocumentObject} from '@alwatr/type';
Expand Down
12 changes: 4 additions & 8 deletions packages/engine/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"extends": "../../tsconfig.base",
"extends": "@alwatr/tsconfig-base/tsconfig.json",
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": ".tsbuildinfo",
"rootDir": "src",
"outDir": ".",
"outDir": "dist",
"emitDeclarationOnly": true,
"composite": true,
},

"include": ["src/**/*.ts"],
"exclude": [],
"references": []
"include": ["src/**/*.ts"]
}
22 changes: 21 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ __metadata:
languageName: node
linkType: hard

"@alwatr/nano-build@npm:^1.2.1":
version: 1.2.1
resolution: "@alwatr/nano-build@npm:1.2.1"
dependencies:
esbuild: "npm:^0.19.10"
bin:
nano-build: nano-build.cjs
checksum: dd683718601b1cc240ef2da0d343cfceb9c058be25da786b2288bedd18f63a3634a2586d2af4d6c5b69399f1445e725e9c755d5a30bef755ffa6d0930b75c66f
languageName: node
linkType: hard

"@alwatr/nano-server@npm:^1.2.7":
version: 1.2.7
resolution: "@alwatr/nano-server@npm:1.2.7"
Expand Down Expand Up @@ -110,13 +121,15 @@ __metadata:
resolution: "@alwatr/storage-engine@workspace:packages/engine"
dependencies:
"@alwatr/logger": "npm:^2.4.1"
"@alwatr/nano-build": "npm:^1.2.1"
"@alwatr/prettier-config": "npm:^1.0.4"
"@alwatr/tsconfig-base": "npm:^1.0.5"
"@alwatr/type": "npm:^1.2.4"
"@alwatr/util": "npm:^1.4.1"
"@types/node": "npm:^20.10.5"
esbuild: "npm:^0.19.10"
exit-hook: "npm:^4.0.0"
npm-run-all: "npm:^4.1.5"
tslib: "npm:^2.6.2"
typescript: "npm:^5.3.3"
languageName: unknown
linkType: soft
Expand All @@ -137,6 +150,13 @@ __metadata:
languageName: unknown
linkType: soft

"@alwatr/tsconfig-base@npm:^1.0.5":
version: 1.0.5
resolution: "@alwatr/tsconfig-base@npm:1.0.5"
checksum: 5ef9c8bc91fd24dac416ac3599cd471dc7025fa4044aee6fe97910b83e84f11dbcea9251a03e7d142c4fd9e2cca92bbbc894433310fcbbe4405f402be3c1c56a
languageName: node
linkType: hard

"@alwatr/type@npm:^1.2.4":
version: 1.2.4
resolution: "@alwatr/type@npm:1.2.4"
Expand Down

0 comments on commit 87970d4

Please sign in to comment.