@nanoforge-dev/cli 1.4.0 → 1.4.1
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 +124 -35
- package/dist/command.loader.js +283 -99
- package/dist/command.loader.js.map +1 -1
- package/dist/nf.js +289 -101
- package/package.json +18 -14
package/dist/nf.js
CHANGED
|
@@ -40,7 +40,7 @@ var require_package = __commonJS({
|
|
|
40
40
|
module.exports = {
|
|
41
41
|
$schema: "https://json.schemastore.org/package.json",
|
|
42
42
|
name: "@nanoforge-dev/cli",
|
|
43
|
-
version: "1.4.
|
|
43
|
+
version: "1.4.1",
|
|
44
44
|
description: "NanoForge CLI",
|
|
45
45
|
keywords: [
|
|
46
46
|
"nanoforge",
|
|
@@ -103,6 +103,7 @@ var require_package = __commonJS({
|
|
|
103
103
|
commander: "catalog:cli",
|
|
104
104
|
dotenv: "catalog:libs",
|
|
105
105
|
"node-emoji": "catalog:cli",
|
|
106
|
+
open: "catalog:libs",
|
|
106
107
|
ora: "catalog:cli",
|
|
107
108
|
rc9: "catalog:libs",
|
|
108
109
|
"reflect-metadata": "catalog:libs"
|
|
@@ -126,7 +127,10 @@ var require_package = __commonJS({
|
|
|
126
127
|
typescript: "catalog:build",
|
|
127
128
|
vitest: "catalog:tests"
|
|
128
129
|
},
|
|
129
|
-
|
|
130
|
+
optionalDependencies: {
|
|
131
|
+
"@nanoforge-dev/editor": "file:../editor"
|
|
132
|
+
},
|
|
133
|
+
packageManager: "pnpm@10.33.0",
|
|
130
134
|
engines: {
|
|
131
135
|
node: "25"
|
|
132
136
|
},
|
|
@@ -266,10 +270,10 @@ var loadLocalBinCommandLoader = /* @__PURE__ */ __name(async () => {
|
|
|
266
270
|
}, "loadLocalBinCommandLoader");
|
|
267
271
|
|
|
268
272
|
// src/command/command.loader.ts
|
|
269
|
-
import { red as
|
|
273
|
+
import { red as red7 } from "ansis";
|
|
270
274
|
|
|
271
275
|
// src/lib/ui/messages.ts
|
|
272
|
-
import { green } from "ansis";
|
|
276
|
+
import { bold, green } from "ansis";
|
|
273
277
|
|
|
274
278
|
// src/lib/ui/emojis.ts
|
|
275
279
|
import { get } from "node-emoji";
|
|
@@ -304,8 +308,9 @@ var Messages = {
|
|
|
304
308
|
BUILD_WATCH_START: "Watching for changes...",
|
|
305
309
|
BUILD_PART_IN_PROGRESS: /* @__PURE__ */ __name((part) => `Building ${part}`, "BUILD_PART_IN_PROGRESS"),
|
|
306
310
|
BUILD_PART_WATCH_IN_PROGRESS: /* @__PURE__ */ __name((part) => `${part} updated, rebuilding`, "BUILD_PART_WATCH_IN_PROGRESS"),
|
|
311
|
+
BUILD_PART_SUCCESS: /* @__PURE__ */ __name((name) => success(`Build of ${name} succeeded!`), "BUILD_PART_SUCCESS"),
|
|
307
312
|
BUILD_PART_FAILED: /* @__PURE__ */ __name((part, command) => failure(`Build of ${part} failed!
|
|
308
|
-
Try running manually: ${command}`), "BUILD_PART_FAILED"),
|
|
313
|
+
Try running manually: ${bold(command)}`), "BUILD_PART_FAILED"),
|
|
309
314
|
// --- Install ---
|
|
310
315
|
INSTALL_START: "NanoForge Installation",
|
|
311
316
|
INSTALL_SUCCESS: success("Installation completed!"),
|
|
@@ -325,6 +330,7 @@ Try running manually: ${command}`), "BUILD_PART_FAILED"),
|
|
|
325
330
|
NEW_START: "NanoForge Project Creation",
|
|
326
331
|
NEW_SUCCESS: success("Project successfully created!"),
|
|
327
332
|
NEW_FAILED: failure("Project creation failed!"),
|
|
333
|
+
NEW_GENERATION_START: "Creating project...",
|
|
328
334
|
NEW_NAME_QUESTION: "What is the name of your project?",
|
|
329
335
|
NEW_PACKAGE_MANAGER_QUESTION: "Which package manager do you want to use?",
|
|
330
336
|
NEW_LANGUAGE_QUESTION: "Which language do you want to use?",
|
|
@@ -332,6 +338,8 @@ Try running manually: ${command}`), "BUILD_PART_FAILED"),
|
|
|
332
338
|
NEW_SERVER_QUESTION: "Do you want to generate a server for multiplayer?",
|
|
333
339
|
NEW_SKIP_INSTALL_QUESTION: "Do you want to skip dependency installation?",
|
|
334
340
|
NEW_DOCKER_QUESTION: "Do you want to add a Dockerfile for containerization?",
|
|
341
|
+
NEW_GIT_QUESTION: "Do you want to create a git repository?",
|
|
342
|
+
NEW_GIT_REMOTE_QUESTION: "Do you want to setup a git remote? (leave empty if you don't want to)",
|
|
335
343
|
// --- Create ---
|
|
336
344
|
CREATE_START: "NanoForge Component/System Creation",
|
|
337
345
|
CREATE_SUCCESS: success("Element successfully created!"),
|
|
@@ -353,6 +361,9 @@ Try running manually: ${command}`), "BUILD_PART_FAILED"),
|
|
|
353
361
|
START_PART_IN_PROGRESS: /* @__PURE__ */ __name((part) => `Starting ${part}...`, "START_PART_IN_PROGRESS"),
|
|
354
362
|
START_PART_SUCCESS: /* @__PURE__ */ __name((part) => success(`${part} terminated.`), "START_PART_SUCCESS"),
|
|
355
363
|
START_PART_FAILED: /* @__PURE__ */ __name((part) => failure(`${part} failed!`), "START_PART_FAILED"),
|
|
364
|
+
EDITOR_START: "NanoForge Editor",
|
|
365
|
+
EDITOR_SUCCESS: "Editor ended",
|
|
366
|
+
EDITOR_FAILED: failure("Editor failed!"),
|
|
356
367
|
// --- Publish ---
|
|
357
368
|
PUBLISH_START: "NanoForge Publish",
|
|
358
369
|
PUBLISH_SUCCESS: success("Publish completed!"),
|
|
@@ -364,7 +375,6 @@ Try running manually: ${command}`), "BUILD_PART_FAILED"),
|
|
|
364
375
|
UNPUBLISH_FAILED: failure("Unpublish failed!"),
|
|
365
376
|
UNPUBLISH_IN_PROGRESS: /* @__PURE__ */ __name((name) => `Unpublishing ${name}...`, "UNPUBLISH_IN_PROGRESS"),
|
|
366
377
|
// --- Schematics ---
|
|
367
|
-
SCHEMATICS_START: "Running schematics",
|
|
368
378
|
SCHEMATIC_IN_PROGRESS: /* @__PURE__ */ __name((name) => `Generating ${name}...`, "SCHEMATIC_IN_PROGRESS"),
|
|
369
379
|
SCHEMATIC_WATCH_IN_PROGRESS: /* @__PURE__ */ __name((name) => `Change detected, regenerating ${name}...`, "SCHEMATIC_WATCH_IN_PROGRESS"),
|
|
370
380
|
SCHEMATIC_SUCCESS: /* @__PURE__ */ __name((name) => success(`${name} generated successfully!`), "SCHEMATIC_SUCCESS"),
|
|
@@ -374,10 +384,20 @@ Try running manually: ${command}`), "BUILD_PART_FAILED"),
|
|
|
374
384
|
PACKAGE_MANAGER_INSTALLATION_NOTHING: "Nothing to install.",
|
|
375
385
|
PACKAGE_MANAGER_INSTALLATION_SUCCEED: /* @__PURE__ */ __name((names) => names ? success(`Packages installed: ${names.map((n) => green(n)).join(", ")}`) : success("Packages installed!"), "PACKAGE_MANAGER_INSTALLATION_SUCCEED"),
|
|
376
386
|
PACKAGE_MANAGER_INSTALLATION_FAILED: /* @__PURE__ */ __name((command) => failure(`Package installation failed!
|
|
377
|
-
Try running manually: ${command}`), "PACKAGE_MANAGER_INSTALLATION_FAILED"),
|
|
387
|
+
Try running manually: ${bold(command)}`), "PACKAGE_MANAGER_INSTALLATION_FAILED"),
|
|
388
|
+
// --- Git init ---
|
|
389
|
+
GIT_INIT_IN_PROGRESS: `Initializing git repository... ${Emojis.COFFEE}`,
|
|
390
|
+
GIT_INIT_SUCCEED: success("Git repository initialized!"),
|
|
391
|
+
GIT_INIT_FAILED: /* @__PURE__ */ __name((command) => failure(`Git repository initialization failed!
|
|
392
|
+
Try running manually: ${bold(command)}`), "GIT_INIT_FAILED"),
|
|
393
|
+
// --- Git remote ---
|
|
394
|
+
GIT_REMOTE_IN_PROGRESS: `Adding git remote... ${Emojis.COFFEE}`,
|
|
395
|
+
GIT_REMOTE_SUCCEED: success("Git remote added!"),
|
|
396
|
+
GIT_REMOTE_FAILED: /* @__PURE__ */ __name((command) => failure(`Git remote addition failed!
|
|
397
|
+
Try running manually: ${bold(command)}`), "GIT_REMOTE_FAILED"),
|
|
378
398
|
// --- Runner ---
|
|
379
399
|
RUNNER_EXECUTION_ERROR: /* @__PURE__ */ __name((command) => `
|
|
380
|
-
Failed to execute command: ${command}`, "RUNNER_EXECUTION_ERROR")
|
|
400
|
+
Failed to execute command: ${bold(command)}`, "RUNNER_EXECUTION_ERROR")
|
|
381
401
|
};
|
|
382
402
|
|
|
383
403
|
// src/lib/ui/prefixes.ts
|
|
@@ -589,6 +609,11 @@ var getDevGenerateInput = /* @__PURE__ */ __name((inputs) => {
|
|
|
589
609
|
return getBooleanInputWithDefault(inputs, "generate", false);
|
|
590
610
|
}, "getDevGenerateInput");
|
|
591
611
|
|
|
612
|
+
// src/lib/input/inputs/editor/open.input.ts
|
|
613
|
+
var getEditorOpenInput = /* @__PURE__ */ __name((inputs, defaultValue) => {
|
|
614
|
+
return getBooleanInputWithDefault(inputs, "open", defaultValue);
|
|
615
|
+
}, "getEditorOpenInput");
|
|
616
|
+
|
|
592
617
|
// src/lib/input/inputs/install/lib.input.ts
|
|
593
618
|
function getInstallLibInput(inputs) {
|
|
594
619
|
return getBooleanInputWithDefault(inputs, "lib", false);
|
|
@@ -710,7 +735,7 @@ var getNewStrictOrAsk = /* @__PURE__ */ __name((inputs) => {
|
|
|
710
735
|
}, "getNewStrictOrAsk");
|
|
711
736
|
|
|
712
737
|
// src/lib/package-manager/package-manager.ts
|
|
713
|
-
import {
|
|
738
|
+
import { red as red4 } from "ansis";
|
|
714
739
|
|
|
715
740
|
// src/lib/runner/process-logger.ts
|
|
716
741
|
import { green as green2, red as red2, yellow } from "ansis";
|
|
@@ -757,15 +782,16 @@ var resolveCLINodeBinaryPath = /* @__PURE__ */ __name((name) => {
|
|
|
757
782
|
}, "resolveCLINodeBinaryPath");
|
|
758
783
|
|
|
759
784
|
// src/lib/utils/spinner.ts
|
|
760
|
-
|
|
761
|
-
|
|
785
|
+
import { red as red3 } from "ansis";
|
|
786
|
+
var withSpinner = /* @__PURE__ */ __name(async (task, loadingMessage, successMessage, failureMessage, onError) => {
|
|
787
|
+
const spinner = getSpinner(loadingMessage);
|
|
762
788
|
spinner.start();
|
|
763
789
|
try {
|
|
764
790
|
const value = await task(spinner);
|
|
765
|
-
spinner.succeed();
|
|
791
|
+
spinner.succeed(successMessage);
|
|
766
792
|
return { success: true, value };
|
|
767
793
|
} catch (error) {
|
|
768
|
-
spinner.fail();
|
|
794
|
+
spinner.fail(red3(failureMessage));
|
|
769
795
|
if (onError) onError();
|
|
770
796
|
return { success: false, error };
|
|
771
797
|
}
|
|
@@ -787,12 +813,10 @@ var PackageManager = class {
|
|
|
787
813
|
async install(directory) {
|
|
788
814
|
const args = [this.commands.install, this.commands.silentFlag];
|
|
789
815
|
const result = await withSpinner(
|
|
816
|
+
() => this.exec(args, directory),
|
|
790
817
|
Messages.PACKAGE_MANAGER_INSTALLATION_IN_PROGRESS,
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
this.logSuccess(Messages.PACKAGE_MANAGER_INSTALLATION_SUCCEED());
|
|
794
|
-
},
|
|
795
|
-
() => this.logFailure(this.formatFailCommand([this.commands.install]))
|
|
818
|
+
Messages.PACKAGE_MANAGER_INSTALLATION_SUCCEED(),
|
|
819
|
+
Messages.PACKAGE_MANAGER_INSTALLATION_FAILED(this.formatFailCommand([this.commands.install]))
|
|
796
820
|
);
|
|
797
821
|
return result.success;
|
|
798
822
|
}
|
|
@@ -815,11 +839,10 @@ var PackageManager = class {
|
|
|
815
839
|
...flags
|
|
816
840
|
];
|
|
817
841
|
const result = await withSpinner(
|
|
842
|
+
() => this.exec(args, directory),
|
|
818
843
|
message,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
},
|
|
822
|
-
() => this.logBuildFailure(name)
|
|
844
|
+
Messages.BUILD_PART_SUCCESS(name),
|
|
845
|
+
Messages.BUILD_PART_FAILED(name, this.formatFailCommand(args))
|
|
823
846
|
);
|
|
824
847
|
return result.success;
|
|
825
848
|
}
|
|
@@ -837,7 +860,25 @@ var PackageManager = class {
|
|
|
837
860
|
console.info(Messages.START_PART_SUCCESS(name));
|
|
838
861
|
return true;
|
|
839
862
|
} catch {
|
|
840
|
-
console.error(
|
|
863
|
+
console.error(red4(Messages.START_PART_FAILED(name)));
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
async runFile(name, directory, script, params, env2 = {}, flags = [], silent = false) {
|
|
868
|
+
console.info(Messages.START_PART_IN_PROGRESS(name));
|
|
869
|
+
try {
|
|
870
|
+
const args = this.buildRunFileArgs(script, params, flags, silent);
|
|
871
|
+
await this.exec(args, directory, {
|
|
872
|
+
env: env2,
|
|
873
|
+
listeners: {
|
|
874
|
+
onStdout: createStdoutLogger(name),
|
|
875
|
+
onStderr: createStderrLogger(name)
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
console.info(Messages.START_PART_SUCCESS(name));
|
|
879
|
+
return true;
|
|
880
|
+
} catch {
|
|
881
|
+
console.error(red4(Messages.START_PART_FAILED(name)));
|
|
841
882
|
return false;
|
|
842
883
|
}
|
|
843
884
|
}
|
|
@@ -858,12 +899,10 @@ var PackageManager = class {
|
|
|
858
899
|
}
|
|
859
900
|
const args = [this.commands.add, saveFlag, ...dependencies];
|
|
860
901
|
const result = await withSpinner(
|
|
902
|
+
() => this.exec(args, directory),
|
|
861
903
|
Messages.PACKAGE_MANAGER_INSTALLATION_IN_PROGRESS,
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
this.logSuccess(Messages.PACKAGE_MANAGER_INSTALLATION_SUCCEED(dependencies));
|
|
865
|
-
},
|
|
866
|
-
() => this.logFailure(this.formatFailCommand(args))
|
|
904
|
+
Messages.PACKAGE_MANAGER_INSTALLATION_SUCCEED(),
|
|
905
|
+
Messages.PACKAGE_MANAGER_INSTALLATION_FAILED(this.formatFailCommand(args))
|
|
867
906
|
);
|
|
868
907
|
return result.success;
|
|
869
908
|
}
|
|
@@ -880,6 +919,15 @@ var PackageManager = class {
|
|
|
880
919
|
if (this.commands.runArgsFlag) args.push(this.commands.runArgsFlag);
|
|
881
920
|
return args.concat(params);
|
|
882
921
|
}
|
|
922
|
+
buildRunFileArgs(script, params, flags, silent) {
|
|
923
|
+
if (!this.commands.runFile) throw new Error("Package manager does not support runFile");
|
|
924
|
+
const args = [...flags, this.commands.runFile];
|
|
925
|
+
if (silent) args.push(this.commands.silentFlag);
|
|
926
|
+
args.push(script);
|
|
927
|
+
if (params.length === 0) return args;
|
|
928
|
+
if (this.commands.runArgsFlag) args.push(this.commands.runArgsFlag);
|
|
929
|
+
return args.concat(params);
|
|
930
|
+
}
|
|
883
931
|
exec(args, directory, options = {}) {
|
|
884
932
|
return this.runner.run(args, {
|
|
885
933
|
collect: options.collect ?? true,
|
|
@@ -892,18 +940,6 @@ var PackageManager = class {
|
|
|
892
940
|
formatFailCommand(args) {
|
|
893
941
|
return this.runner.fullCommand(args);
|
|
894
942
|
}
|
|
895
|
-
logSuccess(message) {
|
|
896
|
-
console.info();
|
|
897
|
-
console.info(message);
|
|
898
|
-
console.info();
|
|
899
|
-
}
|
|
900
|
-
logFailure(command) {
|
|
901
|
-
console.error(red3(Messages.PACKAGE_MANAGER_INSTALLATION_FAILED(bold(command))));
|
|
902
|
-
}
|
|
903
|
-
logBuildFailure(name) {
|
|
904
|
-
const command = this.formatFailCommand([this.commands.install]);
|
|
905
|
-
console.error(red3(Messages.BUILD_PART_FAILED(name, bold(command))));
|
|
906
|
-
}
|
|
907
943
|
logEmpty(message) {
|
|
908
944
|
console.info();
|
|
909
945
|
console.info(message);
|
|
@@ -916,7 +952,7 @@ import fs2 from "fs";
|
|
|
916
952
|
import { resolve as resolve2 } from "path";
|
|
917
953
|
|
|
918
954
|
// src/lib/runner/runner.ts
|
|
919
|
-
import { red as
|
|
955
|
+
import { red as red5 } from "ansis";
|
|
920
956
|
import { spawn as spawn2 } from "child_process";
|
|
921
957
|
import * as process2 from "process";
|
|
922
958
|
var Runner = class {
|
|
@@ -973,7 +1009,7 @@ var Runner = class {
|
|
|
973
1009
|
this.logCapturedOutput(output);
|
|
974
1010
|
}
|
|
975
1011
|
logFailedCommand(args) {
|
|
976
|
-
console.error(
|
|
1012
|
+
console.error(red5(`
|
|
977
1013
|
Failed to execute command: ${this.binary} ${args.join(" ")}`));
|
|
978
1014
|
}
|
|
979
1015
|
logCapturedOutput(output) {
|
|
@@ -1142,17 +1178,17 @@ var copyFiles = /* @__PURE__ */ __name((from, to) => {
|
|
|
1142
1178
|
}, "copyFiles");
|
|
1143
1179
|
var resetFolder = /* @__PURE__ */ __name((folder) => {
|
|
1144
1180
|
if (fs3.existsSync(folder)) fs3.rmSync(folder, { recursive: true, force: true });
|
|
1145
|
-
fs3.mkdirSync(folder);
|
|
1181
|
+
fs3.mkdirSync(folder, { recursive: true });
|
|
1146
1182
|
}, "resetFolder");
|
|
1147
1183
|
|
|
1148
1184
|
// src/lib/utils/run-safe.ts
|
|
1149
|
-
import { red as
|
|
1185
|
+
import { red as red6 } from "ansis";
|
|
1150
1186
|
var runSafe = /* @__PURE__ */ __name(async (fn, fallback) => {
|
|
1151
1187
|
try {
|
|
1152
1188
|
return await fn();
|
|
1153
1189
|
} catch (error) {
|
|
1154
1190
|
const msg = getErrorMessage(error);
|
|
1155
|
-
if (msg) console.error(
|
|
1191
|
+
if (msg) console.error(red6(msg));
|
|
1156
1192
|
return fallback;
|
|
1157
1193
|
}
|
|
1158
1194
|
}, "runSafe");
|
|
@@ -1828,8 +1864,44 @@ var DevAction = class extends AbstractAction {
|
|
|
1828
1864
|
}
|
|
1829
1865
|
};
|
|
1830
1866
|
|
|
1831
|
-
// src/action/actions/
|
|
1867
|
+
// src/action/actions/editor.action.ts
|
|
1868
|
+
import open from "open";
|
|
1832
1869
|
import { join as join6 } from "path";
|
|
1870
|
+
var EditorAction = class extends AbstractAction {
|
|
1871
|
+
static {
|
|
1872
|
+
__name(this, "EditorAction");
|
|
1873
|
+
}
|
|
1874
|
+
startMessage = Messages.EDITOR_START;
|
|
1875
|
+
successMessage = Messages.EDITOR_SUCCESS;
|
|
1876
|
+
failureMessage = Messages.EDITOR_FAILED;
|
|
1877
|
+
async handle(args, options) {
|
|
1878
|
+
const directory = getDirectoryInput(options);
|
|
1879
|
+
const path = getPathInput(args);
|
|
1880
|
+
const open2 = getEditorOpenInput(options, !!path);
|
|
1881
|
+
void this.startEditor(directory);
|
|
1882
|
+
if (open2) await this.openEditor(path);
|
|
1883
|
+
return { keepAlive: true };
|
|
1884
|
+
}
|
|
1885
|
+
async startEditor(directory) {
|
|
1886
|
+
const editorPath = join6(
|
|
1887
|
+
getModulePath("@nanoforge-dev/editor/package.json", true),
|
|
1888
|
+
"dist",
|
|
1889
|
+
"index.js"
|
|
1890
|
+
);
|
|
1891
|
+
await runSafe(async () => {
|
|
1892
|
+
const packageManager = PackageManagerFactory.create("local_bun" /* LOCAL_BUN */);
|
|
1893
|
+
await packageManager.run("Editor", directory, editorPath, [], {}, [], true);
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
async openEditor(path) {
|
|
1897
|
+
const query = path ? `?projectPath=${encodeURIComponent(path)}` : "";
|
|
1898
|
+
const url = `http://localhost:3000/load-project${query}`;
|
|
1899
|
+
await open(url);
|
|
1900
|
+
}
|
|
1901
|
+
};
|
|
1902
|
+
|
|
1903
|
+
// src/action/actions/generate.action.ts
|
|
1904
|
+
import { join as join7 } from "path";
|
|
1833
1905
|
var GenerateAction = class extends AbstractAction {
|
|
1834
1906
|
static {
|
|
1835
1907
|
__name(this, "GenerateAction");
|
|
@@ -1888,7 +1960,7 @@ var GenerateAction = class extends AbstractAction {
|
|
|
1888
1960
|
);
|
|
1889
1961
|
}
|
|
1890
1962
|
watchPath(directory, subDir, saveFile) {
|
|
1891
|
-
return
|
|
1963
|
+
return join7(getCwd(directory), subDir, saveFile);
|
|
1892
1964
|
}
|
|
1893
1965
|
enterWatchMode() {
|
|
1894
1966
|
console.info();
|
|
@@ -1899,7 +1971,7 @@ var GenerateAction = class extends AbstractAction {
|
|
|
1899
1971
|
};
|
|
1900
1972
|
|
|
1901
1973
|
// src/action/actions/install.action.ts
|
|
1902
|
-
import { join as
|
|
1974
|
+
import { join as join9 } from "path";
|
|
1903
1975
|
|
|
1904
1976
|
// src/lib/global-config/global-config-handler.ts
|
|
1905
1977
|
import { read, readUser, write, writeUser } from "rc9";
|
|
@@ -2143,7 +2215,7 @@ var concatDeps = /* @__PURE__ */ __name((deps) => {
|
|
|
2143
2215
|
|
|
2144
2216
|
// src/lib/registry/registry.ts
|
|
2145
2217
|
import fs4 from "fs";
|
|
2146
|
-
import { join as
|
|
2218
|
+
import { join as join8 } from "path";
|
|
2147
2219
|
var Registry = class {
|
|
2148
2220
|
static {
|
|
2149
2221
|
__name(this, "Registry");
|
|
@@ -2174,9 +2246,9 @@ var Registry = class {
|
|
|
2174
2246
|
}
|
|
2175
2247
|
static async installPackage(client2, manifest, dir) {
|
|
2176
2248
|
const file = await client2.getFile(`/registry/${manifest.name}/-/${manifest._file}`);
|
|
2177
|
-
const path =
|
|
2249
|
+
const path = join8(dir, this.getTypeSubFolder(manifest.type));
|
|
2178
2250
|
fs4.mkdirSync(path, { recursive: true });
|
|
2179
|
-
fs4.writeFileSync(
|
|
2251
|
+
fs4.writeFileSync(join8(path, manifest._file), await file.bytes());
|
|
2180
2252
|
}
|
|
2181
2253
|
static getTypeSubFolder(type) {
|
|
2182
2254
|
if (type === "component") return "components";
|
|
@@ -2188,7 +2260,7 @@ var Registry = class {
|
|
|
2188
2260
|
return withAuth(config2.apiKey, force, !headers ? {} : void 0);
|
|
2189
2261
|
}
|
|
2190
2262
|
static _getPackageFile(filename, dir) {
|
|
2191
|
-
const path =
|
|
2263
|
+
const path = join8(getCwd(dir ?? "."), filename);
|
|
2192
2264
|
if (!fs4.existsSync(path))
|
|
2193
2265
|
throw new Error(
|
|
2194
2266
|
"Package not found, please specify path in the nanoforge.manifest.json : `publish.paths.package`!"
|
|
@@ -2223,17 +2295,16 @@ var InstallAction = class extends AbstractAction {
|
|
|
2223
2295
|
}
|
|
2224
2296
|
async _installNfPackages(directory, names, isServer) {
|
|
2225
2297
|
const deps = await resolveManifestDependencies(names, directory);
|
|
2298
|
+
const part = isServer ? "server" : "client";
|
|
2226
2299
|
const libSuccess = await this._installLibs(
|
|
2227
2300
|
directory,
|
|
2228
2301
|
deps.npm.map(([name, version]) => `${name}@${version}`)
|
|
2229
2302
|
);
|
|
2230
2303
|
if (!libSuccess) return { success: false };
|
|
2231
|
-
return withSpinner(
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
);
|
|
2236
|
-
});
|
|
2304
|
+
return withSpinner(
|
|
2305
|
+
() => Registry.install(Object.values(deps.nf), join9(directory, part)),
|
|
2306
|
+
Messages.INSTALL_PACKAGES_IN_PROGRESS
|
|
2307
|
+
);
|
|
2237
2308
|
}
|
|
2238
2309
|
};
|
|
2239
2310
|
|
|
@@ -2284,7 +2355,82 @@ var LogoutAction = class extends AbstractAction {
|
|
|
2284
2355
|
};
|
|
2285
2356
|
|
|
2286
2357
|
// src/action/actions/new.action.ts
|
|
2287
|
-
import { join as
|
|
2358
|
+
import { join as join10 } from "path";
|
|
2359
|
+
|
|
2360
|
+
// src/lib/git/git-runner.ts
|
|
2361
|
+
var GIT = "git";
|
|
2362
|
+
var GIT_COMMANDS = {
|
|
2363
|
+
init: "init",
|
|
2364
|
+
remote: "remote"
|
|
2365
|
+
};
|
|
2366
|
+
var GitRunner = class {
|
|
2367
|
+
static {
|
|
2368
|
+
__name(this, "GitRunner");
|
|
2369
|
+
}
|
|
2370
|
+
runner;
|
|
2371
|
+
constructor() {
|
|
2372
|
+
this.runner = new Runner(GIT);
|
|
2373
|
+
}
|
|
2374
|
+
async init(directory) {
|
|
2375
|
+
const args = [GIT_COMMANDS.init];
|
|
2376
|
+
const result = await withSpinner(
|
|
2377
|
+
() => this.exec(args, directory),
|
|
2378
|
+
Messages.GIT_INIT_IN_PROGRESS,
|
|
2379
|
+
Messages.GIT_INIT_SUCCEED,
|
|
2380
|
+
Messages.GIT_INIT_FAILED(this.formatFailCommand(args))
|
|
2381
|
+
);
|
|
2382
|
+
return result.success;
|
|
2383
|
+
}
|
|
2384
|
+
async addRemote(directory, remote) {
|
|
2385
|
+
const args = [GIT_COMMANDS.remote, "add", "origin", remote];
|
|
2386
|
+
const result = await withSpinner(
|
|
2387
|
+
() => this.exec(args, directory),
|
|
2388
|
+
Messages.GIT_REMOTE_IN_PROGRESS,
|
|
2389
|
+
Messages.GIT_REMOTE_SUCCEED,
|
|
2390
|
+
Messages.GIT_REMOTE_FAILED(this.formatFailCommand(args))
|
|
2391
|
+
);
|
|
2392
|
+
return result.success;
|
|
2393
|
+
}
|
|
2394
|
+
exec(args, directory, options = {}) {
|
|
2395
|
+
return this.runner.run(args, {
|
|
2396
|
+
collect: options.collect ?? true,
|
|
2397
|
+
cwd: getCwd(directory),
|
|
2398
|
+
env: options.env,
|
|
2399
|
+
listeners: options.listeners,
|
|
2400
|
+
onFail: options.onFail
|
|
2401
|
+
});
|
|
2402
|
+
}
|
|
2403
|
+
formatFailCommand(args) {
|
|
2404
|
+
return this.runner.fullCommand(args);
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
|
|
2408
|
+
// src/lib/input/inputs/new/git-remote.input.ts
|
|
2409
|
+
var getGitRemoteInput = /* @__PURE__ */ __name((inputs) => {
|
|
2410
|
+
return getStringInput(inputs, "gitRemote");
|
|
2411
|
+
}, "getGitRemoteInput");
|
|
2412
|
+
var getNewGitRemoteInputOrAsk = /* @__PURE__ */ __name((inputs) => {
|
|
2413
|
+
return getInputOrAsk(
|
|
2414
|
+
getGitRemoteInput(inputs),
|
|
2415
|
+
() => askInput(Messages.NEW_GIT_REMOTE_QUESTION, {
|
|
2416
|
+
required: false,
|
|
2417
|
+
default: ""
|
|
2418
|
+
})
|
|
2419
|
+
);
|
|
2420
|
+
}, "getNewGitRemoteInputOrAsk");
|
|
2421
|
+
|
|
2422
|
+
// src/lib/input/inputs/new/git.input.ts
|
|
2423
|
+
var getNewGitInput = /* @__PURE__ */ __name((inputs) => {
|
|
2424
|
+
return getBooleanInput(inputs, "git");
|
|
2425
|
+
}, "getNewGitInput");
|
|
2426
|
+
var getNewGitOrAsk = /* @__PURE__ */ __name((inputs) => {
|
|
2427
|
+
return getInputOrAsk(
|
|
2428
|
+
getNewGitInput(inputs),
|
|
2429
|
+
() => askConfirm(Messages.NEW_GIT_QUESTION, { default: true })
|
|
2430
|
+
);
|
|
2431
|
+
}, "getNewGitOrAsk");
|
|
2432
|
+
|
|
2433
|
+
// src/action/actions/new.action.ts
|
|
2288
2434
|
var NewAction = class extends AbstractAction {
|
|
2289
2435
|
static {
|
|
2290
2436
|
__name(this, "NewAction");
|
|
@@ -2297,18 +2443,16 @@ var NewAction = class extends AbstractAction {
|
|
|
2297
2443
|
const values = await this.collectValues(options);
|
|
2298
2444
|
await this.scaffold(values, cwdDirectory);
|
|
2299
2445
|
let res = true;
|
|
2446
|
+
const distDir = join10(cwdDirectory, values.directory);
|
|
2300
2447
|
if (!values.skipInstall) {
|
|
2301
|
-
res = await this.installDependencies(
|
|
2302
|
-
values.packageManager,
|
|
2303
|
-
join9(cwdDirectory, values.directory ?? values.name)
|
|
2304
|
-
);
|
|
2448
|
+
res = await this.installDependencies(values.packageManager, distDir);
|
|
2305
2449
|
}
|
|
2450
|
+
if (values.git) await this.setupGitRepository(values.gitRemote, distDir);
|
|
2306
2451
|
return { success: res };
|
|
2307
2452
|
}
|
|
2308
2453
|
async collectValues(inputs) {
|
|
2309
|
-
|
|
2454
|
+
const values = {
|
|
2310
2455
|
name: await getNewNameInputOrAsk(inputs),
|
|
2311
|
-
directory: getPathInput(inputs),
|
|
2312
2456
|
packageManager: await getNewPackageManagerInputOrAsk(inputs),
|
|
2313
2457
|
language: await getNewLanguageInputOrAsk(inputs),
|
|
2314
2458
|
strict: await getNewStrictOrAsk(inputs),
|
|
@@ -2317,12 +2461,19 @@ var NewAction = class extends AbstractAction {
|
|
|
2317
2461
|
skipInstall: await getNewSkipInstallOrAsk(inputs),
|
|
2318
2462
|
docker: await getNewDockerOrAsk(inputs),
|
|
2319
2463
|
lint: getNewLintInput(inputs),
|
|
2320
|
-
editor: getEditorInput(inputs)
|
|
2464
|
+
editor: getEditorInput(inputs),
|
|
2465
|
+
git: await getNewGitOrAsk(inputs)
|
|
2466
|
+
};
|
|
2467
|
+
return {
|
|
2468
|
+
...values,
|
|
2469
|
+
directory: getPathInput(inputs) ?? values.name,
|
|
2470
|
+
gitRemote: values.git ? await getNewGitRemoteInputOrAsk(inputs) || null : null
|
|
2321
2471
|
};
|
|
2322
2472
|
}
|
|
2323
2473
|
async scaffold(values, directory) {
|
|
2324
2474
|
const collection = CollectionFactory.create("@nanoforge-dev/schematics" /* NANOFORGE */, directory);
|
|
2325
|
-
console.info(
|
|
2475
|
+
console.info();
|
|
2476
|
+
console.info(Messages.NEW_GENERATION_START);
|
|
2326
2477
|
console.info();
|
|
2327
2478
|
await this.generateApplication(collection, values);
|
|
2328
2479
|
await this.generateConfiguration(collection, values);
|
|
@@ -2347,7 +2498,7 @@ var NewAction = class extends AbstractAction {
|
|
|
2347
2498
|
generateConfiguration(collection, values) {
|
|
2348
2499
|
return executeSchematic("Configuration", collection, "configuration", {
|
|
2349
2500
|
name: values.name,
|
|
2350
|
-
directory: values.directory
|
|
2501
|
+
directory: values.directory,
|
|
2351
2502
|
server: values.server,
|
|
2352
2503
|
language: values.language,
|
|
2353
2504
|
initFunctions: values.initFunctions
|
|
@@ -2375,14 +2526,14 @@ var NewAction = class extends AbstractAction {
|
|
|
2375
2526
|
}
|
|
2376
2527
|
async generateDocker(collection, values) {
|
|
2377
2528
|
await executeSchematic("Docker", collection, "docker", {
|
|
2378
|
-
directory: values.directory
|
|
2529
|
+
directory: values.directory,
|
|
2379
2530
|
packageManager: values.packageManager
|
|
2380
2531
|
});
|
|
2381
2532
|
}
|
|
2382
2533
|
partOptions(values, part) {
|
|
2383
2534
|
return {
|
|
2384
2535
|
part,
|
|
2385
|
-
directory: values.directory
|
|
2536
|
+
directory: values.directory,
|
|
2386
2537
|
language: values.language,
|
|
2387
2538
|
initFunctions: values.initFunctions
|
|
2388
2539
|
};
|
|
@@ -2391,6 +2542,13 @@ var NewAction = class extends AbstractAction {
|
|
|
2391
2542
|
const packageManager = PackageManagerFactory.create(packageManagerName);
|
|
2392
2543
|
return await packageManager.install(directory);
|
|
2393
2544
|
}
|
|
2545
|
+
async setupGitRepository(gitRemote, dir) {
|
|
2546
|
+
const runner = new GitRunner();
|
|
2547
|
+
let res;
|
|
2548
|
+
res = await runner.init(dir);
|
|
2549
|
+
if (res && gitRemote) res = await runner.addRemote(dir, gitRemote);
|
|
2550
|
+
return res;
|
|
2551
|
+
}
|
|
2394
2552
|
};
|
|
2395
2553
|
|
|
2396
2554
|
// src/lib/manifest/manifest.type.ts
|
|
@@ -2489,10 +2647,10 @@ __decorateClass([
|
|
|
2489
2647
|
import { plainToInstance as plainToInstance2 } from "class-transformer";
|
|
2490
2648
|
import { validate as validate2 } from "class-validator";
|
|
2491
2649
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
2492
|
-
import { join as
|
|
2650
|
+
import { join as join11 } from "path";
|
|
2493
2651
|
var getManifestPath = /* @__PURE__ */ __name((directory) => {
|
|
2494
2652
|
for (const n of [MANIFEST_FILE_NAME]) {
|
|
2495
|
-
const path =
|
|
2653
|
+
const path = join11(directory, n);
|
|
2496
2654
|
if (existsSync3(path)) return path;
|
|
2497
2655
|
}
|
|
2498
2656
|
throw new Error(`No manifest file found in directory: ${directory}`);
|
|
@@ -2527,15 +2685,16 @@ var PublishAction = class extends AbstractAction {
|
|
|
2527
2685
|
async handle(_args, options) {
|
|
2528
2686
|
const directory = getDirectoryInput(options);
|
|
2529
2687
|
const manifest = await loadManifest(directory);
|
|
2530
|
-
return withSpinner(
|
|
2531
|
-
|
|
2532
|
-
|
|
2688
|
+
return withSpinner(
|
|
2689
|
+
() => Registry.publish(manifest, directory),
|
|
2690
|
+
Messages.PUBLISH_IN_PROGRESS(manifest.name)
|
|
2691
|
+
);
|
|
2533
2692
|
}
|
|
2534
2693
|
};
|
|
2535
2694
|
|
|
2536
2695
|
// src/action/actions/start.action.ts
|
|
2537
2696
|
import dotenv from "dotenv";
|
|
2538
|
-
import { join as
|
|
2697
|
+
import { join as join12, resolve as resolve3 } from "path";
|
|
2539
2698
|
var StartAction = class extends AbstractAction {
|
|
2540
2699
|
static {
|
|
2541
2700
|
__name(this, "StartAction");
|
|
@@ -2596,14 +2755,14 @@ var StartAction = class extends AbstractAction {
|
|
|
2596
2755
|
}
|
|
2597
2756
|
buildClientParams(directory, config2, options) {
|
|
2598
2757
|
const params = {
|
|
2599
|
-
"-d": getCwd(
|
|
2758
|
+
"-d": getCwd(join12(directory, options.clientDir)),
|
|
2600
2759
|
"-p": options.port
|
|
2601
2760
|
};
|
|
2602
2761
|
if (options.watch) params["--watch"] = true;
|
|
2603
2762
|
if (options.watch) {
|
|
2604
2763
|
params["--watch"] = true;
|
|
2605
2764
|
if (config2.server.enable) {
|
|
2606
|
-
params["--watch-server-dir"] = getCwd(
|
|
2765
|
+
params["--watch-server-dir"] = getCwd(join12(directory, options.serverDir));
|
|
2607
2766
|
}
|
|
2608
2767
|
}
|
|
2609
2768
|
if (options.ssl) {
|
|
@@ -2614,7 +2773,7 @@ var StartAction = class extends AbstractAction {
|
|
|
2614
2773
|
}
|
|
2615
2774
|
buildServerParams(directory, _config, options) {
|
|
2616
2775
|
const params = {
|
|
2617
|
-
"-d": getCwd(
|
|
2776
|
+
"-d": getCwd(join12(directory, options.serverDir))
|
|
2618
2777
|
};
|
|
2619
2778
|
if (options.watch) params["--watch"] = true;
|
|
2620
2779
|
return this.buildParams(params);
|
|
@@ -2630,7 +2789,7 @@ var StartAction = class extends AbstractAction {
|
|
|
2630
2789
|
...process.env
|
|
2631
2790
|
};
|
|
2632
2791
|
dotenv.config({
|
|
2633
|
-
path: resolve3(getCwd(
|
|
2792
|
+
path: resolve3(getCwd(join12(dir, ".env"))),
|
|
2634
2793
|
processEnv: rawEnv
|
|
2635
2794
|
});
|
|
2636
2795
|
const baseEnv = Object.entries(rawEnv).filter(
|
|
@@ -2664,9 +2823,10 @@ var UnpublishAction = class extends AbstractAction {
|
|
|
2664
2823
|
async handle(_args, options) {
|
|
2665
2824
|
const directory = getDirectoryInput(options);
|
|
2666
2825
|
const manifest = await loadManifest(directory);
|
|
2667
|
-
return withSpinner(
|
|
2668
|
-
|
|
2669
|
-
|
|
2826
|
+
return withSpinner(
|
|
2827
|
+
() => Registry.unpublish(manifest, directory),
|
|
2828
|
+
Messages.UNPUBLISH_IN_PROGRESS(manifest.name)
|
|
2829
|
+
);
|
|
2670
2830
|
}
|
|
2671
2831
|
};
|
|
2672
2832
|
|
|
@@ -2694,7 +2854,7 @@ var BuildCommand = class extends AbstractCommand {
|
|
|
2694
2854
|
__name(this, "BuildCommand");
|
|
2695
2855
|
}
|
|
2696
2856
|
load(program2) {
|
|
2697
|
-
program2.command("build").description("build your game").option("-d, --directory
|
|
2857
|
+
program2.command("build").description("build your game").option("-d, --directory <directory>", "specify the working directory of the command").option("-c, --config <config>", "path to the config file", CONFIG_FILE_NAME).option("--client-entry <clientEntry>", "specify the entry file of the client").option("--server-entry <serverEntry>", "specify the entry file of the server").option("--client-static-dir <clientStaticDir>", "specify the static directory of the client").option("--server-static-dir <serverStaticDir>", "specify the static directory of the server").option("--client-out-dir <clientOutDir>", "specify the output directory of the client").option("--server-out-dir <serverOutDir>", "specify the output directory of the server").option("--editor", "specify if the project must build with editor config").option("--watch", "build app in watching mode", false).action(async (rawOptions) => {
|
|
2698
2858
|
const options = AbstractCommand.mapToInput({
|
|
2699
2859
|
directory: rawOptions.directory,
|
|
2700
2860
|
config: rawOptions.config,
|
|
@@ -2718,13 +2878,13 @@ var CreateCommand = class extends AbstractCommand {
|
|
|
2718
2878
|
__name(this, "CreateCommand");
|
|
2719
2879
|
}
|
|
2720
2880
|
load(program2) {
|
|
2721
|
-
program2.command("create
|
|
2881
|
+
program2.command("create <type>").description("create nanoforge components or systems").option("-d, --directory <directory>", "specify the working directory of the command").option("-c, --config <config>", "path to the config file", CONFIG_FILE_NAME).option("-n, --name <name>", "name of the component/system").option(
|
|
2722
2882
|
"-s, --server",
|
|
2723
2883
|
"install components/systems on server (default install on client)",
|
|
2724
2884
|
false
|
|
2725
2885
|
).option(
|
|
2726
|
-
"-p, --path
|
|
2727
|
-
"path to the component/system folder (default:
|
|
2886
|
+
"-p, --path <path>",
|
|
2887
|
+
"path to the component/system folder (default: <part>/<components|systems>)"
|
|
2728
2888
|
).action(async (type, rawOptions) => {
|
|
2729
2889
|
const args = AbstractCommand.mapToInput({
|
|
2730
2890
|
type
|
|
@@ -2747,7 +2907,7 @@ var DevCommand = class extends AbstractCommand {
|
|
|
2747
2907
|
__name(this, "DevCommand");
|
|
2748
2908
|
}
|
|
2749
2909
|
load(program2) {
|
|
2750
|
-
program2.command("dev").description("run your game in dev mode").option("-d, --directory
|
|
2910
|
+
program2.command("dev").description("run your game in dev mode").option("-d, --directory <directory>", "specify the working directory of the command").option("-c, --config <config>", "path to the config file", CONFIG_FILE_NAME).option("--generate", "generate app from config", false).action(async (rawOptions) => {
|
|
2751
2911
|
const options = AbstractCommand.mapToInput({
|
|
2752
2912
|
directory: rawOptions.directory,
|
|
2753
2913
|
config: rawOptions.config,
|
|
@@ -2758,13 +2918,35 @@ var DevCommand = class extends AbstractCommand {
|
|
|
2758
2918
|
}
|
|
2759
2919
|
};
|
|
2760
2920
|
|
|
2921
|
+
// src/command/commands/editor.command.ts
|
|
2922
|
+
var EditorCommand = class extends AbstractCommand {
|
|
2923
|
+
static {
|
|
2924
|
+
__name(this, "EditorCommand");
|
|
2925
|
+
}
|
|
2926
|
+
load(program2) {
|
|
2927
|
+
program2.command("editor [path]").description("start the editor").option("-d, --directory <directory>", "specify the working directory of the command").option(
|
|
2928
|
+
"--open",
|
|
2929
|
+
"open the editor on the default web browser (default: true if path is specified, false otherwise)"
|
|
2930
|
+
).option("--no-open", "do not open the editor on the default web browser").action(async (path, rawOptions) => {
|
|
2931
|
+
const args = AbstractCommand.mapToInput({
|
|
2932
|
+
path
|
|
2933
|
+
});
|
|
2934
|
+
const options = AbstractCommand.mapToInput({
|
|
2935
|
+
directory: rawOptions.directory,
|
|
2936
|
+
open: rawOptions.open
|
|
2937
|
+
});
|
|
2938
|
+
await this.action.run(args, options);
|
|
2939
|
+
});
|
|
2940
|
+
}
|
|
2941
|
+
};
|
|
2942
|
+
|
|
2761
2943
|
// src/command/commands/generate.command.ts
|
|
2762
2944
|
var GenerateCommand = class extends AbstractCommand {
|
|
2763
2945
|
static {
|
|
2764
2946
|
__name(this, "GenerateCommand");
|
|
2765
2947
|
}
|
|
2766
2948
|
load(program2) {
|
|
2767
|
-
program2.command("generate").description("generate nanoforge files from config").option("-d, --directory
|
|
2949
|
+
program2.command("generate").description("generate nanoforge files from config").option("-d, --directory <directory>", "specify the working directory of the command").option("-c, --config <config>", "path to the config file", CONFIG_FILE_NAME).option("--editor", "specify if the project must generate editor main file").option("--watch", "generate app in watching mode", false).action(async (rawOptions) => {
|
|
2768
2950
|
const options = AbstractCommand.mapToInput({
|
|
2769
2951
|
directory: rawOptions.directory,
|
|
2770
2952
|
config: rawOptions.config,
|
|
@@ -2782,7 +2964,7 @@ var InstallCommand = class extends AbstractCommand {
|
|
|
2782
2964
|
__name(this, "InstallCommand");
|
|
2783
2965
|
}
|
|
2784
2966
|
load(program2) {
|
|
2785
|
-
program2.command("install [names...]").alias("add").description("add Nanoforge components and systems to your project").option("-d, --directory
|
|
2967
|
+
program2.command("install [names...]").alias("add").description("add Nanoforge components and systems to your project").option("-d, --directory <directory>", "specify the working directory of the command").option("-l, --lib", "install library instead of component/system", false).option(
|
|
2786
2968
|
"-s, --server",
|
|
2787
2969
|
"install components/systems on server (default install on client)",
|
|
2788
2970
|
false
|
|
@@ -2806,7 +2988,7 @@ var LoginCommand = class extends AbstractCommand {
|
|
|
2806
2988
|
__name(this, "LoginCommand");
|
|
2807
2989
|
}
|
|
2808
2990
|
load(program2) {
|
|
2809
|
-
program2.command("login").description("login to Nanoforge registry").option("-d, --directory
|
|
2991
|
+
program2.command("login").description("login to Nanoforge registry").option("-d, --directory <directory>", "specify the working directory of the command").option("-l, --local", "login only for the project", false).option("-k, --api-key <key>", "api key for Nanoforge registry").action(async (rawOptions) => {
|
|
2810
2992
|
const options = AbstractCommand.mapToInput({
|
|
2811
2993
|
directory: rawOptions.directory,
|
|
2812
2994
|
local: rawOptions.local,
|
|
@@ -2823,7 +3005,7 @@ var LogoutCommand = class extends AbstractCommand {
|
|
|
2823
3005
|
__name(this, "LogoutCommand");
|
|
2824
3006
|
}
|
|
2825
3007
|
load(program2) {
|
|
2826
|
-
program2.command("logout").description("logout from Nanoforge registry").option("-d, --directory
|
|
3008
|
+
program2.command("logout").description("logout from Nanoforge registry").option("-d, --directory <directory>", "specify the working directory of the command").option("-l, --local", "logout only for the project").action(async (rawOptions) => {
|
|
2827
3009
|
const options = AbstractCommand.mapToInput({
|
|
2828
3010
|
directory: rawOptions.directory,
|
|
2829
3011
|
local: rawOptions.local
|
|
@@ -2839,10 +3021,13 @@ var NewCommand = class extends AbstractCommand {
|
|
|
2839
3021
|
__name(this, "NewCommand");
|
|
2840
3022
|
}
|
|
2841
3023
|
load(program2) {
|
|
2842
|
-
program2.command("new").description("create a new nanoforge project").option("-d, --directory
|
|
2843
|
-
"--path
|
|
3024
|
+
program2.command("new").description("create a new nanoforge project").option("-d, --directory <directory>", "specify the working directory of the command").option("--name <name>", "specify the name of your project").option(
|
|
3025
|
+
"--path <path>",
|
|
2844
3026
|
"specify the relative path where your project will be created (default: name of the project)"
|
|
2845
|
-
).option("--package-manager
|
|
3027
|
+
).option("--package-manager <packageManager>", "specify the package manager of your project").option("--language <language>", "specify the language of your project").option("--strict", "use strict mode").option("--no-strict", "do not use strict mode").option("--server", "create a server").option("--no-server", "do not create a server").option("--init-functions", "initialize functions").option("--no-init-functions", "do not initialize functions").option("--skip-install", "skip installing dependencies").option("--no-skip-install", "do not skip installing dependencies").option("--docker", "generate docker files").option("--no-docker", "do not generate docker files").option("--no-lint", "do not generate lint files").option("--editor", "do add editor dependencies").option("--git", "generate git repository").option("--no-git", "do not generate git repository").option(
|
|
3028
|
+
"--git-remote <gitRemote>",
|
|
3029
|
+
"setup git remote to git repository (required if --git is used)"
|
|
3030
|
+
).option("--no-git-remote", "do not setup git remote to git repository").action(async (rawOptions) => {
|
|
2846
3031
|
const options = AbstractCommand.mapToInput({
|
|
2847
3032
|
directory: rawOptions.directory,
|
|
2848
3033
|
name: rawOptions.name,
|
|
@@ -2855,7 +3040,9 @@ var NewCommand = class extends AbstractCommand {
|
|
|
2855
3040
|
skipInstall: rawOptions.skipInstall,
|
|
2856
3041
|
docker: rawOptions.docker,
|
|
2857
3042
|
lint: rawOptions.lint,
|
|
2858
|
-
editor: rawOptions.editor
|
|
3043
|
+
editor: rawOptions.editor,
|
|
3044
|
+
git: rawOptions.git,
|
|
3045
|
+
gitRemote: rawOptions.gitRemote || void 0
|
|
2859
3046
|
});
|
|
2860
3047
|
await this.action.run(/* @__PURE__ */ new Map(), options);
|
|
2861
3048
|
});
|
|
@@ -2868,7 +3055,7 @@ var PublishCommand = class extends AbstractCommand {
|
|
|
2868
3055
|
__name(this, "PublishCommand");
|
|
2869
3056
|
}
|
|
2870
3057
|
load(program2) {
|
|
2871
|
-
program2.command("publish").description("publish package to Nanoforge registry").option("-d, --directory
|
|
3058
|
+
program2.command("publish").description("publish package to Nanoforge registry").option("-d, --directory <directory>", "specify the working directory of the command").action(async (rawOptions) => {
|
|
2872
3059
|
const options = AbstractCommand.mapToInput({
|
|
2873
3060
|
directory: rawOptions.directory
|
|
2874
3061
|
});
|
|
@@ -2883,7 +3070,7 @@ var StartCommand = class extends AbstractCommand {
|
|
|
2883
3070
|
__name(this, "StartCommand");
|
|
2884
3071
|
}
|
|
2885
3072
|
load(program2) {
|
|
2886
|
-
program2.command("start").description("start your game").option("-d, --directory
|
|
3073
|
+
program2.command("start").description("start your game").option("-d, --directory <directory>", "specify the working directory of the command").option("-c, --config <config>", "path to the config file", CONFIG_FILE_NAME).option("-p, --port <port>", "specify the port of the loader (the website to load the game)").option("--client-dir <clientDirectory>", "specify the directory of the client").option("--server-dir <serverDirectory>", "specify the directory of the server").option("--watch", "run app in watching mode", false).option("--cert <cert>", "path to the SSL certificate for HTTPS").option("--key <key>", "path to the SSL key for HTTPS").action(async (rawOptions) => {
|
|
2887
3074
|
const options = AbstractCommand.mapToInput({
|
|
2888
3075
|
directory: rawOptions.directory,
|
|
2889
3076
|
config: rawOptions.config,
|
|
@@ -2905,7 +3092,7 @@ var UnpublishCommand = class extends AbstractCommand {
|
|
|
2905
3092
|
__name(this, "UnpublishCommand");
|
|
2906
3093
|
}
|
|
2907
3094
|
load(program2) {
|
|
2908
|
-
program2.command("unpublish").description("unpublish package to Nanoforge registry").option("-d, --directory
|
|
3095
|
+
program2.command("unpublish").description("unpublish package to Nanoforge registry").option("-d, --directory <directory>", "specify the working directory of the command").action(async (rawOptions) => {
|
|
2909
3096
|
const options = AbstractCommand.mapToInput({
|
|
2910
3097
|
directory: rawOptions.directory
|
|
2911
3098
|
});
|
|
@@ -2925,6 +3112,7 @@ var CommandLoader = class {
|
|
|
2925
3112
|
new BuildCommand(new BuildAction()).load(program2);
|
|
2926
3113
|
new StartCommand(new StartAction()).load(program2);
|
|
2927
3114
|
new DevCommand(new DevAction()).load(program2);
|
|
3115
|
+
new EditorCommand(new EditorAction()).load(program2);
|
|
2928
3116
|
new GenerateCommand(new GenerateAction()).load(program2);
|
|
2929
3117
|
new CreateCommand(new CreateAction()).load(program2);
|
|
2930
3118
|
new LoginCommand(new LoginAction()).load(program2);
|
|
@@ -2936,8 +3124,8 @@ var CommandLoader = class {
|
|
|
2936
3124
|
static handleInvalidCommand(program2) {
|
|
2937
3125
|
program2.on("command:*", () => {
|
|
2938
3126
|
console.error(`
|
|
2939
|
-
${Prefixes.ERROR} Invalid command: ${
|
|
2940
|
-
console.log(`See ${
|
|
3127
|
+
${Prefixes.ERROR} Invalid command: ${red7`%s`}`, program2.args.join(" "));
|
|
3128
|
+
console.log(`See ${red7`--help`} for a list of available commands.
|
|
2941
3129
|
`);
|
|
2942
3130
|
process.exit(1);
|
|
2943
3131
|
});
|