mevn-orm 2.3.0 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 StanoJs
3
+ Copyright (c) 2021 Stanley Masinde
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/initDb CHANGED
@@ -1,7 +1,16 @@
1
1
  #!/bin/env node
2
+ const fs = require('fs')
2
3
  require('dotenv').config()
3
4
  const Knex = require('knex')
4
- const { development, staging, production } = require('./knexfile.cjs')
5
+
6
+ let knexfilePath
7
+
8
+ if (fs.existsSync(process.cwd() + '/knexfile.js')) {
9
+ knexfilePath = process.cwd() + '/knexfile.js'
10
+ } else {
11
+ knexfilePath = process.cwd() + '/knexfile.cjs'
12
+ }
13
+ const { development, staging, production } = require(knexfilePath)
5
14
  let config
6
15
 
7
16
  switch (process.env.NODE_ENV) {
File without changes
package/lib/model.js CHANGED
@@ -1,5 +1,15 @@
1
+ const fs = require('fs')
1
2
  const knex = require('knex').knex
2
- const { development, staging, production } = require(process.cwd() + '/knexfile.cjs')
3
+
4
+ let fileName
5
+
6
+ if (fs.existsSync(process.cwd() + '/knexfile.js')) {
7
+ fileName = process.cwd() + '/knexfile.js'
8
+ } else {
9
+ fileName = process.cwd() + '/knexfile.cjs'
10
+ }
11
+ const { development, staging, production } = require(fileName)
12
+
3
13
  const pluralize = require('pluralize')
4
14
  let config
5
15
  switch (process.env.NODE_ENV) {
@@ -178,7 +188,7 @@ class Model {
178
188
  foreignKey = `${this.modelName}_id`
179
189
  }
180
190
 
181
- if(localKey) {
191
+ if (localKey) {
182
192
  relation[foreignKey] = localKey
183
193
  const res = await DB(table).where(relation).first()
184
194
  if (res) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mevn-orm",
3
- "version": "2.3.0",
3
+ "version": "2.3.5",
4
4
  "description": "simple ORM for express js",
5
5
  "type": "commonjs",
6
6
  "scripts": {
@@ -12,16 +12,24 @@
12
12
  },
13
13
  "peerDependencies": {
14
14
  "dotenv": "^15.0.0",
15
- "knex": "^0.95.11",
15
+ "knex": "^1.0.1",
16
16
  "mysql": "^2.18.1"
17
17
  },
18
+ "peerDependenciesMeta": {
19
+ "dotenv": {
20
+ "optional": false
21
+ },
22
+ "knex": {
23
+ "optional": false
24
+ }
25
+ },
18
26
  "keywords": [
19
27
  "ORM",
20
28
  "express",
21
29
  "Mysql",
22
30
  "mevn"
23
31
  ],
24
- "author": "Stanley Masinde",
32
+ "author": "Stanley Masinde <stanmasinde@gmail.com> (https://stanleymasinde.github.io)",
25
33
  "contributors": [
26
34
  "Stanley Masinde <stanmasinde@gmail.com>"
27
35
  ],
@@ -35,25 +43,24 @@
35
43
  "@babel/eslint-parser": "^7.13.14",
36
44
  "@babel/eslint-plugin": "^7.13.16",
37
45
  "@babel/plugin-proposal-class-properties": "^7.14.5",
46
+ "@vscode/sqlite3": "^5.0.7",
38
47
  "chai": "^4.2.0",
39
- "dotenv": "^8.6.0",
48
+ "dotenv": "^15.0.0",
40
49
  "eslint": "^7.25.0",
41
50
  "faker": "^5.5.3",
42
- "knex": "^0.95.11",
51
+ "knex": "^1.0.1",
43
52
  "mocha": "^9.1.2",
44
- "mysql2": "^2.3.0",
45
- "sqlite3": "^4.2.0"
53
+ "mysql2": "^2.3.0"
46
54
  },
47
55
  "directories": {
56
+ "lib": "lib",
48
57
  "test": "test"
49
58
  },
50
59
  "private": false,
51
- "repository": {
52
- "type": "git",
53
- "url": "git+https://github.com/StanleyMasinde/mevn-orm.git"
54
- },
60
+ "repository": "git+https://github.com/StanleyMasinde/mevn-orm.git",
55
61
  "bugs": {
56
- "url": "https://github.com/StanleyMasinde/mevn-orm/issues"
62
+ "url": "https://github.com/StanleyMasinde/mevn-orm/issues",
63
+ "email": "stanmasinde@gmail.com"
57
64
  },
58
65
  "homepage": "https://github.com/StanleyMasinde/mevn-orm#readme",
59
66
  "main": "index.js"