@evjs/cli 0.0.1-rc.27 → 0.0.1-rc.28
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/README.md +2 -2
- package/dist/create-webpack-config.js +5 -2
- package/dist/index.js +4 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ export default defineConfig({
|
|
|
55
55
|
},
|
|
56
56
|
server: {
|
|
57
57
|
endpoint: "/api/fn",
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
dev: { port: 3001 },
|
|
60
60
|
},
|
|
61
61
|
});
|
|
@@ -77,7 +77,7 @@ my-app/
|
|
|
77
77
|
├── api/ # server functions
|
|
78
78
|
│ ├── users.server.ts
|
|
79
79
|
│ └── posts.server.ts
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
└── auth.ts
|
|
82
82
|
```
|
|
83
83
|
|
|
@@ -19,8 +19,8 @@ export function createWebpackConfig(config, cwd) {
|
|
|
19
19
|
const isProduction = process.env.NODE_ENV === "production";
|
|
20
20
|
const HtmlWebpackPlugin = esmRequire("html-webpack-plugin");
|
|
21
21
|
const { EvWebpackPlugin } = esmRequire("@evjs/webpack-plugin");
|
|
22
|
-
const pluginOptions = server
|
|
23
|
-
? { server: {
|
|
22
|
+
const pluginOptions = server
|
|
23
|
+
? { server: { entry: server.entry } }
|
|
24
24
|
: undefined;
|
|
25
25
|
// Resolve loader paths from evjs's dependency tree so they work
|
|
26
26
|
// even when the user's project doesn't list them as direct deps.
|
|
@@ -93,6 +93,9 @@ export function createWebpackConfig(config, cwd) {
|
|
|
93
93
|
plugins: [
|
|
94
94
|
new HtmlWebpackPlugin({ template: html }),
|
|
95
95
|
new EvWebpackPlugin(pluginOptions),
|
|
96
|
+
...(!isProduction
|
|
97
|
+
? [new (esmRequire("webpack").HotModuleReplacementPlugin)()]
|
|
98
|
+
: []),
|
|
96
99
|
],
|
|
97
100
|
optimization: isProduction
|
|
98
101
|
? { splitChunks: { chunks: "all" } }
|
package/dist/index.js
CHANGED
|
@@ -62,8 +62,8 @@ program
|
|
|
62
62
|
const bootstrapPath = path.resolve(cwd, "dist/server/_dev_start.cjs");
|
|
63
63
|
if (fs.existsSync(manifestPath)) {
|
|
64
64
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
65
|
-
//
|
|
66
|
-
if (
|
|
65
|
+
// Start API server if there's a server entry
|
|
66
|
+
if (!manifest.server?.entry)
|
|
67
67
|
return;
|
|
68
68
|
apiStarted = true;
|
|
69
69
|
const backendConfig = evjsConfig?.server?.backend ?? "node";
|
|
@@ -71,9 +71,10 @@ program
|
|
|
71
71
|
logger.info `Server bundle detected, starting ${backend} API...`;
|
|
72
72
|
try {
|
|
73
73
|
const serverBundlePath = path.resolve(cwd, "dist/server", manifest.server.entry);
|
|
74
|
+
fs.ensureDirSync(path.dirname(bootstrapPath));
|
|
74
75
|
fs.writeFileSync(bootstrapPath, [
|
|
75
76
|
`const bundle = require(${JSON.stringify(serverBundlePath)});`,
|
|
76
|
-
`const app = bundle.createApp({ endpoint: ${JSON.stringify(evjsConfig?.server?.endpoint ?? CONFIG_DEFAULTS.endpoint)} });`,
|
|
77
|
+
`const app = bundle.app || bundle.createApp({ endpoint: ${JSON.stringify(evjsConfig?.server?.endpoint ?? CONFIG_DEFAULTS.endpoint)} });`,
|
|
77
78
|
`const { serve } = require("@evjs/server/node");`,
|
|
78
79
|
`serve(app, { port: ${serverPort} });`,
|
|
79
80
|
].join("\n"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evjs/cli",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.28",
|
|
4
4
|
"description": "CLI and configuration layer for the evjs framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/config.js",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@evjs/webpack-plugin": "*",
|
|
32
32
|
"@logtape/logtape": "^2.0.4",
|
|
33
|
-
"@swc/core": "^1.15.
|
|
33
|
+
"@swc/core": "^1.15.21",
|
|
34
34
|
"commander": "^12.1.0",
|
|
35
|
-
"execa": "^9.
|
|
36
|
-
"fs-extra": "^11.3.
|
|
35
|
+
"execa": "^9.6.1",
|
|
36
|
+
"fs-extra": "^11.3.4",
|
|
37
37
|
"glob": "^13.0.6",
|
|
38
38
|
"html-webpack-plugin": "^5.6.6",
|
|
39
39
|
"picocolors": "^1.1.1",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/fs-extra": "^11.0.4",
|
|
47
|
-
"@types/node": "^22.
|
|
48
|
-
"typescript": "^
|
|
47
|
+
"@types/node": "^22.19.15",
|
|
48
|
+
"typescript": "^6.0.2"
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://github.com/evaijs/evjs#readme",
|
|
51
51
|
"bugs": {
|