@ooneex/cli 1.20.0 → 1.20.2
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 +26 -31
- package/dist/index.js.map +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5545,7 +5545,7 @@ var package_default = `{
|
|
|
5545
5545
|
|
|
5546
5546
|
// src/templates/module/test.txt
|
|
5547
5547
|
var test_default = `import { describe, expect, test } from "bun:test";
|
|
5548
|
-
import { {{NAME}}Module } from "
|
|
5548
|
+
import { {{NAME}}Module } from "@module/{{name}}/{{NAME}}Module";
|
|
5549
5549
|
|
|
5550
5550
|
describe("{{NAME}}Module", () => {
|
|
5551
5551
|
test("should have controllers array", () => {
|
|
@@ -5572,15 +5572,7 @@ describe("{{NAME}}Module", () => {
|
|
|
5572
5572
|
|
|
5573
5573
|
// src/templates/module/tsconfig.txt
|
|
5574
5574
|
var tsconfig_default = `{
|
|
5575
|
-
"extends": "../../tsconfig.json"
|
|
5576
|
-
"compilerOptions": {
|
|
5577
|
-
"types": ["@types/bun"],
|
|
5578
|
-
"paths": {
|
|
5579
|
-
"@/*": ["./src/*"]
|
|
5580
|
-
}
|
|
5581
|
-
},
|
|
5582
|
-
"include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "tests/**/*.tsx", "bin/**/*.ts"],
|
|
5583
|
-
"exclude": ["node_modules", "dist"]
|
|
5575
|
+
"extends": "../../tsconfig.json"
|
|
5584
5576
|
}
|
|
5585
5577
|
`;
|
|
5586
5578
|
|
|
@@ -5643,7 +5635,7 @@ class MakeModuleCommand {
|
|
|
5643
5635
|
const existing = match[2]?.trim() ?? "";
|
|
5644
5636
|
const newScope = `"${kebabName}"`;
|
|
5645
5637
|
if (!existing.includes(newScope)) {
|
|
5646
|
-
const newValue = existing ? `${existing}
|
|
5638
|
+
const newValue = existing ? `${existing},
|
|
5647
5639
|
${newScope},` : `
|
|
5648
5640
|
${newScope},`;
|
|
5649
5641
|
content = content.replace(regex, `$1${newValue}
|
|
@@ -5657,7 +5649,7 @@ class MakeModuleCommand {
|
|
|
5657
5649
|
const tsconfig = JSON.parse(content);
|
|
5658
5650
|
tsconfig.compilerOptions ??= {};
|
|
5659
5651
|
tsconfig.compilerOptions.paths ??= {};
|
|
5660
|
-
tsconfig.compilerOptions.paths[`@module/${kebabName}/*`] = [
|
|
5652
|
+
tsconfig.compilerOptions.paths[`@module/${kebabName}/*`] = [`./modules/${kebabName}/src/*`];
|
|
5661
5653
|
await Bun.write(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
|
|
5662
5654
|
`);
|
|
5663
5655
|
}
|
|
@@ -5674,7 +5666,7 @@ class MakeModuleCommand {
|
|
|
5674
5666
|
const testsDir = join5(moduleDir, "tests");
|
|
5675
5667
|
const moduleContent = module_default.replace(/{{NAME}}/g, pascalName);
|
|
5676
5668
|
const packageContent = package_default.replace(/{{NAME}}/g, kebabName);
|
|
5677
|
-
const testContent = test_default.replace(/{{NAME}}/g, pascalName);
|
|
5669
|
+
const testContent = test_default.replace(/{{NAME}}/g, pascalName).replace(/{{name}}/g, kebabName);
|
|
5678
5670
|
await Bun.write(join5(srcDir, `${pascalName}Module.ts`), moduleContent);
|
|
5679
5671
|
if (!skipMigrations) {
|
|
5680
5672
|
await Bun.write(join5(srcDir, "migrations", "migrations.ts"), "");
|
|
@@ -5690,10 +5682,10 @@ class MakeModuleCommand {
|
|
|
5690
5682
|
if (await Bun.file(appModulePath).exists()) {
|
|
5691
5683
|
await this.addToAppModule(appModulePath, pascalName, kebabName);
|
|
5692
5684
|
}
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5685
|
+
}
|
|
5686
|
+
const appTsconfigPath = join5(cwd, "tsconfig.json");
|
|
5687
|
+
if (await Bun.file(appTsconfigPath).exists()) {
|
|
5688
|
+
await this.addPathAlias(appTsconfigPath, kebabName);
|
|
5697
5689
|
}
|
|
5698
5690
|
if (kebabName !== "app" && kebabName !== "shared") {
|
|
5699
5691
|
const sharedModuleDir = join5(cwd, "modules", "shared");
|
|
@@ -5701,12 +5693,6 @@ class MakeModuleCommand {
|
|
|
5701
5693
|
if (await Bun.file(sharedModuleFilePath).exists()) {
|
|
5702
5694
|
await this.addToSharedModule(sharedModuleFilePath, pascalName, kebabName);
|
|
5703
5695
|
}
|
|
5704
|
-
const sharedTsconfigPath = join5(sharedModuleDir, "tsconfig.json");
|
|
5705
|
-
if (await Bun.file(sharedTsconfigPath).exists()) {
|
|
5706
|
-
await this.addPathAlias(sharedTsconfigPath, kebabName);
|
|
5707
|
-
const moduleTsconfigPath = join5(moduleDir, "tsconfig.json");
|
|
5708
|
-
await this.addPathAlias(moduleTsconfigPath, "shared");
|
|
5709
|
-
}
|
|
5710
5696
|
}
|
|
5711
5697
|
const commitlintPath = join5(cwd, ".commitlintrc.ts");
|
|
5712
5698
|
if (await Bun.file(commitlintPath).exists()) {
|
|
@@ -5928,6 +5914,7 @@ const Configuration: UserConfig = {
|
|
|
5928
5914
|
"always",
|
|
5929
5915
|
[
|
|
5930
5916
|
"common",
|
|
5917
|
+
"shared",
|
|
5931
5918
|
"app",
|
|
5932
5919
|
],
|
|
5933
5920
|
],
|
|
@@ -6211,7 +6198,7 @@ var app_database_default = `import { inject } from "@ooneex/container";
|
|
|
6211
6198
|
import { AppEnv } from "@ooneex/app-env";
|
|
6212
6199
|
import { DataSource } from "typeorm";
|
|
6213
6200
|
import { TypeormDatabase, DatabaseException, decorator } from "@ooneex/database";
|
|
6214
|
-
import { SharedModule } from "
|
|
6201
|
+
import { SharedModule } from "@module/shared/SharedModule";
|
|
6215
6202
|
|
|
6216
6203
|
@decorator.database()
|
|
6217
6204
|
export class SharedDatabase extends TypeormDatabase {
|
|
@@ -6341,6 +6328,8 @@ ARG DATABASE_URL
|
|
|
6341
6328
|
|
|
6342
6329
|
# Promote build arg to runtime environment variable
|
|
6343
6330
|
ENV DATABASE_URL=\${DATABASE_URL}
|
|
6331
|
+
# Disable HUSKY
|
|
6332
|
+
ENV HUSKY=0
|
|
6344
6333
|
|
|
6345
6334
|
# install dependencies into temp directory
|
|
6346
6335
|
# this will cache them and speed up future builds
|
|
@@ -6352,7 +6341,7 @@ RUN cd /temp/dev && bun install --frozen-lockfile
|
|
|
6352
6341
|
# install with --production (exclude devDependencies)
|
|
6353
6342
|
RUN mkdir -p /temp/prod
|
|
6354
6343
|
COPY package.json bun.lock /temp/prod/
|
|
6355
|
-
RUN cd /temp/prod && bun install --frozen-lockfile --production
|
|
6344
|
+
RUN cd /temp/prod && bun install --frozen-lockfile --production --ignore-scripts
|
|
6356
6345
|
|
|
6357
6346
|
# copy node_modules from temp directory
|
|
6358
6347
|
# then copy all (non-ignored) project files into the image
|
|
@@ -6888,8 +6877,14 @@ var tsconfig_json_default = `{
|
|
|
6888
6877
|
"emitDecoratorMetadata": true,
|
|
6889
6878
|
"experimentalDecorators": true,
|
|
6890
6879
|
"strictNullChecks": true,
|
|
6891
|
-
"exactOptionalPropertyTypes": false
|
|
6880
|
+
"exactOptionalPropertyTypes": false,
|
|
6881
|
+
"paths": {
|
|
6882
|
+
"@module/app/*": ["./modules/app/src/*"],
|
|
6883
|
+
"@module/shared/*": ["./modules/shared/src/*"]
|
|
6884
|
+
},
|
|
6885
|
+
"types": ["bun"]
|
|
6892
6886
|
},
|
|
6887
|
+
"include": ["modules/**/*.ts"],
|
|
6893
6888
|
"exclude": ["node_modules", ".github", ".husky", ".nx", ".zed", ".vscode"]
|
|
6894
6889
|
}
|
|
6895
6890
|
`;
|
|
@@ -9556,7 +9551,7 @@ import { migrationCreate } from "@ooneex/migrations";
|
|
|
9556
9551
|
var migration_up_default = `#!/usr/bin/env bun
|
|
9557
9552
|
|
|
9558
9553
|
import { up } from "@ooneex/migrations";
|
|
9559
|
-
import "
|
|
9554
|
+
import "@module/{{name}}/migrations/migrations";
|
|
9560
9555
|
|
|
9561
9556
|
await up({
|
|
9562
9557
|
databaseUrl: Bun.env.DATABASE_URL,
|
|
@@ -9585,7 +9580,7 @@ class MakeMigrationCommand {
|
|
|
9585
9580
|
const binMigrationUpPath = join21(process.cwd(), base, "bin", "migration", "up.ts");
|
|
9586
9581
|
const binMigrationUpFile = Bun.file(binMigrationUpPath);
|
|
9587
9582
|
if (!await binMigrationUpFile.exists()) {
|
|
9588
|
-
await Bun.write(binMigrationUpPath, migration_up_default);
|
|
9583
|
+
await Bun.write(binMigrationUpPath, migration_up_default.replace(/{{name}}/g, module ?? ""));
|
|
9589
9584
|
}
|
|
9590
9585
|
const logger = new TerminalLogger20;
|
|
9591
9586
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
@@ -13318,7 +13313,7 @@ import { SharedDatabase } from "@module/shared/databases/SharedDatabase";
|
|
|
13318
13313
|
import { AppEnv } from "@ooneex/app-env";
|
|
13319
13314
|
import { container } from "@ooneex/container";
|
|
13320
13315
|
import { run } from "@ooneex/seeds";
|
|
13321
|
-
import "
|
|
13316
|
+
import "@module/{{name}}/seeds/seeds";
|
|
13322
13317
|
|
|
13323
13318
|
if (!container.has(AppEnv)) {
|
|
13324
13319
|
container.add(AppEnv);
|
|
@@ -13356,7 +13351,7 @@ class MakeSeedCommand {
|
|
|
13356
13351
|
const binSeedRunPath = join30(process.cwd(), base, "bin", "seed", "run.ts");
|
|
13357
13352
|
const binSeedRunFile = Bun.file(binSeedRunPath);
|
|
13358
13353
|
if (!await binSeedRunFile.exists()) {
|
|
13359
|
-
await Bun.write(binSeedRunPath, seed_run_default);
|
|
13354
|
+
await Bun.write(binSeedRunPath, seed_run_default.replace(/{{name}}/g, module ?? ""));
|
|
13360
13355
|
}
|
|
13361
13356
|
const logger = new TerminalLogger26;
|
|
13362
13357
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
@@ -21244,4 +21239,4 @@ SeedRunCommand = __legacyDecorateClassTS([
|
|
|
21244
21239
|
// src/index.ts
|
|
21245
21240
|
await run();
|
|
21246
21241
|
|
|
21247
|
-
//# debugId=
|
|
21242
|
+
//# debugId=F644FC22050EAEC964756E2164756E21
|