Skip to content

Commit

Permalink
chore(build): add instructions for running build
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Jan 7, 2024
1 parent 7a4d428 commit 5885f36
Show file tree
Hide file tree
Showing 22 changed files with 49 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down
9 changes: 9 additions & 0 deletions src/commands/BuildCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/ignite/Ignite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class Ignite {

this.parentURL = parentURL
this.options = Options.create(options, {
beforePath: 'build',
bootLogs: true,
shutdownLogs: true,
environments: [],
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/absolute-path-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/base-console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/console-mock-dest-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/dont-copy-dot-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/import-alias-path-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/include-files-glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/include-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/include-folders-glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/include-folders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/outdir-not-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/relative-path-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/relative-path-tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/resolve-outdir-setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/watch-mode-logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/consoles/watch-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/helpers/BaseCommandTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/commands/BuildCommandTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
7 changes: 3 additions & 4 deletions tests/unit/ignite/IgniteTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand Down

0 comments on commit 5885f36

Please sign in to comment.