Skip to content

Commit

Permalink
fix types, fix exports, add json library module, fix env expand, vers…
Browse files Browse the repository at this point in the history
…ion bump
  • Loading branch information
realtux committed Sep 11, 2024
1 parent aeaa70d commit 842d8f2
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 8 deletions.
28 changes: 28 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,31 @@ declare module '@exajs/core' {
const exa: any;
export default exa;
}

declare module '@exajs/core/database' {
const connection: any;
const models: any;
export { connection, models };
}

declare module '@exajs/core/database/models' {
const models: any;
export default models;
}

declare module '@exajs/core/database/connection' {
const connection: any;
export default connection;
}

declare module '@exajs/core/system/sequelize' {
const sequelize: any;
export default sequelize;
export * from 'sequelize';
}

declare module '@exajs/core/util' {
import json from '#exa/util/json.js';

export { json };
}
2 changes: 1 addition & 1 deletion lib/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let config = {
/**
* internal config
*/
version: '0.0.12',
version: '0.0.13',

paths: {
root: '',
Expand Down
4 changes: 4 additions & 0 deletions lib/database/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import connection from '#exa/database/connection.js';
import models from '#exa/database/models.js';

export { connection, models };
1 change: 1 addition & 0 deletions lib/http/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const init = async () => {
app.use(cors());
app.use(multer({ storage: multer.memoryStorage() }).any());
app.use(Express.json({ limit: '16mb' }));
app.use(Express.urlencoded({ extended: true }));
app.use('/public', Express.static(`${config.paths.root}/public`));

// mounted http controller routes
Expand Down
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as dotenv from 'dotenv';
dotenv.config();
import dotenv_expand from 'dotenv-expand';
dotenv_expand.expand(dotenv.config());

import config, { init as init_config } from '#exa/core/config.js';
import connection, { init as init_db } from '#exa/database/connection.js';
Expand Down
Empty file removed lib/system/index.js
Empty file.
3 changes: 3 additions & 0 deletions lib/util/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import json from '#exa/util/json.js';

export { json };
11 changes: 11 additions & 0 deletions lib/util/json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default new class {

safe_parse(json, def) {
try {
return JSON.parse(json);
} catch {
return def ?? json;
}
}

};
21 changes: 18 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@exajs/core",
"type": "module",
"author": "Brian Seymour <@realtux>",
"version": "0.0.12",
"version": "0.0.13",
"description": "modern opinionated node.js framework",
"license": "MIT",
"homepage": "https://github.com/realtux/exa",
Expand All @@ -20,15 +20,17 @@
},
"exports": {
".": "./lib/index.js",
"./database": "./lib/database/index.js",
"./database/models": "./lib/database/models.js",
"./database/connection": "./lib/database/connection.js",
"./system": "./lib/system/index.js",
"./system/sequelize": "./lib/system/sequelize.js"
"./system/sequelize": "./lib/system/sequelize.js",
"./util": "./lib/util/index.js"
},
"dependencies": {
"chalk": "5.3.0",
"cors": "2.8.5",
"dotenv": "16.4.5",
"dotenv-expand": "11.0.6",
"express": "4.19.2",
"glob": "10.4.1",
"luxon": "3.4.4",
Expand Down

0 comments on commit 842d8f2

Please sign in to comment.