@anolilab/prettier-config 4.1.2 → 4.1.3

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 CHANGED
@@ -1,3 +1,15 @@
1
+ ## @anolilab/prettier-config [4.1.3](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/prettier-config@4.1.2...@anolilab/prettier-config@4.1.3) (2023-06-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update postinstall.ts to dynamically import prettier-config ([816c421](https://github.com/anolilab/javascript-style-guide/commit/816c421c7da22893085085c9bff94746c88615a6))
7
+
8
+
9
+ ### Miscellaneous Chores
10
+
11
+ * updated license date ([7c2549e](https://github.com/anolilab/javascript-style-guide/commit/7c2549e8605948aef563193b28b772240d9c2c8b))
12
+
1
13
  ## @anolilab/prettier-config [4.1.2](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/prettier-config@4.1.1...@anolilab/prettier-config@4.1.2) (2023-06-28)
2
14
 
3
15
 
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Anolilab
3
+ Copyright (c) 2023 Anolilab
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -7,10 +7,14 @@ var path = require('path');
7
7
  var util = require('util');
8
8
 
9
9
  process.env.CI&&process.exit(0);var l=util.promisify(fs.writeFile);console.log("Configuring @anolilab/prettier-config",packageJsonUtils.projectPath,`
10
- `);var e=".prettierrc",g=()=>{for(let n of [e,`${e}.js`,`${e}.cjs`,`${e}.json`,`${e}.json5`,`${e}.yaml`,`${e}.yml`,`${e}.toml`,"prettier.config.js","prettier.config.cjs"])if(fs.existsSync(path.join(packageJsonUtils.projectPath,n)))return console.warn(`\u26A0\uFE0F ${n} already exists;
10
+ `);var e=".prettierrc",g=()=>{for(let i of [e,`${e}.js`,`${e}.cjs`,`${e}.json`,`${e}.json5`,`${e}.yaml`,`${e}.yml`,`${e}.toml`,"prettier.config.js","prettier.config.cjs"])if(fs.existsSync(path.join(packageJsonUtils.projectPath,i)))return console.warn(`\u26A0\uFE0F ${i} already exists;
11
11
  Make sure that it includes the following for @anolilab/prettier-config to work as it should:
12
12
  ${JSON.stringify(chunkWCJNF4E4_js.a,void 0,4)}
13
- `),Promise.resolve();let r=path.join(packageJsonUtils.projectPath,".prettierrc.js");return l(r,`${packageJsonUtils.packageIsTypeModule?"export default":"module.exports ="} ${JSON.stringify(chunkWCJNF4E4_js.a,void 0,2).replace("rangeEnd: null,","rangeEnd: Number.POSITIVE_INFINITY,")}
13
+ `),Promise.resolve();let r=path.join(packageJsonUtils.projectPath,".prettierrc.js");return l(r,`${packageJsonUtils.packageIsTypeModule?'import config from "@anolilab/prettier-config";':'var config = require("@anolilab/prettier-config");'}
14
+
15
+ ${packageJsonUtils.packageIsTypeModule?"export default":"module.exports ="} {
16
+ ...config,
17
+ }
14
18
  `,"utf8")},p=()=>{let r=path.join(packageJsonUtils.projectPath,".prettierignore");return fs.existsSync(r)?(console.warn("\u26A0\uFE0F .prettierignore already exists"),Promise.resolve()):l(r,`${["*.md","*.sh","*.yml","*.svg","*.gif","*.log",".DS_Store","CNAME","AUTHORS","LICENSE","es/","lib/","dist/","coverage/"].join(`
15
19
  `)}
16
20
  `,"utf8")};(async()=>{try{await Promise.all([g(),p()]),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(r){console.log("\u{1F62C} something went wrong:"),console.error(r),process.exit(1);}})();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","configFile","writePrettierRc","filename","src_default","prettierPath","writePrettierIgnore","error"],"mappings":"wCAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAItB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,wCAAyCF,EAAa;AAAA,CAAI,EAEtE,IAAMM,EAAa,cAKbC,EAAkB,IAAM,CAE1B,QAAWC,IAAY,CACnBF,EACA,GAAGA,OACH,GAAGA,QACH,GAAGA,SACH,GAAGA,UACH,GAAGA,SACH,GAAGA,QACH,GAAGA,SACH,qBACA,qBACJ,EACI,GAAIL,EAAWE,EAAKH,EAAaQ,CAAQ,CAAC,EACtC,eAAQ,KAAK,iBAAOA;AAAA;AAAA,EAE9B,KAAK,UAAUC,EAAS,OAAW,CAAC;AAAA,CAAK,EAExB,QAAQ,QAAQ,EAI/B,IAAMC,EAAeP,EAAKH,EAAa,gBAAgB,EAEvD,OAAOK,EACHK,EACA,GAAGX,EAAsB,iBAAmB,sBAAsB,KAAK,UAAUU,EAAS,OAAW,CAAC,EAAE,QACpG,kBACA,qCACJ;AAAA,EACA,MACJ,CACJ,EAKME,EAAsB,IAAM,CAC9B,IAAMD,EAAeP,EAAKH,EAAa,iBAAiB,EAExD,OAAIC,EAAWS,CAAY,GACvB,QAAQ,KAAK,8CAAoC,EAE1C,QAAQ,QAAQ,GAGpBL,EACHK,EACA,GAAG,CAAC,OAAQ,OAAQ,QAAS,QAAS,QAAS,QAAS,YAAa,QAAS,UAAW,UAAW,MAAO,OAAQ,QAAS,WAAW,EAAE,KAAK;AAAA,CAAI;AAAA,EAClJ,MACJ,CACJ,GAGC,SAAY,CACT,GAAI,CAEA,MAAM,QAAQ,IAAI,CAACH,EAAgB,EAAGI,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":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nimport content from \".\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/prettier-config\", projectPath, \"\\n\");\n\nconst configFile = \".prettierrc\";\n\n/**\n * Writes .prettierrc.${m|c}js if it doesn't exist. Warns if it exists.\n */\nconst writePrettierRc = () => {\n // eslint-disable-next-line no-restricted-syntax\n for (const filename of [\n configFile,\n `${configFile}.js`,\n `${configFile}.cjs`,\n `${configFile}.json`,\n `${configFile}.json5`,\n `${configFile}.yaml`,\n `${configFile}.yml`,\n `${configFile}.toml`,\n \"prettier.config.js\",\n \"prettier.config.cjs\",\n ]) {\n if (existsSync(join(projectPath, filename))) {\n console.warn(`⚠️ ${filename} 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\n const prettierPath = join(projectPath, \".prettierrc.js\");\n\n return writeFileAsync(\n prettierPath,\n `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} ${JSON.stringify(content, undefined, 2).replace(\n \"rangeEnd: null,\",\n \"rangeEnd: Number.POSITIVE_INFINITY,\",\n )}\\n`,\n \"utf8\",\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(\n prettierPath,\n `${[\"*.md\", \"*.sh\", \"*.yml\", \"*.svg\", \"*.gif\", \"*.log\", \".DS_Store\", \"CNAME\", \"AUTHORS\", \"LICENSE\", \"es/\", \"lib/\", \"dist/\", \"coverage/\"].join(\"\\n\")}\\n`,\n \"utf8\",\n );\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 unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
1
+ {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","configFile","writePrettierRc","filename","src_default","prettierPath","writePrettierIgnore","error"],"mappings":"wCAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAItB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,wCAAyCF,EAAa;AAAA,CAAI,EAEtE,IAAMM,EAAa,cAKbC,EAAkB,IAAM,CAE1B,QAAWC,IAAY,CACnBF,EACA,GAAGA,OACH,GAAGA,QACH,GAAGA,SACH,GAAGA,UACH,GAAGA,SACH,GAAGA,QACH,GAAGA,SACH,qBACA,qBACJ,EACI,GAAIL,EAAWE,EAAKH,EAAaQ,CAAQ,CAAC,EACtC,eAAQ,KAAK,iBAAOA;AAAA;AAAA,EAE9B,KAAK,UAAUC,EAAS,OAAW,CAAC;AAAA,CAAK,EAExB,QAAQ,QAAQ,EAI/B,IAAMC,EAAeP,EAAKH,EAAa,gBAAgB,EAEvD,OAAOK,EACHK,EACA,GAAGX,EAAsB,kDAAoD;AAAA;AAAA,EAEnFA,EAAsB,iBAAmB;AAAA;AAAA;AAAA,EAInC,MACJ,CACJ,EAKMY,EAAsB,IAAM,CAC9B,IAAMD,EAAeP,EAAKH,EAAa,iBAAiB,EAExD,OAAIC,EAAWS,CAAY,GACvB,QAAQ,KAAK,8CAAoC,EAE1C,QAAQ,QAAQ,GAGpBL,EACHK,EACA,GAAG,CAAC,OAAQ,OAAQ,QAAS,QAAS,QAAS,QAAS,YAAa,QAAS,UAAW,UAAW,MAAO,OAAQ,QAAS,WAAW,EAAE,KAAK;AAAA,CAAI;AAAA,EAClJ,MACJ,CACJ,GAGC,SAAY,CACT,GAAI,CAEA,MAAM,QAAQ,IAAI,CAACH,EAAgB,EAAGI,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":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nimport content from \".\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/prettier-config\", projectPath, \"\\n\");\n\nconst configFile = \".prettierrc\";\n\n/**\n * Writes .prettierrc.${m|c}js if it doesn't exist. Warns if it exists.\n */\nconst writePrettierRc = () => {\n // eslint-disable-next-line no-restricted-syntax\n for (const filename of [\n configFile,\n `${configFile}.js`,\n `${configFile}.cjs`,\n `${configFile}.json`,\n `${configFile}.json5`,\n `${configFile}.yaml`,\n `${configFile}.yml`,\n `${configFile}.toml`,\n \"prettier.config.js\",\n \"prettier.config.cjs\",\n ]) {\n if (existsSync(join(projectPath, filename))) {\n console.warn(`⚠️ ${filename} 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\n const prettierPath = join(projectPath, \".prettierrc.js\");\n\n return writeFileAsync(\n prettierPath,\n `${packageIsTypeModule ? 'import config from \"@anolilab/prettier-config\";' : 'var config = require(\"@anolilab/prettier-config\");'}\n\n${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n ...config,\n}\n`,\n \"utf8\",\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(\n prettierPath,\n `${[\"*.md\", \"*.sh\", \"*.yml\", \"*.svg\", \"*.gif\", \"*.log\", \".DS_Store\", \"CNAME\", \"AUTHORS\", \"LICENSE\", \"es/\", \"lib/\", \"dist/\", \"coverage/\"].join(\"\\n\")}\\n`,\n \"utf8\",\n );\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 unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
@@ -5,10 +5,14 @@ import { join } from 'path';
5
5
  import { promisify } from 'util';
6
6
 
7
7
  process.env.CI&&process.exit(0);var l=promisify(writeFile);console.log("Configuring @anolilab/prettier-config",projectPath,`
8
- `);var e=".prettierrc",g=()=>{for(let n of [e,`${e}.js`,`${e}.cjs`,`${e}.json`,`${e}.json5`,`${e}.yaml`,`${e}.yml`,`${e}.toml`,"prettier.config.js","prettier.config.cjs"])if(existsSync(join(projectPath,n)))return console.warn(`\u26A0\uFE0F ${n} already exists;
8
+ `);var e=".prettierrc",g=()=>{for(let i of [e,`${e}.js`,`${e}.cjs`,`${e}.json`,`${e}.json5`,`${e}.yaml`,`${e}.yml`,`${e}.toml`,"prettier.config.js","prettier.config.cjs"])if(existsSync(join(projectPath,i)))return console.warn(`\u26A0\uFE0F ${i} already exists;
9
9
  Make sure that it includes the following for @anolilab/prettier-config to work as it should:
10
10
  ${JSON.stringify(a,void 0,4)}
11
- `),Promise.resolve();let r=join(projectPath,".prettierrc.js");return l(r,`${packageIsTypeModule?"export default":"module.exports ="} ${JSON.stringify(a,void 0,2).replace("rangeEnd: null,","rangeEnd: Number.POSITIVE_INFINITY,")}
11
+ `),Promise.resolve();let r=join(projectPath,".prettierrc.js");return l(r,`${packageIsTypeModule?'import config from "@anolilab/prettier-config";':'var config = require("@anolilab/prettier-config");'}
12
+
13
+ ${packageIsTypeModule?"export default":"module.exports ="} {
14
+ ...config,
15
+ }
12
16
  `,"utf8")},p=()=>{let r=join(projectPath,".prettierignore");return existsSync(r)?(console.warn("\u26A0\uFE0F .prettierignore already exists"),Promise.resolve()):l(r,`${["*.md","*.sh","*.yml","*.svg","*.gif","*.log",".DS_Store","CNAME","AUTHORS","LICENSE","es/","lib/","dist/","coverage/"].join(`
13
17
  `)}
14
18
  `,"utf8")};(async()=>{try{await Promise.all([g(),p()]),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(r){console.log("\u{1F62C} something went wrong:"),console.error(r),process.exit(1);}})();
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","configFile","writePrettierRc","filename","src_default","prettierPath","writePrettierIgnore","error"],"mappings":"yCAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAItB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,wCAAyCF,EAAa;AAAA,CAAI,EAEtE,IAAMM,EAAa,cAKbC,EAAkB,IAAM,CAE1B,QAAWC,IAAY,CACnBF,EACA,GAAGA,OACH,GAAGA,QACH,GAAGA,SACH,GAAGA,UACH,GAAGA,SACH,GAAGA,QACH,GAAGA,SACH,qBACA,qBACJ,EACI,GAAIL,EAAWE,EAAKH,EAAaQ,CAAQ,CAAC,EACtC,eAAQ,KAAK,iBAAOA;AAAA;AAAA,EAE9B,KAAK,UAAUC,EAAS,OAAW,CAAC;AAAA,CAAK,EAExB,QAAQ,QAAQ,EAI/B,IAAMC,EAAeP,EAAKH,EAAa,gBAAgB,EAEvD,OAAOK,EACHK,EACA,GAAGX,EAAsB,iBAAmB,sBAAsB,KAAK,UAAUU,EAAS,OAAW,CAAC,EAAE,QACpG,kBACA,qCACJ;AAAA,EACA,MACJ,CACJ,EAKME,EAAsB,IAAM,CAC9B,IAAMD,EAAeP,EAAKH,EAAa,iBAAiB,EAExD,OAAIC,EAAWS,CAAY,GACvB,QAAQ,KAAK,8CAAoC,EAE1C,QAAQ,QAAQ,GAGpBL,EACHK,EACA,GAAG,CAAC,OAAQ,OAAQ,QAAS,QAAS,QAAS,QAAS,YAAa,QAAS,UAAW,UAAW,MAAO,OAAQ,QAAS,WAAW,EAAE,KAAK;AAAA,CAAI;AAAA,EAClJ,MACJ,CACJ,GAGC,SAAY,CACT,GAAI,CAEA,MAAM,QAAQ,IAAI,CAACH,EAAgB,EAAGI,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":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nimport content from \".\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/prettier-config\", projectPath, \"\\n\");\n\nconst configFile = \".prettierrc\";\n\n/**\n * Writes .prettierrc.${m|c}js if it doesn't exist. Warns if it exists.\n */\nconst writePrettierRc = () => {\n // eslint-disable-next-line no-restricted-syntax\n for (const filename of [\n configFile,\n `${configFile}.js`,\n `${configFile}.cjs`,\n `${configFile}.json`,\n `${configFile}.json5`,\n `${configFile}.yaml`,\n `${configFile}.yml`,\n `${configFile}.toml`,\n \"prettier.config.js\",\n \"prettier.config.cjs\",\n ]) {\n if (existsSync(join(projectPath, filename))) {\n console.warn(`⚠️ ${filename} 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\n const prettierPath = join(projectPath, \".prettierrc.js\");\n\n return writeFileAsync(\n prettierPath,\n `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} ${JSON.stringify(content, undefined, 2).replace(\n \"rangeEnd: null,\",\n \"rangeEnd: Number.POSITIVE_INFINITY,\",\n )}\\n`,\n \"utf8\",\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(\n prettierPath,\n `${[\"*.md\", \"*.sh\", \"*.yml\", \"*.svg\", \"*.gif\", \"*.log\", \".DS_Store\", \"CNAME\", \"AUTHORS\", \"LICENSE\", \"es/\", \"lib/\", \"dist/\", \"coverage/\"].join(\"\\n\")}\\n`,\n \"utf8\",\n );\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 unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
1
+ {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","configFile","writePrettierRc","filename","src_default","prettierPath","writePrettierIgnore","error"],"mappings":"yCAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAItB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,wCAAyCF,EAAa;AAAA,CAAI,EAEtE,IAAMM,EAAa,cAKbC,EAAkB,IAAM,CAE1B,QAAWC,IAAY,CACnBF,EACA,GAAGA,OACH,GAAGA,QACH,GAAGA,SACH,GAAGA,UACH,GAAGA,SACH,GAAGA,QACH,GAAGA,SACH,qBACA,qBACJ,EACI,GAAIL,EAAWE,EAAKH,EAAaQ,CAAQ,CAAC,EACtC,eAAQ,KAAK,iBAAOA;AAAA;AAAA,EAE9B,KAAK,UAAUC,EAAS,OAAW,CAAC;AAAA,CAAK,EAExB,QAAQ,QAAQ,EAI/B,IAAMC,EAAeP,EAAKH,EAAa,gBAAgB,EAEvD,OAAOK,EACHK,EACA,GAAGX,EAAsB,kDAAoD;AAAA;AAAA,EAEnFA,EAAsB,iBAAmB;AAAA;AAAA;AAAA,EAInC,MACJ,CACJ,EAKMY,EAAsB,IAAM,CAC9B,IAAMD,EAAeP,EAAKH,EAAa,iBAAiB,EAExD,OAAIC,EAAWS,CAAY,GACvB,QAAQ,KAAK,8CAAoC,EAE1C,QAAQ,QAAQ,GAGpBL,EACHK,EACA,GAAG,CAAC,OAAQ,OAAQ,QAAS,QAAS,QAAS,QAAS,YAAa,QAAS,UAAW,UAAW,MAAO,OAAQ,QAAS,WAAW,EAAE,KAAK;AAAA,CAAI;AAAA,EAClJ,MACJ,CACJ,GAGC,SAAY,CACT,GAAI,CAEA,MAAM,QAAQ,IAAI,CAACH,EAAgB,EAAGI,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":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nimport content from \".\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/prettier-config\", projectPath, \"\\n\");\n\nconst configFile = \".prettierrc\";\n\n/**\n * Writes .prettierrc.${m|c}js if it doesn't exist. Warns if it exists.\n */\nconst writePrettierRc = () => {\n // eslint-disable-next-line no-restricted-syntax\n for (const filename of [\n configFile,\n `${configFile}.js`,\n `${configFile}.cjs`,\n `${configFile}.json`,\n `${configFile}.json5`,\n `${configFile}.yaml`,\n `${configFile}.yml`,\n `${configFile}.toml`,\n \"prettier.config.js\",\n \"prettier.config.cjs\",\n ]) {\n if (existsSync(join(projectPath, filename))) {\n console.warn(`⚠️ ${filename} 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\n const prettierPath = join(projectPath, \".prettierrc.js\");\n\n return writeFileAsync(\n prettierPath,\n `${packageIsTypeModule ? 'import config from \"@anolilab/prettier-config\";' : 'var config = require(\"@anolilab/prettier-config\");'}\n\n${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n ...config,\n}\n`,\n \"utf8\",\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(\n prettierPath,\n `${[\"*.md\", \"*.sh\", \"*.yml\", \"*.svg\", \"*.gif\", \"*.log\", \".DS_Store\", \"CNAME\", \"AUTHORS\", \"LICENSE\", \"es/\", \"lib/\", \"dist/\", \"coverage/\"].join(\"\\n\")}\\n`,\n \"utf8\",\n );\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 unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\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": "4.1.2",
3
+ "version": "4.1.3",
4
4
  "description": "Prettier shareable config for Anolilab.",
5
5
  "keywords": [
6
6
  "css",