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')