|
7 | 7 | * file that was distributed with this source code.
|
8 | 8 | */
|
9 | 9 |
|
10 |
| -import fs from 'fs-extra' |
11 | 10 | import slash from 'slash'
|
12 | 11 | import copyfiles from 'cpy'
|
13 | 12 | import type tsStatic from 'typescript'
|
| 13 | +import fs from 'node:fs/promises' |
14 | 14 | import { fileURLToPath } from 'node:url'
|
15 | 15 | import { join, relative } from 'node:path'
|
16 | 16 | import { cliui, type Logger } from '@poppinss/cliui'
|
@@ -56,7 +56,7 @@ export class Bundler {
|
56 | 56 | * Cleans up the build directory
|
57 | 57 | */
|
58 | 58 | async #cleanupBuildDirectory(outDir: string) {
|
59 |
| - await fs.remove(outDir) |
| 59 | + await fs.rm(outDir, { recursive: true, force: true, maxRetries: 5 }) |
60 | 60 | }
|
61 | 61 |
|
62 | 62 | /**
|
@@ -125,13 +125,19 @@ export class Bundler {
|
125 | 125 | * Copies .adonisrc.json file to the destination
|
126 | 126 | */
|
127 | 127 | async #copyAdonisRcFile(outDir: string) {
|
128 |
| - const existingContents = await fs.readJSON(join(this.#cwdPath, '.adonisrc.json')) |
| 128 | + const existingContents = JSON.parse( |
| 129 | + await fs.readFile(join(this.#cwdPath, '.adonisrc.json'), 'utf-8') |
| 130 | + ) |
129 | 131 | const compiledContents = Object.assign({}, existingContents, {
|
130 | 132 | typescript: false,
|
131 | 133 | lastCompiledAt: new Date().toISOString(),
|
132 | 134 | })
|
133 | 135 |
|
134 |
| - await fs.outputJSON(join(outDir, '.adonisrc.json'), compiledContents, { spaces: 2 }) |
| 136 | + await fs.mkdir(outDir, { recursive: true }) |
| 137 | + await fs.writeFile( |
| 138 | + join(outDir, '.adonisrc.json'), |
| 139 | + JSON.stringify(compiledContents, null, 2) + '\n' |
| 140 | + ) |
135 | 141 | }
|
136 | 142 |
|
137 | 143 | /**
|
|
0 commit comments