@anolilab/prettier-config 3.1.1 → 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/CHANGELOG.md +21 -0
- package/dist/chunk-NAA7XF5C.js +7 -0
- package/dist/chunk-NAA7XF5C.js.map +1 -0
- package/dist/chunk-YVQ27E43.mjs +5 -0
- package/dist/chunk-YVQ27E43.mjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/postinstall.d.ts +1 -0
- package/dist/postinstall.js +17 -0
- package/dist/postinstall.js.map +1 -0
- package/dist/postinstall.mjs +15 -0
- package/dist/postinstall.mjs.map +1 -0
- package/package.json +30 -26
- package/index.cjs +0 -44
- package/lib/postinstall.js +0 -76
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## @anolilab/prettier-config [4.0.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/prettier-config@3.1.2...@anolilab/prettier-config@4.0.0) (2023-06-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ⚠ BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* Changed the package to support cjs and mjs, so the type module was removed
|
|
7
|
+
|
|
8
|
+
Signed-off-by: prisis <d.bannert@anolilab.de>
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* switched prettier-config to typescript ([c014026](https://github.com/anolilab/javascript-style-guide/commit/c014026e3c7c987933d5668afe5246d2eb46b5db))
|
|
13
|
+
|
|
14
|
+
## @anolilab/prettier-config [3.1.2](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/prettier-config@3.1.1...@anolilab/prettier-config@3.1.2) (2023-06-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Dependencies
|
|
19
|
+
|
|
20
|
+
* **@anolilab/semantic-release-preset:** upgraded to 3.0.0
|
|
21
|
+
|
|
1
22
|
## @anolilab/prettier-config [3.1.1](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/prettier-config@3.1.0...@anolilab/prettier-config@3.1.1) (2023-05-25)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var e={printWidth:164,tabWidth:4,useTabs:!1,semi:!0,singleQuote:!1,quoteProps:"as-needed",jsxSingleQuote:!1,trailingComma:"all",bracketSpacing:!0,arrowParens:"always",rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,requirePragma:!1,insertPragma:!1,proseWrap:"preserve",htmlWhitespaceSensitivity:"css",vueIndentScriptAndStyle:!1,endOfLine:"lf",embeddedLanguageFormatting:"auto"},t=e;
|
|
4
|
+
|
|
5
|
+
exports.a = t;
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=chunk-NAA7XF5C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["config","src_default"],"mappings":"AAEA,IAAMA,EAAkB,CAEpB,WAAY,IAEZ,SAAU,EAEV,QAAS,GAET,KAAM,GAEN,YAAa,GAEb,WAAY,YAEZ,eAAgB,GAEhB,cAAe,MAEf,eAAgB,GAEhB,YAAa,SAEb,WAAY,EACZ,SAAU,OAAO,kBAEjB,cAAe,GAEf,aAAc,GAEd,UAAW,WAEX,0BAA2B,MAE3B,wBAAyB,GAEzB,UAAW,KAEX,2BAA4B,MAChC,EAEOC,EAAQD","sourcesContent":["import type { Options } from \"prettier\";\n\nconst config: Options = {\n // max 164 characters per line\n printWidth: 164,\n // use 4 spaces for indentation\n tabWidth: 4,\n // use spaces instead of indentations\n useTabs: false,\n // semicolon at the end of the line\n semi: true,\n // use single quotes\n singleQuote: false,\n // object's key is quoted only when necessary\n quoteProps: \"as-needed\",\n // use double quotes instead of single quotes in jsx\n jsxSingleQuote: false,\n // all comma at the end\n trailingComma: \"all\",\n // spaces are required at the beginning and end of the braces\n bracketSpacing: true,\n // brackets are required for arrow function parameter, even when there is only one parameter\n arrowParens: \"always\",\n // format the entire contents of the file\n rangeStart: 0,\n rangeEnd: Number.POSITIVE_INFINITY,\n // no need to write the beginning @prettier of the file\n requirePragma: false,\n // No need to automatically insert @prettier at the beginning of the file\n insertPragma: false,\n // use default break criteria\n proseWrap: \"preserve\",\n // decide whether to break the html according to the display style\n htmlWhitespaceSensitivity: \"css\",\n // vue files script and style tags indentation\n vueIndentScriptAndStyle: false,\n // lf for newline\n endOfLine: \"lf\",\n // formats quoted code embedded\n embeddedLanguageFormatting: \"auto\",\n};\n\nexport default config;\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var e={printWidth:164,tabWidth:4,useTabs:!1,semi:!0,singleQuote:!1,quoteProps:"as-needed",jsxSingleQuote:!1,trailingComma:"all",bracketSpacing:!0,arrowParens:"always",rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,requirePragma:!1,insertPragma:!1,proseWrap:"preserve",htmlWhitespaceSensitivity:"css",vueIndentScriptAndStyle:!1,endOfLine:"lf",embeddedLanguageFormatting:"auto"},t=e;
|
|
2
|
+
|
|
3
|
+
export { t as a };
|
|
4
|
+
//# sourceMappingURL=out.js.map
|
|
5
|
+
//# sourceMappingURL=chunk-YVQ27E43.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["config","src_default"],"mappings":"AAEA,IAAMA,EAAkB,CAEpB,WAAY,IAEZ,SAAU,EAEV,QAAS,GAET,KAAM,GAEN,YAAa,GAEb,WAAY,YAEZ,eAAgB,GAEhB,cAAe,MAEf,eAAgB,GAEhB,YAAa,SAEb,WAAY,EACZ,SAAU,OAAO,kBAEjB,cAAe,GAEf,aAAc,GAEd,UAAW,WAEX,0BAA2B,MAE3B,wBAAyB,GAEzB,UAAW,KAEX,2BAA4B,MAChC,EAEOC,EAAQD","sourcesContent":["import type { Options } from \"prettier\";\n\nconst config: Options = {\n // max 164 characters per line\n printWidth: 164,\n // use 4 spaces for indentation\n tabWidth: 4,\n // use spaces instead of indentations\n useTabs: false,\n // semicolon at the end of the line\n semi: true,\n // use single quotes\n singleQuote: false,\n // object's key is quoted only when necessary\n quoteProps: \"as-needed\",\n // use double quotes instead of single quotes in jsx\n jsxSingleQuote: false,\n // all comma at the end\n trailingComma: \"all\",\n // spaces are required at the beginning and end of the braces\n bracketSpacing: true,\n // brackets are required for arrow function parameter, even when there is only one parameter\n arrowParens: \"always\",\n // format the entire contents of the file\n rangeStart: 0,\n rangeEnd: Number.POSITIVE_INFINITY,\n // no need to write the beginning @prettier of the file\n requirePragma: false,\n // No need to automatically insert @prettier at the beginning of the file\n insertPragma: false,\n // use default break criteria\n proseWrap: \"preserve\",\n // decide whether to break the html according to the display style\n htmlWhitespaceSensitivity: \"css\",\n // vue files script and style tags indentation\n vueIndentScriptAndStyle: false,\n // lf for newline\n endOfLine: \"lf\",\n // formats quoted code embedded\n embeddedLanguageFormatting: \"auto\",\n};\n\nexport default config;\n"]}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkNAA7XF5C_js = require('./chunk-NAA7XF5C.js');
|
|
5
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
var util = require('util');
|
|
9
|
+
|
|
10
|
+
process.env.CI&&process.exit(0);var s=util.promisify(fs.writeFile),n=path.resolve(process.cwd(),"..","..","..");console.log("Configuring @anolilab/prettier-config",n,`
|
|
11
|
+
`);var p=()=>{let e=path.join(n,`.prettierrc.${packageJsonUtils.packageIsTypeModule?"m":"c"}js`);return fs.existsSync(e)||fs.existsSync(e.replace(`.${packageJsonUtils.packageIsTypeModule?"m":"c"}js`,""))?(console.warn(`\u26A0\uFE0F .prettierrc.${packageJsonUtils.packageIsTypeModule?"m":"c"}js already exists;
|
|
12
|
+
Make sure that it includes the following for @anolilab/prettier-config to work as it should:
|
|
13
|
+
${JSON.stringify(chunkNAA7XF5C_js.a,void 0,4)}
|
|
14
|
+
`),Promise.resolve()):s(e,`${packageJsonUtils.packageIsTypeModule?"export default":"module.exports ="} ${JSON.stringify(chunkNAA7XF5C_js.a,void 0,2).replace("rangeEnd: null,","rangeEnd: Infinity,")}
|
|
15
|
+
`,"utf-8")},f=()=>{let e=path.join(n,".prettierignore");return fs.existsSync(e)?(console.warn("\u26A0\uFE0F .prettierignore already exists"),Promise.resolve()):s(e,"","utf-8")};(async()=>{try{await Promise.all([p(),f()]),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(e){console.log("\u{1F62C} something went wrong:"),console.error(e),process.exit(1);}})();
|
|
16
|
+
//# sourceMappingURL=out.js.map
|
|
17
|
+
//# sourceMappingURL=postinstall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","existsSync","writeFile","join","resolve","promisify","writeFileAsync","projectPath","writePrettierRc","prettierPath","src_default","writePrettierIgnore","error"],"mappings":";wCAEA,OAAS,uBAAAA,MAA2B,+BACpC,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,EAAM,WAAAC,MAAe,OAC9B,OAAS,aAAAC,MAAiB,OAItB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUH,CAAS,EAIpCK,EAAcH,EAAQ,QAAQ,IAAI,EAAG,KAAM,KAAM,IAAI,EAE3D,QAAQ,IAAI,wCAAyCG,EAAa;AAAA,CAAI,EAKtE,IAAMC,EAAkB,IAAM,CAC1B,IAAMC,EAAeN,EAAKI,EAAa,eAAeP,EAAsB,IAAM,OAAO,EAEzF,OAAIC,EAAWQ,CAAY,GAAKR,EAAWQ,EAAa,QAAQ,IAAIT,EAAsB,IAAM,QAAS,EAAE,CAAC,GACxG,QAAQ,KAAK,6BAAmBA,EAAsB,IAAM;AAAA;AAAA,EAElE,KAAK,UAAUU,EAAS,OAAW,CAAC;AAAA,CAAK,EAE5B,QAAQ,QAAQ,GAGpBJ,EACHG,EACA,GAAGT,EAAsB,iBAAmB,sBAAsB,KAAK,UAAUU,EAAS,OAAW,CAAC,EAAE,QACpG,kBACA,qBACJ;AAAA,EACA,OACJ,CACJ,EAKMC,EAAsB,IAAM,CAC9B,IAAMF,EAAeN,EAAKI,EAAa,iBAAiB,EAExD,OAAIN,EAAWQ,CAAY,GACvB,QAAQ,KAAK,8CAAoC,EAE1C,QAAQ,QAAQ,GAGpBH,EAAeG,EAAc,GAAI,OAAO,CACnD,GAGC,SAAY,CACT,GAAI,CAEA,MAAM,QAAQ,IAAI,CAACD,EAAgB,EAAGG,EAAoB,CAAC,CAAC,EAE5D,QAAQ,IAAI,4CAAqC,EAGjD,QAAQ,KAAK,CAAC,CAClB,OAASC,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["#!/usr/bin/env node\n\nimport { packageIsTypeModule } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nimport content from \"./index\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line no-undef\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\n// get the path to the host project.\n// eslint-disable-next-line no-undef\nconst projectPath = resolve(process.cwd(), \"..\", \"..\", \"..\");\n\nconsole.log(\"Configuring @anolilab/prettier-config\", projectPath, \"\\n\");\n\n/**\n * Writes .prettierrc.${m|c}js if it doesn't exist. Warns if it exists.\n */\nconst writePrettierRc = () => {\n const prettierPath = join(projectPath, `.prettierrc.${packageIsTypeModule ? \"m\" : \"c\"}js`);\n\n if (existsSync(prettierPath) || existsSync(prettierPath.replace(`.${packageIsTypeModule ? \"m\" : \"c\"}js`, \"\"))) {\n console.warn(`⚠️ .prettierrc.${packageIsTypeModule ? \"m\" : \"c\"}js already exists;\nMake sure that it includes the following for @anolilab/prettier-config to work as it should:\n${JSON.stringify(content, undefined, 4)}\\n`);\n\n return Promise.resolve();\n }\n\n return writeFileAsync(\n prettierPath,\n `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} ${JSON.stringify(content, undefined, 2).replace(\n \"rangeEnd: null,\",\n \"rangeEnd: Infinity,\",\n )}\\n`,\n \"utf-8\",\n );\n};\n\n/**\n * Writes .prettierignore if it doesn't exist. Warns if it exists.\n */\nconst writePrettierIgnore = () => {\n const prettierPath = join(projectPath, \".prettierignore\");\n\n if (existsSync(prettierPath)) {\n console.warn(\"⚠️ .prettierignore already exists\");\n\n return Promise.resolve();\n }\n\n return writeFileAsync(prettierPath, \"\", \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n // eslint-disable-next-line compat/compat\n await Promise.all([writePrettierRc(), writePrettierIgnore()]);\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line no-undef\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line no-undef\n process.exit(1);\n }\n})();\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { a } from './chunk-YVQ27E43.mjs';
|
|
3
|
+
import { packageIsTypeModule } from '@anolilab/package-json-utils';
|
|
4
|
+
import { writeFile, existsSync } from 'fs';
|
|
5
|
+
import { resolve, join } from 'path';
|
|
6
|
+
import { promisify } from 'util';
|
|
7
|
+
|
|
8
|
+
process.env.CI&&process.exit(0);var s=promisify(writeFile),n=resolve(process.cwd(),"..","..","..");console.log("Configuring @anolilab/prettier-config",n,`
|
|
9
|
+
`);var p=()=>{let e=join(n,`.prettierrc.${packageIsTypeModule?"m":"c"}js`);return existsSync(e)||existsSync(e.replace(`.${packageIsTypeModule?"m":"c"}js`,""))?(console.warn(`\u26A0\uFE0F .prettierrc.${packageIsTypeModule?"m":"c"}js already exists;
|
|
10
|
+
Make sure that it includes the following for @anolilab/prettier-config to work as it should:
|
|
11
|
+
${JSON.stringify(a,void 0,4)}
|
|
12
|
+
`),Promise.resolve()):s(e,`${packageIsTypeModule?"export default":"module.exports ="} ${JSON.stringify(a,void 0,2).replace("rangeEnd: null,","rangeEnd: Infinity,")}
|
|
13
|
+
`,"utf-8")},f=()=>{let e=join(n,".prettierignore");return existsSync(e)?(console.warn("\u26A0\uFE0F .prettierignore already exists"),Promise.resolve()):s(e,"","utf-8")};(async()=>{try{await Promise.all([p(),f()]),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(e){console.log("\u{1F62C} something went wrong:"),console.error(e),process.exit(1);}})();
|
|
14
|
+
//# sourceMappingURL=out.js.map
|
|
15
|
+
//# sourceMappingURL=postinstall.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","existsSync","writeFile","join","resolve","promisify","writeFileAsync","projectPath","writePrettierRc","prettierPath","src_default","writePrettierIgnore","error"],"mappings":";yCAEA,OAAS,uBAAAA,MAA2B,+BACpC,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,EAAM,WAAAC,MAAe,OAC9B,OAAS,aAAAC,MAAiB,OAItB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUH,CAAS,EAIpCK,EAAcH,EAAQ,QAAQ,IAAI,EAAG,KAAM,KAAM,IAAI,EAE3D,QAAQ,IAAI,wCAAyCG,EAAa;AAAA,CAAI,EAKtE,IAAMC,EAAkB,IAAM,CAC1B,IAAMC,EAAeN,EAAKI,EAAa,eAAeP,EAAsB,IAAM,OAAO,EAEzF,OAAIC,EAAWQ,CAAY,GAAKR,EAAWQ,EAAa,QAAQ,IAAIT,EAAsB,IAAM,QAAS,EAAE,CAAC,GACxG,QAAQ,KAAK,6BAAmBA,EAAsB,IAAM;AAAA;AAAA,EAElE,KAAK,UAAUU,EAAS,OAAW,CAAC;AAAA,CAAK,EAE5B,QAAQ,QAAQ,GAGpBJ,EACHG,EACA,GAAGT,EAAsB,iBAAmB,sBAAsB,KAAK,UAAUU,EAAS,OAAW,CAAC,EAAE,QACpG,kBACA,qBACJ;AAAA,EACA,OACJ,CACJ,EAKMC,EAAsB,IAAM,CAC9B,IAAMF,EAAeN,EAAKI,EAAa,iBAAiB,EAExD,OAAIN,EAAWQ,CAAY,GACvB,QAAQ,KAAK,8CAAoC,EAE1C,QAAQ,QAAQ,GAGpBH,EAAeG,EAAc,GAAI,OAAO,CACnD,GAGC,SAAY,CACT,GAAI,CAEA,MAAM,QAAQ,IAAI,CAACD,EAAgB,EAAGG,EAAoB,CAAC,CAAC,EAE5D,QAAQ,IAAI,4CAAqC,EAGjD,QAAQ,KAAK,CAAC,CAClB,OAASC,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["#!/usr/bin/env node\n\nimport { packageIsTypeModule } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nimport content from \"./index\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line no-undef\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\n// get the path to the host project.\n// eslint-disable-next-line no-undef\nconst projectPath = resolve(process.cwd(), \"..\", \"..\", \"..\");\n\nconsole.log(\"Configuring @anolilab/prettier-config\", projectPath, \"\\n\");\n\n/**\n * Writes .prettierrc.${m|c}js if it doesn't exist. Warns if it exists.\n */\nconst writePrettierRc = () => {\n const prettierPath = join(projectPath, `.prettierrc.${packageIsTypeModule ? \"m\" : \"c\"}js`);\n\n if (existsSync(prettierPath) || existsSync(prettierPath.replace(`.${packageIsTypeModule ? \"m\" : \"c\"}js`, \"\"))) {\n console.warn(`⚠️ .prettierrc.${packageIsTypeModule ? \"m\" : \"c\"}js already exists;\nMake sure that it includes the following for @anolilab/prettier-config to work as it should:\n${JSON.stringify(content, undefined, 4)}\\n`);\n\n return Promise.resolve();\n }\n\n return writeFileAsync(\n prettierPath,\n `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} ${JSON.stringify(content, undefined, 2).replace(\n \"rangeEnd: null,\",\n \"rangeEnd: Infinity,\",\n )}\\n`,\n \"utf-8\",\n );\n};\n\n/**\n * Writes .prettierignore if it doesn't exist. Warns if it exists.\n */\nconst writePrettierIgnore = () => {\n const prettierPath = join(projectPath, \".prettierignore\");\n\n if (existsSync(prettierPath)) {\n console.warn(\"⚠️ .prettierignore already exists\");\n\n return Promise.resolve();\n }\n\n return writeFileAsync(prettierPath, \"\", \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n // eslint-disable-next-line compat/compat\n await Promise.all([writePrettierRc(), writePrettierIgnore()]);\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line no-undef\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line no-undef\n process.exit(1);\n }\n})();\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/prettier-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Prettier shareable config for Anolilab.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -31,17 +31,35 @@
|
|
|
31
31
|
"name": "Daniel Bannert",
|
|
32
32
|
"email": "d.bannert@anolilab.de"
|
|
33
33
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"require": "./dist/index.js",
|
|
39
|
+
"import": "./dist/index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"main": "dist/index.js",
|
|
44
|
+
"module": "dist/index.mjs",
|
|
45
|
+
"types": "dist/index.d.ts",
|
|
36
46
|
"files": [
|
|
37
|
-
"
|
|
38
|
-
"index.cjs",
|
|
47
|
+
"dist",
|
|
39
48
|
"README.md",
|
|
40
49
|
"CHANGELOG.md",
|
|
41
50
|
"LICENSE.md"
|
|
42
51
|
],
|
|
43
52
|
"scripts": {
|
|
44
|
-
"
|
|
53
|
+
"build": "cross-env NODE_ENV=development tsup",
|
|
54
|
+
"build:prod": "cross-env NODE_ENV=production tsup",
|
|
55
|
+
"clean": "rimraf node_modules dist",
|
|
56
|
+
"postinstall": "node ./skip.js || node ./dist/postinstall.js"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@anolilab/package-json-utils": "1.0.1"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@anolilab/semantic-release-preset": "3.0.0"
|
|
45
63
|
},
|
|
46
64
|
"peerDependencies": {
|
|
47
65
|
"prettier": "2.x"
|
|
@@ -50,25 +68,11 @@
|
|
|
50
68
|
"node": ">=16"
|
|
51
69
|
},
|
|
52
70
|
"publishConfig": {
|
|
53
|
-
"access": "public"
|
|
54
|
-
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@anolilab/semantic-release-preset": "2.2.1"
|
|
71
|
+
"access": "public",
|
|
72
|
+
"provenance": true
|
|
57
73
|
},
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"chrono-node@<2.2.4": ">=2.2.4",
|
|
63
|
-
"yargs-parser@>=6.0.0 <13.1.2": ">=13.1.2",
|
|
64
|
-
"trim@<0.0.3": ">=0.0.3",
|
|
65
|
-
"trim-newlines@<3.0.1": ">=3.0.1",
|
|
66
|
-
"moment@<2.29.2": ">=2.29.2",
|
|
67
|
-
"semver-regex@<3.1.4": ">=3.1.4",
|
|
68
|
-
"got@<11.8.5": ">=11.8.5",
|
|
69
|
-
"moment@>=2.18.0 <2.29.4": ">=2.29.4",
|
|
70
|
-
"ansi-regex@>=3.0.0 <3.0.1": ">=3.0.1",
|
|
71
|
-
"ansi-regex@>=4.0.0 <4.1.1": ">=4.1.1"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
+
"sources": [
|
|
75
|
+
"src/index.ts",
|
|
76
|
+
"src/postinstall.ts"
|
|
77
|
+
]
|
|
74
78
|
}
|
package/index.cjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @type {import('prettier').Options}
|
|
5
|
-
*/
|
|
6
|
-
module.exports = {
|
|
7
|
-
// max 120 characters per line
|
|
8
|
-
printWidth: 120,
|
|
9
|
-
// use 2 spaces for indentation
|
|
10
|
-
tabWidth: 4,
|
|
11
|
-
// use spaces instead of indentations
|
|
12
|
-
useTabs: false,
|
|
13
|
-
// semicolon at the end of the line
|
|
14
|
-
semi: true,
|
|
15
|
-
// use single quotes
|
|
16
|
-
singleQuote: false,
|
|
17
|
-
// object's key is quoted only when necessary
|
|
18
|
-
quoteProps: "as-needed",
|
|
19
|
-
// use double quotes instead of single quotes in jsx
|
|
20
|
-
jsxSingleQuote: false,
|
|
21
|
-
// no comma at the end
|
|
22
|
-
trailingComma: "all",
|
|
23
|
-
// spaces are required at the beginning and end of the braces
|
|
24
|
-
bracketSpacing: true,
|
|
25
|
-
// brackets are required for arrow function parameter, even when there is only one parameter
|
|
26
|
-
arrowParens: "always",
|
|
27
|
-
// format the entire contents of the file
|
|
28
|
-
rangeStart: 0,
|
|
29
|
-
rangeEnd: Number.POSITIVE_INFINITY,
|
|
30
|
-
// no need to write the beginning @prettier of the file
|
|
31
|
-
requirePragma: false,
|
|
32
|
-
// No need to automatically insert @prettier at the beginning of the file
|
|
33
|
-
insertPragma: false,
|
|
34
|
-
// use default break criteria
|
|
35
|
-
proseWrap: "preserve",
|
|
36
|
-
// decide whether to break the html according to the display style
|
|
37
|
-
htmlWhitespaceSensitivity: "css",
|
|
38
|
-
// vue files script and style tags indentation
|
|
39
|
-
vueIndentScriptAndStyle: false,
|
|
40
|
-
// lf for newline
|
|
41
|
-
endOfLine: "lf",
|
|
42
|
-
// formats quoted code embedded
|
|
43
|
-
embeddedLanguageFormatting: "auto",
|
|
44
|
-
};
|
package/lib/postinstall.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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
|
|
10
|
-
if (process.env.CI) {
|
|
11
|
-
// eslint-disable-next-line no-undef
|
|
12
|
-
process.exit(0);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const writeFileAsync = promisify(writeFile);
|
|
16
|
-
|
|
17
|
-
// get the path to the host project.
|
|
18
|
-
// eslint-disable-next-line no-undef
|
|
19
|
-
const projectPath = resolve(process.cwd(), "..", "..", "..");
|
|
20
|
-
|
|
21
|
-
console.log("Configuring @anolilab/prettier-config", projectPath, "\n");
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Writes .prettierrc.cjs if it doesn't exist. Warns if it exists.
|
|
25
|
-
*/
|
|
26
|
-
const writePrettierRc = () => {
|
|
27
|
-
const prettierPath = join(projectPath, ".prettierrc.cjs");
|
|
28
|
-
|
|
29
|
-
if (existsSync(prettierPath) || existsSync(prettierPath.replace(".cjs", ""))) {
|
|
30
|
-
console.warn(`⚠️ .prettierrc.cjs already exists;
|
|
31
|
-
Make sure that it includes the following for @anolilab/prettier-config to work as it should:
|
|
32
|
-
${JSON.stringify(content, undefined, 4)}\n`);
|
|
33
|
-
|
|
34
|
-
return Promise.resolve();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return writeFileAsync(
|
|
38
|
-
prettierPath,
|
|
39
|
-
`module.exports = ${JSON.stringify(content, undefined, 2).replace("rangeEnd: null,", "rangeEnd: Infinity,")}\n`,
|
|
40
|
-
"utf-8",
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Writes .prettierignore if it doesn't exist. Warns if it exists.
|
|
46
|
-
*/
|
|
47
|
-
const writePrettierIgnore = () => {
|
|
48
|
-
const prettierPath = join(projectPath, ".prettierignore");
|
|
49
|
-
|
|
50
|
-
if (existsSync(prettierPath)) {
|
|
51
|
-
console.warn("⚠️ .prettierignore already exists");
|
|
52
|
-
|
|
53
|
-
return Promise.resolve();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return writeFileAsync(prettierPath, "", "utf-8");
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// eslint-disable-next-line unicorn/prefer-top-level-await
|
|
60
|
-
(async () => {
|
|
61
|
-
try {
|
|
62
|
-
// eslint-disable-next-line compat/compat
|
|
63
|
-
await Promise.all([writePrettierRc(), writePrettierIgnore()]);
|
|
64
|
-
|
|
65
|
-
console.log("😎 Everything went well, have fun!");
|
|
66
|
-
|
|
67
|
-
// eslint-disable-next-line no-undef
|
|
68
|
-
process.exit(0);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
console.log("😬 something went wrong:");
|
|
71
|
-
console.error(error.message);
|
|
72
|
-
|
|
73
|
-
// eslint-disable-next-line no-undef
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
})();
|