From e8caeb40e0042726a2aa09443b76e637ff056cf7 Mon Sep 17 00:00:00 2001 From: Julien Ripouteau Date: Sun, 19 Nov 2023 18:31:15 +0100 Subject: [PATCH 01/11] chore: test that showcase error --- tests/bundler.spec.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/bundler.spec.ts b/tests/bundler.spec.ts index 04c58b8d..35c5f4a2 100644 --- a/tests/bundler.spec.ts +++ b/tests/bundler.spec.ts @@ -41,4 +41,34 @@ test.group('Bundler', () => { assert.fileExists('./build/package-lock.json'), ]) }) + + test('should copy metafiles even if lock file is missing', async ({ assert, fs }) => { + await Promise.all([ + fs.create( + 'tsconfig.json', + JSON.stringify({ compilerOptions: { outDir: 'build', skipLibCheck: true } }) + ), + fs.create('adonisrc.ts', 'export default {}'), + fs.create('package.json', '{}'), + + fs.create('resources/views/app.edge', ''), + ]) + + const bundler = new Bundler(fs.baseUrl, ts, { + metaFiles: [ + { + pattern: 'resources/views/**/*.edge', + reloadServer: false, + }, + ], + }) + + await bundler.bundle(true, 'npm') + + await Promise.all([ + assert.fileExists('./build/resources/views/app.edge'), + assert.fileExists('./build/package.json'), + assert.fileExists('./build/adonisrc.js'), + ]) + }).fails() }) From 75d3d52ef4c1211c06a0d89aa829fec0c271f959 Mon Sep 17 00:00:00 2001 From: Julien Ripouteau Date: Sat, 25 Nov 2023 20:56:23 +0100 Subject: [PATCH 02/11] fix: implement custom cpy --- src/bundler.ts | 17 ++----------- src/helpers.ts | 36 +++++++++++++++++++-------- tests/bundler.spec.ts | 2 +- tests/copy.spec.ts | 57 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 26 deletions(-) create mode 100644 tests/copy.spec.ts diff --git a/src/bundler.ts b/src/bundler.ts index d426bdbf..0d9e3225 100644 --- a/src/bundler.ts +++ b/src/bundler.ts @@ -95,19 +95,6 @@ export class Bundler { } } - /** - * Copy files to destination directory - */ - async #copyFiles(files: string[], outDir: string) { - try { - await copyFiles(files, this.#cwdPath, outDir) - } catch (error) { - if (!error.message.includes("the file doesn't exist")) { - throw error - } - } - } - /** * Copy meta files to the output directory */ @@ -116,7 +103,7 @@ export class Bundler { .map((file) => file.pattern) .concat(additionalFilesToCopy) - await this.#copyFiles(metaFiles, outDir) + await copyFiles(metaFiles, this.#cwdPath, outDir) } /** @@ -189,7 +176,7 @@ export class Bundler { */ this.#logger.info('compiling typescript source', { suffix: 'tsc' }) const buildCompleted = await this.#runTsc(outDir) - await this.#copyFiles(['ace.js'], outDir) + await copyFiles(['ace.js'], this.#cwdPath, outDir) /** * Remove incomplete build directory when tsc build diff --git a/src/helpers.ts b/src/helpers.ts index 082d5b5b..58066cdc 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -7,14 +7,15 @@ * file that was distributed with this source code. */ -import cpy from 'cpy' import { isNotJunk } from 'junk' import fastGlob from 'fast-glob' import getRandomPort from 'get-port' +import { existsSync } from 'node:fs' import type tsStatic from 'typescript' import { fileURLToPath } from 'node:url' import { execaNode, execa } from 'execa' -import { isAbsolute, relative } from 'node:path' +import { copyFile, mkdir } from 'node:fs/promises' +import { dirname, isAbsolute, join, relative } from 'node:path' import { EnvLoader, EnvParser } from '@adonisjs/env' import { ConfigParser, Watcher } from '@poppinss/chokidar-ts' @@ -179,9 +180,18 @@ export async function copyFiles(files: string[], cwd: string, outDir: string) { */ const { paths, patterns } = files.reduce<{ patterns: string[]; paths: string[] }>( (result, file) => { + /** + * If file is a glob pattern, then push it to patterns + */ if (fastGlob.isDynamicPattern(file)) { result.patterns.push(file) - } else { + return result + } + + /** + * Otherwise, check if file exists and push it to paths to copy + */ + if (existsSync(join(cwd, file))) { result.paths.push(file) } @@ -198,14 +208,20 @@ export async function copyFiles(files: string[], cwd: string, outDir: string) { const filePaths = paths.concat(await fastGlob(patterns, { cwd })) /** - * Computing relative destination. This is because, cpy is buggy when - * outDir is an absolute path. + * Finally copy files to the destination by keeping the same + * directory structure and ignoring junk files */ - const destination = isAbsolute(outDir) ? relative(cwd, outDir) : outDir - debug('copying files %O to destination "%s"', filePaths, destination) + debug('copying files %O to destination "%s"', filePaths, outDir) + const copyPromises = filePaths.map(async (file) => { + const isJunkFile = !isNotJunk(file) + if (isJunkFile) return - return cpy(filePaths.filter(isNotJunk), destination, { - cwd: cwd, - flat: false, + const src = isAbsolute(file) ? file : join(cwd, file) + const dest = join(outDir, relative(cwd, src)) + + await mkdir(dirname(dest), { recursive: true }) + return copyFile(src, dest) }) + + return await Promise.all(copyPromises) } diff --git a/tests/bundler.spec.ts b/tests/bundler.spec.ts index 35c5f4a2..c07670e8 100644 --- a/tests/bundler.spec.ts +++ b/tests/bundler.spec.ts @@ -70,5 +70,5 @@ test.group('Bundler', () => { assert.fileExists('./build/package.json'), assert.fileExists('./build/adonisrc.js'), ]) - }).fails() + }) }) diff --git a/tests/copy.spec.ts b/tests/copy.spec.ts new file mode 100644 index 00000000..7aed4afb --- /dev/null +++ b/tests/copy.spec.ts @@ -0,0 +1,57 @@ +import { test } from '@japa/runner' +import { copyFiles } from '../src/helpers.js' +import { join } from 'node:path' + +test.group('Copy files', () => { + test('match file patterns', async ({ fs }) => { + await fs.create('resources/views/welcome.edge', '') + await fs.create('resources/views/about.edge', '') + await fs.create('resources/views/contact/main.edge', '') + + await fs.create('public/foo/test/a.json', '') + await fs.create('public/foo/test/b/a.json', '') + + await copyFiles( + ['resources/views/*.edge', 'public/**'], + fs.basePath, + join(fs.basePath, 'build') + ) + + await fs.exists('build/resources/views/welcome.edge') + await fs.exists('build/resources/views/about.edge') + await fs.exists('build/resources/views/contact/main.edge') + + await fs.exists('build/public/foo/test/a.json') + await fs.exists('build/public/foo/test/b/a.json') + }) + + test('copy files that are not glob patterns', async ({ fs }) => { + await fs.create('resources/views/welcome.edge', '') + await fs.create('resources/views/about.edge', '') + await fs.create('package.json', '') + + await copyFiles( + ['resources/views/welcome.edge', 'resources/views/about.edge', 'package.json'], + fs.basePath, + join(fs.basePath, 'build') + ) + + await fs.exists('build/resources/views/welcome.edge') + await fs.exists('build/resources/views/about.edge') + await fs.exists('build/package.json') + }) + + test("copy files even if one path doesn't exist", async ({ fs }) => { + await fs.create('resources/views/welcome.edge', '') + await fs.create('resources/views/about.edge', '') + + await copyFiles( + ['resources/views/welcome.edge', 'resources/views/about.edge', 'package.json'], + fs.basePath, + join(fs.basePath, 'build') + ) + + await fs.exists('build/resources/views/welcome.edge') + await fs.exists('build/resources/views/about.edge') + }) +}) From 4b64a59ec952a9bcf6dc996c9971ae1a82c85052 Mon Sep 17 00:00:00 2001 From: Julien Ripouteau Date: Thu, 23 Nov 2023 05:48:34 +0100 Subject: [PATCH 03/11] feat: add `addJapaPlugin` to Codemods (#63) --- src/code_transformer/main.ts | 51 +++++++++++++++++- .../code_transformer.spec.ts.cjs | 22 ++++++++ tests/code_transformer.spec.ts | 52 +++++++++++++++++++ 3 files changed, 123 insertions(+), 2 deletions(-) diff --git a/src/code_transformer/main.ts b/src/code_transformer/main.ts index e670eaa7..f8b7083c 100644 --- a/src/code_transformer/main.ts +++ b/src/code_transformer/main.ts @@ -9,7 +9,15 @@ import { join } from 'node:path' import { fileURLToPath } from 'node:url' -import { CodeBlockWriter, Node, Project, SourceFile, SyntaxKind } from 'ts-morph' +import { + CodeBlockWriter, + FormatCodeSettings, + Node, + Project, + QuoteKind, + SourceFile, + SyntaxKind, +} from 'ts-morph' import { RcFileTransformer } from './rc_file_transformer.js' import type { AddMiddlewareEntry, EnvValidationDefinition } from '../types.js' @@ -31,16 +39,19 @@ export class CodeTransformer { /** * Settings to use when persisting files */ - #editorSettings = { + #editorSettings: FormatCodeSettings = { indentSize: 2, convertTabsToSpaces: true, trimTrailingWhitespace: true, + // @ts-expect-error SemicolonPreference doesn't seem to be re-exported from ts-morph + semicolons: 'remove', } constructor(cwd: URL) { this.#cwd = cwd this.#project = new Project({ tsConfigFilePath: join(fileURLToPath(this.#cwd), 'tsconfig.json'), + manipulationSettings: { quoteKind: QuoteKind.Single }, }) } @@ -177,6 +188,42 @@ export class CodeTransformer { await file.save() } + /** + * Add a new Japa plugin in the `tests/bootstrap.ts` file + */ + async addJapaPlugin( + pluginCall: string, + importDeclaration: { isNamed: boolean; module: string; identifier: string } + ) { + /** + * Get the `tests/bootstrap.ts` source file + */ + const testBootstrapUrl = fileURLToPath(new URL('./tests/bootstrap.ts', this.#cwd)) + const file = this.#project.getSourceFileOrThrow(testBootstrapUrl) + + /** + * Add the import declaration + */ + file.addImportDeclaration({ + ...(importDeclaration.isNamed + ? { namedImports: [importDeclaration.identifier] } + : { defaultImport: importDeclaration.identifier }), + moduleSpecifier: importDeclaration.module, + }) + + /** + * Insert the plugin call in the `plugins` array + */ + const pluginsArray = file + .getVariableDeclaration('plugins') + ?.getInitializerIfKind(SyntaxKind.ArrayLiteralExpression) + + if (pluginsArray) pluginsArray.addElement(pluginCall) + + file.formatText(this.#editorSettings) + await file.save() + } + /** * Add new env variable validation in the * `env.ts` file diff --git a/tests/__snapshots__/code_transformer.spec.ts.cjs b/tests/__snapshots__/code_transformer.spec.ts.cjs index 0566dcca..244c90fc 100644 --- a/tests/__snapshots__/code_transformer.spec.ts.cjs +++ b/tests/__snapshots__/code_transformer.spec.ts.cjs @@ -354,3 +354,25 @@ export default defineConfig({ }) "` +exports[`Code transformer | addJapaPlugin > addJapaPlugin with named import 1`] = `" +import app from '@adonisjs/core/services/app' +import { assert } from '@japa/assert' +import { fooPlugin } from '@adonisjs/foo/plugin/japa' + +export const plugins: Config['plugins'] = [ + assert(), + fooPlugin(app) +] +"` + +exports[`Code transformer | addJapaPlugin > addJapaPlugin with default import 1`] = `" +import app from '@adonisjs/core/services/app' +import { assert } from '@japa/assert' +import fooPlugin from '@adonisjs/foo/plugin/japa' + +export const plugins: Config['plugins'] = [ + assert(), + fooPlugin() +] +"` + diff --git a/tests/code_transformer.spec.ts b/tests/code_transformer.spec.ts index ba2c9fb4..317baa1f 100644 --- a/tests/code_transformer.spec.ts +++ b/tests/code_transformer.spec.ts @@ -506,3 +506,55 @@ test.group('Code transformer | addPreloadFile', (group) => { assert.equal(occurrences, 1) }) }) + +test.group('Code transformer | addJapaPlugin', (group) => { + group.each.setup(async ({ context }) => setupFakeAdonisproject(context.fs)) + + test('add named import', async ({ assert, fs }) => { + await fs.create( + 'tests/bootstrap.ts', + ` + import app from '@adonisjs/core/services/app' + import { assert } from '@japa/assert' + + export const plugins: Config['plugins'] = [ + assert(), + ]` + ) + + const transformer = new CodeTransformer(fs.baseUrl) + + await transformer.addJapaPlugin('fooPlugin(app)', { + module: '@adonisjs/foo/plugin/japa', + identifier: 'fooPlugin', + isNamed: true, + }) + + const file = await fs.contents('tests/bootstrap.ts') + assert.snapshot(file).match() + }) + + test('add default import', async ({ assert, fs }) => { + await fs.create( + 'tests/bootstrap.ts', + ` + import app from '@adonisjs/core/services/app' + import { assert } from '@japa/assert' + + export const plugins: Config['plugins'] = [ + assert(), + ]` + ) + + const transformer = new CodeTransformer(fs.baseUrl) + + await transformer.addJapaPlugin('fooPlugin()', { + module: '@adonisjs/foo/plugin/japa', + identifier: 'fooPlugin', + isNamed: false, + }) + + const file = await fs.contents('tests/bootstrap.ts') + assert.snapshot(file).match() + }) +}) From cd9ab30ace714931f3584ee37d13d98301d818cf Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 23 Nov 2023 10:21:26 +0530 Subject: [PATCH 04/11] chore: update dependencies --- package.json | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 8719951f..857fbe28 100644 --- a/package.json +++ b/package.json @@ -31,44 +31,44 @@ "quick:test": "node --enable-source-maps --loader=ts-node/esm bin/test.ts" }, "devDependencies": { - "@adonisjs/application": "^8.0.0-0", - "@adonisjs/eslint-config": "^1.1.8", - "@adonisjs/prettier-config": "^1.1.8", - "@adonisjs/tsconfig": "^1.1.8", - "@commitlint/cli": "^17.6.7", - "@commitlint/config-conventional": "^17.6.7", - "@japa/assert": "^2.0.0", - "@japa/file-system": "^2.0.0", - "@japa/runner": "^3.0.2", - "@japa/snapshot": "^2.0.0", - "@swc/core": "1.3.82", - "@types/node": "^20.4.5", - "@types/picomatch": "^2.3.0", - "@types/pretty-hrtime": "^1.0.1", + "@adonisjs/application": "^8.0.0-2", + "@adonisjs/eslint-config": "^1.1.9", + "@adonisjs/prettier-config": "^1.1.9", + "@adonisjs/tsconfig": "^1.1.9", + "@commitlint/cli": "^18.4.3", + "@commitlint/config-conventional": "^18.4.3", + "@japa/assert": "^2.0.1", + "@japa/file-system": "^2.0.1", + "@japa/runner": "^3.1.0", + "@japa/snapshot": "^2.0.3", + "@swc/core": "^1.3.99", + "@types/node": "^20.9.4", + "@types/picomatch": "^2.3.3", + "@types/pretty-hrtime": "^1.0.3", "c8": "^8.0.1", "cross-env": "^7.0.3", "dedent": "^1.5.1", "del-cli": "^5.0.0", - "eslint": "^8.45.0", + "eslint": "^8.54.0", "github-label-sync": "^2.3.1", "husky": "^8.0.3", "np": "^8.0.4", "p-event": "^6.0.0", - "prettier": "^3.0.0", + "prettier": "^3.1.0", "ts-node": "^10.9.1", - "tsup": "^7.2.0", - "typescript": "^5.1.6" + "tsup": "^8.0.1", + "typescript": "5.2.2" }, "dependencies": { - "@adonisjs/env": "^4.2.0-6", - "@poppinss/chokidar-ts": "^4.1.0", - "@poppinss/cliui": "^6.2.0", - "cpy": "^10.1.0", + "@adonisjs/env": "^4.2.0-7", + "@poppinss/chokidar-ts": "^4.1.1", + "@poppinss/cliui": "^6.2.1", + "cpy": "^11.0.0", "execa": "^8.0.1", - "fast-glob": "^3.3.1", + "fast-glob": "^3.3.2", "get-port": "^7.0.0", "junk": "^4.0.1", - "picomatch": "^2.3.1", + "picomatch": "^3.0.1", "pretty-hrtime": "^1.0.3", "slash": "^5.1.0", "ts-morph": "^20.0.0" From 69892cc554792dad1e331e582ee9ee74c35c89b0 Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 23 Nov 2023 10:22:29 +0530 Subject: [PATCH 05/11] chore: update snapshots --- .../code_transformer.spec.ts.cjs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/__snapshots__/code_transformer.spec.ts.cjs b/tests/__snapshots__/code_transformer.spec.ts.cjs index 244c90fc..9267556f 100644 --- a/tests/__snapshots__/code_transformer.spec.ts.cjs +++ b/tests/__snapshots__/code_transformer.spec.ts.cjs @@ -376,3 +376,25 @@ export const plugins: Config['plugins'] = [ ] "` +exports[`Code transformer | addJapaPlugin > add named import 1`] = `" +import app from '@adonisjs/core/services/app' +import { assert } from '@japa/assert' +import { fooPlugin } from '@adonisjs/foo/plugin/japa' + +export const plugins: Config['plugins'] = [ + assert(), + fooPlugin(app) +] +"` + +exports[`Code transformer | addJapaPlugin > add default import 1`] = `" +import app from '@adonisjs/core/services/app' +import { assert } from '@japa/assert' +import fooPlugin from '@adonisjs/foo/plugin/japa' + +export const plugins: Config['plugins'] = [ + assert(), + fooPlugin() +] +"` + From 30c5ac08297f38c7063c0fc3d3916f11fd1d27fe Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 23 Nov 2023 10:24:18 +0530 Subject: [PATCH 06/11] chore: publish source maps and use tsc for generating types --- package.json | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 857fbe28..8a313474 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "main": "build/index.js", "type": "module", "files": [ - "build" + "build", + "!build/bin", + "!build/tests" ], "exports": { ".": "./build/index.js", @@ -21,7 +23,8 @@ "lint": "eslint . --ext=.ts", "clean": "del-cli build", "typecheck": "tsc --noEmit", - "compile": "npm run lint && npm run clean && tsup-node", + "precompile": "npm run lint && npm run clean", + "compile": "tsup-node && tsc --emitDeclarationOnly --declaration", "build": "npm run compile", "release": "np", "version": "npm run build", @@ -127,13 +130,13 @@ "tsup": { "entry": [ "./index.ts", - "./src/code_transformer/main.ts", - "./src/types.ts" + "./src/code_transformer/main.ts" ], "outDir": "./build", "clean": true, "format": "esm", - "dts": true, + "dts": false, + "sourcemap": true, "target": "esnext" } } From e746464f8366830a4d9430c3c7996c3cffa34c63 Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 23 Nov 2023 10:32:02 +0530 Subject: [PATCH 07/11] chore(release): 6.1.3-26 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8a313474..016f41a7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@adonisjs/assembler", "description": "Provides utilities to run AdonisJS development server and build project for production", - "version": "6.1.3-25", + "version": "6.1.3-26", "engines": { "node": ">=18.16.0" }, From 492c11d9419180c26a286cb096aaaa1bf5f492cf Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 23 Nov 2023 11:42:58 +0530 Subject: [PATCH 08/11] refactor: construct click friendly URL in welcome message --- src/dev_server.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dev_server.ts b/src/dev_server.ts index d80a1ac2..2012c5aa 100644 --- a/src/dev_server.ts +++ b/src/dev_server.ts @@ -9,6 +9,7 @@ import picomatch from 'picomatch' import type tsStatic from 'typescript' +import prettyHrtime from 'pretty-hrtime' import { type ExecaChildProcess } from 'execa' import { cliui, type Logger } from '@poppinss/cliui' import type { Watcher } from '@poppinss/chokidar-ts' @@ -16,7 +17,6 @@ import type { Watcher } from '@poppinss/chokidar-ts' import type { DevServerOptions } from './types.js' import { AssetsDevServer } from './assets_dev_server.js' import { getPort, isDotEnvFile, isRcFile, runNode, watch } from './helpers.js' -import prettyHrtime from 'pretty-hrtime' /** * Instance of CLIUI @@ -113,11 +113,12 @@ export class DevServer { this.#httpServer.on('message', (message) => { if (this.#isAdonisJSReadyMessage(message)) { const readyAt = process.hrtime(initialTime) + const host = message.host === '0.0.0.0' ? '127.0.0.1' : message.host ui.sticker() .useColors(this.#colors) .useRenderer(this.#logger.getRenderer()) - .add(`Server address: ${this.#colors.cyan(`http://${message.host}:${message.port}`)}`) + .add(`Server address: ${this.#colors.cyan(`http://${host}:${message.port}`)}`) .add( `File system watcher: ${this.#colors.cyan( `${this.#isWatching ? 'enabled' : 'disabled'}` From bea58d9dd2b5af9341cc69b563b3b39f51c4a0ef Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 23 Nov 2023 11:51:04 +0530 Subject: [PATCH 09/11] chore(release): 6.1.3-27 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 016f41a7..af05352e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@adonisjs/assembler", "description": "Provides utilities to run AdonisJS development server and build project for production", - "version": "6.1.3-26", + "version": "6.1.3-27", "engines": { "node": ">=18.16.0" }, From dd86707b47cf6f359cc4ded998a5df163e1c736a Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 23 Nov 2023 12:18:56 +0530 Subject: [PATCH 10/11] refactor: display inter process message duration in the welcome message --- src/dev_server.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/dev_server.ts b/src/dev_server.ts index 2012c5aa..481ef998 100644 --- a/src/dev_server.ts +++ b/src/dev_server.ts @@ -77,9 +77,13 @@ export class DevServer { /** * Inspect if child process message is from AdonisJS HTTP server */ - #isAdonisJSReadyMessage( - message: unknown - ): message is { isAdonisJS: true; environment: 'web'; port: number; host: string } { + #isAdonisJSReadyMessage(message: unknown): message is { + isAdonisJS: true + environment: 'web' + port: number + host: string + duration?: [number, number] + } { return ( message !== null && typeof message === 'object' && @@ -102,7 +106,6 @@ export class DevServer { * Starts the HTTP server */ #startHTTPServer(port: string, mode: 'blocking' | 'nonblocking') { - let initialTime = process.hrtime() this.#httpServer = runNode(this.#cwd, { script: this.#scriptFile, env: { PORT: port, ...this.#options.env }, @@ -112,10 +115,10 @@ export class DevServer { this.#httpServer.on('message', (message) => { if (this.#isAdonisJSReadyMessage(message)) { - const readyAt = process.hrtime(initialTime) const host = message.host === '0.0.0.0' ? '127.0.0.1' : message.host - ui.sticker() + const displayMessage = ui + .sticker() .useColors(this.#colors) .useRenderer(this.#logger.getRenderer()) .add(`Server address: ${this.#colors.cyan(`http://${host}:${message.port}`)}`) @@ -124,8 +127,12 @@ export class DevServer { `${this.#isWatching ? 'enabled' : 'disabled'}` )}` ) - .add(`Ready in: ${this.#colors.cyan(prettyHrtime(readyAt))}`) - .render() + + if (message.duration) { + displayMessage.add(`Ready in: ${this.#colors.cyan(prettyHrtime(message.duration))}`) + } + + displayMessage.render() } }) From cb2220e2d0c1acc71df6d251253cc4349cfe799d Mon Sep 17 00:00:00 2001 From: Harminder Virk Date: Thu, 23 Nov 2023 12:23:22 +0530 Subject: [PATCH 11/11] chore(release): 6.1.3-28 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index af05352e..babc6f7c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@adonisjs/assembler", "description": "Provides utilities to run AdonisJS development server and build project for production", - "version": "6.1.3-27", + "version": "6.1.3-28", "engines": { "node": ">=18.16.0" },