@m00rl0ck/simple-builder 1.0.7 ā 1.0.9
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/dev-server.js +4 -16
- package/index.js +2 -2
- package/package.json +1 -1
package/dev-server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import { build
|
|
4
|
+
import { build } from './index.js';
|
|
5
5
|
|
|
6
6
|
const PORT = 3000;
|
|
7
7
|
const ROOT = process.cwd();
|
|
@@ -107,28 +107,16 @@ const server = http.createServer((req, res) => {
|
|
|
107
107
|
serveFile(req, res);
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
// ======================
|
|
112
|
-
// š Build
|
|
113
|
-
// ======================
|
|
114
|
-
|
|
115
|
-
export function build({ watch, isProd }) {
|
|
116
|
-
if (!!watch) {
|
|
117
|
-
return watch();
|
|
118
|
-
} else {
|
|
119
|
-
return build({ isProd });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
110
|
// ======================
|
|
125
111
|
// ā¶ļø START
|
|
126
112
|
// ======================
|
|
127
113
|
|
|
128
|
-
|
|
114
|
+
function runServer({ isProd }) {
|
|
129
115
|
build({ watch: true, isProd })
|
|
130
116
|
|
|
131
117
|
server.listen(PORT, () => {
|
|
132
118
|
console.log(`\nš Dev server running: http://localhost:${PORT}\n`);
|
|
133
119
|
});
|
|
134
120
|
}
|
|
121
|
+
|
|
122
|
+
export { build, runServer };
|
package/index.js
CHANGED
|
@@ -96,7 +96,7 @@ function buildHTML(isProd) {
|
|
|
96
96
|
// š WATCH MODE
|
|
97
97
|
// ======================
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
function watchBuild() {
|
|
100
100
|
console.log('š Watch mode ON...\n');
|
|
101
101
|
|
|
102
102
|
fs.watch(SRC_DIR, { recursive: true }, (eventType, filename) => {
|
|
@@ -116,7 +116,7 @@ export function watch() {
|
|
|
116
116
|
|
|
117
117
|
export function build({ watch, isProd }) {
|
|
118
118
|
if (!!watch) {
|
|
119
|
-
return
|
|
119
|
+
return watchBuild();
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
console.log(`\nš Build started (${isProd} ? 'production' : 'development')`);
|