create-jwn-js 1.0.3 → 1.0.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/package.json
CHANGED
|
@@ -5,8 +5,12 @@ import {Query} from "buildmsql";
|
|
|
5
5
|
* @param config
|
|
6
6
|
*/
|
|
7
7
|
export const createMariadb = (config: Record<string, any>) => {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
if(config.db.home) {
|
|
9
|
+
const home = new Query({debug: process.env.NODE_ENV === "production" ? 0 : 1});
|
|
10
|
+
const homePool = home.createPool(config.db.home);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
return {homePool, home};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return {};
|
|
12
16
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {createServer, ViteDevServer} from "vite";
|
|
2
2
|
import {Query, Connection} from "buildmsql";
|
|
3
|
+
import {apiUrl} from "./jest.setup";
|
|
3
4
|
|
|
4
5
|
declare global {
|
|
5
6
|
var server: ViteDevServer;
|
|
@@ -8,5 +9,14 @@ declare global {
|
|
|
8
9
|
export default async(config: Record<string, any>) => {
|
|
9
10
|
global.server = await createServer();
|
|
10
11
|
await global.server.listen();
|
|
11
|
-
await new Promise(resolve =>
|
|
12
|
+
await new Promise(resolve => {
|
|
13
|
+
const interval = setInterval(async() => {
|
|
14
|
+
try {
|
|
15
|
+
await fetch(apiUrl);
|
|
16
|
+
clearInterval(interval);
|
|
17
|
+
resolve(true);
|
|
18
|
+
} catch(e) {}
|
|
19
|
+
|
|
20
|
+
}, 50);
|
|
21
|
+
});
|
|
12
22
|
}
|
|
@@ -46,7 +46,13 @@ const node = (opt: Options): Plugin => {
|
|
|
46
46
|
process.exit(0);
|
|
47
47
|
}
|
|
48
48
|
} else {
|
|
49
|
-
|
|
49
|
+
const interval = setInterval(async() => {
|
|
50
|
+
try {
|
|
51
|
+
await fetch(`http://${cnf.host}:${cnf.vitePort}/start-server`);
|
|
52
|
+
clearInterval(interval);
|
|
53
|
+
} catch(e) {}
|
|
54
|
+
|
|
55
|
+
}, 50);
|
|
50
56
|
}
|
|
51
57
|
},
|
|
52
58
|
async closeBundle() {
|