@studiometa/forge-cli 0.4.7 → 0.4.8
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/dist/cli.js +17 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/deployments/handlers.d.ts.map +1 -1
- package/dist/commands/env/handlers.d.ts.map +1 -1
- package/dist/commands/nginx/handlers.d.ts.map +1 -1
- package/dist/commands/php/handlers.d.ts.map +1 -1
- package/dist/utils/print-content.d.ts +9 -0
- package/dist/utils/print-content.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -2058,6 +2058,18 @@ function reportTextDrift(label, remote, local, formatter) {
|
|
|
2058
2058
|
} : null, formatter);
|
|
2059
2059
|
}
|
|
2060
2060
|
//#endregion
|
|
2061
|
+
//#region src/utils/print-content.ts
|
|
2062
|
+
/**
|
|
2063
|
+
* Print file content fetched from Forge, such as a configuration or a script.
|
|
2064
|
+
*/
|
|
2065
|
+
/**
|
|
2066
|
+
* Write the content as it is, with a newline only when it does not end with one,
|
|
2067
|
+
* so `forge <command> get > file` round-trips with `--file file --check` without drift.
|
|
2068
|
+
*/
|
|
2069
|
+
function printContent(content) {
|
|
2070
|
+
process.stdout.write(content.endsWith("\n") ? content : `${content}\n`);
|
|
2071
|
+
}
|
|
2072
|
+
//#endregion
|
|
2061
2073
|
//#region src/commands/deployments/handlers.ts
|
|
2062
2074
|
async function deploymentsList(ctx) {
|
|
2063
2075
|
const server = String(ctx.options.server ?? "");
|
|
@@ -2126,7 +2138,7 @@ async function deploymentsScript(ctx) {
|
|
|
2126
2138
|
site_id: await resolveSiteId(site, server_id, execCtx)
|
|
2127
2139
|
}, execCtx);
|
|
2128
2140
|
if (ctx.formatter.isJson()) console.log(JSON.stringify({ content: result.data }));
|
|
2129
|
-
else
|
|
2141
|
+
else printContent(result.data);
|
|
2130
2142
|
}, ctx.formatter);
|
|
2131
2143
|
}
|
|
2132
2144
|
async function deploymentsUpdateScript(ctx) {
|
|
@@ -2414,7 +2426,7 @@ async function envGet(ctx) {
|
|
|
2414
2426
|
site_id: await resolveSiteId(site, server_id, execCtx)
|
|
2415
2427
|
}, execCtx);
|
|
2416
2428
|
if (ctx.formatter.isJson()) console.log(JSON.stringify({ content: result.data }));
|
|
2417
|
-
else
|
|
2429
|
+
else printContent(result.data);
|
|
2418
2430
|
}, ctx.formatter);
|
|
2419
2431
|
}
|
|
2420
2432
|
async function envUpdate(ctx) {
|
|
@@ -2775,7 +2787,7 @@ async function nginxGet(ctx) {
|
|
|
2775
2787
|
site_id: await resolveSiteId(site, server_id, execCtx)
|
|
2776
2788
|
}, execCtx);
|
|
2777
2789
|
if (ctx.formatter.isJson()) console.log(JSON.stringify({ content: result.data }));
|
|
2778
|
-
else
|
|
2790
|
+
else printContent(result.data);
|
|
2779
2791
|
}, ctx.formatter);
|
|
2780
2792
|
}
|
|
2781
2793
|
async function nginxUpdate(ctx) {
|
|
@@ -3127,7 +3139,7 @@ async function phpConfig(ctx) {
|
|
|
3127
3139
|
...target
|
|
3128
3140
|
}, execCtx);
|
|
3129
3141
|
if (ctx.formatter.isJson()) console.log(JSON.stringify({ content: result.data }));
|
|
3130
|
-
else
|
|
3142
|
+
else printContent(result.data);
|
|
3131
3143
|
});
|
|
3132
3144
|
}
|
|
3133
3145
|
/**
|
|
@@ -5102,7 +5114,7 @@ function isVersionRequest({ command, options }) {
|
|
|
5102
5114
|
}
|
|
5103
5115
|
//#endregion
|
|
5104
5116
|
//#region src/cli.ts
|
|
5105
|
-
var VERSION = "0.4.
|
|
5117
|
+
var VERSION = "0.4.8";
|
|
5106
5118
|
function showHelp() {
|
|
5107
5119
|
console.log(`
|
|
5108
5120
|
${colors.bold("forge")} v${VERSION}
|