Skip to content

Commit 0937a51

Browse files
authored
Merge pull request #201 from devforth/next
fix: CLI bundle command, also prevent duplicating of AdminFOrth initi…
2 parents 1e0230f + 06864a2 commit 0937a51

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

adminforth/commands/callTsProxy.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import chalk from "chalk";
77
const currentFilePath = import.meta.url;
88
const currentFileFolder = path.dirname(currentFilePath).replace("file:", "");
99

10-
export function callTsProxy(tsCode) {
10+
export function callTsProxy(tsCode, silent=false) {
1111

1212
process.env.HEAVY_DEBUG && console.log("🌐 Calling tsproxy with code:", path.join(currentFileFolder, "proxy.ts"));
1313
return new Promise((resolve, reject) => {
@@ -30,9 +30,11 @@ export function callTsProxy(tsCode) {
3030
if (code === 0) {
3131
try {
3232
const parsed = JSON.parse(stdout);
33-
parsed.capturedLogs.forEach((log) => {
34-
console.log(...log);
35-
});
33+
if (!silent) {
34+
parsed.capturedLogs.forEach((log) => {
35+
console.log(...log);
36+
});
37+
}
3638

3739
if (parsed.error) {
3840
reject(new Error(`${parsed.error}\n${parsed.stack}`));
@@ -73,13 +75,13 @@ export async function findAdminInstance() {
7375
const fileNoTs = file.replace(/\.ts$/, "");
7476
process.env.HEAVY_DEBUG && console.log(`🪲 Trying bundleing ${file}...`);
7577
try {
76-
res = await callTsProxy(`
78+
const res = await callTsProxy(`
7779
import { admin } from './${fileNoTs}.js';
7880
7981
export async function exec() {
8082
return admin.formatAdminForth();
8183
}
82-
`);
84+
`, true);
8385
instanceFound.file = fileNoTs;
8486
instanceFound.version = res;
8587
break;

adminforth/modules/codeInjector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ class CodeInjector implements ICodeInjector {
814814
// save hash
815815
await fs.promises.writeFile(path.join(serveDir, '.adminforth_messages_hash'), sourcesHash);
816816
} else {
817-
console.log(`Skipping AdminForth i18n messages extraction - it is already done for these sources set`);
817+
console.log(`AdminForth i18n message extraction skipped — build already performed for the current sources.`);
818818
}
819819

820820
if (!hotReload) {
@@ -836,7 +836,7 @@ class CodeInjector implements ICodeInjector {
836836
// save hash
837837
await fs.promises.writeFile(path.join(serveDir, '.adminforth_build_hash'), sourcesHash);
838838
} else {
839-
console.log(`Skipping AdminForth SPA bundle - it is already done for these sources set`);
839+
console.log(`Skipping AdminForth SPA bundling - already completed for the current sources.`);
840840
}
841841
} else {
842842

0 commit comments

Comments
 (0)