Skip to content

Commit

Permalink
fix: json output formatting (oclif#1051)
Browse files Browse the repository at this point in the history
* fix: json output formatting

* fix: don't format on memfs

* refactor: use native fs in cli.ts
  • Loading branch information
mshanemc authored and mattwebbio committed Dec 29, 2022
1 parent 984dd5b commit dd1760e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/tarballs/build.ts
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 @@ -162,7 +162,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
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
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
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
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 dd1760e

Please sign in to comment.