makepack 1.5.18 → 1.5.20
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
|
@@ -4,14 +4,12 @@ import chalk from 'chalk';
|
|
|
4
4
|
import makepackConfig from '../../makepack-config.js';
|
|
5
5
|
import viteSetup from './vite.js';
|
|
6
6
|
import userExpress from './user-express.js';
|
|
7
|
-
import path from 'path';
|
|
8
7
|
|
|
9
8
|
const app = express();
|
|
10
9
|
const server = async () => {
|
|
11
10
|
const config = await makepackConfig()
|
|
12
11
|
userExpress(app)
|
|
13
12
|
await viteSetup(app)
|
|
14
|
-
app.use(express.static(path.join(process.cwd(), 'public')));
|
|
15
13
|
app.use((_req, res) => {
|
|
16
14
|
res.status(500).send('Internal Server Error');
|
|
17
15
|
});
|
|
@@ -44,29 +44,25 @@ const start = async () => {
|
|
|
44
44
|
|
|
45
45
|
if (fs.existsSync(expressjs) || fs.existsSync(expressts)) {
|
|
46
46
|
let filename = fs.existsSync(expressjs) ? "express.js" : "express.ts";
|
|
47
|
-
|
|
48
|
-
esbuild.build({
|
|
49
|
-
entryPoints: [filename],
|
|
50
|
-
outfile: path.resolve(__dirname, 'user-express.js'),
|
|
51
|
-
bundle: true,
|
|
52
|
-
format: 'esm',
|
|
53
|
-
platform: 'node',
|
|
54
|
-
});
|
|
55
|
-
}
|
|
47
|
+
let outfile = path.resolve(__dirname, 'user-express.js')
|
|
56
48
|
|
|
57
|
-
|
|
49
|
+
const ctx = await esbuild.context({
|
|
50
|
+
entryPoints: [filename],
|
|
51
|
+
outfile: path.resolve(__dirname, 'user-express.js'),
|
|
52
|
+
bundle: true,
|
|
53
|
+
format: 'esm',
|
|
54
|
+
platform: 'node',
|
|
55
|
+
external: ['*'],
|
|
56
|
+
})
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
ctx.watch()
|
|
59
|
+
|
|
60
|
+
const watcher = chokidar.watch(outfile, {
|
|
60
61
|
persistent: true,
|
|
61
62
|
ignoreInitial: true,
|
|
62
63
|
});
|
|
63
64
|
|
|
64
65
|
watcher.on('change', async () => {
|
|
65
|
-
build()
|
|
66
|
-
startServer(config)
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
watcher.on('unlink', (path) => {
|
|
70
66
|
startServer(config)
|
|
71
67
|
});
|
|
72
68
|
|