From d9c1949d9a3cd69145e9f47a90cb0cb4461a45e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lenon?= Date: Sun, 7 Jan 2024 13:33:39 +0000 Subject: [PATCH] update deps (#206) ## Proposed changes Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue. ## Types of changes What types of changes does your code introduce? _Put an `x` in the boxes that apply_ - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) ## Checklist _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._ - [ ] I have read the [CONTRIBUTING](https://github.com/AthennaIO/Core/blob/master/CONTRIBUTING.md) documentation - [ ] Lint and unit tests pass locally with my changes - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added necessary documentation (if appropriate) ## Further comments If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... --- package-lock.json | 4 ++-- package.json | 2 +- src/commands/BuildCommand.ts | 9 +++++++++ src/ignite/Ignite.ts | 1 - tests/fixtures/consoles/absolute-path-entry.ts | 2 ++ tests/fixtures/consoles/base-console.ts | 2 ++ tests/fixtures/consoles/console-mock-dest-import.ts | 2 ++ tests/fixtures/consoles/dont-copy-dot-env.ts | 2 ++ tests/fixtures/consoles/import-alias-path-entry.ts | 2 ++ tests/fixtures/consoles/include-files-glob.ts | 2 ++ tests/fixtures/consoles/include-files.ts | 2 ++ tests/fixtures/consoles/include-folders-glob.ts | 2 ++ tests/fixtures/consoles/include-folders.ts | 2 ++ tests/fixtures/consoles/outdir-not-set.ts | 2 ++ tests/fixtures/consoles/relative-path-entry.ts | 2 ++ tests/fixtures/consoles/relative-path-tsconfig.ts | 2 ++ tests/fixtures/consoles/resolve-outdir-setting.ts | 2 ++ tests/fixtures/consoles/watch-mode-logs.ts | 2 ++ tests/fixtures/consoles/watch-mode.ts | 2 ++ tests/helpers/BaseCommandTest.ts | 2 ++ tests/unit/commands/BuildCommandTest.ts | 2 ++ tests/unit/ignite/IgniteTest.ts | 7 +++---- 22 files changed, 49 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 57deb34..572f1b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/core", - "version": "4.20.0", + "version": "4.21.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/core", - "version": "4.20.0" + "version": "4.21.0", "license": "MIT", "dependencies": { "pretty-repl": "^3.1.2", diff --git a/package.json b/package.json index bb4b9fb..3c6a022 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "4.20.0", + "version": "4.21.0", "description": "The plug and play Node.js framework.", "license": "MIT", "author": "João Lenon ", diff --git a/src/commands/BuildCommand.ts b/src/commands/BuildCommand.ts index 91be4b7..3e856b5 100644 --- a/src/commands/BuildCommand.ts +++ b/src/commands/BuildCommand.ts @@ -66,6 +66,15 @@ export class BuildCommand extends BaseCommand { console.log() this.logger.success('Application successfully compiled') + + this.logger + .instruction() + .head('Running compiled code') + .add(`cd ${outDirName}`) + .add('npm ci --omit=dev') + .add('Define your production environment variables') + .add(`node ${Color.yellow.bold('bin/main.js')}`) + .render() } private getOutDir(): string { diff --git a/src/ignite/Ignite.ts b/src/ignite/Ignite.ts index 7dae38c..7aac4ad 100644 --- a/src/ignite/Ignite.ts +++ b/src/ignite/Ignite.ts @@ -58,7 +58,6 @@ export class Ignite { this.parentURL = parentURL this.options = Options.create(options, { - beforePath: 'build', bootLogs: true, shutdownLogs: true, environments: [], diff --git a/tests/fixtures/consoles/absolute-path-entry.ts b/tests/fixtures/consoles/absolute-path-entry.ts index b1774bd..aaa525c 100644 --- a/tests/fixtures/consoles/absolute-path-entry.ts +++ b/tests/fixtures/consoles/absolute-path-entry.ts @@ -9,9 +9,11 @@ import { ViewProvider } from '@athenna/view' import { Rc, Config } from '@athenna/config' +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' new ViewProvider().register() +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/base-console.ts b/tests/fixtures/consoles/base-console.ts index d6da854..8a03dae 100644 --- a/tests/fixtures/consoles/base-console.ts +++ b/tests/fixtures/consoles/base-console.ts @@ -9,9 +9,11 @@ import { ViewProvider } from '@athenna/view' import { Rc, Config } from '@athenna/config' +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' new ViewProvider().register() +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/console-mock-dest-import.ts b/tests/fixtures/consoles/console-mock-dest-import.ts index c36c109..ae5eaf3 100644 --- a/tests/fixtures/consoles/console-mock-dest-import.ts +++ b/tests/fixtures/consoles/console-mock-dest-import.ts @@ -9,9 +9,11 @@ import { ViewProvider } from '@athenna/view' import { Rc, Config } from '@athenna/config' +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' new ViewProvider().register() +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/dont-copy-dot-env.ts b/tests/fixtures/consoles/dont-copy-dot-env.ts index 2a45ddf..0986ac2 100644 --- a/tests/fixtures/consoles/dont-copy-dot-env.ts +++ b/tests/fixtures/consoles/dont-copy-dot-env.ts @@ -7,8 +7,10 @@ * file that was distributed with this source code. */ +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/import-alias-path-entry.ts b/tests/fixtures/consoles/import-alias-path-entry.ts index 3868494..82a7d72 100644 --- a/tests/fixtures/consoles/import-alias-path-entry.ts +++ b/tests/fixtures/consoles/import-alias-path-entry.ts @@ -9,9 +9,11 @@ import { ViewProvider } from '@athenna/view' import { Rc, Config } from '@athenna/config' +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' new ViewProvider().register() +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/include-files-glob.ts b/tests/fixtures/consoles/include-files-glob.ts index 2efa2cd..c61a7ad 100644 --- a/tests/fixtures/consoles/include-files-glob.ts +++ b/tests/fixtures/consoles/include-files-glob.ts @@ -7,8 +7,10 @@ * file that was distributed with this source code. */ +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/include-files.ts b/tests/fixtures/consoles/include-files.ts index 68170b0..ba92ba8 100644 --- a/tests/fixtures/consoles/include-files.ts +++ b/tests/fixtures/consoles/include-files.ts @@ -7,8 +7,10 @@ * file that was distributed with this source code. */ +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/include-folders-glob.ts b/tests/fixtures/consoles/include-folders-glob.ts index bf4211c..0c39da4 100644 --- a/tests/fixtures/consoles/include-folders-glob.ts +++ b/tests/fixtures/consoles/include-folders-glob.ts @@ -7,8 +7,10 @@ * file that was distributed with this source code. */ +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/include-folders.ts b/tests/fixtures/consoles/include-folders.ts index 188acd0..61e4b31 100644 --- a/tests/fixtures/consoles/include-folders.ts +++ b/tests/fixtures/consoles/include-folders.ts @@ -7,8 +7,10 @@ * file that was distributed with this source code. */ +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/outdir-not-set.ts b/tests/fixtures/consoles/outdir-not-set.ts index 09c949a..b23db7c 100644 --- a/tests/fixtures/consoles/outdir-not-set.ts +++ b/tests/fixtures/consoles/outdir-not-set.ts @@ -7,8 +7,10 @@ * file that was distributed with this source code. */ +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/relative-path-entry.ts b/tests/fixtures/consoles/relative-path-entry.ts index b76234a..9e7a278 100644 --- a/tests/fixtures/consoles/relative-path-entry.ts +++ b/tests/fixtures/consoles/relative-path-entry.ts @@ -9,9 +9,11 @@ import { ViewProvider } from '@athenna/view' import { Rc, Config } from '@athenna/config' +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' new ViewProvider().register() +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/relative-path-tsconfig.ts b/tests/fixtures/consoles/relative-path-tsconfig.ts index c8b600c..70076c0 100644 --- a/tests/fixtures/consoles/relative-path-tsconfig.ts +++ b/tests/fixtures/consoles/relative-path-tsconfig.ts @@ -7,8 +7,10 @@ * file that was distributed with this source code. */ +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/resolve-outdir-setting.ts b/tests/fixtures/consoles/resolve-outdir-setting.ts index c8b600c..70076c0 100644 --- a/tests/fixtures/consoles/resolve-outdir-setting.ts +++ b/tests/fixtures/consoles/resolve-outdir-setting.ts @@ -7,8 +7,10 @@ * file that was distributed with this source code. */ +import { LoggerProvider } from '@athenna/logger' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/watch-mode-logs.ts b/tests/fixtures/consoles/watch-mode-logs.ts index 3861cf0..967663b 100644 --- a/tests/fixtures/consoles/watch-mode-logs.ts +++ b/tests/fixtures/consoles/watch-mode-logs.ts @@ -10,10 +10,12 @@ import { Mock } from '@athenna/test' import { ViewProvider } from '@athenna/view' import { Rc, Config } from '@athenna/config' +import { LoggerProvider } from '@athenna/logger' import { ServeCommand } from '#src/commands/ServeCommand' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' new ViewProvider().register() +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/fixtures/consoles/watch-mode.ts b/tests/fixtures/consoles/watch-mode.ts index fc93222..ac40c38 100644 --- a/tests/fixtures/consoles/watch-mode.ts +++ b/tests/fixtures/consoles/watch-mode.ts @@ -10,10 +10,12 @@ import { Mock } from '@athenna/test' import { ViewProvider } from '@athenna/view' import { Rc, Config } from '@athenna/config' +import { LoggerProvider } from '@athenna/logger' import { ServeCommand } from '#src/commands/ServeCommand' import { Artisan, ConsoleKernel, ArtisanProvider } from '@athenna/artisan' new ViewProvider().register() +new LoggerProvider().register() new ArtisanProvider().register() await Config.loadAll(Path.fixtures('config')) diff --git a/tests/helpers/BaseCommandTest.ts b/tests/helpers/BaseCommandTest.ts index 8ffc490..e4a79b2 100644 --- a/tests/helpers/BaseCommandTest.ts +++ b/tests/helpers/BaseCommandTest.ts @@ -8,6 +8,7 @@ */ import { File, Folder } from '@athenna/common' +import { LoggerProvider } from '@athenna/logger' import { ArtisanProvider } from '@athenna/artisan' import { BeforeEach, AfterEach, Mock } from '@athenna/test' import { TestCommand } from '@athenna/artisan/testing/plugins' @@ -17,6 +18,7 @@ export class BaseCommandTest { @BeforeEach() public async beforeEach() { + new LoggerProvider().register() new ArtisanProvider().register() TestCommand.setArtisanPath(Path.fixtures('consoles/base-console.ts')) diff --git a/tests/unit/commands/BuildCommandTest.ts b/tests/unit/commands/BuildCommandTest.ts index e7afb9d..0a37aeb 100644 --- a/tests/unit/commands/BuildCommandTest.ts +++ b/tests/unit/commands/BuildCommandTest.ts @@ -16,6 +16,8 @@ export default class BuildCommandTest extends BaseCommandTest { public async shouldBeAbleToBuildTheApplicationCode({ assert, command }: Context) { const output = await command.run('build') + console.log(output.output.stdout) + console.log(output.output.stderr) output.assertSucceeded() output.assertLogged('Application successfully compiled') diff --git a/tests/unit/ignite/IgniteTest.ts b/tests/unit/ignite/IgniteTest.ts index c8d0fc2..cd257f5 100644 --- a/tests/unit/ignite/IgniteTest.ts +++ b/tests/unit/ignite/IgniteTest.ts @@ -68,7 +68,6 @@ export default class IgniteTest { assert.containsSubset(ignite.options, { bootLogs: true, shutdownLogs: true, - beforePath: 'build', envPath: undefined, loadConfigSafe: true, athennaRcPath: Path.pwd('package.json') @@ -240,7 +239,7 @@ export default class IgniteTest { public async shouldNotSetTheApplicationRootPathIfApplicationIsRunningTSCode({ assert }: Context) { process.env.IS_TS = 'true' - const ignite = await new Ignite().load(Path.toHref(Path.pwd() + '/')) + const ignite = await new Ignite().load(Path.toHref(Path.pwd() + '/'), { beforePath: 'build' }) assert.deepEqual(Path.dirs, { ...this.oldDirs, bootstrap: 'bin' }) assert.equal(ignite.options.beforePath, 'build') @@ -260,7 +259,7 @@ export default class IgniteTest { public async shouldBeAbleToSetTheApplicationBeforePathWhenRunningJSCode({ assert }: Context) { process.env.IS_TS = 'false' - const ignite = await new Ignite().load(Path.toHref(Path.pwd() + '/main.js')) + const ignite = await new Ignite().load(Path.toHref(Path.pwd() + '/main.js'), { beforePath: 'build' }) assert.equal(Path.dirs.bootstrap, 'build/bin') assert.equal(Path.dirs.nodeModules, 'node_modules') @@ -274,7 +273,7 @@ export default class IgniteTest { process.env.IS_TS = 'false' Config.set('rc.ignoreDirsBeforePath', ['bootstrap', 'nodeModules']) - const ignite = await new Ignite().load(Path.toHref(Path.pwd() + '/main.js')) + const ignite = await new Ignite().load(Path.toHref(Path.pwd() + '/main.js'), { beforePath: 'build' }) assert.equal(Path.dirs.bootstrap, 'bin') assert.equal(Path.dirs.nodeModules, 'node_modules')