@anolilab/prettier-config 2.0.5 → 3.0.1
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/CHANGELOG.md +32 -0
- package/README.md +1 -1
- package/index.cjs +6 -1
- package/lib/postinstall.js +23 -16
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
### @anolilab/prettier-config [3.0.1](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/prettier-config@3.0.0...@anolilab/prettier-config@3.0.1) (2022-05-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update all deps of the package and fixes found code style issues ([2776ecd](https://github.com/anolilab/javascript-style-guide/commit/2776ecd44d35f1d317abf367e69fef24dbd00335))
|
|
7
|
+
|
|
8
|
+
## @anolilab/prettier-config [3.0.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/prettier-config@2.0.6...@anolilab/prettier-config@3.0.0) (2022-02-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### ⚠ BREAKING CHANGES
|
|
12
|
+
|
|
13
|
+
* remove old node version from our supported versions
|
|
14
|
+
|
|
15
|
+
Signed-off-by: prisis <d.bannert@anolilab.de>
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* markdown lint ([24059d4](https://github.com/anolilab/javascript-style-guide/commit/24059d41ca682ca21b39ad7f6dff594be734329d))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Performance Improvements
|
|
23
|
+
|
|
24
|
+
* support for v12, v14 was removed from our supported versions of node ([83d6a80](https://github.com/anolilab/javascript-style-guide/commit/83d6a8058ed7791135aff03d4cd734327bb1b694))
|
|
25
|
+
|
|
26
|
+
### @anolilab/prettier-config [2.0.6](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/prettier-config@2.0.5...@anolilab/prettier-config@2.0.6) (2022-01-12)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* added ts-check to the prettier config ([6d03d06](https://github.com/anolilab/javascript-style-guide/commit/6d03d067f6b26176c449ab3ac1175dbd2b99a0f4))
|
|
32
|
+
|
|
1
33
|
### @anolilab/prettier-config [2.0.5](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/prettier-config@2.0.4...@anolilab/prettier-config@2.0.5) (2021-12-30)
|
|
2
34
|
|
|
3
35
|
|
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ module.exports = {
|
|
|
55
55
|
## Supported Node.js Versions
|
|
56
56
|
|
|
57
57
|
Libraries in this ecosystem make the best effort to track
|
|
58
|
-
[Node.js
|
|
58
|
+
[Node.js’ release schedule](https://nodejs.org/en/about/releases/). Here’s [a
|
|
59
59
|
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
|
60
60
|
|
|
61
61
|
Contributing
|
package/index.cjs
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @type {import('prettier').Options}
|
|
5
|
+
*/
|
|
1
6
|
module.exports = {
|
|
2
7
|
// max 120 characters per line
|
|
3
8
|
printWidth: 120,
|
|
@@ -21,7 +26,7 @@ module.exports = {
|
|
|
21
26
|
arrowParens: "always",
|
|
22
27
|
// format the entire contents of the file
|
|
23
28
|
rangeStart: 0,
|
|
24
|
-
rangeEnd:
|
|
29
|
+
rangeEnd: Number.POSITIVE_INFINITY,
|
|
25
30
|
// no need to write the beginning @prettier of the file
|
|
26
31
|
requirePragma: false,
|
|
27
32
|
// No need to automatically insert @prettier at the beginning of the file
|
package/lib/postinstall.js
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { existsSync, writeFile } from "node:fs";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
|
|
7
|
+
import content from "../index.cjs";
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line no-undef
|
|
3
10
|
if (process.env.CI) {
|
|
11
|
+
// eslint-disable-next-line no-undef
|
|
4
12
|
process.exit(0);
|
|
5
13
|
}
|
|
6
14
|
|
|
7
|
-
import { writeFile, existsSync } from 'fs';
|
|
8
|
-
import { resolve, join } from 'path';
|
|
9
|
-
import { promisify } from 'util';
|
|
10
|
-
import content from '../index.cjs';
|
|
11
|
-
|
|
12
15
|
const writeFileAsync = promisify(writeFile);
|
|
13
16
|
|
|
14
17
|
// get the path to the host project.
|
|
15
|
-
|
|
18
|
+
// eslint-disable-next-line no-undef
|
|
19
|
+
const projectPath = resolve(process.cwd(), "..", "..", "..");
|
|
16
20
|
|
|
17
|
-
console.log(
|
|
21
|
+
console.log("Configuring @anolilab/prettier-config", projectPath, "\n");
|
|
18
22
|
|
|
19
23
|
/**
|
|
20
24
|
* Writes .prettierrc.cjs if it doesn't exist. Warns if it exists.
|
|
21
25
|
*/
|
|
22
26
|
const writePrettierRc = () => {
|
|
23
|
-
const prettierPath = join(projectPath,
|
|
27
|
+
const prettierPath = join(projectPath, ".prettierrc.cjs");
|
|
24
28
|
|
|
25
|
-
if (existsSync(prettierPath) || existsSync(prettierPath.replace(
|
|
29
|
+
if (existsSync(prettierPath) || existsSync(prettierPath.replace(".cjs", ""))) {
|
|
26
30
|
console.warn(`⚠️ .prettierrc.cjs already exists;
|
|
27
31
|
Make sure that it includes the following for @anolilab/prettier-config to work as it should:
|
|
28
|
-
${JSON.stringify(content,
|
|
32
|
+
${JSON.stringify(content, undefined, 4)}\n`);
|
|
29
33
|
|
|
30
34
|
return Promise.resolve();
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
return writeFileAsync(
|
|
34
38
|
prettierPath,
|
|
35
|
-
`module.exports = ${JSON.stringify(content,
|
|
36
|
-
|
|
39
|
+
`module.exports = ${JSON.stringify(content, undefined, 2).replace("rangeEnd: null,", "rangeEnd: Infinity,")}\n`,
|
|
40
|
+
"utf-8",
|
|
37
41
|
);
|
|
38
42
|
};
|
|
39
43
|
|
|
@@ -41,10 +45,10 @@ ${JSON.stringify(content, null, 4)}\n`);
|
|
|
41
45
|
* Writes .prettierignore if it doesn't exist. Warns if it exists.
|
|
42
46
|
*/
|
|
43
47
|
const writePrettierIgnore = () => {
|
|
44
|
-
const prettierPath = join(projectPath,
|
|
48
|
+
const prettierPath = join(projectPath, ".prettierignore");
|
|
45
49
|
|
|
46
50
|
if (existsSync(prettierPath)) {
|
|
47
|
-
console.warn(
|
|
51
|
+
console.warn("⚠️ .prettierignore already exists");
|
|
48
52
|
|
|
49
53
|
return Promise.resolve();
|
|
50
54
|
}
|
|
@@ -54,15 +58,18 @@ const writePrettierIgnore = () => {
|
|
|
54
58
|
|
|
55
59
|
(async () => {
|
|
56
60
|
try {
|
|
61
|
+
// eslint-disable-next-line compat/compat
|
|
57
62
|
await Promise.all([writePrettierRc(), writePrettierIgnore()]);
|
|
58
63
|
|
|
59
64
|
console.log("😎 Everything went well, have fun!");
|
|
60
65
|
|
|
66
|
+
// eslint-disable-next-line no-undef
|
|
61
67
|
process.exit(0);
|
|
62
|
-
} catch (
|
|
68
|
+
} catch (error) {
|
|
63
69
|
console.log("😬 something went wrong:");
|
|
64
|
-
console.error(
|
|
70
|
+
console.error(error.message);
|
|
65
71
|
|
|
72
|
+
// eslint-disable-next-line no-undef
|
|
66
73
|
process.exit(1);
|
|
67
74
|
}
|
|
68
75
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/prettier-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Prettier shareable config for Anolilab.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"prettier": "2.x"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
50
|
+
"node": ">=16"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|