Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@
"@adonisjs/env": "^4.2.0-0",
"@poppinss/chokidar-ts": "^4.1.0-1",
"@poppinss/cliui": "^6.1.1-1",
"@types/fs-extra": "^11.0.1",
"@types/picomatch": "^2.3.0",
"cpy": "^9.0.1",
"execa": "^7.0.0",
"fs-extra": "^11.1.0",
"get-port": "^6.1.2",
"picomatch": "^2.3.1",
"slash": "^5.0.0"
Expand Down
14 changes: 10 additions & 4 deletions src/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* file that was distributed with this source code.
*/

import fs from 'fs-extra'
import slash from 'slash'
import copyfiles from 'cpy'
import type tsStatic from 'typescript'
import fs from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import { join, relative } from 'node:path'
import { cliui, type Logger } from '@poppinss/cliui'
Expand Down Expand Up @@ -56,7 +56,7 @@ export class Bundler {
* Cleans up the build directory
*/
async #cleanupBuildDirectory(outDir: string) {
await fs.remove(outDir)
await fs.rm(outDir, { recursive: true, force: true, maxRetries: 5 })
}

/**
Expand Down Expand Up @@ -125,13 +125,19 @@ export class Bundler {
* Copies .adonisrc.json file to the destination
*/
async #copyAdonisRcFile(outDir: string) {
const existingContents = await fs.readJSON(join(this.#cwdPath, '.adonisrc.json'))
const existingContents = JSON.parse(
await fs.readFile(join(this.#cwdPath, '.adonisrc.json'), 'utf-8')
)
const compiledContents = Object.assign({}, existingContents, {
typescript: false,
lastCompiledAt: new Date().toISOString(),
})

await fs.outputJSON(join(outDir, '.adonisrc.json'), compiledContents, { spaces: 2 })
await fs.mkdir(outDir, { recursive: true })
await fs.writeFile(
join(outDir, '.adonisrc.json'),
JSON.stringify(compiledContents, null, 2) + '\n'
)
}

/**
Expand Down