@nanoforge-dev/cli 1.6.0 ā 1.6.1-alpha.upgrade-schematics.0
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/command.loader.js +41 -14
- package/dist/command.loader.js.map +1 -1
- package/dist/nf.js +42 -15
- package/package.json +17 -17
package/dist/command.loader.js
CHANGED
|
@@ -855,7 +855,7 @@ const runSafe = async (fn, fallback) => {
|
|
|
855
855
|
}
|
|
856
856
|
};
|
|
857
857
|
//#endregion
|
|
858
|
-
//#region \0@oxc-project+runtime@0.
|
|
858
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
|
|
859
859
|
function __decorate(decorators, target, key, desc) {
|
|
860
860
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
861
861
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -964,12 +964,21 @@ __decorate([
|
|
|
964
964
|
Type(() => DirsConfig),
|
|
965
965
|
ValidateNested()
|
|
966
966
|
], ServerConfig.prototype, "dirs", void 0);
|
|
967
|
+
var SslConfig = class {
|
|
968
|
+
enable;
|
|
969
|
+
cert;
|
|
970
|
+
key;
|
|
971
|
+
};
|
|
972
|
+
__decorate([Expose(), IsBoolean()], SslConfig.prototype, "enable", void 0);
|
|
973
|
+
__decorate([Expose(), IsString()], SslConfig.prototype, "cert", void 0);
|
|
974
|
+
__decorate([Expose(), IsString()], SslConfig.prototype, "key", void 0);
|
|
967
975
|
var Config = class {
|
|
968
976
|
name;
|
|
969
977
|
language;
|
|
970
978
|
initFunctions;
|
|
971
979
|
client;
|
|
972
980
|
server;
|
|
981
|
+
ssl;
|
|
973
982
|
};
|
|
974
983
|
__decorate([
|
|
975
984
|
Expose(),
|
|
@@ -988,6 +997,11 @@ __decorate([
|
|
|
988
997
|
Type(() => ServerConfig),
|
|
989
998
|
ValidateNested()
|
|
990
999
|
], Config.prototype, "server", void 0);
|
|
1000
|
+
__decorate([
|
|
1001
|
+
Expose(),
|
|
1002
|
+
Type(() => SslConfig),
|
|
1003
|
+
ValidateNested()
|
|
1004
|
+
], Config.prototype, "ssl", void 0);
|
|
991
1005
|
//#endregion
|
|
992
1006
|
//#region src/lib/constants.ts
|
|
993
1007
|
const CONFIG_FILE_NAME = "nanoforge.config.json";
|
|
@@ -1014,6 +1028,11 @@ const CONFIG_DEFAULTS = {
|
|
|
1014
1028
|
name: "nanoforge-app",
|
|
1015
1029
|
language: "ts",
|
|
1016
1030
|
initFunctions: true,
|
|
1031
|
+
ssl: {
|
|
1032
|
+
enable: false,
|
|
1033
|
+
cert: "",
|
|
1034
|
+
key: ""
|
|
1035
|
+
},
|
|
1017
1036
|
client: {
|
|
1018
1037
|
enable: true,
|
|
1019
1038
|
port: "3000",
|
|
@@ -1200,10 +1219,14 @@ var AbstractCollection = class {
|
|
|
1200
1219
|
onFail
|
|
1201
1220
|
});
|
|
1202
1221
|
}
|
|
1203
|
-
buildCommandLine(name, options, flags = [
|
|
1222
|
+
buildCommandLine(name, options, flags = [
|
|
1223
|
+
"--no-dry-run",
|
|
1224
|
+
"--allow-private",
|
|
1225
|
+
"--no-debug"
|
|
1226
|
+
]) {
|
|
1204
1227
|
return [
|
|
1205
|
-
`${this.collection}:${name}`,
|
|
1206
1228
|
...flags,
|
|
1229
|
+
`'${getModulePath(this.collection + "/collection.json")}:${name}'`,
|
|
1207
1230
|
...this.serializeOptions(options)
|
|
1208
1231
|
];
|
|
1209
1232
|
}
|
|
@@ -1407,9 +1430,11 @@ var EditorAction = class extends AbstractAction {
|
|
|
1407
1430
|
async handle(args, options) {
|
|
1408
1431
|
const directory = getDirectoryInput(options);
|
|
1409
1432
|
const path = getPathInput(args);
|
|
1410
|
-
const
|
|
1433
|
+
const shouldOpen = getEditorOpenInput(options, !!path);
|
|
1434
|
+
const url = `http://localhost:3000/load-project${path ? `?projectPath=${encodeURIComponent(path)}` : ""}`;
|
|
1435
|
+
console.log(`\nš Editor running! Open it in your browser: \x1b[36m${url}\x1b[0m\n`);
|
|
1411
1436
|
this.startEditor(directory);
|
|
1412
|
-
if (
|
|
1437
|
+
if (shouldOpen) await this.openBrowser(url);
|
|
1413
1438
|
return { keepAlive: true };
|
|
1414
1439
|
}
|
|
1415
1440
|
async startEditor(directory) {
|
|
@@ -1418,8 +1443,8 @@ var EditorAction = class extends AbstractAction {
|
|
|
1418
1443
|
await PackageManagerFactory.create("local_bun").run("Editor", directory, editorPath, [], {}, [], true);
|
|
1419
1444
|
});
|
|
1420
1445
|
}
|
|
1421
|
-
async
|
|
1422
|
-
await open(
|
|
1446
|
+
async openBrowser(url) {
|
|
1447
|
+
await open(url);
|
|
1423
1448
|
}
|
|
1424
1449
|
};
|
|
1425
1450
|
//#endregion
|
|
@@ -2070,7 +2095,7 @@ var StartAction = class extends AbstractAction {
|
|
|
2070
2095
|
const serverDir = getStringInputWithDefault(options, "serverDir", config.server.outDir);
|
|
2071
2096
|
const watch = getWatchInput(options);
|
|
2072
2097
|
const port = getStringInputWithDefault(options, "port", config.client.port);
|
|
2073
|
-
const ssl = this.resolveSSL(options);
|
|
2098
|
+
const ssl = this.resolveSSL(options, config);
|
|
2074
2099
|
const tasks = this.buildStartTasks(config, directory, {
|
|
2075
2100
|
clientDir,
|
|
2076
2101
|
serverDir,
|
|
@@ -2081,12 +2106,14 @@ var StartAction = class extends AbstractAction {
|
|
|
2081
2106
|
await Promise.all(tasks);
|
|
2082
2107
|
return { keepAlive: true };
|
|
2083
2108
|
}
|
|
2084
|
-
resolveSSL(options) {
|
|
2085
|
-
const
|
|
2086
|
-
const
|
|
2087
|
-
if (!
|
|
2088
|
-
|
|
2089
|
-
|
|
2109
|
+
resolveSSL(options, config) {
|
|
2110
|
+
const cliCert = getStringInput(options, "cert");
|
|
2111
|
+
const cliKey = getStringInput(options, "key");
|
|
2112
|
+
if (!Boolean(cliCert || cliKey || config.ssl?.enable)) return void 0;
|
|
2113
|
+
const cert = cliCert ? cliCert : config.ssl?.cert;
|
|
2114
|
+
const key = cliKey ? cliKey : config.ssl?.key;
|
|
2115
|
+
if (!cert) throw new CLIError("No certificate found for SSL.", "Please provide a certificate path with --cert or configure 'ssl.cert' in your nanoforge.config.json.");
|
|
2116
|
+
if (!key) throw new CLIError("No key found for SSL.", "Please provide a key path with --key or configure 'ssl.key' in your nanoforge.config.json.");
|
|
2090
2117
|
return {
|
|
2091
2118
|
cert,
|
|
2092
2119
|
key
|