3.1.3 • Published 3 months ago

pakag v3.1.3

Weekly downloads
85
License
MIT
Repository
github
Last release
3 months ago

pakag

Format package.json contents when working with it in node.

Features

  • Compatible with npm formatting
  • Sorts properties

Usage

import { readFileSync, writeFileSync } from 'fs'
import { join } from 'path'
import { formatPackageJson } from 'pakag'

const packageJsonPath = join(process.cwd(), 'package.json')

const packageContents = readFileSync(packageJsonPath, 'utf8')

const formattedContents = await formatPackageJson(packageContents)

writeFileSync(packageJsonPath, formattedContents)

To format the package.json in the current folder from the CLI run the following:

npx pakag
bunx pakag

Options

Options can be provided as the second parameter.

await formatPackageJson(packageContents, {
  // Sort properties using sort-package-json, default true.
  sort: false,
  // Customize sort order for package.json keys, default order see index.js.
  sortOrder: ['version'],
})
3.1.3

3 months ago

3.1.2

3 months ago

3.1.1

9 months ago

3.1.0

9 months ago

3.0.0

10 months ago

2.10.0

11 months ago

2.9.0

11 months ago

2.8.0

1 year ago

2.7.0

1 year ago

2.6.0

3 years ago

2.5.0

3 years ago

2.4.0

3 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.1.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago