@pob/pretty-pkg 3.1.0 → 4.0.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-module"]
3
+ "extends": ["@pob/eslint-config/root-commonjs"]
4
4
  }
package/CHANGELOG.md CHANGED
@@ -3,6 +3,52 @@
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.0.0](https://github.com/christophehurpeau/pob/compare/@pob/pretty-pkg@3.2.0...@pob/pretty-pkg@4.0.0) (2021-12-11)
7
+
8
+
9
+ ### Features
10
+
11
+ * drop node 12 ([2f32308](https://github.com/christophehurpeau/pob/commit/2f32308b06ca74d0deb3355707e3082fa73e25dc))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * requires node 14
17
+
18
+
19
+
20
+
21
+
22
+ # [3.2.0](https://github.com/christophehurpeau/pob/compare/@pob/pretty-pkg@3.1.2...@pob/pretty-pkg@3.2.0) (2021-11-11)
23
+
24
+
25
+ ### Features
26
+
27
+ * improve npmignore ([b47706a](https://github.com/christophehurpeau/pob/commit/b47706af4f9be4f8103ec1306879bbd0a6989e6b))
28
+
29
+
30
+
31
+
32
+
33
+ ## [3.1.2](https://github.com/christophehurpeau/pob/compare/@pob/pretty-pkg@3.1.1...@pob/pretty-pkg@3.1.2) (2021-09-05)
34
+
35
+ **Note:** Version bump only for package @pob/pretty-pkg
36
+
37
+
38
+
39
+
40
+
41
+ ## [3.1.1](https://github.com/christophehurpeau/pob/compare/@pob/pretty-pkg@3.1.0...@pob/pretty-pkg@3.1.1) (2021-08-10)
42
+
43
+
44
+ ### Bug Fixes
45
+
46
+ * go back to commonjs modules for yarn pnp compatibility ([2a6442c](https://github.com/christophehurpeau/pob/commit/2a6442cbc96f221320d796f15d3c84bc1ee4b0ab))
47
+
48
+
49
+
50
+
51
+
6
52
  # [3.1.0](https://github.com/christophehurpeau/pob/compare/@pob/pretty-pkg@3.0.0...@pob/pretty-pkg@3.1.0) (2021-07-11)
7
53
 
8
54
 
package/bin/pretty-pkg.js CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { overrideSync } from '../lib/index.js';
3
+ 'use strict';
4
+
5
+ const { overrideSync } = require('../lib');
4
6
 
5
7
  const paths = process.argv.slice(2);
6
8
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "root": true,
3
- "extends": ["@pob/eslint-config/node-module"]
3
+ "extends": ["@pob/eslint-config/node-commonjs"]
4
4
  }
package/lib/index.js CHANGED
@@ -1,8 +1,10 @@
1
- import fs from 'fs';
2
- import sortPkg from '@pob/sort-pkg';
3
- import prettier from 'prettier';
1
+ 'use strict';
4
2
 
5
- export default function prettyPkg(pkg, prettierOptions = pkg.prettier) {
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) {
6
8
  if (typeof pkg === 'string') {
7
9
  pkg = JSON.parse(pkg);
8
10
  if (typeof pkg !== 'object') {
@@ -26,14 +28,14 @@ export default function prettyPkg(pkg, prettierOptions = pkg.prettier) {
26
28
  printWidth: 80,
27
29
  ...prettierOptions,
28
30
  });
29
- }
31
+ };
30
32
 
31
- export function writeSync(pkg, path, prettierOptions) {
32
- const string = prettyPkg(pkg, prettierOptions);
33
+ module.exports.writeSync = function writeSync(pkg, path, prettierOptions) {
34
+ const string = module.exports(pkg, prettierOptions);
33
35
  fs.writeFileSync(path, string, 'utf-8');
34
- }
36
+ };
35
37
 
36
- export function overrideSync(path, prettierOptions) {
38
+ module.exports.overrideSync = function overrideSync(path, prettierOptions) {
37
39
  const pkg = fs.readFileSync(path, 'utf-8');
38
- return writeSync(pkg, path, prettierOptions);
39
- }
40
+ return module.exports.writeSync(pkg, path, prettierOptions);
41
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/pretty-pkg",
3
- "version": "3.1.0",
3
+ "version": "4.0.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": "module",
14
+ "type": "commonjs",
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"
@@ -28,7 +28,7 @@
28
28
  "bin": "./bin/pretty-pkg.js",
29
29
  "scripts": {
30
30
  "lint": "yarn run lint:eslint",
31
- "lint:eslint": "yarn --cwd ../.. run eslint --report-unused-disable-directives --quiet @pob/pretty-pkg"
31
+ "lint:eslint": "cd ../.. && yarn run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet @pob/pretty-pkg"
32
32
  },
33
33
  "prettier": {
34
34
  "trailingComma": "all",
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "pob": {},
39
39
  "dependencies": {
40
- "@pob/sort-pkg": "^3.0.0",
40
+ "@pob/sort-pkg": "^4.0.0",
41
41
  "prettier": "^2.1.2"
42
42
  },
43
- "gitHead": "0f6ccc9223186f2f8e06cb5d535ae9fe38b173b5"
43
+ "gitHead": "eec3c30b83fbb8d9dd9caa947c6c64977dd14403"
44
44
  }