Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 635a08e

Browse files
author
Chris McConnell
authored
Ensure all operations are under checkOnly. (#1018)
Ensure deleted component imports are deleted.
1 parent d8a6b54 commit 635a08e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

packages/dialog/src/library/schemaMerger.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,11 @@ export class SchemaMerger {
532532

533533
// Delete existing output
534534
let outputPath = ppath.resolve(this.output + '.schema')
535-
await fs.remove(this.output + '.schema')
536-
await fs.remove(this.output + '.schema.final')
537-
await fs.remove(this.output + '.schema.expanded')
535+
if (!this.checkOnly) {
536+
await fs.remove(this.output + '.schema')
537+
await fs.remove(this.output + '.schema.final')
538+
await fs.remove(this.output + '.schema.expanded')
539+
}
538540

539541
let componentPaths: PathComponent[] = []
540542
let schemas = this.files.get('.schema')
@@ -679,7 +681,9 @@ export class SchemaMerger {
679681
* Does extensive error checking and validation against the schema.
680682
*/
681683
private async mergeUISchemas(schema: any): Promise<void> {
682-
await fs.remove(this.output + '.uischema')
684+
if (!this.checkOnly) {
685+
await fs.remove(this.output + '.uischema')
686+
}
683687

684688
let uiSchemas = this.files.get('.uischema')
685689
let result = {}
@@ -872,7 +876,7 @@ export class SchemaMerger {
872876
}
873877
}
874878
if (!this.checkOnly) {
875-
await fs.remove(importedDir)
879+
await fs.remove(ppath.join(this.imports, importedDir))
876880
}
877881
}
878882
}

packages/dialog/test/commands/dialog/merge.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ describe('dialog:merge', async () => {
357357
assert(merged5?.deleted.length === 4, 'Wrong number deleted 5th')
358358
assert(merged5?.unchanged.length === 0, 'Wrong number unchanged 5th')
359359
assert(merged5?.conflicts.length === 1, 'Wrong number of conflicts on 5th')
360+
assert(!await fs.pathExists(ppath.join(tempDir, 'imported/nuget3')))
360361
})
361362

362363
it('package.json', async () => {

0 commit comments

Comments
 (0)