Skip to content

Commit

Permalink
Ensure all operations are under checkOnly. (#1018)
Browse files Browse the repository at this point in the history
Ensure deleted component imports are deleted.
  • Loading branch information
chrimc62 committed Oct 15, 2020
1 parent d8a6b54 commit 635a08e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/dialog/src/library/schemaMerger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,11 @@ export class SchemaMerger {

// Delete existing output
let outputPath = ppath.resolve(this.output + '.schema')
await fs.remove(this.output + '.schema')
await fs.remove(this.output + '.schema.final')
await fs.remove(this.output + '.schema.expanded')
if (!this.checkOnly) {
await fs.remove(this.output + '.schema')
await fs.remove(this.output + '.schema.final')
await fs.remove(this.output + '.schema.expanded')
}

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

let uiSchemas = this.files.get('.uischema')
let result = {}
Expand Down Expand Up @@ -872,7 +876,7 @@ export class SchemaMerger {
}
}
if (!this.checkOnly) {
await fs.remove(importedDir)
await fs.remove(ppath.join(this.imports, importedDir))
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/dialog/test/commands/dialog/merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ describe('dialog:merge', async () => {
assert(merged5?.deleted.length === 4, 'Wrong number deleted 5th')
assert(merged5?.unchanged.length === 0, 'Wrong number unchanged 5th')
assert(merged5?.conflicts.length === 1, 'Wrong number of conflicts on 5th')
assert(!await fs.pathExists(ppath.join(tempDir, 'imported/nuget3')))
})

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

0 comments on commit 635a08e

Please sign in to comment.