From 4e5f7647f832b4fefab7d436a9407f9d900535f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lenon?= Date: Mon, 26 Aug 2024 17:15:48 +0100 Subject: [PATCH] chore(npm): update dependencies --- .athennarc.json | 64 +++++++++++ .athennarc.prod.json | 10 ++ artisan.js | 3 +- bin/.athennarc.prod.json | 28 ----- bin/main.ts | 2 +- package-lock.json | 96 ++++++++--------- package.json | 102 ++---------------- src/{ => console}/commands/new.command.ts | 32 +++--- src/{ => console}/commands/version.command.ts | 0 .../commands}/new.command.test.ts | 42 +------- .../commands}/version.command.test.ts | 0 .../{confirm-cli-slim.ts => confirm-cron.ts} | 4 +- .../confirm-restapi-slim-bellow-v20.ts | 13 --- .../fixtures/consoles/confirm-restapi-slim.ts | 11 -- 14 files changed, 159 insertions(+), 248 deletions(-) create mode 100644 .athennarc.json create mode 100644 .athennarc.prod.json delete mode 100644 bin/.athennarc.prod.json rename src/{ => console}/commands/new.command.ts (89%) rename src/{ => console}/commands/version.command.ts (100%) rename tests/e2e/{ => console/commands}/new.command.test.ts (67%) rename tests/e2e/{ => console/commands}/version.command.test.ts (100%) rename tests/fixtures/consoles/{confirm-cli-slim.ts => confirm-cron.ts} (75%) delete mode 100644 tests/fixtures/consoles/confirm-restapi-slim-bellow-v20.ts delete mode 100644 tests/fixtures/consoles/confirm-restapi-slim.ts diff --git a/.athennarc.json b/.athennarc.json new file mode 100644 index 0000000..f9b169d --- /dev/null +++ b/.athennarc.json @@ -0,0 +1,64 @@ +{ + "providers": [ + "@athenna/core/providers/CoreProvider" + ], + "commands": { + "configure": "@athenna/artisan/commands/ConfigureCommand", + "template:customize": "@athenna/artisan/commands/TemplateCustomizeCommand", + "make:exception": "@athenna/core/commands/MakeExceptionCommand", + "make:facade": "@athenna/core/commands/MakeFacadeCommand", + "make:provider": "@athenna/core/commands/MakeProviderCommand", + "make:service": "@athenna/core/commands/MakeServiceCommand", + "make:test": "@athenna/core/commands/MakeTestCommand", + "make:command": "@athenna/artisan/commands/MakeCommandCommand", + "serve": { + "path": "@athenna/core/commands/ServeCommand", + "stayAlive": true + }, + "build": { + "path": "@athenna/core/commands/BuildCommand", + "outDir": "build", + "tsconfig": "node_modules/@athenna/tsconfig/tsconfig.app-build.json", + "include": [ + "package.json", + "package-lock.json", + "README.md", + "LICENSE.md", + "templates/*.edge", + "bin/.athennarc.prod.json" + ] + }, + "test": { + "path": "@athenna/core/commands/TestCommand", + "loadAllCommands": true, + "stayAlive": true + }, + "repl": { + "path": "@athenna/core/commands/ReplCommand", + "stayAlive": true + }, + "install": { + "path": "@athenna/core/commands/InstallCommand", + "registry": "npm" + }, + "new": { + "path": "#src/console/commands/new.command", + "loadApp": true + }, + "version": { + "path": "#src/console/commands/version.command", + "loadApp": true + } + }, + "templates": { + "artisan": "templates/artisan.edge", + "exception": "node_modules/@athenna/core/templates/exception.edge", + "facade": "node_modules/@athenna/core/templates/facade.edge", + "provider": "node_modules/@athenna/core/templates/provider.edge", + "service": "node_modules/@athenna/core/templates/service.edge", + "test": "node_modules/@athenna/core/templates/test.edge", + "test-console": "node_modules/@athenna/core/templates/test-console.edge", + "test-fn": "node_modules/@athenna/core/templates/test-fn.edge", + "command": "node_modules/@athenna/artisan/templates/command.edge" + } +} diff --git a/.athennarc.prod.json b/.athennarc.prod.json new file mode 100644 index 0000000..f2a3467 --- /dev/null +++ b/.athennarc.prod.json @@ -0,0 +1,10 @@ +{ + "providers": ["@athenna/core/providers/CoreProvider"], + "commands": { + "new": "#src/console/commands/new.command", + "version": "#src/console/commands/version.command" + }, + "templates": { + "artisan": "templates/artisan.edge" + } +} diff --git a/artisan.js b/artisan.js index 0afdde5..e21fbad 100644 --- a/artisan.js +++ b/artisan.js @@ -4,8 +4,9 @@ import { Exec } from '@athenna/common' Exec.artisan('./bin/artisan.js', { nodeOptions: [ - '--no-warnings', '--enable-source-maps', + '--disable-warning=DEP0180', + '--disable-warning=DEP0040', '--import=@athenna/tsconfig', ], }) diff --git a/bin/.athennarc.prod.json b/bin/.athennarc.prod.json deleted file mode 100644 index 8275bae..0000000 --- a/bin/.athennarc.prod.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "providers": ["@athenna/core/providers/CoreProvider"], - "commands": { - "new": "#src/commands/new.command", - "version": "#src/commands/version.command" - }, - "templates": { - "artisan": "templates/artisan.edge" - }, - "directories": { - "bootstrap": "bin", - "config": "src/config", - "routes": "src/routes", - "exceptions": "src/exceptions", - "providers": "src/providers", - "facades": "src/providers/facades", - "services": "src/services", - "commands": "src/commands", - "repositories": "src/repositories", - "tests": "tests", - "resources": "src/resources", - "views": "src/resources/views", - "locales": "src/resources/locales", - "database": "src/database", - "seeders": "src/database/seeders", - "migrations": "src/database/migrations" - } -} diff --git a/bin/main.ts b/bin/main.ts index 78446f5..bc0ca3e 100644 --- a/bin/main.ts +++ b/bin/main.ts @@ -9,7 +9,7 @@ sourceMapSupport.install({ handleUncaughtExceptions: false }) const ignite = await new Ignite().load(import.meta.url, { bootLogs: false, - athennaRcPath: 'bin/.athennarc.prod.json', + athennaRcPath: '.athennarc.prod.json', }) Config.set('app.version', `Athenna CLI v${process.env.APP_VERSION}`) diff --git a/package-lock.json b/package-lock.json index 54c15f6..7fa758e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,21 @@ { "name": "@athenna/cli", - "version": "4.22.0", + "version": "5.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/cli", - "version": "4.22.0", + "version": "5.0.0", "license": "MIT", "dependencies": { - "@athenna/artisan": "^4.45.0", - "@athenna/common": "^4.46.0", - "@athenna/config": "^4.27.0", - "@athenna/core": "^4.45.0", - "@athenna/ioc": "^4.27.0", - "@athenna/logger": "^4.29.0", - "@athenna/view": "^4.33.0", + "@athenna/artisan": "^5.1.0", + "@athenna/common": "^5.0.0", + "@athenna/config": "^5.0.0", + "@athenna/core": "^5.2.0", + "@athenna/ioc": "^5.0.0", + "@athenna/logger": "^5.0.0", + "@athenna/view": "^5.0.0", "reflect-metadata": "^0.2.2", "source-map-support": "^0.5.21" }, @@ -23,8 +23,8 @@ "athenna": "bin/main.js" }, "devDependencies": { - "@athenna/test": "^4.30.0", - "@athenna/tsconfig": "^4.19.0", + "@athenna/test": "^5.0.0", + "@athenna/tsconfig": "^5.0.0", "@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^7.18.0", "eslint": "^8.57.0", @@ -68,9 +68,9 @@ "license": "MIT" }, "node_modules/@athenna/artisan": { - "version": "4.45.0", - "resolved": "https://registry.npmjs.org/@athenna/artisan/-/artisan-4.45.0.tgz", - "integrity": "sha512-jHAE7NVL+Lf7xMuutBlntQQAuwrh0M0M4bx3eZZB3ftnAFGEQtJ4aZFPPc5uLQ9MY7q1GxKe7hR1XsYhHn6SXw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@athenna/artisan/-/artisan-5.1.0.tgz", + "integrity": "sha512-5x2+BmxLuosH+8OX9uPZwk/M8MBXJBK5GLUHuvY0JotargfvWhu/83sWiJinBBXAnoXgu6k+WMZlDlJ9YuhIKQ==", "license": "MIT", "dependencies": { "chalk-rainbow": "^1.0.0", @@ -79,7 +79,7 @@ "columnify": "^1.6.0", "commander": "^9.5.0", "figlet": "^1.7.0", - "inquirer": "^9.2.22", + "inquirer": "^9.3.6", "log-update": "^5.0.1", "ora": "^6.3.1" }, @@ -88,9 +88,9 @@ } }, "node_modules/@athenna/common": { - "version": "4.46.0", - "resolved": "https://registry.npmjs.org/@athenna/common/-/common-4.46.0.tgz", - "integrity": "sha512-Cnx+Rx8OW5MRKaNcBwBvpSlF2uguycDvzUerYlKl6piHf7FOOiQ0it443uozVvaBNWBYuhAv4fYw1xM2HpyFEA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@athenna/common/-/common-5.0.0.tgz", + "integrity": "sha512-gUbwCJraEw06CNdNYV6Nb0jIq/OYpXbbTNdYZ1yj62y7+s/A4q3Y05P7BzTxhNhIraP6117O7Vi2UoYY45ilwQ==", "license": "MIT", "dependencies": { "@fastify/formbody": "^7.4.0", @@ -125,9 +125,9 @@ } }, "node_modules/@athenna/config": { - "version": "4.27.0", - "resolved": "https://registry.npmjs.org/@athenna/config/-/config-4.27.0.tgz", - "integrity": "sha512-Y9UkjvOrETW3Nr6bfPtKEoU2pka4BOCZ+0VkKgRyNkLauMJ5iqD8DDiDLNA9+6BzIZuU683Ozx2cmwgUGH5hAg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@athenna/config/-/config-5.0.0.tgz", + "integrity": "sha512-PZE8u7uzH+JKXQhNzALV0mtfPEzpXLWkR/77wPjqV5j1l3Giu1opw4Q+mB9NIVtsiy16FRt58z+BDyXH9ajw1g==", "license": "MIT", "dependencies": { "dotenv": "^16.4.5", @@ -139,9 +139,9 @@ } }, "node_modules/@athenna/core": { - "version": "4.45.0", - "resolved": "https://registry.npmjs.org/@athenna/core/-/core-4.45.0.tgz", - "integrity": "sha512-I6iO/+TH+SZJsM2zcsKsZ8FjGSnT7rqGZpBX+Cm0rWQ42HB3x6Nd2THGQ60xF+6lDarNtyKAduKs74l2FHBd9g==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@athenna/core/-/core-5.2.0.tgz", + "integrity": "sha512-pKDLeg/hKaC55FXEUkwAPwrD34bFxVwDvmD4Gy86bAoGDzasesVGZWl59+4qrJL4kc8BmEcZ/uExoVyZ5XwcIw==", "license": "MIT", "dependencies": { "pretty-repl": "^3.1.2", @@ -152,9 +152,9 @@ } }, "node_modules/@athenna/ioc": { - "version": "4.27.0", - "resolved": "https://registry.npmjs.org/@athenna/ioc/-/ioc-4.27.0.tgz", - "integrity": "sha512-8rVYoUaBpDeaaHVJJmC+IZ/2nzWqHPSlfvt7/X7FLrxB00n0TlLkI/8rlJtuH6O8v5wRBphn8D0kgi/jkkx9qw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@athenna/ioc/-/ioc-5.0.0.tgz", + "integrity": "sha512-Czxc+1vyIpkx9fcTQQeKYCkNDjc5+ljKYC7UkNgFQJszQCfZjuUU+I+Y6goyWFvZZ0IdAGi67/bc9wlCP+c1Wg==", "license": "MIT", "dependencies": { "awilix": "^10.0.2" @@ -164,9 +164,9 @@ } }, "node_modules/@athenna/logger": { - "version": "4.29.0", - "resolved": "https://registry.npmjs.org/@athenna/logger/-/logger-4.29.0.tgz", - "integrity": "sha512-k8VdDs8XDKH9v6AA59j4bEnWnw7ir5+pBFHEZlAqLorzaR23go1XC3CJmY9h1oZt6UNugxYlwzalX6cEGfis+g==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@athenna/logger/-/logger-5.0.0.tgz", + "integrity": "sha512-blLKcIejErX0INAQa66QvhydVdF93GtqQkhz0JnuKjRhP5MAKgTqFst8vIrvGGmCiZ33MXUSn9yaPX+H3cEHxA==", "license": "MIT", "dependencies": { "@aws-lambda-powertools/logger": "^1.18.1", @@ -178,9 +178,9 @@ } }, "node_modules/@athenna/test": { - "version": "4.30.0", - "resolved": "https://registry.npmjs.org/@athenna/test/-/test-4.30.0.tgz", - "integrity": "sha512-PyvvDXUf3ZsHpBxhwqA5OBUv8JCTOFtAIxmBJZwYPJEMnf4RndlhkjdKfJ/1anE9yoazqm5iJ4G4IvAp4dZF3g==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@athenna/test/-/test-5.0.0.tgz", + "integrity": "sha512-+mrFFc/EapTrz7T3Inobo/2NKGsF1IIquZTBElQubvchoTk7kJvZcPqYOLqqNn7Ha8zpQAthUo/GouUSmDEaZw==", "dev": true, "license": "MIT", "dependencies": { @@ -195,9 +195,9 @@ } }, "node_modules/@athenna/tsconfig": { - "version": "4.19.0", - "resolved": "https://registry.npmjs.org/@athenna/tsconfig/-/tsconfig-4.19.0.tgz", - "integrity": "sha512-BpbbnXyMXDHS2DMCUDHWOjFYvzHOe3CJQM+OmQ7MFTS8UXIBaavDd0160aoLCrJLk5IPuCytO1VastQ+h2xRUg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@athenna/tsconfig/-/tsconfig-5.0.0.tgz", + "integrity": "sha512-GolYan7ILYA5/GDVriEAbz6E100epGh68Gy1ZbPven4VrfrBsf3Zqfl3qsjcqJvks5shEFko8N/xL4sGO2qMjA==", "dev": true, "license": "MIT", "dependencies": { @@ -218,9 +218,9 @@ "license": "Apache-2.0" }, "node_modules/@athenna/view": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@athenna/view/-/view-4.33.0.tgz", - "integrity": "sha512-inlk39UQT0scyfRboM7thw07LLxG5n/I2I1wupBQZ7UVDBsWiO14riEM9GfNA4L0KCcL96rO9Ru0fjXqLHUIAA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@athenna/view/-/view-5.0.0.tgz", + "integrity": "sha512-B5e7+RKa5vN1K0ufMDn/o1Qz28m9Uw/dMTfkpp0Qm4P5chqCtbxm3+njKGdHcVTmR97qOv+5JlK1kYvbA5hNGQ==", "license": "MIT", "dependencies": { "edge.js": "^6.0.2" @@ -1296,9 +1296,9 @@ "license": "MIT" }, "node_modules/@types/chai": { - "version": "4.3.17", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.17.tgz", - "integrity": "sha512-zmZ21EWzR71B4Sscphjief5djsLre50M6lI622OSySTmn9DB3j+C3kWroHfBQWXbOBwbgg/M8CG/hUxDLIloow==", + "version": "4.3.18", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.18.tgz", + "integrity": "sha512-2UfJzigyNa8kYTKn7o4hNMPphkxtu4WTJyobK3m4FBpyj7EK5xgtPcOtxLm7Dznk/Qxr0QXn+gQbkg7mCZKdfg==", "dev": true, "license": "MIT" }, @@ -3591,9 +3591,9 @@ } }, "node_modules/emoji-regex": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", - "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", "dev": true, "license": "MIT" }, @@ -3965,9 +3965,9 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", - "integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.2.tgz", + "integrity": "sha512-3XnC5fDyc8M4J2E8pt8pmSVRX2M+5yWMCfI/kDZwauQeFgzQOuhcRBFKjTeJagqgk4sFKxe1mvNVnaWwImx/Tg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 387f3a6..b54fb6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/cli", - "version": "4.22.0", + "version": "5.0.0", "description": "Athenna CLI to create new Athenna projects.", "license": "MIT", "author": "João Lenon ", @@ -49,19 +49,19 @@ "#tests": "./tests/index.js" }, "dependencies": { - "@athenna/artisan": "^4.45.0", - "@athenna/common": "^4.46.0", - "@athenna/config": "^4.27.0", - "@athenna/core": "^4.45.0", - "@athenna/ioc": "^4.27.0", - "@athenna/logger": "^4.29.0", - "@athenna/view": "^4.33.0", + "@athenna/artisan": "^5.1.0", + "@athenna/common": "^5.0.0", + "@athenna/config": "^5.0.0", + "@athenna/core": "^5.2.0", + "@athenna/ioc": "^5.0.0", + "@athenna/logger": "^5.0.0", + "@athenna/view": "^5.0.0", "reflect-metadata": "^0.2.2", "source-map-support": "^0.5.21" }, "devDependencies": { - "@athenna/test": "^4.30.0", - "@athenna/tsconfig": "^4.19.0", + "@athenna/test": "^5.0.0", + "@athenna/tsconfig": "^5.0.0", "@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^7.18.0", "eslint": "^8.57.0", @@ -142,87 +142,5 @@ } ] } - }, - "athenna": { - "providers": [ - "@athenna/core/providers/CoreProvider" - ], - "commands": { - "configure": "@athenna/artisan/commands/ConfigureCommand", - "template:customize": "@athenna/artisan/commands/TemplateCustomizeCommand", - "make:exception": "@athenna/core/commands/MakeExceptionCommand", - "make:facade": "@athenna/core/commands/MakeFacadeCommand", - "make:provider": "@athenna/core/commands/MakeProviderCommand", - "make:service": "@athenna/core/commands/MakeServiceCommand", - "make:test": "@athenna/core/commands/MakeTestCommand", - "make:command": "@athenna/artisan/commands/MakeCommandCommand", - "serve": { - "path": "@athenna/core/commands/ServeCommand", - "stayAlive": true - }, - "build": { - "path": "@athenna/core/commands/BuildCommand", - "outDir": "build", - "tsconfig": "node_modules/@athenna/tsconfig/tsconfig.app-build.json", - "include": [ - "package.json", - "package-lock.json", - "README.md", - "LICENSE.md", - "templates/*.edge", - "bin/.athennarc.prod.json" - ] - }, - "test": { - "path": "@athenna/core/commands/TestCommand", - "loadAllCommands": true, - "stayAlive": true - }, - "repl": { - "path": "@athenna/core/commands/ReplCommand", - "stayAlive": true - }, - "install": { - "path": "@athenna/core/commands/InstallCommand", - "registry": "npm" - }, - "new": { - "path": "#src/commands/new.command", - "loadApp": true - }, - "version": { - "path": "#src/commands/version.command", - "loadApp": true - } - }, - "templates": { - "artisan": "templates/artisan.edge", - "exception": "node_modules/@athenna/core/templates/exception.edge", - "facade": "node_modules/@athenna/core/templates/facade.edge", - "provider": "node_modules/@athenna/core/templates/provider.edge", - "service": "node_modules/@athenna/core/templates/service.edge", - "test": "node_modules/@athenna/core/templates/test.edge", - "test-console": "node_modules/@athenna/core/templates/test-console.edge", - "test-fn": "node_modules/@athenna/core/templates/test-fn.edge", - "command": "node_modules/@athenna/artisan/templates/command.edge" - }, - "directories": { - "bootstrap": "bin", - "config": "src/config", - "routes": "src/routes", - "exceptions": "src/exceptions", - "providers": "src/providers", - "facades": "src/providers/facades", - "services": "src/services", - "commands": "src/commands", - "repositories": "src/repositories", - "tests": "tests", - "resources": "src/resources", - "views": "src/resources/views", - "locales": "src/resources/locales", - "database": "src/database", - "seeders": "src/database/seeders", - "migrations": "src/database/migrations" - } } } diff --git a/src/commands/new.command.ts b/src/console/commands/new.command.ts similarity index 89% rename from src/commands/new.command.ts rename to src/console/commands/new.command.ts index 2949817..709d22e 100644 --- a/src/commands/new.command.ts +++ b/src/console/commands/new.command.ts @@ -9,7 +9,6 @@ export class NewCommand extends BaseCommand { private name: string private branch: string - private isSlim: boolean private readonly url = 'https://github.com/AthennaIO/AthennaIO.git' public static signature(): string { @@ -25,11 +24,7 @@ export class NewCommand extends BaseCommand { const type = await this.prompt.list( 'What type of application do you wish to create?', - ['REST API', 'CLI'], - ) - - this.isSlim = await this.prompt.confirm( - 'Do you wish to create a slim project style?', + ['REST API', 'CLI', 'CRON'], ) this.branch = this.getApplicationBranch(type) @@ -38,6 +33,9 @@ export class NewCommand extends BaseCommand { case 'CLI': await this.cli() break + case 'CRON': + await this.cron() + break case 'REST API': await this.http() break @@ -57,13 +55,10 @@ export class NewCommand extends BaseCommand { public getApplicationBranch(result: string) { const map = { CLI: 'cli', + CRON: 'cron', 'REST API': 'http', } - if (this.isSlim) { - return map[result].concat('-slim') - } - return map[result] } @@ -80,6 +75,19 @@ export class NewCommand extends BaseCommand { .render() } + public async cron(): Promise { + this.logger.simple('\n({bold,green} [ GENERATING CRON ])\n') + + await this.clone() + + this.logger + .instruction() + .head('Run following commands to get started:') + .add(`cd ${this.name}`) + .add('node artisan serve') + .render() + } + public async http(): Promise { this.logger.simple('\n({bold,green} [ GENERATING HTTP SERVER ])\n') @@ -156,9 +164,7 @@ export class NewCommand extends BaseCommand { await File.safeRemove(`${projectPath}/artisan.js`) await this.generator .properties({ - artisanPath: this.isSlim - ? './bin/artisan.js' - : './bootstrap/artisan.js', + artisanPath: './bin/artisan.js', }) .path(`${projectPath}/artisan.js`) .template('artisan') diff --git a/src/commands/version.command.ts b/src/console/commands/version.command.ts similarity index 100% rename from src/commands/version.command.ts rename to src/console/commands/version.command.ts diff --git a/tests/e2e/new.command.test.ts b/tests/e2e/console/commands/new.command.test.ts similarity index 67% rename from tests/e2e/new.command.test.ts rename to tests/e2e/console/commands/new.command.test.ts index 1f8de6f..040c434 100644 --- a/tests/e2e/new.command.test.ts +++ b/tests/e2e/console/commands/new.command.test.ts @@ -16,23 +16,6 @@ export default class NewCommandTest extends BaseConsoleTest { output.assertSucceeded() - assert.isFalse(await Folder.exists(Path.pwd('project/.git'))) - assert.isFalse(await Folder.exists(Path.pwd('project/.github'))) - assert.isFalse(await Folder.exists(Path.pwd('project/README.md'))) - assert.isTrue(await File.exists(Path.pwd('project/.env'))) - assert.isTrue(await File.exists(Path.pwd('project/.env.test'))) - assert.isTrue(await File.exists(Path.pwd('project/.env.example'))) - assert.isTrue(await File.exists(Path.pwd('project/bootstrap/main.ts'))) - } - - @Test() - public async shouldBeAbleToCreateASlimHttpProject({ command, assert }: Context) { - const output = await command.run('new project', { - path: Path.fixtures('consoles/confirm-restapi-slim.ts'), - }) - - output.assertSucceeded() - assert.isFalse(await Folder.exists(Path.pwd('project/.git'))) assert.isFalse(await Folder.exists(Path.pwd('project/.github'))) assert.isFalse(await Folder.exists(Path.pwd('project/README.md'))) @@ -56,13 +39,13 @@ export default class NewCommandTest extends BaseConsoleTest { assert.isTrue(await File.exists(Path.pwd('project/.env'))) assert.isTrue(await File.exists(Path.pwd('project/.env.test'))) assert.isTrue(await File.exists(Path.pwd('project/.env.example'))) - assert.isTrue(await File.exists(Path.pwd('project/bootstrap/main.ts'))) + assert.isTrue(await File.exists(Path.pwd('project/bin/main.ts'))) } @Test() - public async shouldBeAbleToCreateASlimCliProject({ command, assert }: Context) { + public async shouldBeAbleToCreateACronProject({ command, assert }: Context) { const output = await command.run('new project', { - path: Path.fixtures('consoles/confirm-cli-slim.ts'), + path: Path.fixtures('consoles/confirm-cron.ts'), }) output.assertSucceeded() @@ -86,25 +69,6 @@ export default class NewCommandTest extends BaseConsoleTest { const artisanFile = new File(Path.pwd('project/artisan.js')).getContentAsStringSync() - assert.isTrue(artisanFile.includes('./bootstrap/artisan.js')) - assert.isTrue(artisanFile.includes('--no-warnings')) - assert.isTrue(artisanFile.includes('--loader=ts-node/esm')) - assert.isTrue(await File.exists(Path.pwd('project/bootstrap/main.ts'))) - } - - @Test() - public async shouldBeAbleToCreateADifferentArtisanFileForNodeJSVersionsBellowV20ForSlimApps({ - command, - assert, - }: Context) { - const output = await command.run('new project', { - path: Path.fixtures('consoles/confirm-restapi-slim-bellow-v20.ts'), - }) - - output.assertSucceeded() - - const artisanFile = new File(Path.pwd('project/artisan.js')).getContentAsStringSync() - assert.isTrue(artisanFile.includes('./bin/artisan.js')) assert.isTrue(artisanFile.includes('--no-warnings')) assert.isTrue(artisanFile.includes('--loader=ts-node/esm')) diff --git a/tests/e2e/version.command.test.ts b/tests/e2e/console/commands/version.command.test.ts similarity index 100% rename from tests/e2e/version.command.test.ts rename to tests/e2e/console/commands/version.command.test.ts diff --git a/tests/fixtures/consoles/confirm-cli-slim.ts b/tests/fixtures/consoles/confirm-cron.ts similarity index 75% rename from tests/fixtures/consoles/confirm-cli-slim.ts rename to tests/fixtures/consoles/confirm-cron.ts index 86f06ed..f650059 100644 --- a/tests/fixtures/consoles/confirm-cli-slim.ts +++ b/tests/fixtures/consoles/confirm-cron.ts @@ -3,8 +3,8 @@ import { Path } from '@athenna/common' import { Ignite } from '@athenna/core' import { Prompt } from '@athenna/artisan' -Mock.when(Prompt.prototype, 'confirm').resolve(true) -Mock.when(Prompt.prototype, 'list').resolve('CLI') +Mock.when(Prompt.prototype, 'confirm').resolve(false) +Mock.when(Prompt.prototype, 'list').resolve('CRON') const ignite = await new Ignite().load(Path.toHref(Path.bin('artisan.ts')), { bootLogs: false }) diff --git a/tests/fixtures/consoles/confirm-restapi-slim-bellow-v20.ts b/tests/fixtures/consoles/confirm-restapi-slim-bellow-v20.ts deleted file mode 100644 index 81df59a..0000000 --- a/tests/fixtures/consoles/confirm-restapi-slim-bellow-v20.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Mock } from '@athenna/test' -import { Path } from '@athenna/common' -import { Ignite } from '@athenna/core' -import { Prompt } from '@athenna/artisan' - -process.env.TESTING_BELLOW_V20 = 'true' - -Mock.when(Prompt.prototype, 'confirm').resolve(true) -Mock.when(Prompt.prototype, 'list').resolve('REST API') - -const ignite = await new Ignite().load(Path.toHref(Path.bin('artisan.ts')), { bootLogs: false }) - -await ignite.console(process.argv, { displayName: 'Artisan' }) diff --git a/tests/fixtures/consoles/confirm-restapi-slim.ts b/tests/fixtures/consoles/confirm-restapi-slim.ts deleted file mode 100644 index d13fe66..0000000 --- a/tests/fixtures/consoles/confirm-restapi-slim.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Mock } from '@athenna/test' -import { Path } from '@athenna/common' -import { Ignite } from '@athenna/core' -import { Prompt } from '@athenna/artisan' - -Mock.when(Prompt.prototype, 'confirm').resolve(true) -Mock.when(Prompt.prototype, 'list').resolve('REST API') - -const ignite = await new Ignite().load(Path.toHref(Path.bin('artisan.ts')), { bootLogs: false }) - -await ignite.console(process.argv, { displayName: 'Artisan' })