@ooneex/cli 1.34.0 → 1.34.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/dist/index.js +341 -302
- package/dist/index.js.map +8 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4619,14 +4619,14 @@ var require_ReflectLite = __commonJS(() => {
|
|
|
4619
4619
|
}
|
|
4620
4620
|
exporter("decorate", decorate);
|
|
4621
4621
|
function metadata(metadataKey, metadataValue) {
|
|
4622
|
-
function
|
|
4622
|
+
function decorator3(target, propertyKey) {
|
|
4623
4623
|
if (!IsObject(target))
|
|
4624
4624
|
throw new TypeError;
|
|
4625
4625
|
if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))
|
|
4626
4626
|
throw new TypeError;
|
|
4627
4627
|
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
4628
4628
|
}
|
|
4629
|
-
return
|
|
4629
|
+
return decorator3;
|
|
4630
4630
|
}
|
|
4631
4631
|
exporter("metadata", metadata);
|
|
4632
4632
|
function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
|
@@ -4698,8 +4698,8 @@ var require_ReflectLite = __commonJS(() => {
|
|
|
4698
4698
|
exporter("deleteMetadata", deleteMetadata);
|
|
4699
4699
|
function DecorateConstructor(decorators, target) {
|
|
4700
4700
|
for (var i = decorators.length - 1;i >= 0; --i) {
|
|
4701
|
-
var
|
|
4702
|
-
var decorated =
|
|
4701
|
+
var decorator3 = decorators[i];
|
|
4702
|
+
var decorated = decorator3(target);
|
|
4703
4703
|
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
4704
4704
|
if (!IsConstructor(decorated))
|
|
4705
4705
|
throw new TypeError;
|
|
@@ -4710,8 +4710,8 @@ var require_ReflectLite = __commonJS(() => {
|
|
|
4710
4710
|
}
|
|
4711
4711
|
function DecorateProperty(decorators, target, propertyKey, descriptor) {
|
|
4712
4712
|
for (var i = decorators.length - 1;i >= 0; --i) {
|
|
4713
|
-
var
|
|
4714
|
-
var decorated =
|
|
4713
|
+
var decorator3 = decorators[i];
|
|
4714
|
+
var decorated = decorator3(target, propertyKey, descriptor);
|
|
4715
4715
|
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
4716
4716
|
if (!IsObject(decorated))
|
|
4717
4717
|
throw new TypeError;
|
|
@@ -5619,7 +5619,7 @@ AppBuildCommand = __legacyDecorateClassTS([
|
|
|
5619
5619
|
decorator.command()
|
|
5620
5620
|
], AppBuildCommand);
|
|
5621
5621
|
// src/commands/AppCreateCommand.ts
|
|
5622
|
-
import { join as
|
|
5622
|
+
import { join as join6 } from "path";
|
|
5623
5623
|
import { decorator as decorator5 } from "@ooneex/command";
|
|
5624
5624
|
import { TerminalLogger as TerminalLogger5 } from "@ooneex/logger";
|
|
5625
5625
|
|
|
@@ -6850,9 +6850,271 @@ var renovate_json_default = `{
|
|
|
6850
6850
|
}
|
|
6851
6851
|
`;
|
|
6852
6852
|
|
|
6853
|
-
// src/
|
|
6853
|
+
// src/utils.ts
|
|
6854
6854
|
import { join as join3 } from "path";
|
|
6855
6855
|
|
|
6856
|
+
// src/commands/ModuleCreateCommand.ts
|
|
6857
|
+
import { join as join2 } from "path";
|
|
6858
|
+
import { decorator as decorator2 } from "@ooneex/command";
|
|
6859
|
+
import { TerminalLogger as TerminalLogger2 } from "@ooneex/logger";
|
|
6860
|
+
import { toKebabCase, toPascalCase } from "@ooneex/utils";
|
|
6861
|
+
|
|
6862
|
+
// src/templates/module/module.txt
|
|
6863
|
+
var module_default = `import type { ModuleType } from "@ooneex/module";
|
|
6864
|
+
|
|
6865
|
+
export const {{NAME}}Module: ModuleType = {
|
|
6866
|
+
controllers: [],
|
|
6867
|
+
entities: [],
|
|
6868
|
+
middlewares: [],
|
|
6869
|
+
cronJobs: [],
|
|
6870
|
+
events: [],
|
|
6871
|
+
};
|
|
6872
|
+
`;
|
|
6873
|
+
|
|
6874
|
+
// src/templates/module/package.txt
|
|
6875
|
+
var package_default = `{
|
|
6876
|
+
"name": "@module/{{NAME}}",
|
|
6877
|
+
"description": "",
|
|
6878
|
+
"version": "0.0.1",
|
|
6879
|
+
"scripts": {
|
|
6880
|
+
"test": "bun test tests",
|
|
6881
|
+
"lint": "tsgo --noEmit && bunx biome lint"
|
|
6882
|
+
}
|
|
6883
|
+
}
|
|
6884
|
+
`;
|
|
6885
|
+
|
|
6886
|
+
// src/templates/module/test.txt
|
|
6887
|
+
var test_default = `import { describe, expect, test } from "bun:test";
|
|
6888
|
+
import { {{NAME}}Module } from "@module/{{name}}/{{NAME}}Module";
|
|
6889
|
+
|
|
6890
|
+
describe("{{NAME}}Module", () => {
|
|
6891
|
+
test("should have controllers array", () => {
|
|
6892
|
+
expect(Array.isArray({{NAME}}Module.controllers)).toBe(true);
|
|
6893
|
+
});
|
|
6894
|
+
|
|
6895
|
+
test("should have entities array", () => {
|
|
6896
|
+
expect(Array.isArray({{NAME}}Module.entities)).toBe(true);
|
|
6897
|
+
});
|
|
6898
|
+
|
|
6899
|
+
test("should have middlewares array", () => {
|
|
6900
|
+
expect(Array.isArray({{NAME}}Module.middlewares)).toBe(true);
|
|
6901
|
+
});
|
|
6902
|
+
|
|
6903
|
+
test("should have cronJobs array", () => {
|
|
6904
|
+
expect(Array.isArray({{NAME}}Module.cronJobs)).toBe(true);
|
|
6905
|
+
});
|
|
6906
|
+
|
|
6907
|
+
test("should have events array", () => {
|
|
6908
|
+
expect(Array.isArray({{NAME}}Module.events)).toBe(true);
|
|
6909
|
+
});
|
|
6910
|
+
});
|
|
6911
|
+
`;
|
|
6912
|
+
|
|
6913
|
+
// src/templates/module/tsconfig.txt
|
|
6914
|
+
var tsconfig_default = `{
|
|
6915
|
+
"extends": "../../tsconfig.json"
|
|
6916
|
+
}
|
|
6917
|
+
`;
|
|
6918
|
+
|
|
6919
|
+
// src/templates/module/yml.txt
|
|
6920
|
+
var yml_default = `name: {{name}}
|
|
6921
|
+
`;
|
|
6922
|
+
|
|
6923
|
+
// src/commands/ModuleCreateCommand.ts
|
|
6924
|
+
class ModuleCreateCommand {
|
|
6925
|
+
getName() {
|
|
6926
|
+
return "module:create";
|
|
6927
|
+
}
|
|
6928
|
+
getDescription() {
|
|
6929
|
+
return "Generate a new module";
|
|
6930
|
+
}
|
|
6931
|
+
async addToAppModule(appModulePath, pascalName, kebabName) {
|
|
6932
|
+
let content = await Bun.file(appModulePath).text();
|
|
6933
|
+
const moduleName = `${pascalName}Module`;
|
|
6934
|
+
const importPath = `@module/${kebabName}/${moduleName}`;
|
|
6935
|
+
const importLine = `import { ${moduleName} } from "${importPath}";
|
|
6936
|
+
`;
|
|
6937
|
+
const lastImportIndex = content.lastIndexOf("import ");
|
|
6938
|
+
const lineEnd = content.indexOf(`
|
|
6939
|
+
`, lastImportIndex);
|
|
6940
|
+
content = `${content.slice(0, lineEnd + 1)}${importLine}${content.slice(lineEnd + 1)}`;
|
|
6941
|
+
const fields = ["controllers", "middlewares", "cronJobs", "events"];
|
|
6942
|
+
for (const field of fields) {
|
|
6943
|
+
const regex = new RegExp(`(${field}:\\s*\\[)([^\\]]*)`, "s");
|
|
6944
|
+
const match = content.match(regex);
|
|
6945
|
+
if (match) {
|
|
6946
|
+
const existing = match[2] ?? "";
|
|
6947
|
+
const spread = `...${moduleName}.${field}`;
|
|
6948
|
+
const indent = existing.match(/\n(\s+)\S/)?.[1] ?? " ";
|
|
6949
|
+
const closingIndent = existing.match(/\n(\s*)$/)?.[1] ?? " ";
|
|
6950
|
+
const trimmedExisting = existing.trimEnd().replace(/,\s*$/, "");
|
|
6951
|
+
const newValue = trimmedExisting ? `${trimmedExisting},
|
|
6952
|
+
${indent}${spread},
|
|
6953
|
+
${closingIndent}` : `
|
|
6954
|
+
${indent}${spread},
|
|
6955
|
+
${closingIndent}`;
|
|
6956
|
+
content = content.replace(regex, `$1${newValue}`);
|
|
6957
|
+
}
|
|
6958
|
+
}
|
|
6959
|
+
await Bun.write(appModulePath, content);
|
|
6960
|
+
}
|
|
6961
|
+
async addToSharedModule(sharedModulePath, pascalName, kebabName) {
|
|
6962
|
+
let content = await Bun.file(sharedModulePath).text();
|
|
6963
|
+
const moduleName = `${pascalName}Module`;
|
|
6964
|
+
const importPath = `@module/${kebabName}/${moduleName}`;
|
|
6965
|
+
const importLine = `import { ${moduleName} } from "${importPath}";
|
|
6966
|
+
`;
|
|
6967
|
+
const lastImportIndex = content.lastIndexOf("import ");
|
|
6968
|
+
const lineEnd = content.indexOf(`
|
|
6969
|
+
`, lastImportIndex);
|
|
6970
|
+
content = `${content.slice(0, lineEnd + 1)}${importLine}${content.slice(lineEnd + 1)}`;
|
|
6971
|
+
const regex = /(entities:\s*\[)([^\]]*)/s;
|
|
6972
|
+
const match = content.match(regex);
|
|
6973
|
+
if (match) {
|
|
6974
|
+
const existing = match[2] ?? "";
|
|
6975
|
+
const spread = `...${moduleName}.entities`;
|
|
6976
|
+
const indent = existing.match(/\n(\s+)\S/)?.[1] ?? " ";
|
|
6977
|
+
const closingIndent = existing.match(/\n(\s*)$/)?.[1] ?? " ";
|
|
6978
|
+
const trimmedExisting = existing.trimEnd().replace(/,\s*$/, "");
|
|
6979
|
+
const newValue = trimmedExisting ? `${trimmedExisting},
|
|
6980
|
+
${indent}${spread},
|
|
6981
|
+
${closingIndent}` : `
|
|
6982
|
+
${indent}${spread},
|
|
6983
|
+
${closingIndent}`;
|
|
6984
|
+
content = content.replace(regex, `$1${newValue}`);
|
|
6985
|
+
}
|
|
6986
|
+
await Bun.write(sharedModulePath, content);
|
|
6987
|
+
}
|
|
6988
|
+
async addModuleScope(commitlintPath, kebabName) {
|
|
6989
|
+
let content = await Bun.file(commitlintPath).text();
|
|
6990
|
+
const regex = /("scope-enum":\s*\[\s*RuleConfigSeverity\.Error,\s*"always",\s*\[)([\s\S]*?)(\])/;
|
|
6991
|
+
const match = content.match(regex);
|
|
6992
|
+
if (match) {
|
|
6993
|
+
const existing = match[2]?.trim() ?? "";
|
|
6994
|
+
const newScope = `"${kebabName}"`;
|
|
6995
|
+
if (!existing.includes(newScope)) {
|
|
6996
|
+
const newValue = existing ? `${existing},
|
|
6997
|
+
${newScope},` : `
|
|
6998
|
+
${newScope},`;
|
|
6999
|
+
content = content.replace(regex, `$1${newValue}
|
|
7000
|
+
$3`);
|
|
7001
|
+
await Bun.write(commitlintPath, content.replace(/,+/g, ","));
|
|
7002
|
+
}
|
|
7003
|
+
}
|
|
7004
|
+
}
|
|
7005
|
+
async addPathAlias(tsconfigPath, kebabName) {
|
|
7006
|
+
const content = await Bun.file(tsconfigPath).text();
|
|
7007
|
+
const tsconfig = JSON.parse(content);
|
|
7008
|
+
tsconfig.compilerOptions ??= {};
|
|
7009
|
+
tsconfig.compilerOptions.paths ??= {};
|
|
7010
|
+
tsconfig.compilerOptions.paths[`@module/${kebabName}/*`] = [`./modules/${kebabName}/src/*`];
|
|
7011
|
+
await Bun.write(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
|
|
7012
|
+
`);
|
|
7013
|
+
}
|
|
7014
|
+
async run(options) {
|
|
7015
|
+
const { cwd = process.cwd(), silent = false } = options;
|
|
7016
|
+
let { name } = options;
|
|
7017
|
+
if (!name) {
|
|
7018
|
+
name = await askName({ message: "Enter module name" });
|
|
7019
|
+
}
|
|
7020
|
+
const pascalName = toPascalCase(name).replace(/Module$/, "");
|
|
7021
|
+
const kebabName = toKebabCase(pascalName);
|
|
7022
|
+
const moduleDir = join2(cwd, "modules", kebabName);
|
|
7023
|
+
const srcDir = join2(moduleDir, "src");
|
|
7024
|
+
const testsDir = join2(moduleDir, "tests");
|
|
7025
|
+
const moduleContent = module_default.replace(/{{NAME}}/g, pascalName);
|
|
7026
|
+
const packageContent = package_default.replace(/{{NAME}}/g, kebabName);
|
|
7027
|
+
const testContent = test_default.replace(/{{NAME}}/g, pascalName).replace(/{{name}}/g, kebabName);
|
|
7028
|
+
await Bun.write(join2(srcDir, `${pascalName}Module.ts`), moduleContent);
|
|
7029
|
+
await Bun.write(join2(moduleDir, "package.json"), packageContent);
|
|
7030
|
+
await Bun.write(join2(moduleDir, "tsconfig.json"), tsconfig_default);
|
|
7031
|
+
await Bun.write(join2(moduleDir, `${kebabName}.yml`), yml_default.replace(/{{name}}/g, kebabName));
|
|
7032
|
+
await Bun.write(join2(testsDir, `${pascalName}Module.spec.ts`), testContent);
|
|
7033
|
+
if (kebabName !== "app") {
|
|
7034
|
+
const appModulePath = join2(cwd, "modules", "app", "src", "AppModule.ts");
|
|
7035
|
+
if (await Bun.file(appModulePath).exists()) {
|
|
7036
|
+
await this.addToAppModule(appModulePath, pascalName, kebabName);
|
|
7037
|
+
}
|
|
7038
|
+
}
|
|
7039
|
+
const appTsconfigPath = join2(cwd, "tsconfig.json");
|
|
7040
|
+
if (await Bun.file(appTsconfigPath).exists()) {
|
|
7041
|
+
await this.addPathAlias(appTsconfigPath, kebabName);
|
|
7042
|
+
}
|
|
7043
|
+
if (kebabName !== "app" && kebabName !== "shared") {
|
|
7044
|
+
const sharedModuleDir = join2(cwd, "modules", "shared");
|
|
7045
|
+
const sharedModuleFilePath = join2(sharedModuleDir, "src", "SharedModule.ts");
|
|
7046
|
+
if (await Bun.file(sharedModuleFilePath).exists()) {
|
|
7047
|
+
await this.addToSharedModule(sharedModuleFilePath, pascalName, kebabName);
|
|
7048
|
+
}
|
|
7049
|
+
}
|
|
7050
|
+
const commitlintPath = join2(cwd, ".commitlintrc.ts");
|
|
7051
|
+
if (await Bun.file(commitlintPath).exists()) {
|
|
7052
|
+
await this.addModuleScope(commitlintPath, kebabName);
|
|
7053
|
+
}
|
|
7054
|
+
if (!silent) {
|
|
7055
|
+
const logger = new TerminalLogger2;
|
|
7056
|
+
logger.success(`modules/${kebabName} created successfully`, undefined, {
|
|
7057
|
+
showTimestamp: false,
|
|
7058
|
+
showArrow: false,
|
|
7059
|
+
useSymbol: true
|
|
7060
|
+
});
|
|
7061
|
+
}
|
|
7062
|
+
}
|
|
7063
|
+
}
|
|
7064
|
+
ModuleCreateCommand = __legacyDecorateClassTS([
|
|
7065
|
+
decorator2.command()
|
|
7066
|
+
], ModuleCreateCommand);
|
|
7067
|
+
|
|
7068
|
+
// src/utils.ts
|
|
7069
|
+
var toYaml = (value, indent = 0) => {
|
|
7070
|
+
const pad = " ".repeat(indent);
|
|
7071
|
+
if (value === null || value === undefined)
|
|
7072
|
+
return '""';
|
|
7073
|
+
if (typeof value === "string") {
|
|
7074
|
+
if (value === "")
|
|
7075
|
+
return '""';
|
|
7076
|
+
if (/^[{[\]&*!|>'"%@`]/.test(value) || value.includes(": ")) {
|
|
7077
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
7078
|
+
}
|
|
7079
|
+
return value;
|
|
7080
|
+
}
|
|
7081
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
7082
|
+
return String(value);
|
|
7083
|
+
if (Array.isArray(value)) {
|
|
7084
|
+
if (value.length === 0)
|
|
7085
|
+
return "[]";
|
|
7086
|
+
return value.map((item) => `${pad}- ${toYaml(item, indent)}`).join(`
|
|
7087
|
+
`);
|
|
7088
|
+
}
|
|
7089
|
+
return Object.entries(value).map(([k, v]) => {
|
|
7090
|
+
if (Array.isArray(v)) {
|
|
7091
|
+
if (v.length === 0)
|
|
7092
|
+
return `${pad}${k}: []`;
|
|
7093
|
+
const childPad = " ".repeat(indent + 1);
|
|
7094
|
+
return `${pad}${k}:
|
|
7095
|
+
${v.map((item) => `${childPad}- ${toYaml(item, indent + 1)}`).join(`
|
|
7096
|
+
`)}`;
|
|
7097
|
+
}
|
|
7098
|
+
if (v !== null && v !== undefined && typeof v === "object") {
|
|
7099
|
+
return `${pad}${k}:
|
|
7100
|
+
${toYaml(v, indent + 1)}`;
|
|
7101
|
+
}
|
|
7102
|
+
return `${pad}${k}: ${toYaml(v, indent)}`;
|
|
7103
|
+
}).join(`
|
|
7104
|
+
`);
|
|
7105
|
+
};
|
|
7106
|
+
var ensureModule = async (module) => {
|
|
7107
|
+
const moduleDir = join3(process.cwd(), "modules", module);
|
|
7108
|
+
const moduleDirExists = await Bun.file(join3(moduleDir, "package.json")).exists();
|
|
7109
|
+
if (!moduleDirExists) {
|
|
7110
|
+
const makeModule = new ModuleCreateCommand;
|
|
7111
|
+
await makeModule.run({ name: module, cwd: process.cwd(), silent: true });
|
|
7112
|
+
}
|
|
7113
|
+
};
|
|
7114
|
+
|
|
7115
|
+
// src/commands/AppInitCommand.ts
|
|
7116
|
+
import { join as join5 } from "path";
|
|
7117
|
+
|
|
6856
7118
|
// ../../node_modules/.bun/@inversifyjs+common@1.5.2/node_modules/@inversifyjs/common/lib/esm/index.js
|
|
6857
7119
|
function e(e2) {
|
|
6858
7120
|
return (typeof e2 == "object" && e2 !== null || typeof e2 == "function") && typeof e2.then == "function";
|
|
@@ -9653,10 +9915,9 @@ var Environment;
|
|
|
9653
9915
|
})(Environment ||= {});
|
|
9654
9916
|
|
|
9655
9917
|
// src/commands/AppInitCommand.ts
|
|
9656
|
-
import { decorator as
|
|
9657
|
-
import { TerminalLogger as
|
|
9658
|
-
import { random, toKebabCase } from "@ooneex/utils";
|
|
9659
|
-
var {YAML } = globalThis.Bun;
|
|
9918
|
+
import { decorator as decorator4 } from "@ooneex/command";
|
|
9919
|
+
import { TerminalLogger as TerminalLogger4 } from "@ooneex/logger";
|
|
9920
|
+
import { random, toKebabCase as toKebabCase2 } from "@ooneex/utils";
|
|
9660
9921
|
|
|
9661
9922
|
// src/templates/app/.commitlintrc.ts.txt
|
|
9662
9923
|
var _commitlintrc_ts_default = `import { RuleConfigSeverity, type UserConfig } from "@commitlint/types";
|
|
@@ -10233,9 +10494,9 @@ var zed_settings_json_default = `{
|
|
|
10233
10494
|
`;
|
|
10234
10495
|
|
|
10235
10496
|
// src/commands/ClaudeSkillCreateCommand.ts
|
|
10236
|
-
import { join as
|
|
10237
|
-
import { decorator as
|
|
10238
|
-
import { TerminalLogger as
|
|
10497
|
+
import { join as join4 } from "path";
|
|
10498
|
+
import { decorator as decorator3 } from "@ooneex/command";
|
|
10499
|
+
import { TerminalLogger as TerminalLogger3 } from "@ooneex/logger";
|
|
10239
10500
|
|
|
10240
10501
|
// src/templates/claude/CLAUDE.md.txt
|
|
10241
10502
|
var CLAUDE_md_default = `# CLAUDE.md
|
|
@@ -14005,22 +14266,22 @@ class ClaudeSkillCreateCommand {
|
|
|
14005
14266
|
}
|
|
14006
14267
|
async run() {
|
|
14007
14268
|
const claudeLocalDir = ".claude";
|
|
14008
|
-
const claudeDir =
|
|
14009
|
-
const skillsLocalDir =
|
|
14010
|
-
const skillsDir =
|
|
14011
|
-
const logger = new
|
|
14012
|
-
const claudeMdPath =
|
|
14269
|
+
const claudeDir = join4(process.cwd(), claudeLocalDir);
|
|
14270
|
+
const skillsLocalDir = join4(claudeLocalDir, "skills");
|
|
14271
|
+
const skillsDir = join4(process.cwd(), skillsLocalDir);
|
|
14272
|
+
const logger = new TerminalLogger3;
|
|
14273
|
+
const claudeMdPath = join4(claudeDir, "CLAUDE.md");
|
|
14013
14274
|
await Bun.write(claudeMdPath, CLAUDE_md_default);
|
|
14014
|
-
logger.success(`${
|
|
14275
|
+
logger.success(`${join4(claudeLocalDir, "CLAUDE.md")} created successfully`, undefined, {
|
|
14015
14276
|
showTimestamp: false,
|
|
14016
14277
|
showArrow: false,
|
|
14017
14278
|
useSymbol: true
|
|
14018
14279
|
});
|
|
14019
14280
|
for (const [skillName, content] of Object.entries(skills)) {
|
|
14020
14281
|
const dirName = skillName.replace(/\./g, "-");
|
|
14021
|
-
const filePath =
|
|
14282
|
+
const filePath = join4(skillsDir, dirName, "SKILL.md");
|
|
14022
14283
|
await Bun.write(filePath, content);
|
|
14023
|
-
logger.success(`${
|
|
14284
|
+
logger.success(`${join4(skillsLocalDir, dirName, "SKILL.md")} created successfully`, undefined, {
|
|
14024
14285
|
showTimestamp: false,
|
|
14025
14286
|
showArrow: false,
|
|
14026
14287
|
useSymbol: true
|
|
@@ -14029,7 +14290,7 @@ class ClaudeSkillCreateCommand {
|
|
|
14029
14290
|
}
|
|
14030
14291
|
}
|
|
14031
14292
|
ClaudeSkillCreateCommand = __legacyDecorateClassTS([
|
|
14032
|
-
|
|
14293
|
+
decorator3.command()
|
|
14033
14294
|
], ClaudeSkillCreateCommand);
|
|
14034
14295
|
|
|
14035
14296
|
// src/commands/AppInitCommand.ts
|
|
@@ -14045,20 +14306,20 @@ class AppInitCommand {
|
|
|
14045
14306
|
if (!name) {
|
|
14046
14307
|
name = await askName({ message: "Enter application name" });
|
|
14047
14308
|
}
|
|
14048
|
-
const kebabName =
|
|
14309
|
+
const kebabName = toKebabCase2(name);
|
|
14049
14310
|
if (!destination) {
|
|
14050
14311
|
destination = await askDestination({ message: "Enter destination path", initial: kebabName });
|
|
14051
14312
|
}
|
|
14052
14313
|
const packageContent = package_json_default.replace(/{{NAME}}/g, kebabName);
|
|
14053
|
-
await Bun.write(
|
|
14054
|
-
await Bun.write(
|
|
14055
|
-
await Bun.write(
|
|
14056
|
-
await Bun.write(
|
|
14057
|
-
await Bun.write(
|
|
14058
|
-
await Bun.write(
|
|
14059
|
-
await Bun.write(
|
|
14060
|
-
await Bun.write(
|
|
14061
|
-
await Bun.write(
|
|
14314
|
+
await Bun.write(join5(destination, ".commitlintrc.ts"), _commitlintrc_ts_default);
|
|
14315
|
+
await Bun.write(join5(destination, ".gitignore"), _gitignore_default);
|
|
14316
|
+
await Bun.write(join5(destination, "biome.jsonc"), biome_jsonc_default);
|
|
14317
|
+
await Bun.write(join5(destination, "bunfig.toml"), bunfig_toml_default);
|
|
14318
|
+
await Bun.write(join5(destination, "nx.json"), nx_json_default);
|
|
14319
|
+
await Bun.write(join5(destination, "package.json"), packageContent);
|
|
14320
|
+
await Bun.write(join5(destination, "README.md"), README_md_default.replace(/{{NAME}}/g, kebabName));
|
|
14321
|
+
await Bun.write(join5(destination, "tsconfig.json"), tsconfig_json_default);
|
|
14322
|
+
await Bun.write(join5(destination, ".zed", "settings.json"), zed_settings_json_default);
|
|
14062
14323
|
const envData = structuredClone(env_default);
|
|
14063
14324
|
envData.cache.redis.url = "redis://localhost:6379";
|
|
14064
14325
|
envData.pubsub.redis.url = "redis://localhost:6379";
|
|
@@ -14067,9 +14328,11 @@ class AppInitCommand {
|
|
|
14067
14328
|
envData.database.redis.url = "redis://localhost:6379";
|
|
14068
14329
|
envData.csrf.secret = random.nanoid(20);
|
|
14069
14330
|
if (appType === "api") {
|
|
14070
|
-
await Bun.write(
|
|
14331
|
+
await Bun.write(join5(destination, "modules", "app", ".env.yml"), `${toYaml(envData)}
|
|
14332
|
+
`);
|
|
14071
14333
|
} else {
|
|
14072
|
-
await Bun.write(
|
|
14334
|
+
await Bun.write(join5(destination, ".env.yml"), `${toYaml(envData)}
|
|
14335
|
+
`);
|
|
14073
14336
|
}
|
|
14074
14337
|
const addDevDeps = Bun.spawn([
|
|
14075
14338
|
"bun",
|
|
@@ -14096,8 +14359,8 @@ class AppInitCommand {
|
|
|
14096
14359
|
await gitInit.exited;
|
|
14097
14360
|
const huskyInit = Bun.spawn(["bunx", "husky", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
14098
14361
|
await huskyInit.exited;
|
|
14099
|
-
await Bun.write(
|
|
14100
|
-
await Bun.write(
|
|
14362
|
+
await Bun.write(join5(destination, ".husky", "pre-commit"), "lint-staged");
|
|
14363
|
+
await Bun.write(join5(destination, ".husky", "commit-msg"), `bunx commitlint --edit "$1"`);
|
|
14101
14364
|
const runClaudeSkills = await askConfirm({ message: "Add Claude skills?", initial: true });
|
|
14102
14365
|
if (runClaudeSkills) {
|
|
14103
14366
|
const originalCwd = process.cwd();
|
|
@@ -14106,7 +14369,7 @@ class AppInitCommand {
|
|
|
14106
14369
|
process.chdir(originalCwd);
|
|
14107
14370
|
}
|
|
14108
14371
|
if (!silent) {
|
|
14109
|
-
const logger = new
|
|
14372
|
+
const logger = new TerminalLogger4;
|
|
14110
14373
|
logger.success(`${kebabName} initialized successfully at ${destination}`, undefined, {
|
|
14111
14374
|
showTimestamp: false,
|
|
14112
14375
|
showArrow: false,
|
|
@@ -14116,220 +14379,8 @@ class AppInitCommand {
|
|
|
14116
14379
|
}
|
|
14117
14380
|
}
|
|
14118
14381
|
AppInitCommand = __legacyDecorateClassTS([
|
|
14119
|
-
decorator3.command()
|
|
14120
|
-
], AppInitCommand);
|
|
14121
|
-
|
|
14122
|
-
// src/commands/ModuleCreateCommand.ts
|
|
14123
|
-
import { join as join4 } from "path";
|
|
14124
|
-
import { decorator as decorator4 } from "@ooneex/command";
|
|
14125
|
-
import { TerminalLogger as TerminalLogger4 } from "@ooneex/logger";
|
|
14126
|
-
import { toKebabCase as toKebabCase2, toPascalCase } from "@ooneex/utils";
|
|
14127
|
-
|
|
14128
|
-
// src/templates/module/module.txt
|
|
14129
|
-
var module_default = `import type { ModuleType } from "@ooneex/module";
|
|
14130
|
-
|
|
14131
|
-
export const {{NAME}}Module: ModuleType = {
|
|
14132
|
-
controllers: [],
|
|
14133
|
-
entities: [],
|
|
14134
|
-
middlewares: [],
|
|
14135
|
-
cronJobs: [],
|
|
14136
|
-
events: [],
|
|
14137
|
-
};
|
|
14138
|
-
`;
|
|
14139
|
-
|
|
14140
|
-
// src/templates/module/package.txt
|
|
14141
|
-
var package_default = `{
|
|
14142
|
-
"name": "@module/{{NAME}}",
|
|
14143
|
-
"description": "",
|
|
14144
|
-
"version": "0.0.1",
|
|
14145
|
-
"scripts": {
|
|
14146
|
-
"test": "bun test tests",
|
|
14147
|
-
"lint": "tsgo --noEmit && bunx biome lint"
|
|
14148
|
-
}
|
|
14149
|
-
}
|
|
14150
|
-
`;
|
|
14151
|
-
|
|
14152
|
-
// src/templates/module/test.txt
|
|
14153
|
-
var test_default = `import { describe, expect, test } from "bun:test";
|
|
14154
|
-
import { {{NAME}}Module } from "@module/{{name}}/{{NAME}}Module";
|
|
14155
|
-
|
|
14156
|
-
describe("{{NAME}}Module", () => {
|
|
14157
|
-
test("should have controllers array", () => {
|
|
14158
|
-
expect(Array.isArray({{NAME}}Module.controllers)).toBe(true);
|
|
14159
|
-
});
|
|
14160
|
-
|
|
14161
|
-
test("should have entities array", () => {
|
|
14162
|
-
expect(Array.isArray({{NAME}}Module.entities)).toBe(true);
|
|
14163
|
-
});
|
|
14164
|
-
|
|
14165
|
-
test("should have middlewares array", () => {
|
|
14166
|
-
expect(Array.isArray({{NAME}}Module.middlewares)).toBe(true);
|
|
14167
|
-
});
|
|
14168
|
-
|
|
14169
|
-
test("should have cronJobs array", () => {
|
|
14170
|
-
expect(Array.isArray({{NAME}}Module.cronJobs)).toBe(true);
|
|
14171
|
-
});
|
|
14172
|
-
|
|
14173
|
-
test("should have events array", () => {
|
|
14174
|
-
expect(Array.isArray({{NAME}}Module.events)).toBe(true);
|
|
14175
|
-
});
|
|
14176
|
-
});
|
|
14177
|
-
`;
|
|
14178
|
-
|
|
14179
|
-
// src/templates/module/tsconfig.txt
|
|
14180
|
-
var tsconfig_default = `{
|
|
14181
|
-
"extends": "../../tsconfig.json"
|
|
14182
|
-
}
|
|
14183
|
-
`;
|
|
14184
|
-
|
|
14185
|
-
// src/templates/module/yml.txt
|
|
14186
|
-
var yml_default = `name: {{name}}
|
|
14187
|
-
`;
|
|
14188
|
-
|
|
14189
|
-
// src/commands/ModuleCreateCommand.ts
|
|
14190
|
-
class ModuleCreateCommand {
|
|
14191
|
-
getName() {
|
|
14192
|
-
return "module:create";
|
|
14193
|
-
}
|
|
14194
|
-
getDescription() {
|
|
14195
|
-
return "Generate a new module";
|
|
14196
|
-
}
|
|
14197
|
-
async addToAppModule(appModulePath, pascalName, kebabName) {
|
|
14198
|
-
let content = await Bun.file(appModulePath).text();
|
|
14199
|
-
const moduleName = `${pascalName}Module`;
|
|
14200
|
-
const importPath = `@module/${kebabName}/${moduleName}`;
|
|
14201
|
-
const importLine = `import { ${moduleName} } from "${importPath}";
|
|
14202
|
-
`;
|
|
14203
|
-
const lastImportIndex = content.lastIndexOf("import ");
|
|
14204
|
-
const lineEnd = content.indexOf(`
|
|
14205
|
-
`, lastImportIndex);
|
|
14206
|
-
content = `${content.slice(0, lineEnd + 1)}${importLine}${content.slice(lineEnd + 1)}`;
|
|
14207
|
-
const fields = ["controllers", "middlewares", "cronJobs", "events"];
|
|
14208
|
-
for (const field of fields) {
|
|
14209
|
-
const regex = new RegExp(`(${field}:\\s*\\[)([^\\]]*)`, "s");
|
|
14210
|
-
const match = content.match(regex);
|
|
14211
|
-
if (match) {
|
|
14212
|
-
const existing = match[2] ?? "";
|
|
14213
|
-
const spread = `...${moduleName}.${field}`;
|
|
14214
|
-
const indent = existing.match(/\n(\s+)\S/)?.[1] ?? " ";
|
|
14215
|
-
const closingIndent = existing.match(/\n(\s*)$/)?.[1] ?? " ";
|
|
14216
|
-
const trimmedExisting = existing.trimEnd().replace(/,\s*$/, "");
|
|
14217
|
-
const newValue = trimmedExisting ? `${trimmedExisting},
|
|
14218
|
-
${indent}${spread},
|
|
14219
|
-
${closingIndent}` : `
|
|
14220
|
-
${indent}${spread},
|
|
14221
|
-
${closingIndent}`;
|
|
14222
|
-
content = content.replace(regex, `$1${newValue}`);
|
|
14223
|
-
}
|
|
14224
|
-
}
|
|
14225
|
-
await Bun.write(appModulePath, content);
|
|
14226
|
-
}
|
|
14227
|
-
async addToSharedModule(sharedModulePath, pascalName, kebabName) {
|
|
14228
|
-
let content = await Bun.file(sharedModulePath).text();
|
|
14229
|
-
const moduleName = `${pascalName}Module`;
|
|
14230
|
-
const importPath = `@module/${kebabName}/${moduleName}`;
|
|
14231
|
-
const importLine = `import { ${moduleName} } from "${importPath}";
|
|
14232
|
-
`;
|
|
14233
|
-
const lastImportIndex = content.lastIndexOf("import ");
|
|
14234
|
-
const lineEnd = content.indexOf(`
|
|
14235
|
-
`, lastImportIndex);
|
|
14236
|
-
content = `${content.slice(0, lineEnd + 1)}${importLine}${content.slice(lineEnd + 1)}`;
|
|
14237
|
-
const regex = /(entities:\s*\[)([^\]]*)/s;
|
|
14238
|
-
const match = content.match(regex);
|
|
14239
|
-
if (match) {
|
|
14240
|
-
const existing = match[2] ?? "";
|
|
14241
|
-
const spread = `...${moduleName}.entities`;
|
|
14242
|
-
const indent = existing.match(/\n(\s+)\S/)?.[1] ?? " ";
|
|
14243
|
-
const closingIndent = existing.match(/\n(\s*)$/)?.[1] ?? " ";
|
|
14244
|
-
const trimmedExisting = existing.trimEnd().replace(/,\s*$/, "");
|
|
14245
|
-
const newValue = trimmedExisting ? `${trimmedExisting},
|
|
14246
|
-
${indent}${spread},
|
|
14247
|
-
${closingIndent}` : `
|
|
14248
|
-
${indent}${spread},
|
|
14249
|
-
${closingIndent}`;
|
|
14250
|
-
content = content.replace(regex, `$1${newValue}`);
|
|
14251
|
-
}
|
|
14252
|
-
await Bun.write(sharedModulePath, content);
|
|
14253
|
-
}
|
|
14254
|
-
async addModuleScope(commitlintPath, kebabName) {
|
|
14255
|
-
let content = await Bun.file(commitlintPath).text();
|
|
14256
|
-
const regex = /("scope-enum":\s*\[\s*RuleConfigSeverity\.Error,\s*"always",\s*\[)([\s\S]*?)(\])/;
|
|
14257
|
-
const match = content.match(regex);
|
|
14258
|
-
if (match) {
|
|
14259
|
-
const existing = match[2]?.trim() ?? "";
|
|
14260
|
-
const newScope = `"${kebabName}"`;
|
|
14261
|
-
if (!existing.includes(newScope)) {
|
|
14262
|
-
const newValue = existing ? `${existing},
|
|
14263
|
-
${newScope},` : `
|
|
14264
|
-
${newScope},`;
|
|
14265
|
-
content = content.replace(regex, `$1${newValue}
|
|
14266
|
-
$3`);
|
|
14267
|
-
await Bun.write(commitlintPath, content.replace(/,+/g, ","));
|
|
14268
|
-
}
|
|
14269
|
-
}
|
|
14270
|
-
}
|
|
14271
|
-
async addPathAlias(tsconfigPath, kebabName) {
|
|
14272
|
-
const content = await Bun.file(tsconfigPath).text();
|
|
14273
|
-
const tsconfig = JSON.parse(content);
|
|
14274
|
-
tsconfig.compilerOptions ??= {};
|
|
14275
|
-
tsconfig.compilerOptions.paths ??= {};
|
|
14276
|
-
tsconfig.compilerOptions.paths[`@module/${kebabName}/*`] = [`./modules/${kebabName}/src/*`];
|
|
14277
|
-
await Bun.write(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
|
|
14278
|
-
`);
|
|
14279
|
-
}
|
|
14280
|
-
async run(options) {
|
|
14281
|
-
const { cwd = process.cwd(), silent = false } = options;
|
|
14282
|
-
let { name } = options;
|
|
14283
|
-
if (!name) {
|
|
14284
|
-
name = await askName({ message: "Enter module name" });
|
|
14285
|
-
}
|
|
14286
|
-
const pascalName = toPascalCase(name).replace(/Module$/, "");
|
|
14287
|
-
const kebabName = toKebabCase2(pascalName);
|
|
14288
|
-
const moduleDir = join4(cwd, "modules", kebabName);
|
|
14289
|
-
const srcDir = join4(moduleDir, "src");
|
|
14290
|
-
const testsDir = join4(moduleDir, "tests");
|
|
14291
|
-
const moduleContent = module_default.replace(/{{NAME}}/g, pascalName);
|
|
14292
|
-
const packageContent = package_default.replace(/{{NAME}}/g, kebabName);
|
|
14293
|
-
const testContent = test_default.replace(/{{NAME}}/g, pascalName).replace(/{{name}}/g, kebabName);
|
|
14294
|
-
await Bun.write(join4(srcDir, `${pascalName}Module.ts`), moduleContent);
|
|
14295
|
-
await Bun.write(join4(moduleDir, "package.json"), packageContent);
|
|
14296
|
-
await Bun.write(join4(moduleDir, "tsconfig.json"), tsconfig_default);
|
|
14297
|
-
await Bun.write(join4(moduleDir, `${kebabName}.yml`), yml_default.replace(/{{name}}/g, kebabName));
|
|
14298
|
-
await Bun.write(join4(testsDir, `${pascalName}Module.spec.ts`), testContent);
|
|
14299
|
-
if (kebabName !== "app") {
|
|
14300
|
-
const appModulePath = join4(cwd, "modules", "app", "src", "AppModule.ts");
|
|
14301
|
-
if (await Bun.file(appModulePath).exists()) {
|
|
14302
|
-
await this.addToAppModule(appModulePath, pascalName, kebabName);
|
|
14303
|
-
}
|
|
14304
|
-
}
|
|
14305
|
-
const appTsconfigPath = join4(cwd, "tsconfig.json");
|
|
14306
|
-
if (await Bun.file(appTsconfigPath).exists()) {
|
|
14307
|
-
await this.addPathAlias(appTsconfigPath, kebabName);
|
|
14308
|
-
}
|
|
14309
|
-
if (kebabName !== "app" && kebabName !== "shared") {
|
|
14310
|
-
const sharedModuleDir = join4(cwd, "modules", "shared");
|
|
14311
|
-
const sharedModuleFilePath = join4(sharedModuleDir, "src", "SharedModule.ts");
|
|
14312
|
-
if (await Bun.file(sharedModuleFilePath).exists()) {
|
|
14313
|
-
await this.addToSharedModule(sharedModuleFilePath, pascalName, kebabName);
|
|
14314
|
-
}
|
|
14315
|
-
}
|
|
14316
|
-
const commitlintPath = join4(cwd, ".commitlintrc.ts");
|
|
14317
|
-
if (await Bun.file(commitlintPath).exists()) {
|
|
14318
|
-
await this.addModuleScope(commitlintPath, kebabName);
|
|
14319
|
-
}
|
|
14320
|
-
if (!silent) {
|
|
14321
|
-
const logger = new TerminalLogger4;
|
|
14322
|
-
logger.success(`modules/${kebabName} created successfully`, undefined, {
|
|
14323
|
-
showTimestamp: false,
|
|
14324
|
-
showArrow: false,
|
|
14325
|
-
useSymbol: true
|
|
14326
|
-
});
|
|
14327
|
-
}
|
|
14328
|
-
}
|
|
14329
|
-
}
|
|
14330
|
-
ModuleCreateCommand = __legacyDecorateClassTS([
|
|
14331
14382
|
decorator4.command()
|
|
14332
|
-
],
|
|
14383
|
+
], AppInitCommand);
|
|
14333
14384
|
|
|
14334
14385
|
// src/commands/AppCreateCommand.ts
|
|
14335
14386
|
class AppCreateCommand {
|
|
@@ -14354,23 +14405,24 @@ class AppCreateCommand {
|
|
|
14354
14405
|
cwd: destination,
|
|
14355
14406
|
silent: true
|
|
14356
14407
|
});
|
|
14357
|
-
const appModulePackagePath =
|
|
14408
|
+
const appModulePackagePath = join6(destination, "modules", "app", "package.json");
|
|
14358
14409
|
const appModulePackageJson = await Bun.file(appModulePackagePath).json();
|
|
14359
14410
|
await Bun.write(appModulePackagePath, JSON.stringify(appModulePackageJson, null, 2));
|
|
14360
|
-
await Bun.write(
|
|
14411
|
+
await Bun.write(join6(destination, "modules", "app", "src", "index.ts"), index_ts_default);
|
|
14361
14412
|
await makeModuleCommand.run({
|
|
14362
14413
|
name: "shared",
|
|
14363
14414
|
cwd: destination,
|
|
14364
14415
|
silent: true
|
|
14365
14416
|
});
|
|
14366
|
-
await Bun.write(
|
|
14367
|
-
await Bun.write(
|
|
14417
|
+
await Bun.write(join6(destination, "modules", "shared", "src", "databases", "SharedDatabase.ts"), app_database_default);
|
|
14418
|
+
await Bun.write(join6(destination, "modules", "shared", "src", "roles.yml"), `${toYaml(roles_default)}
|
|
14419
|
+
`);
|
|
14368
14420
|
const snakeName = toSnakeCase(name);
|
|
14369
14421
|
const dockerComposeContent = docker_compose_yml_default.replace(/{{NAME}}/g, snakeName);
|
|
14370
|
-
await Bun.write(
|
|
14422
|
+
await Bun.write(join6(destination, "modules", "app", "docker-compose.yml"), dockerComposeContent);
|
|
14371
14423
|
const dockerfileContent = Dockerfile_default.replace(/{{NAME}}/g, snakeName);
|
|
14372
|
-
await Bun.write(
|
|
14373
|
-
await Bun.write(
|
|
14424
|
+
await Bun.write(join6(destination, "modules", "app", "Dockerfile"), dockerfileContent);
|
|
14425
|
+
await Bun.write(join6(destination, "modules", "app", "var", ".gitkeep"), "");
|
|
14374
14426
|
const addDeps = Bun.spawn([
|
|
14375
14427
|
"bun",
|
|
14376
14428
|
"add",
|
|
@@ -14448,19 +14500,19 @@ Start the app:
|
|
|
14448
14500
|
if (createCiCd) {
|
|
14449
14501
|
const provider = await askCiProvider({ message: "Choose CI/CD provider" });
|
|
14450
14502
|
if (provider === "github") {
|
|
14451
|
-
await Bun.write(
|
|
14452
|
-
await Bun.write(
|
|
14503
|
+
await Bun.write(join6(destination, ".github", "workflows", "ci.yml"), templates2.ci.replace(/{{NAME}}/g, snakeName));
|
|
14504
|
+
await Bun.write(join6(destination, ".github", "workflows", "production.yml"), templates2.production.replace(/{{NAME}}/g, snakeName));
|
|
14453
14505
|
} else if (provider === "gitlab") {
|
|
14454
|
-
await Bun.write(
|
|
14455
|
-
await Bun.write(
|
|
14456
|
-
await Bun.write(
|
|
14506
|
+
await Bun.write(join6(destination, ".gitlab", "ci", "ci.yml"), templates3.ci.replace(/{{NAME}}/g, snakeName));
|
|
14507
|
+
await Bun.write(join6(destination, ".gitlab", "ci", "production.yml"), templates3.production.replace(/{{NAME}}/g, snakeName));
|
|
14508
|
+
await Bun.write(join6(destination, ".gitlab-ci.yml"), `include:
|
|
14457
14509
|
- local: .gitlab/ci/ci.yml
|
|
14458
14510
|
- local: .gitlab/ci/production.yml
|
|
14459
14511
|
`);
|
|
14460
14512
|
} else {
|
|
14461
|
-
await Bun.write(
|
|
14513
|
+
await Bun.write(join6(destination, "bitbucket-pipelines.yml"), templates.pipelines.replace(/{{NAME}}/g, snakeName));
|
|
14462
14514
|
}
|
|
14463
|
-
await Bun.write(
|
|
14515
|
+
await Bun.write(join6(destination, "renovate.json"), renovate_json_default);
|
|
14464
14516
|
logger.success(`${provider} CI/CD files created`, undefined, {
|
|
14465
14517
|
showTimestamp: false,
|
|
14466
14518
|
showArrow: false,
|
|
@@ -14473,7 +14525,7 @@ AppCreateCommand = __legacyDecorateClassTS([
|
|
|
14473
14525
|
decorator5.command()
|
|
14474
14526
|
], AppCreateCommand);
|
|
14475
14527
|
// src/commands/AppStartCommand.ts
|
|
14476
|
-
import { join as
|
|
14528
|
+
import { join as join7 } from "path";
|
|
14477
14529
|
import { decorator as decorator6 } from "@ooneex/command";
|
|
14478
14530
|
import { TerminalLogger as TerminalLogger6 } from "@ooneex/logger";
|
|
14479
14531
|
class AppStartCommand {
|
|
@@ -14485,8 +14537,8 @@ class AppStartCommand {
|
|
|
14485
14537
|
}
|
|
14486
14538
|
async run() {
|
|
14487
14539
|
const logger = new TerminalLogger6;
|
|
14488
|
-
const appDir =
|
|
14489
|
-
const packageJsonFile = Bun.file(
|
|
14540
|
+
const appDir = join7(process.cwd(), "modules", "app");
|
|
14541
|
+
const packageJsonFile = Bun.file(join7(appDir, "package.json"));
|
|
14490
14542
|
if (!await packageJsonFile.exists()) {
|
|
14491
14543
|
logger.error("Module app not found", undefined, {
|
|
14492
14544
|
showTimestamp: false,
|
|
@@ -14497,7 +14549,7 @@ class AppStartCommand {
|
|
|
14497
14549
|
}
|
|
14498
14550
|
const packageJson = await packageJsonFile.json();
|
|
14499
14551
|
const name = packageJson.name ?? "app";
|
|
14500
|
-
const composeFile =
|
|
14552
|
+
const composeFile = join7(appDir, "docker-compose.yml");
|
|
14501
14553
|
const composeExists = await Bun.file(composeFile).exists();
|
|
14502
14554
|
if (composeExists) {
|
|
14503
14555
|
logger.info(`Starting Docker services for ${name}...`, undefined, {
|
|
@@ -14531,7 +14583,7 @@ class AppStartCommand {
|
|
|
14531
14583
|
showArrow: false,
|
|
14532
14584
|
useSymbol: true
|
|
14533
14585
|
});
|
|
14534
|
-
const entryPoint =
|
|
14586
|
+
const entryPoint = join7(appDir, "src", "index.ts");
|
|
14535
14587
|
const app = Bun.spawn(["bun", "--hot", "run", entryPoint], {
|
|
14536
14588
|
cwd: process.cwd(),
|
|
14537
14589
|
stdout: "inherit",
|
|
@@ -14551,7 +14603,7 @@ AppStartCommand = __legacyDecorateClassTS([
|
|
|
14551
14603
|
decorator6.command()
|
|
14552
14604
|
], AppStartCommand);
|
|
14553
14605
|
// src/commands/AppStopCommand.ts
|
|
14554
|
-
import { join as
|
|
14606
|
+
import { join as join8 } from "path";
|
|
14555
14607
|
import { decorator as decorator7 } from "@ooneex/command";
|
|
14556
14608
|
import { TerminalLogger as TerminalLogger7 } from "@ooneex/logger";
|
|
14557
14609
|
class AppStopCommand {
|
|
@@ -14563,8 +14615,8 @@ class AppStopCommand {
|
|
|
14563
14615
|
}
|
|
14564
14616
|
async run() {
|
|
14565
14617
|
const logger = new TerminalLogger7;
|
|
14566
|
-
const appDir =
|
|
14567
|
-
const packageJsonFile = Bun.file(
|
|
14618
|
+
const appDir = join8(process.cwd(), "modules", "app");
|
|
14619
|
+
const packageJsonFile = Bun.file(join8(appDir, "package.json"));
|
|
14568
14620
|
if (!await packageJsonFile.exists()) {
|
|
14569
14621
|
logger.error("Module app not found", undefined, {
|
|
14570
14622
|
showTimestamp: false,
|
|
@@ -14606,7 +14658,7 @@ AppStopCommand = __legacyDecorateClassTS([
|
|
|
14606
14658
|
], AppStopCommand);
|
|
14607
14659
|
// src/commands/CommandRunCommand.ts
|
|
14608
14660
|
import { existsSync } from "fs";
|
|
14609
|
-
import { join as
|
|
14661
|
+
import { join as join9 } from "path";
|
|
14610
14662
|
import { decorator as decorator8 } from "@ooneex/command";
|
|
14611
14663
|
import { TerminalLogger as TerminalLogger8 } from "@ooneex/logger";
|
|
14612
14664
|
class CommandRunCommand {
|
|
@@ -14628,7 +14680,7 @@ class CommandRunCommand {
|
|
|
14628
14680
|
return;
|
|
14629
14681
|
}
|
|
14630
14682
|
const extraArgs = Bun.argv.slice(4);
|
|
14631
|
-
const modulesDir =
|
|
14683
|
+
const modulesDir = join9(process.cwd(), "modules");
|
|
14632
14684
|
if (!existsSync(modulesDir)) {
|
|
14633
14685
|
logger.warn(`Command "${commandName}" not found in any module`, undefined, {
|
|
14634
14686
|
showTimestamp: false,
|
|
@@ -14641,10 +14693,10 @@ class CommandRunCommand {
|
|
|
14641
14693
|
const modules = [];
|
|
14642
14694
|
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
14643
14695
|
const entry = match.replace("/package.json", "");
|
|
14644
|
-
const moduleDir =
|
|
14645
|
-
const commandRunFile = Bun.file(
|
|
14696
|
+
const moduleDir = join9(modulesDir, entry);
|
|
14697
|
+
const commandRunFile = Bun.file(join9(moduleDir, "bin", "command", "run.ts"));
|
|
14646
14698
|
if (await commandRunFile.exists()) {
|
|
14647
|
-
const packageJson = await Bun.file(
|
|
14699
|
+
const packageJson = await Bun.file(join9(modulesDir, match)).json();
|
|
14648
14700
|
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
14649
14701
|
}
|
|
14650
14702
|
}
|
|
@@ -14657,14 +14709,14 @@ class CommandRunCommand {
|
|
|
14657
14709
|
return;
|
|
14658
14710
|
}
|
|
14659
14711
|
for (const { name, dir } of modules) {
|
|
14660
|
-
const commandRunPath =
|
|
14712
|
+
const commandRunPath = join9(dir, "bin", "command", "run.ts");
|
|
14661
14713
|
logger.info(`Running "${commandName}" for ${name}...`, undefined, {
|
|
14662
14714
|
showTimestamp: false,
|
|
14663
14715
|
showArrow: false,
|
|
14664
14716
|
useSymbol: false
|
|
14665
14717
|
});
|
|
14666
14718
|
const proc = Bun.spawn(["bun", "run", commandRunPath, commandName, ...extraArgs], {
|
|
14667
|
-
cwd:
|
|
14719
|
+
cwd: process.cwd(),
|
|
14668
14720
|
stdout: "pipe",
|
|
14669
14721
|
stderr: "pipe"
|
|
14670
14722
|
});
|
|
@@ -14700,7 +14752,7 @@ CommandRunCommand = __legacyDecorateClassTS([
|
|
|
14700
14752
|
], CommandRunCommand);
|
|
14701
14753
|
// src/commands/CompletionZshCommand.ts
|
|
14702
14754
|
import { homedir } from "os";
|
|
14703
|
-
import { join as
|
|
14755
|
+
import { join as join10 } from "path";
|
|
14704
14756
|
import { decorator as decorator9 } from "@ooneex/command";
|
|
14705
14757
|
import { TerminalLogger as TerminalLogger9 } from "@ooneex/logger";
|
|
14706
14758
|
|
|
@@ -15087,10 +15139,10 @@ class CompletionZshCommand {
|
|
|
15087
15139
|
return "Install Zsh completion for oo command";
|
|
15088
15140
|
}
|
|
15089
15141
|
async run() {
|
|
15090
|
-
const completionDir =
|
|
15091
|
-
const ooFilePath =
|
|
15142
|
+
const completionDir = join10(homedir(), ".zsh");
|
|
15143
|
+
const ooFilePath = join10(completionDir, "_oo");
|
|
15092
15144
|
await Bun.write(ooFilePath, _oo_default);
|
|
15093
|
-
const ooneexFilePath =
|
|
15145
|
+
const ooneexFilePath = join10(completionDir, "_ooneex");
|
|
15094
15146
|
await Bun.write(ooneexFilePath, _ooneex_default);
|
|
15095
15147
|
const logger = new TerminalLogger9;
|
|
15096
15148
|
logger.success(`${ooFilePath} created successfully`, undefined, {
|
|
@@ -15150,19 +15202,6 @@ var import_enquirer5 = __toESM(require_enquirer(), 1);
|
|
|
15150
15202
|
import { join as join11 } from "path";
|
|
15151
15203
|
import { decorator as decorator11 } from "@ooneex/command";
|
|
15152
15204
|
import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
|
|
15153
|
-
|
|
15154
|
-
// src/utils.ts
|
|
15155
|
-
import { join as join10 } from "path";
|
|
15156
|
-
var ensureModule = async (module) => {
|
|
15157
|
-
const moduleDir = join10(process.cwd(), "modules", module);
|
|
15158
|
-
const moduleDirExists = await Bun.file(join10(moduleDir, "package.json")).exists();
|
|
15159
|
-
if (!moduleDirExists) {
|
|
15160
|
-
const makeModule = new ModuleCreateCommand;
|
|
15161
|
-
await makeModule.run({ name: module, cwd: process.cwd(), silent: true });
|
|
15162
|
-
}
|
|
15163
|
-
};
|
|
15164
|
-
|
|
15165
|
-
// src/commands/IssueCreateCommand.ts
|
|
15166
15205
|
var ID_PATTERN = /^[A-F]{3}-\d{6}$/;
|
|
15167
15206
|
var generateId = () => {
|
|
15168
15207
|
const letters = "ABCDEF";
|
|
@@ -96128,7 +96167,7 @@ MakeDatabaseCommand = __legacyDecorateClassTS([
|
|
|
96128
96167
|
import { join as join20 } from "path";
|
|
96129
96168
|
import { decorator as decorator20 } from "@ooneex/command";
|
|
96130
96169
|
import { TerminalLogger as TerminalLogger19 } from "@ooneex/logger";
|
|
96131
|
-
var {YAML
|
|
96170
|
+
var {YAML } = globalThis.Bun;
|
|
96132
96171
|
|
|
96133
96172
|
// src/prompts/askDockerService.ts
|
|
96134
96173
|
var import_enquirer10 = __toESM(require_enquirer(), 1);
|
|
@@ -96603,7 +96642,7 @@ var extractServiceBlock = (template) => {
|
|
|
96603
96642
|
`);
|
|
96604
96643
|
};
|
|
96605
96644
|
var extractVolumeNames = (template) => {
|
|
96606
|
-
const config =
|
|
96645
|
+
const config = YAML.parse(template);
|
|
96607
96646
|
return config.volumes ? Object.keys(config.volumes) : [];
|
|
96608
96647
|
};
|
|
96609
96648
|
|
|
@@ -96626,7 +96665,7 @@ class MakeDockerCommand {
|
|
|
96626
96665
|
const composeFile = Bun.file(composePath);
|
|
96627
96666
|
if (await composeFile.exists()) {
|
|
96628
96667
|
const existingContent = await composeFile.text();
|
|
96629
|
-
const existingConfig =
|
|
96668
|
+
const existingConfig = YAML.parse(existingContent);
|
|
96630
96669
|
if (existingConfig.services && name in existingConfig.services) {
|
|
96631
96670
|
logger.warn(`Service "${name}" already exists in docker-compose.yml`, undefined, {
|
|
96632
96671
|
showTimestamp: false,
|
|
@@ -109726,4 +109765,4 @@ SeedRunCommand = __legacyDecorateClassTS([
|
|
|
109726
109765
|
// src/index.ts
|
|
109727
109766
|
await run();
|
|
109728
109767
|
|
|
109729
|
-
//# debugId=
|
|
109768
|
+
//# debugId=1A6419EF7EB53FE364756E2164756E21
|