11import { confirm , intro , isCancel , log , outro } from "@clack/prompts" ;
22import { Command } from "commander" ;
33import { detectPackageManager , installDependencies } from "nypm" ;
4- import { basename , dirname , join , resolve } from "path" ;
4+ import { dirname , join , resolve } from "path" ;
55import { PackageJson , readPackageJSON , type ResolveOptions , resolvePackageJSON } from "pkg-types" ;
66import { z } from "zod" ;
77import { CommonCommandOptions , OutroCommandError , wrapCommandAction } from "../cli/common.js" ;
88import { chalkError , prettyError , prettyWarning } from "../utilities/cliOutput.js" ;
9- import { removeFile , writeJSONFile } from "../utilities/fileSystem.js" ;
9+ import { removeFile , writeJSONFilePreserveOrder } from "../utilities/fileSystem.js" ;
1010import { printStandloneInitialBanner , updateCheck } from "../utilities/initialBanner.js" ;
1111import { logger } from "../utilities/logger.js" ;
1212import { spinner } from "../utilities/windows.js" ;
@@ -227,7 +227,7 @@ export async function updateTriggerPackages(
227227
228228 // Backup package.json
229229 const packageJsonBackupPath = `${ packageJsonPath } .bak` ;
230- await writeJSONFile ( packageJsonBackupPath , readonlyPackageJson , true ) ;
230+ await writeJSONFilePreserveOrder ( packageJsonBackupPath , readonlyPackageJson , true ) ;
231231
232232 const exitHandler = async ( sig : any ) => {
233233 log . warn (
@@ -241,10 +241,10 @@ export async function updateTriggerPackages(
241241
242242 // Update package.json
243243 mutatePackageJsonWithUpdatedPackages ( packageJson , mismatches , cliVersion ) ;
244- await writeJSONFile ( packageJsonPath , packageJson , true ) ;
244+ await writeJSONFilePreserveOrder ( packageJsonPath , packageJson , true ) ;
245245
246246 async function revertPackageJsonChanges ( ) {
247- await writeJSONFile ( packageJsonPath , readonlyPackageJson , true ) ;
247+ await writeJSONFilePreserveOrder ( packageJsonPath , readonlyPackageJson , true ) ;
248248 await removeFile ( packageJsonBackupPath ) ;
249249 }
250250
0 commit comments