File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
adminforth/commands/createApp/templates Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
import express from 'express';
2
2
import AdminForth from 'adminforth';
3
3
import usersResource from "./resources/adminuser.js";
4
+ import { fileURLToPath } from 'url';
5
+ import path from 'path';
4
6
5
7
const ADMIN_BASE_URL = '';
6
8
@@ -55,9 +57,10 @@ export const admin = new AdminForth({
55
57
],
56
58
});
57
59
58
- // Cross-platform check if script is executed directly
59
- const isMainModule = import.meta.url === new URL(process.argv[1], 'file:').href;
60
- if (isMainModule) {
60
+ const currentFilePath = fileURLToPath(import.meta.url);
61
+ const executedFilePath = path.resolve(process.argv[1]);
62
+
63
+ if (currentFilePath === executedFilePath) {
61
64
const app = express();
62
65
app.use(express.json());
63
66
You can’t perform that action at this time.
0 commit comments