@pob/pretty-pkg 3.2.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "root": true,
3
- "extends": ["@pob/eslint-config/root-commonjs"]
3
+ "extends": ["@pob/eslint-config/root-module"]
4
4
  }
package/CHANGELOG.md CHANGED
@@ -3,6 +3,44 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.1.0](https://github.com/christophehurpeau/pob/compare/@pob/pretty-pkg@4.0.1...@pob/pretty-pkg@4.1.0) (2022-04-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * **deps:** update @pob/eslint-config ([#1236](https://github.com/christophehurpeau/pob/issues/1236)) ([e3cc1ad](https://github.com/christophehurpeau/pob/commit/e3cc1ad732f162391cdf4df87bc5f65e9c61e347))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.0.1](https://github.com/christophehurpeau/pob/compare/@pob/pretty-pkg@4.0.0...@pob/pretty-pkg@4.0.1) (2021-12-12)
18
+
19
+
20
+ ### Reverts
21
+
22
+ * fix: go back to commonjs modules for yarn pnp compatibility ([4e943b6](https://github.com/christophehurpeau/pob/commit/4e943b65ac843b6900aa4f86294f13b8fb18a0e8))
23
+
24
+
25
+
26
+
27
+
28
+ # [4.0.0](https://github.com/christophehurpeau/pob/compare/@pob/pretty-pkg@3.2.0...@pob/pretty-pkg@4.0.0) (2021-12-11)
29
+
30
+
31
+ ### Features
32
+
33
+ * drop node 12 ([2f32308](https://github.com/christophehurpeau/pob/commit/2f32308b06ca74d0deb3355707e3082fa73e25dc))
34
+
35
+
36
+ ### BREAKING CHANGES
37
+
38
+ * requires node 14
39
+
40
+
41
+
42
+
43
+
6
44
  # [3.2.0](https://github.com/christophehurpeau/pob/compare/@pob/pretty-pkg@3.1.2...@pob/pretty-pkg@3.2.0) (2021-11-11)
7
45
 
8
46
 
package/bin/pretty-pkg.js CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- 'use strict';
4
-
5
- const { overrideSync } = require('../lib');
3
+ import { overrideSync } from '../lib/index.js';
6
4
 
7
5
  const paths = process.argv.slice(2);
8
6
 
@@ -1,4 +1,20 @@
1
1
  {
2
2
  "root": true,
3
- "extends": ["@pob/eslint-config/node-commonjs"]
3
+ "extends": ["@pob/eslint-config/node-module"],
4
+ "overrides": [
5
+ {
6
+ "files": ["**/*.test.{cjs,js}", "__tests__/**/*.{cjs,js}"],
7
+ "env": {
8
+ "jest": true
9
+ },
10
+ "rules": {
11
+ "import/no-extraneous-dependencies": [
12
+ "error",
13
+ {
14
+ "devDependencies": true
15
+ }
16
+ ]
17
+ }
18
+ }
19
+ ]
4
20
  }
package/lib/index.js CHANGED
@@ -1,10 +1,8 @@
1
- 'use strict';
1
+ import fs from 'fs';
2
+ import sortPkg from '@pob/sort-pkg';
3
+ import prettier from 'prettier';
2
4
 
3
- const fs = require('fs');
4
- const sortPkg = require('@pob/sort-pkg');
5
- const prettier = require('prettier');
6
-
7
- module.exports = function prettyPkg(pkg, prettierOptions = pkg.prettier) {
5
+ export default function prettyPkg(pkg, prettierOptions = pkg.prettier) {
8
6
  if (typeof pkg === 'string') {
9
7
  pkg = JSON.parse(pkg);
10
8
  if (typeof pkg !== 'object') {
@@ -28,14 +26,14 @@ module.exports = function prettyPkg(pkg, prettierOptions = pkg.prettier) {
28
26
  printWidth: 80,
29
27
  ...prettierOptions,
30
28
  });
31
- };
29
+ }
32
30
 
33
- module.exports.writeSync = function writeSync(pkg, path, prettierOptions) {
34
- const string = module.exports(pkg, prettierOptions);
35
- fs.writeFileSync(path, string, 'utf-8');
36
- };
31
+ export function writeSync(pkg, path, prettierOptions) {
32
+ const string = prettyPkg(pkg, prettierOptions);
33
+ fs.writeFileSync(path, string, 'utf8');
34
+ }
37
35
 
38
- module.exports.overrideSync = function overrideSync(path, prettierOptions) {
39
- const pkg = fs.readFileSync(path, 'utf-8');
40
- return module.exports.writeSync(pkg, path, prettierOptions);
41
- };
36
+ export function overrideSync(path, prettierOptions) {
37
+ const pkg = fs.readFileSync(path, 'utf8');
38
+ return writeSync(pkg, path, prettierOptions);
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/pretty-pkg",
3
- "version": "3.2.0",
3
+ "version": "4.1.0",
4
4
  "description": "prettier and sort package.json",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
@@ -11,9 +11,9 @@
11
11
  "directory": "@pob/pretty-pkg"
12
12
  },
13
13
  "homepage": "https://github.com/christophehurpeau/pob",
14
- "type": "commonjs",
14
+ "type": "module",
15
15
  "engines": {
16
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
16
+ "node": "^14.13.1 || >=16.0.0"
17
17
  },
18
18
  "publishConfig": {
19
19
  "access": "public"
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "pob": {},
39
39
  "dependencies": {
40
- "@pob/sort-pkg": "^3.3.0",
40
+ "@pob/sort-pkg": "^4.0.1",
41
41
  "prettier": "^2.1.2"
42
42
  },
43
- "gitHead": "9a766ac7b8e8090527bb7a5aca2c80a29605bb81"
43
+ "gitHead": "ef8bddd03fe7543d9dac575a3450549c874f7f9d"
44
44
  }