Skip to content

Commit

Permalink
fix: json output formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Dec 5, 2022
1 parent ef8ffd0 commit 658433f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/generators/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export default class CLI extends Generator {

if (_.isEmpty(this.pjson.oclif)) delete this.pjson.oclif
this.pjson.files = _.uniq((this.pjson.files || []).sort())
this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson)
this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson, {spaces: 2})

this.fs.write(this.destinationPath('.gitignore'), this._gitignore())
}
Expand Down
2 changes: 1 addition & 1 deletion src/generators/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ export default class Hook extends Generator {
this.pjson.oclif.hooks[this.options.event] = p
}

this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson)
this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson, {spaces: 2})
}
}
4 changes: 2 additions & 2 deletions src/tarballs/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function build(c: BuildConfig, options: {
pjson.oclif.update = pjson.oclif.update || {}
pjson.oclif.update.s3 = pjson.oclif.update.s3 || {}
pjson.oclif.update.s3.bucket = c.s3Config.bucket
await fs.writeJSON(pjsonPath, pjson)
await fs.writeJSON(pjsonPath, pjson, {spaces: 2})
}

const addDependencies = async () => {
Expand Down Expand Up @@ -156,7 +156,7 @@ export async function build(c: BuildConfig, options: {
sha: c.gitSha,
version: config.version,
}))
await fs.writeJSON(manifestFilepath, manifest)
await fs.writeJSON(manifestFilepath, manifest, {spaces: 2})
}

log(`gathering workspace for ${config.bin} to ${c.workspace()}`)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/deb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ describe('publish:deb', () => {
bucket = pjson.oclif.update.s3.bucket
basePrefix = pjson.oclif.update.s3.folder
await deleteFolder(bucket, `${basePrefix}/versions/${pjson.version}/`)
await fs.writeJSON(pjsonPath, pjson)
await fs.writeJSON(pjsonPath, pjson, {spaces: 2})
await fs.emptyDir(root)
})
afterEach(async () => {
await deleteFolder(bucket, `${basePrefix}/versions/${pjson.version}/`)
pjson.version = originalVersion
await fs.writeJSON(pjsonPath, pjson)
await fs.writeJSON(pjsonPath, pjson, {spaces: 2})
})

onlyLinux
Expand Down
4 changes: 2 additions & 2 deletions test/integration/macos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ describe('publish:macos', () => {
bucket = pjson.oclif.update.s3.bucket
basePrefix = pjson.oclif.update.s3.folder
await deleteFolder(bucket, `${basePrefix}/versions/${pjson.version}/`)
await fs.writeJSON(pjsonPath, pjson)
await fs.writeJSON(pjsonPath, pjson, {spaces: 2})
await fs.emptyDir(root)
})
afterEach(async () => {
await deleteFolder(bucket, `${basePrefix}/versions/${pjson.version}/`)
pjson.version = originalVersion
await fs.writeJSON(pjsonPath, pjson)
await fs.writeJSON(pjsonPath, pjson, {spaces: 2})
})

onlyMacos
Expand Down
4 changes: 2 additions & 2 deletions test/integration/publish.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ const folderCleanup = async () => Promise.all([
describe('upload tarballs', async () => {
beforeEach(async () => {
await folderCleanup()
await fs.writeJSON(pjsonPath, pjson)
await fs.writeJSON(pjsonPath, pjson, {spaces: 2})
await fs.emptyDir(root)
})
afterEach(async () => {
await folderCleanup()
pjson.version = originalVersion
await fs.writeJSON(pjsonPath, pjson)
await fs.writeJSON(pjsonPath, pjson, {spaces: 2})
})

skipIfWindows
Expand Down
4 changes: 2 additions & 2 deletions test/integration/win.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ describe('publish:win', () => {
bucket = pjson.oclif.update.s3.bucket
basePrefix = pjson.oclif.update.s3.folder
await deleteFolder(bucket, `${basePrefix}/versions/${pjson.version}/`)
await fs.writeJSON(pjsonPath, pjson)
await fs.writeJSON(pjsonPath, pjson, {spaces: 2})
await fs.emptyDir(root)
})
afterEach(async () => {
await deleteFolder(bucket, `${basePrefix}/versions/${pjson.version}/`)
pjson.version = originalVersion
await fs.writeJSON(pjsonPath, pjson)
await fs.writeJSON(pjsonPath, pjson, {spaces: 2})
})

skipIfWindows
Expand Down

0 comments on commit 658433f

Please sign in to comment.