@anolilab/lint-staged-config 2.0.6 → 2.0.8
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 +43 -0
- package/dist/{chunk-WGTU26NP.mjs → chunk-254HTULG.mjs} +2 -2
- package/dist/{chunk-FUJCV56D.mjs → chunk-BQEQMF7R.mjs} +2 -2
- package/dist/chunk-BQEQMF7R.mjs.map +1 -0
- package/dist/{chunk-5L2ZI35J.mjs → chunk-HGDREIGE.mjs} +3 -3
- package/dist/chunk-HGDREIGE.mjs.map +1 -0
- package/dist/{chunk-K4JGCNPB.js → chunk-IOWFTBT4.js} +3 -3
- package/dist/chunk-IOWFTBT4.js.map +1 -0
- package/dist/{chunk-4XL6CMQH.js → chunk-OOLGGS6M.js} +3 -3
- package/dist/{chunk-MUEXM65V.js → chunk-VU6SMFTD.js} +4 -4
- package/dist/chunk-VU6SMFTD.js.map +1 -0
- package/dist/groups/eslint/index.js +3 -3
- package/dist/groups/eslint/index.mjs +2 -2
- package/dist/groups/typescript.js +3 -3
- package/dist/groups/typescript.mjs +2 -2
- package/dist/index.js +4 -4
- package/dist/index.mjs +3 -3
- package/dist/postinstall.js +3 -3
- package/dist/postinstall.js.map +1 -1
- package/dist/postinstall.mjs +2 -2
- package/dist/postinstall.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-5L2ZI35J.mjs.map +0 -1
- package/dist/chunk-FUJCV56D.mjs.map +0 -1
- package/dist/chunk-K4JGCNPB.js.map +0 -1
- package/dist/chunk-MUEXM65V.js.map +0 -1
- /package/dist/{chunk-WGTU26NP.mjs.map → chunk-254HTULG.mjs.map} +0 -0
- /package/dist/{chunk-4XL6CMQH.js.map → chunk-OOLGGS6M.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
## @anolilab/lint-staged-config [2.0.8](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@2.0.7...@anolilab/lint-staged-config@2.0.8) (2023-09-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Miscellaneous Chores
|
|
5
|
+
|
|
6
|
+
* update package versions and Node.js versions in actions ([ba1bd5f](https://github.com/anolilab/javascript-style-guide/commit/ba1bd5fbdb5a053b7b2929c189486399012d58bc))
|
|
7
|
+
* updated deps ([a287003](https://github.com/anolilab/javascript-style-guide/commit/a2870031901767b64c304f1c926173d66ffaf283))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Continuous Integration
|
|
11
|
+
|
|
12
|
+
* downgrade semantic-release to v21 and conventional-changelog-conventionalcommits to v6.1 ([30d8cd7](https://github.com/anolilab/javascript-style-guide/commit/30d8cd78dae211ed4566c7d23f5b85b696cbae13))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* **@anolilab/semantic-release-preset:** upgraded to 7.0.0
|
|
19
|
+
|
|
20
|
+
## @anolilab/lint-staged-config [2.0.7](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@2.0.6...@anolilab/lint-staged-config@2.0.7) (2023-09-14)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* update dependencies ([72eabc7](https://github.com/anolilab/javascript-style-guide/commit/72eabc78c68be9778ac3e06ec4c2abb982da0636))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Styles
|
|
29
|
+
|
|
30
|
+
* cs fixes based on new rules ([b99c020](https://github.com/anolilab/javascript-style-guide/commit/b99c020b9f61f2517acd65b4d1a9f3d1f15812b1))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Miscellaneous Chores
|
|
34
|
+
|
|
35
|
+
* **deps:** update dependency vitest to ^0.34.4 ([#755](https://github.com/anolilab/javascript-style-guide/issues/755)) ([3246b55](https://github.com/anolilab/javascript-style-guide/commit/3246b55702eae25cf8d95ac95bd5f9b1323b51ff))
|
|
36
|
+
* **deps:** update devdependencies ([#751](https://github.com/anolilab/javascript-style-guide/issues/751)) ([01d4824](https://github.com/anolilab/javascript-style-guide/commit/01d482420a1ef6bbf01ff4b24336dac60d27637c))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Dependencies
|
|
41
|
+
|
|
42
|
+
* **@anolilab/semantic-release-preset:** upgraded to 6.0.6
|
|
43
|
+
|
|
1
44
|
## @anolilab/lint-staged-config [2.0.6](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/lint-staged-config@2.0.5...@anolilab/lint-staged-config@2.0.6) (2023-08-30)
|
|
2
45
|
|
|
3
46
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a } from './chunk-
|
|
1
|
+
import { a } from './chunk-HGDREIGE.mjs';
|
|
2
2
|
import { b as b$1, a as a$1 } from './chunk-32WCNCA6.mjs';
|
|
3
3
|
import { pkg, hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
4
4
|
import { dirname } from 'path';
|
|
@@ -9,4 +9,4 @@ import { quote } from 'shell-quote';
|
|
|
9
9
|
|
|
10
10
|
export { u as a, K as b };
|
|
11
11
|
//# sourceMappingURL=out.js.map
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-254HTULG.mjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as a$1 } from './chunk-
|
|
1
|
+
import { a as a$1 } from './chunk-HGDREIGE.mjs';
|
|
2
2
|
import { env } from 'process';
|
|
3
3
|
|
|
4
4
|
var e={[`**/*.{${["ts","mts","cts"].join(",")}}`]:n=>{let o=new Set;return n.forEach(s=>{try{let t=a$1("tsconfig.json",s);o.add(`tsc --noEmit --project ${t}`);}catch(t){env.DEBUG&&console.error(t);}}),[...o]}},a=e;
|
|
5
5
|
|
|
6
6
|
export { a };
|
|
7
7
|
//# sourceMappingURL=out.js.map
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-BQEQMF7R.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/typescript.ts"],"names":["env","group","filenames","commands","filePath","tsconfigPath","get_nearest_config_path_default","error","typescript_default"],"mappings":"yCAAA,OAAS,OAAAA,MAAW,UAMpB,IAAMC,EAAgB,CAClB,CAAC,SAAS,CAAC,KAAM,MAAO,KAAK,EAAE,KAAK,GAAG,CAAC,GAAG,EAAIC,GAAwB,CACnE,IAAMC,EAAW,IAAI,IAErB,OAAAD,EAAU,QAASE,GAAa,CAC5B,GAAI,CAEA,IAAMC,EAAeC,EAAqB,gBAAiBF,CAAwB,EAEnFD,EAAS,IAAI,0BAA0BE,CAAY,EAAE,CACzD,OAASE,EAAP,CACMP,EAAI,OACJ,QAAQ,MAAMO,CAAK,CAE3B,CACJ,CAAC,EAEM,CAAC,GAAGJ,CAAQ,CACvB,CACJ,EAEOK,EAAQP","sourcesContent":["import { env } from \"node:process\";\n\nimport type { Config } from \"lint-staged\";\n\nimport getNearestConfigPath from \"../utils/get-nearest-config-path\";\n\nconst group: Config = {\n [`**/*.{${[\"ts\", \"mts\", \"cts\"].join(\",\")}}`]: (filenames: string[]) => {\n const commands = new Set<string>();\n\n filenames.forEach((filePath) => {\n try {\n // eslint-disable-next-line no-template-curly-in-string\n const tsconfigPath = getNearestConfigPath(\"tsconfig.json\", filePath as \"/${string}\") as string;\n\n commands.add(`tsc --noEmit --project ${tsconfigPath}`);\n } catch (error) {\n if (env[\"DEBUG\"]) {\n console.error(error);\n }\n }\n });\n\n return [...commands];\n },\n};\n\nexport default group;\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import r from 'find-up';
|
|
2
1
|
import { existsSync } from 'fs';
|
|
3
2
|
import { join, dirname } from 'path';
|
|
3
|
+
import i from 'find-up';
|
|
4
4
|
|
|
5
|
-
var h=e=>{let t=
|
|
5
|
+
var h=e=>{let t=i.sync("package.json",{cwd:e});return t&&dirname(t)},c=e=>{let t=h(e??process.cwd());if(t?.startsWith("/"))return t;throw new Error(`Cannot determine the nearest root of the package for the file: ${e}!`)},f=e=>{let t=join(...e);if(t.startsWith("/"))return t;throw new TypeError("Joined path did not return an absolute path.")},p=(e,t)=>{let n=c(t),o=f([n,e]);if(existsSync(o))return o;throw new Error(`Cannot locate nearest "${e}" file!`)},m=p;
|
|
6
6
|
|
|
7
7
|
export { m as a };
|
|
8
8
|
//# sourceMappingURL=out.js.map
|
|
9
|
-
//# sourceMappingURL=chunk-
|
|
9
|
+
//# sourceMappingURL=chunk-HGDREIGE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["existsSync","dirname","join","findUp","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAE9B,OAAOC,MAAY,UAKnB,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWH,EAAO,KAAK,eAAgB,CAAE,IAAAE,CAAI,CAAC,EAEpD,OAAOC,GAAYL,EAAQK,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAAST,EAAK,GAAGQ,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAmFC,EAAaR,IAA8B,CACvJ,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAGrE,GAAIb,EAAWe,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,CAAQ,SAAS,CAC/D,EAEOG,EAAQJ","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\nimport findUp from \"find-up\";\nimport type { Join } from \"type-fest\";\n\nimport type { AbsolutePath, ConfigFileName, ConfigPath } from \"./types\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName = ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport default getNearestConfigPath;\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVU6SMFTD_js = require('./chunk-VU6SMFTD.js');
|
|
4
4
|
var process = require('process');
|
|
5
5
|
|
|
6
|
-
var e={[`**/*.{${["ts","mts","cts"].join(",")}}`]:n=>{let o=new Set;return n.forEach(s=>{try{let t=
|
|
6
|
+
var e={[`**/*.{${["ts","mts","cts"].join(",")}}`]:n=>{let o=new Set;return n.forEach(s=>{try{let t=chunkVU6SMFTD_js.a("tsconfig.json",s);o.add(`tsc --noEmit --project ${t}`);}catch(t){process.env.DEBUG&&console.error(t);}}),[...o]}},a=e;
|
|
7
7
|
|
|
8
8
|
exports.a = a;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-IOWFTBT4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/groups/typescript.ts"],"names":["env","group","filenames","commands","filePath","tsconfigPath","get_nearest_config_path_default","error","typescript_default"],"mappings":"wCAAA,OAAS,OAAAA,MAAW,UAMpB,IAAMC,EAAgB,CAClB,CAAC,SAAS,CAAC,KAAM,MAAO,KAAK,EAAE,KAAK,GAAG,CAAC,GAAG,EAAIC,GAAwB,CACnE,IAAMC,EAAW,IAAI,IAErB,OAAAD,EAAU,QAASE,GAAa,CAC5B,GAAI,CAEA,IAAMC,EAAeC,EAAqB,gBAAiBF,CAAwB,EAEnFD,EAAS,IAAI,0BAA0BE,CAAY,EAAE,CACzD,OAASE,EAAP,CACMP,EAAI,OACJ,QAAQ,MAAMO,CAAK,CAE3B,CACJ,CAAC,EAEM,CAAC,GAAGJ,CAAQ,CACvB,CACJ,EAEOK,EAAQP","sourcesContent":["import { env } from \"node:process\";\n\nimport type { Config } from \"lint-staged\";\n\nimport getNearestConfigPath from \"../utils/get-nearest-config-path\";\n\nconst group: Config = {\n [`**/*.{${[\"ts\", \"mts\", \"cts\"].join(\",\")}}`]: (filenames: string[]) => {\n const commands = new Set<string>();\n\n filenames.forEach((filePath) => {\n try {\n // eslint-disable-next-line no-template-curly-in-string\n const tsconfigPath = getNearestConfigPath(\"tsconfig.json\", filePath as \"/${string}\") as string;\n\n commands.add(`tsc --noEmit --project ${tsconfigPath}`);\n } catch (error) {\n if (env[\"DEBUG\"]) {\n console.error(error);\n }\n }\n });\n\n return [...commands];\n },\n};\n\nexport default group;\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVU6SMFTD_js = require('./chunk-VU6SMFTD.js');
|
|
4
4
|
var chunk26UFUGBI_js = require('./chunk-26UFUGBI.js');
|
|
5
5
|
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var eslint = require('eslint');
|
|
8
8
|
var shellQuote = require('shell-quote');
|
|
9
9
|
|
|
10
|
-
!global.anolilabLintStagedPackageJsonConfig&&packageJsonUtils.pkg&&(global.anolilabLintStagedPackageJsonConfig=packageJsonUtils.pkg.anolilab?.["lint-staged-config"]);var C=global.anolilabLintStagedPackageJsonConfig??{},u=C;var S=n=>{let i={};return n.forEach(s=>{let t=path.dirname(s);i[t]||(i[t]=[]),i[t].push(s);}),i},p=S;var E=async n=>{let i=new eslint.ESLint,s=await Promise.all(n.map(async o=>await i.isPathIgnored(o)));return n.filter((o,a)=>!s[a]).map(o=>`"${chunk26UFUGBI_js.a?o:shellQuote.quote([o])}"`)},h=E;var e=u?.settings?.eslint??{},b=["react-hooks/exhaustive-deps: off"],r=".eslintrc",F=()=>{let n=[];e["max-warnings"]!==void 0&&Number.isNaN(e["max-warnings"])?n.push(`--max-warnings=${e["max-warnings"]}`):e["max-warnings"]!==!1&&n.push("--max-warnings=0");let i=[];e.rules!==void 0&&Array.isArray(e.rules)?i.push([...e.rules,...b].filter(t=>t.trim().length>0).map(t=>`"${t.trim()}"`)):i.push(b.map(t=>`"${t.trim()}"`)),i.length>0&&n.push(`--rule ${i.join(" --rule ")}`);let s=[...e["fix-type"]??["layout"]].filter(t=>t.trim().length>0);return s.length>0&&n.push(`--fix-type ${s.join(",")}`,"--fix"),e.cache&&n.push("--cache"),n},A=async n=>{let i=await h(n),s=F();if(e.config)return s.push(`--config ${e.config}`),[`cross-env NO_LOGS=true eslint ${s.join(" ")} ${i.join(" ")}`];let t=p(i),o=[];return Object.values(t).forEach(a=>{let l;[r,`${r}.js`,`${r}.cjs`,`${r}.json`,`${r}.yaml`,`${r}.yml`].forEach($=>{if(!l)try{l=
|
|
10
|
+
!global.anolilabLintStagedPackageJsonConfig&&packageJsonUtils.pkg&&(global.anolilabLintStagedPackageJsonConfig=packageJsonUtils.pkg.anolilab?.["lint-staged-config"]);var C=global.anolilabLintStagedPackageJsonConfig??{},u=C;var S=n=>{let i={};return n.forEach(s=>{let t=path.dirname(s);i[t]||(i[t]=[]),i[t].push(s);}),i},p=S;var E=async n=>{let i=new eslint.ESLint,s=await Promise.all(n.map(async o=>await i.isPathIgnored(o)));return n.filter((o,a)=>!s[a]).map(o=>`"${chunk26UFUGBI_js.a?o:shellQuote.quote([o])}"`)},h=E;var e=u?.settings?.eslint??{},b=["react-hooks/exhaustive-deps: off"],r=".eslintrc",F=()=>{let n=[];e["max-warnings"]!==void 0&&Number.isNaN(e["max-warnings"])?n.push(`--max-warnings=${e["max-warnings"]}`):e["max-warnings"]!==!1&&n.push("--max-warnings=0");let i=[];e.rules!==void 0&&Array.isArray(e.rules)?i.push([...e.rules,...b].filter(t=>t.trim().length>0).map(t=>`"${t.trim()}"`)):i.push(b.map(t=>`"${t.trim()}"`)),i.length>0&&n.push(`--rule ${i.join(" --rule ")}`);let s=[...e["fix-type"]??["layout"]].filter(t=>t.trim().length>0);return s.length>0&&n.push(`--fix-type ${s.join(",")}`,"--fix"),e.cache&&n.push("--cache"),n},A=async n=>{let i=await h(n),s=F();if(e.config)return s.push(`--config ${e.config}`),[`cross-env NO_LOGS=true eslint ${s.join(" ")} ${i.join(" ")}`];let t=p(i),o=[];return Object.values(t).forEach(a=>{let l;[r,`${r}.js`,`${r}.cjs`,`${r}.json`,`${r}.yaml`,`${r}.yml`].forEach($=>{if(!l)try{l=chunkVU6SMFTD_js.a($,a[0]);}catch{}}),l&&o.push(`cross-env NO_LOGS=true eslint ${s.join(" ")} --config ${l} ${a.join(" ")}`);}),o},g=A;var x=["cjs","js","mjs","cts","ts","mts","yml","yaml","jsx","tsx","mdx","toml"];global.hasAnolilabLintStagedMarkdownCli||(global.hasAnolilabLintStagedMarkdownCli=packageJsonUtils.hasDependency("markdownlint-cli")||packageJsonUtils.hasDevDependency("markdownlint-cli"));global.hasAnolilabLintStagedMarkdownCli2||(global.hasAnolilabLintStagedMarkdownCli2=packageJsonUtils.hasDependency("markdownlint-cli2")||packageJsonUtils.hasDevDependency("markdownlint-cli2"));!global.hasAnolilabLintStagedMarkdownCli&&!global.hasAnolilabLintStagedMarkdownCli2&&x.push("md");var N={[`**/*.{${["json","json5","jsonc"].join(",")}}`]:async n=>[...await g(n)],[`**/*.{${[x].join(",")}}`]:async n=>[`prettier --write ${chunk26UFUGBI_js.b(n)}`,...await g(n)]},K=N;
|
|
11
11
|
|
|
12
12
|
exports.a = u;
|
|
13
13
|
exports.b = K;
|
|
14
14
|
//# sourceMappingURL=out.js.map
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-OOLGGS6M.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var r = require('find-up');
|
|
4
3
|
var fs = require('fs');
|
|
5
4
|
var path = require('path');
|
|
5
|
+
var i = require('find-up');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var i__default = /*#__PURE__*/_interopDefault(i);
|
|
10
10
|
|
|
11
|
-
var h=e=>{let t=
|
|
11
|
+
var h=e=>{let t=i__default.default.sync("package.json",{cwd:e});return t&&path.dirname(t)},c=e=>{let t=h(e??process.cwd());if(t?.startsWith("/"))return t;throw new Error(`Cannot determine the nearest root of the package for the file: ${e}!`)},f=e=>{let t=path.join(...e);if(t.startsWith("/"))return t;throw new TypeError("Joined path did not return an absolute path.")},p=(e,t)=>{let n=c(t),o=f([n,e]);if(fs.existsSync(o))return o;throw new Error(`Cannot locate nearest "${e}" file!`)},m=p;
|
|
12
12
|
|
|
13
13
|
exports.a = m;
|
|
14
14
|
//# sourceMappingURL=out.js.map
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-VU6SMFTD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["existsSync","dirname","join","findUp","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAS,cAAAA,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAE9B,OAAOC,MAAY,UAKnB,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWH,EAAO,KAAK,eAAgB,CAAE,IAAAE,CAAI,CAAC,EAEpD,OAAOC,GAAYL,EAAQK,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAAST,EAAK,GAAGQ,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAmFC,EAAaR,IAA8B,CACvJ,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAGrE,GAAIb,EAAWe,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,CAAQ,SAAS,CAC/D,EAEOG,EAAQJ","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\nimport findUp from \"find-up\";\nimport type { Join } from \"type-fest\";\n\nimport type { AbsolutePath, ConfigFileName, ConfigPath } from \"./types\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName = ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport default getNearestConfigPath;\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunkOOLGGS6M_js = require('../../chunk-OOLGGS6M.js');
|
|
4
|
+
require('../../chunk-VU6SMFTD.js');
|
|
5
5
|
require('../../chunk-26UFUGBI.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
module.exports =
|
|
9
|
+
module.exports = chunkOOLGGS6M_js.b;
|
|
10
10
|
//# sourceMappingURL=out.js.map
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { b as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { b as default } from '../../chunk-254HTULG.mjs';
|
|
2
|
+
import '../../chunk-HGDREIGE.mjs';
|
|
3
3
|
import '../../chunk-32WCNCA6.mjs';
|
|
4
4
|
//# sourceMappingURL=out.js.map
|
|
5
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkIOWFTBT4_js = require('../chunk-IOWFTBT4.js');
|
|
4
|
+
require('../chunk-VU6SMFTD.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
module.exports =
|
|
8
|
+
module.exports = chunkIOWFTBT4_js.a;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
10
|
//# sourceMappingURL=typescript.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkIOWFTBT4_js = require('./chunk-IOWFTBT4.js');
|
|
4
|
+
var chunkOOLGGS6M_js = require('./chunk-OOLGGS6M.js');
|
|
5
|
+
require('./chunk-VU6SMFTD.js');
|
|
6
6
|
var chunkGWSF22B6_js = require('./chunk-GWSF22B6.js');
|
|
7
7
|
var chunkCZNOXHD3_js = require('./chunk-CZNOXHD3.js');
|
|
8
8
|
var chunk6EWZW5LF_js = require('./chunk-6EWZW5LF.js');
|
|
@@ -12,7 +12,7 @@ require('./chunk-26UFUGBI.js');
|
|
|
12
12
|
var process = require('process');
|
|
13
13
|
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
14
14
|
|
|
15
|
-
var y=[{config:
|
|
15
|
+
var y=[{config:chunkOOLGGS6M_js.b,configName:"eslint",dependencies:["prettier","eslint"]},{config:chunkGWSF22B6_js.a,configName:"json",dependencies:["prettier","sort-package-json"]},{config:chunkCZNOXHD3_js.a,configName:"markdown",dependencies:["prettier","markdownlint-cli","markdownlint-cli2"]},{config:chunk6EWZW5LF_js.a,configName:"secretlint",dependencies:["secretlint"]},{config:chunkFZFCZD6I_js.a,configName:"stylesheets",dependencies:["stylelint"]},{config:chunkVAUDCZ4C_js.a,configName:"tests",dependencies:["vite","jest","ava"]},{config:chunkIOWFTBT4_js.a,configName:"typescript",dependencies:["typescript"]}],g={},r=[],a={};y.forEach(t=>{let{config:n,configName:i,dependencies:l}=t;if(chunkOOLGGS6M_js.a.plugin?.[i]!==!1){let s=[];l.forEach(e=>{(packageJsonUtils.hasDependency(e)||packageJsonUtils.hasDevDependency(e))&&s.push(e);}),s.length>0?(g={...g,...n},r.push(i)):(a[i]={},l.forEach(e=>{a[i][e]=packageJsonUtils.hasDependency(e)||packageJsonUtils.hasDevDependency(e);}));}});var w={...g};var j=()=>{},k=t=>process.env.NO_LOGS?j:n=>console.log(`${t}${n}`),O=k(""),o=O;if(!global.hasAnolilabStagedLintConfigLoaded){process.env.DEBUG&&(o(`
|
|
16
16
|
@anolilab/lint-stage-config loaded the following plugins:
|
|
17
17
|
`),r.forEach(n=>{o(` ${n}`);}));let t=!1;Object.entries(a).forEach(([n,i])=>{Object.values(i).some(Boolean)&&(t=!0,o(`
|
|
18
18
|
Your package.json container dependencies for the "${n}" plugin, please add the following dependencies with your chosen package manager to enable this plugin:`),Object.entries(i).forEach(([s,e])=>{e||o(` ${s}`);}));}),t&&(o(`
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as a$7 } from './chunk-
|
|
2
|
-
import { a as a$1, b } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { a as a$7 } from './chunk-BQEQMF7R.mjs';
|
|
2
|
+
import { a as a$1, b } from './chunk-254HTULG.mjs';
|
|
3
|
+
import './chunk-HGDREIGE.mjs';
|
|
4
4
|
import { a as a$2 } from './chunk-YBLR7X5F.mjs';
|
|
5
5
|
import { a as a$3 } from './chunk-KNLP6LX4.mjs';
|
|
6
6
|
import { a as a$4 } from './chunk-4RVIFLAT.mjs';
|
package/dist/postinstall.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
3
|
+
var chunkVU6SMFTD_js = require('./chunk-VU6SMFTD.js');
|
|
5
4
|
var fs = require('fs');
|
|
6
5
|
var path = require('path');
|
|
7
6
|
var process$1 = require('process');
|
|
8
7
|
var util = require('util');
|
|
8
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
9
9
|
|
|
10
10
|
process.env.CI&&process$1.exit(0);var a=util.promisify(fs.writeFile),_=util.promisify(fs.mkdir);console.log("Configuring @anolilab/lint-staged-config",packageJsonUtils.projectPath,`
|
|
11
11
|
`);var i=".lintstagedrc",c=t=>fs.existsSync(t)?(console.warn(`\u26A0\uFE0F ${t} already exists;`),!0):!1,I=async()=>{for(let s of [i,`${i}.js`,`${i}.cjs`,`${i}.mjs`,`${i}.json`,`${i}.yaml`,`${i}.yml`,"lint-staged.config.js","lint-staged.config.mjs","lint-staged.config.cjs"])if(c(path.join(packageJsonUtils.projectPath,s)))return;let t=path.join(packageJsonUtils.projectPath,".lintstagedrc.js");await a(t,`${packageJsonUtils.packageIsTypeModule?'import config from "@anolilab/lint-staged-config"':'const config = require("@anolilab/lint-staged-config")'};
|
|
@@ -35,7 +35,7 @@ if [ "$IS_WINDOWS" = "true" ]; then
|
|
|
35
35
|
exec < /dev/tty
|
|
36
36
|
fi
|
|
37
37
|
fi
|
|
38
|
-
`,"utf-8");let h=path.join(o,"pre-commit"),e=!1;try{
|
|
38
|
+
`,"utf-8");let h=path.join(o,"pre-commit"),e=!1;try{chunkVU6SMFTD_js.a("pnpm-lock.yaml"),e=!0;}catch{e=!1;}c(h)||await a(h,`#!/bin/sh
|
|
39
39
|
|
|
40
40
|
. "$(dirname "$0")/_/husky.sh"
|
|
41
41
|
. "$(dirname "$0")/common.sh"
|
package/dist/postinstall.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/postinstall.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/postinstall.ts"],"names":["existsSync","mkdir","writeFile","join","exit","promisify","hasDependency","hasDevDependency","packageIsTypeModule","projectPath","writeFileAsync","mkdirAsync","configFile","checkIfFileExists","filename","writeLintstagedRc","lintstagedPath","writeHuskyFiles","huskyFolderPath","commonShPath","preCommitPath","hasPnpm","get_nearest_config_path_default","prepareCommitMessagePath","error"],"mappings":"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","sourcesContent":["import { existsSync, mkdir, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { exit } from \"node:process\";\nimport { promisify } from \"node:util\";\n\nimport { hasDependency, hasDevDependency, packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\n\nimport getNearestConfigPath from \"./utils/get-nearest-config-path\";\n\nif (process.env[\"CI\"]) {\n exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\nconst mkdirAsync = promisify(mkdir);\n\nconsole.log(\"Configuring @anolilab/lint-staged-config\", projectPath, \"\\n\");\n\nconst configFile = \".lintstagedrc\";\n\nconst checkIfFileExists = (filename: string): boolean => {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(filename)) {\n console.warn(`⚠️ ${filename} already exists;`);\n\n return true;\n }\n\n return false;\n};\n\n/**\n * Writes .lintstagedrc.js if it doesn't exist. Warns if it exists.\n */\nconst writeLintstagedRc = async () => {\n // eslint-disable-next-line no-restricted-syntax\n for (const filename of [\n configFile,\n `${configFile}.js`,\n `${configFile}.cjs`,\n `${configFile}.mjs`,\n `${configFile}.json`,\n `${configFile}.yaml`,\n `${configFile}.yml`,\n \"lint-staged.config.js\",\n \"lint-staged.config.mjs\",\n \"lint-staged.config.cjs\",\n ]) {\n if (checkIfFileExists(join(projectPath, filename))) {\n return;\n }\n }\n\n const lintstagedPath = join(projectPath, \".lintstagedrc.js\");\n\n const content = `${packageIsTypeModule ? 'import config from \"@anolilab/lint-staged-config\"' : 'const config = require(\"@anolilab/lint-staged-config\")'};\n\n${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n ...config,\n};\n`;\n\n await writeFileAsync(lintstagedPath, content, \"utf-8\");\n};\n\n/**\n * Adds husky hooks to .husky folder if they don't exist. Warns if they exist.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeHuskyFiles = async () => {\n const hasHusky = hasDependency(\"husky\") || hasDevDependency(\"husky\");\n\n if (!hasHusky) {\n console.warn(\"⚠️ husky is not installed;\");\n\n return;\n }\n\n const huskyFolderPath = join(projectPath, \".husky\");\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!existsSync(huskyFolderPath)) {\n await mkdirAsync(huskyFolderPath);\n }\n\n const commonShPath = join(huskyFolderPath, \"common.sh\");\n\n if (!checkIfFileExists(commonShPath)) {\n await writeFileAsync(\n commonShPath,\n `#!/bin/sh\n\ncommand_exists () {\n command -v \"$1\" >/dev/null 2>&1\n}\n\nIS_WINDOWS=\"false\"\n\nif [ \"$OSTYPE\" = \"cygwin\" ]; then\n IS_WINDOWS=\"true\"\nelif [ \"$OSTYPE\" = \"msys\" ]; then\n IS_WINDOWS=\"true\"\nelif [ \"$OSTYPE\" = \"win32\" ]; then\n IS_WINDOWS=\"true\"\nfi\n\n# Workaround for Windows 10, Git Bash and Yarn\nif [ \"$IS_WINDOWS\" = \"true\" ]; then\n if command_exists winpty && test -t 1; then\n exec < /dev/tty\n fi\nfi\n`,\n \"utf-8\",\n );\n }\n\n const preCommitPath = join(huskyFolderPath, \"pre-commit\");\n\n let hasPnpm = false;\n\n try {\n getNearestConfigPath(\"pnpm-lock.yaml\");\n\n hasPnpm = true;\n } catch {\n hasPnpm = false;\n\n // ignore\n }\n\n if (!checkIfFileExists(preCommitPath)) {\n await writeFileAsync(\n preCommitPath,\n `#!/bin/sh\n\n. \"$(dirname \"$0\")/_/husky.sh\"\n. \"$(dirname \"$0\")/common.sh\"\n\n# The hook should exit with non-zero status after issuing\n# an appropriate message if it wants to stop the commit.\n\necho --------------------------------------------\necho Starting Git hook: pre-commit\n\n${hasPnpm ? \"pnpx\" : \"npx\"} lint-staged --verbose --concurrent false\n\necho Finished Git hook: pre-commit\necho --------------------------------------------\n`,\n \"utf-8\",\n );\n }\n\n const prepareCommitMessagePath = join(huskyFolderPath, \"prepare-commit-msg\");\n const hasCz = hasDependency(\"commitizen\") || hasDevDependency(\"commitizen\");\n\n if (hasCz && !checkIfFileExists(prepareCommitMessagePath)) {\n await writeFileAsync(\n prepareCommitMessagePath,\n `#!/bin/sh\n\n. \"$(dirname \"$0\")/_/husky.sh\"\n. \"$(dirname \"$0\")/common.sh\"\n\necho --------------------------------------------\necho Starting Git hook: prepare-commit-msg\n\n# if we hve a cmd that is running ${hasPnpm ? \"pnpx\" : \"npx\"} cz that means finalize and commit\nFILE=commit.cmd\nif test -f \"$FILE\"; then\n echo \"$FILE exists.\"\n rm commit.cmd\n exit 0;\nfi\n# if on Windows, spawn a cmd that will run ${hasPnpm ? \"pnpx\" : \"npx\"} cz\ncase \\`uname\\` in\n *CYGWIN*|*MINGW*|*MSYS* )\n # Only run commitizen if no commit message was already provided.\n if [ -z \"\\${2-}\" ]; then\n export CZ_TYPE=\"\\${CZ_TYPE:-fix}\"\n export CZ_MAX_HEADER_WIDTH=$COMMITLINT_MAX_WIDTH\n export CZ_MAX_LINE_WIDTH=$CZ_MAX_HEADER_WIDTH\n echo \"${hasPnpm ? \"pnpx\" : \"npx\"} cz && exit\" > commit.cmd\n start commit.cmd\n exit 1;\n fi\n\n exit 0;;\nesac\n\n# Only run commitizen if no commit message was already provided.\nif [ -z \"\\${2-}\" ]; then\n export CZ_TYPE=\"\\${CZ_TYPE:-fix}\"\n export CZ_MAX_HEADER_WIDTH=$COMMITLINT_MAX_WIDTH\n export CZ_MAX_LINE_WIDTH=$CZ_MAX_HEADER_WIDTH\n # By default git hooks are not interactive. exec < /dev/tty allows a users terminal to interact with commitizen.\n exec < /dev/tty && ${hasPnpm ? \"pnpx\" : \"npx\"} cz --hook || true\nfi\n\necho Finished Git hook: prepare-commit-msg\necho --------------------------------------------\n`,\n \"utf-8\",\n );\n }\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n await writeLintstagedRc();\n await writeHuskyFiles();\n\n console.log(\"😎 Everything went well, have fun!\");\n\n exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n exit(1);\n }\n})();\n"]}
|
package/dist/postinstall.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as a$1 } from './chunk-
|
|
2
|
-
import { projectPath, packageIsTypeModule, hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
1
|
+
import { a as a$1 } from './chunk-HGDREIGE.mjs';
|
|
3
2
|
import { writeFile, mkdir, existsSync } from 'fs';
|
|
4
3
|
import { join } from 'path';
|
|
5
4
|
import { exit } from 'process';
|
|
6
5
|
import { promisify } from 'util';
|
|
6
|
+
import { projectPath, packageIsTypeModule, hasDependency, hasDevDependency } from '@anolilab/package-json-utils';
|
|
7
7
|
|
|
8
8
|
process.env.CI&&exit(0);var a=promisify(writeFile),_=promisify(mkdir);console.log("Configuring @anolilab/lint-staged-config",projectPath,`
|
|
9
9
|
`);var i=".lintstagedrc",c=t=>existsSync(t)?(console.warn(`\u26A0\uFE0F ${t} already exists;`),!0):!1,I=async()=>{for(let s of [i,`${i}.js`,`${i}.cjs`,`${i}.mjs`,`${i}.json`,`${i}.yaml`,`${i}.yml`,"lint-staged.config.js","lint-staged.config.mjs","lint-staged.config.cjs"])if(c(join(projectPath,s)))return;let t=join(projectPath,".lintstagedrc.js");await a(t,`${packageIsTypeModule?'import config from "@anolilab/lint-staged-config"':'const config = require("@anolilab/lint-staged-config")'};
|
package/dist/postinstall.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/postinstall.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/postinstall.ts"],"names":["existsSync","mkdir","writeFile","join","exit","promisify","hasDependency","hasDevDependency","packageIsTypeModule","projectPath","writeFileAsync","mkdirAsync","configFile","checkIfFileExists","filename","writeLintstagedRc","lintstagedPath","writeHuskyFiles","huskyFolderPath","commonShPath","preCommitPath","hasPnpm","get_nearest_config_path_default","prepareCommitMessagePath","error"],"mappings":"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","sourcesContent":["import { existsSync, mkdir, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { exit } from \"node:process\";\nimport { promisify } from \"node:util\";\n\nimport { hasDependency, hasDevDependency, packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\n\nimport getNearestConfigPath from \"./utils/get-nearest-config-path\";\n\nif (process.env[\"CI\"]) {\n exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\nconst mkdirAsync = promisify(mkdir);\n\nconsole.log(\"Configuring @anolilab/lint-staged-config\", projectPath, \"\\n\");\n\nconst configFile = \".lintstagedrc\";\n\nconst checkIfFileExists = (filename: string): boolean => {\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(filename)) {\n console.warn(`⚠️ ${filename} already exists;`);\n\n return true;\n }\n\n return false;\n};\n\n/**\n * Writes .lintstagedrc.js if it doesn't exist. Warns if it exists.\n */\nconst writeLintstagedRc = async () => {\n // eslint-disable-next-line no-restricted-syntax\n for (const filename of [\n configFile,\n `${configFile}.js`,\n `${configFile}.cjs`,\n `${configFile}.mjs`,\n `${configFile}.json`,\n `${configFile}.yaml`,\n `${configFile}.yml`,\n \"lint-staged.config.js\",\n \"lint-staged.config.mjs\",\n \"lint-staged.config.cjs\",\n ]) {\n if (checkIfFileExists(join(projectPath, filename))) {\n return;\n }\n }\n\n const lintstagedPath = join(projectPath, \".lintstagedrc.js\");\n\n const content = `${packageIsTypeModule ? 'import config from \"@anolilab/lint-staged-config\"' : 'const config = require(\"@anolilab/lint-staged-config\")'};\n\n${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n ...config,\n};\n`;\n\n await writeFileAsync(lintstagedPath, content, \"utf-8\");\n};\n\n/**\n * Adds husky hooks to .husky folder if they don't exist. Warns if they exist.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst writeHuskyFiles = async () => {\n const hasHusky = hasDependency(\"husky\") || hasDevDependency(\"husky\");\n\n if (!hasHusky) {\n console.warn(\"⚠️ husky is not installed;\");\n\n return;\n }\n\n const huskyFolderPath = join(projectPath, \".husky\");\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (!existsSync(huskyFolderPath)) {\n await mkdirAsync(huskyFolderPath);\n }\n\n const commonShPath = join(huskyFolderPath, \"common.sh\");\n\n if (!checkIfFileExists(commonShPath)) {\n await writeFileAsync(\n commonShPath,\n `#!/bin/sh\n\ncommand_exists () {\n command -v \"$1\" >/dev/null 2>&1\n}\n\nIS_WINDOWS=\"false\"\n\nif [ \"$OSTYPE\" = \"cygwin\" ]; then\n IS_WINDOWS=\"true\"\nelif [ \"$OSTYPE\" = \"msys\" ]; then\n IS_WINDOWS=\"true\"\nelif [ \"$OSTYPE\" = \"win32\" ]; then\n IS_WINDOWS=\"true\"\nfi\n\n# Workaround for Windows 10, Git Bash and Yarn\nif [ \"$IS_WINDOWS\" = \"true\" ]; then\n if command_exists winpty && test -t 1; then\n exec < /dev/tty\n fi\nfi\n`,\n \"utf-8\",\n );\n }\n\n const preCommitPath = join(huskyFolderPath, \"pre-commit\");\n\n let hasPnpm = false;\n\n try {\n getNearestConfigPath(\"pnpm-lock.yaml\");\n\n hasPnpm = true;\n } catch {\n hasPnpm = false;\n\n // ignore\n }\n\n if (!checkIfFileExists(preCommitPath)) {\n await writeFileAsync(\n preCommitPath,\n `#!/bin/sh\n\n. \"$(dirname \"$0\")/_/husky.sh\"\n. \"$(dirname \"$0\")/common.sh\"\n\n# The hook should exit with non-zero status after issuing\n# an appropriate message if it wants to stop the commit.\n\necho --------------------------------------------\necho Starting Git hook: pre-commit\n\n${hasPnpm ? \"pnpx\" : \"npx\"} lint-staged --verbose --concurrent false\n\necho Finished Git hook: pre-commit\necho --------------------------------------------\n`,\n \"utf-8\",\n );\n }\n\n const prepareCommitMessagePath = join(huskyFolderPath, \"prepare-commit-msg\");\n const hasCz = hasDependency(\"commitizen\") || hasDevDependency(\"commitizen\");\n\n if (hasCz && !checkIfFileExists(prepareCommitMessagePath)) {\n await writeFileAsync(\n prepareCommitMessagePath,\n `#!/bin/sh\n\n. \"$(dirname \"$0\")/_/husky.sh\"\n. \"$(dirname \"$0\")/common.sh\"\n\necho --------------------------------------------\necho Starting Git hook: prepare-commit-msg\n\n# if we hve a cmd that is running ${hasPnpm ? \"pnpx\" : \"npx\"} cz that means finalize and commit\nFILE=commit.cmd\nif test -f \"$FILE\"; then\n echo \"$FILE exists.\"\n rm commit.cmd\n exit 0;\nfi\n# if on Windows, spawn a cmd that will run ${hasPnpm ? \"pnpx\" : \"npx\"} cz\ncase \\`uname\\` in\n *CYGWIN*|*MINGW*|*MSYS* )\n # Only run commitizen if no commit message was already provided.\n if [ -z \"\\${2-}\" ]; then\n export CZ_TYPE=\"\\${CZ_TYPE:-fix}\"\n export CZ_MAX_HEADER_WIDTH=$COMMITLINT_MAX_WIDTH\n export CZ_MAX_LINE_WIDTH=$CZ_MAX_HEADER_WIDTH\n echo \"${hasPnpm ? \"pnpx\" : \"npx\"} cz && exit\" > commit.cmd\n start commit.cmd\n exit 1;\n fi\n\n exit 0;;\nesac\n\n# Only run commitizen if no commit message was already provided.\nif [ -z \"\\${2-}\" ]; then\n export CZ_TYPE=\"\\${CZ_TYPE:-fix}\"\n export CZ_MAX_HEADER_WIDTH=$COMMITLINT_MAX_WIDTH\n export CZ_MAX_LINE_WIDTH=$CZ_MAX_HEADER_WIDTH\n # By default git hooks are not interactive. exec < /dev/tty allows a users terminal to interact with commitizen.\n exec < /dev/tty && ${hasPnpm ? \"pnpx\" : \"npx\"} cz --hook || true\nfi\n\necho Finished Git hook: prepare-commit-msg\necho --------------------------------------------\n`,\n \"utf-8\",\n );\n }\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n await writeLintstagedRc();\n await writeHuskyFiles();\n\n console.log(\"😎 Everything went well, have fun!\");\n\n exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n exit(1);\n }\n})();\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anolilab/lint-staged-config",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Shareable Lint-Staged Config for any project.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -100,27 +100,27 @@
|
|
|
100
100
|
"shell-quote": "^1.8.1"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@anolilab/semantic-release-preset": "
|
|
103
|
+
"@anolilab/semantic-release-preset": "7.0.0",
|
|
104
104
|
"@total-typescript/ts-reset": "^0.5.1",
|
|
105
105
|
"@types/lint-staged": "^13.2.0",
|
|
106
106
|
"@types/shell-quote": "^1.7.1",
|
|
107
|
-
"@vitest/coverage-v8": "^0.34.
|
|
107
|
+
"@vitest/coverage-v8": "^0.34.5",
|
|
108
108
|
"husky": "^8.0.3",
|
|
109
109
|
"lint-staged": "^14.0.1",
|
|
110
110
|
"rimraf": "^5.0.1",
|
|
111
|
-
"semantic-release": "^21.1.
|
|
111
|
+
"semantic-release": "^21.1.2",
|
|
112
112
|
"tsup": "^7.2.0",
|
|
113
113
|
"type-fest": "^4.3.1",
|
|
114
114
|
"typescript": "5.2.2",
|
|
115
|
-
"vitest": "^0.34.
|
|
115
|
+
"vitest": "^0.34.5"
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
118
|
"husky": "^8.x",
|
|
119
119
|
"lint-staged": "^13.x || ^14.0.0"
|
|
120
120
|
},
|
|
121
121
|
"optionalDependencies": {
|
|
122
|
-
"eslint": "^8.
|
|
123
|
-
"jest": "^29.
|
|
122
|
+
"eslint": "^8.49.0",
|
|
123
|
+
"jest": "^29.7.0",
|
|
124
124
|
"prettier": "^3.0.3",
|
|
125
125
|
"secretlint": "^7.0.7",
|
|
126
126
|
"stylelint": "^15.10.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["findUp","existsSync","dirname","join","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAOA,MAAY,UACnB,OAAS,cAAAC,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAI9B,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWN,EAAO,KAAK,eAAgB,CAAE,IAAAK,CAAI,CAAC,EAEpD,OAAOC,GAAYJ,EAAQI,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAASR,EAAK,GAAGO,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAmFC,EAAaR,IAA8B,CACvJ,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAGrE,GAAIZ,EAAWc,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,CAAQ,SAAS,CAC/D,EAEOG,EAAQJ","sourcesContent":["import findUp from \"find-up\";\nimport { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { Join } from \"type-fest\";\nimport type { AbsolutePath, ConfigFileName, ConfigPath } from \"./types\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName = ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport default getNearestConfigPath;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/groups/typescript.ts"],"names":["env","group","filenames","commands","filePath","tsconfigPath","get_nearest_config_path_default","error","typescript_default"],"mappings":"yCACA,OAAS,OAAAA,MAAW,UAIpB,IAAMC,EAAgB,CAClB,CAAC,SAAS,CAAC,KAAM,MAAO,KAAK,EAAE,KAAK,GAAG,CAAC,GAAG,EAAIC,GAAwB,CACnE,IAAMC,EAAW,IAAI,IAErB,OAAAD,EAAU,QAASE,GAAa,CAC5B,GAAI,CAEA,IAAMC,EAAeC,EAAqB,gBAAiBF,CAAwB,EAEnFD,EAAS,IAAI,0BAA0BE,CAAY,EAAE,CACzD,OAASE,EAAP,CACMP,EAAI,OACJ,QAAQ,MAAMO,CAAK,CAE3B,CACJ,CAAC,EAEM,CAAC,GAAGJ,CAAQ,CACvB,CACJ,EAEOK,EAAQP","sourcesContent":["import type { Config } from \"lint-staged\";\nimport { env } from \"node:process\";\n\nimport getNearestConfigPath from \"../utils/get-nearest-config-path\";\n\nconst group: Config = {\n [`**/*.{${[\"ts\", \"mts\", \"cts\"].join(\",\")}}`]: (filenames: string[]) => {\n const commands = new Set<string>();\n\n filenames.forEach((filePath) => {\n try {\n // eslint-disable-next-line no-template-curly-in-string\n const tsconfigPath = getNearestConfigPath(\"tsconfig.json\", filePath as \"/${string}\") as string;\n\n commands.add(`tsc --noEmit --project ${tsconfigPath}`);\n } catch (error) {\n if (env[\"DEBUG\"]) {\n console.error(error);\n }\n }\n });\n\n return [...commands];\n },\n};\n\nexport default group;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/groups/typescript.ts"],"names":["env","group","filenames","commands","filePath","tsconfigPath","get_nearest_config_path_default","error","typescript_default"],"mappings":"wCACA,OAAS,OAAAA,MAAW,UAIpB,IAAMC,EAAgB,CAClB,CAAC,SAAS,CAAC,KAAM,MAAO,KAAK,EAAE,KAAK,GAAG,CAAC,GAAG,EAAIC,GAAwB,CACnE,IAAMC,EAAW,IAAI,IAErB,OAAAD,EAAU,QAASE,GAAa,CAC5B,GAAI,CAEA,IAAMC,EAAeC,EAAqB,gBAAiBF,CAAwB,EAEnFD,EAAS,IAAI,0BAA0BE,CAAY,EAAE,CACzD,OAASE,EAAP,CACMP,EAAI,OACJ,QAAQ,MAAMO,CAAK,CAE3B,CACJ,CAAC,EAEM,CAAC,GAAGJ,CAAQ,CACvB,CACJ,EAEOK,EAAQP","sourcesContent":["import type { Config } from \"lint-staged\";\nimport { env } from \"node:process\";\n\nimport getNearestConfigPath from \"../utils/get-nearest-config-path\";\n\nconst group: Config = {\n [`**/*.{${[\"ts\", \"mts\", \"cts\"].join(\",\")}}`]: (filenames: string[]) => {\n const commands = new Set<string>();\n\n filenames.forEach((filePath) => {\n try {\n // eslint-disable-next-line no-template-curly-in-string\n const tsconfigPath = getNearestConfigPath(\"tsconfig.json\", filePath as \"/${string}\") as string;\n\n commands.add(`tsc --noEmit --project ${tsconfigPath}`);\n } catch (error) {\n if (env[\"DEBUG\"]) {\n console.error(error);\n }\n }\n });\n\n return [...commands];\n },\n};\n\nexport default group;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/get-nearest-config-path.ts"],"names":["findUp","existsSync","dirname","join","packageDirectorySync","cwd","filePath","getNearestPackageRootPath","packageDirectoryPath","joinPaths","paths","joined","getNearestConfigPath","fileName","packageRootPath","configPath","get_nearest_config_path_default"],"mappings":"AAAA,OAAOA,MAAY,UACnB,OAAS,cAAAC,MAAkB,KAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,OAI9B,IAAMC,EAAwBC,GAAiB,CAC3C,IAAMC,EAAWN,EAAO,KAAK,eAAgB,CAAE,IAAAK,CAAI,CAAC,EAEpD,OAAOC,GAAYJ,EAAQI,CAAQ,CACvC,EAEMC,EAA6BF,GAA+B,CAC9D,IAAMG,EAAuBJ,EAAqBC,GAAO,QAAQ,IAAI,CAAC,EAEtE,GAAIG,GAAsB,WAAW,GAAG,EACpC,OAAOA,EAGX,MAAM,IAAI,MAAM,kEAAkEH,CAAG,GAAG,CAC5F,EAEMI,EAA8CC,GAA2B,CAC3E,IAAMC,EAASR,EAAK,GAAGO,CAAK,EAE5B,GAAIC,EAAO,WAAW,GAAG,EACrB,OAAOA,EAGX,MAAM,IAAI,UAAU,8CAA8C,CACtE,EAEMC,EAAuB,CAAmFC,EAAaR,IAA8B,CACvJ,IAAMS,EAAkBP,EAA0BF,CAAG,EAC/CU,EAAaN,EAAkB,CAACK,EAAsBD,CAAQ,CAAC,EAGrE,GAAIZ,EAAWc,CAAU,EACrB,OAAOA,EAGX,MAAM,IAAI,MAAM,0BAA0BF,CAAQ,SAAS,CAC/D,EAEOG,EAAQJ","sourcesContent":["import findUp from \"find-up\";\nimport { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { Join } from \"type-fest\";\nimport type { AbsolutePath, ConfigFileName, ConfigPath } from \"./types\";\n\nconst packageDirectorySync = (cwd?: string) => {\n const filePath = findUp.sync(\"package.json\", { cwd });\n\n return filePath && dirname(filePath);\n};\n\nconst getNearestPackageRootPath = (cwd?: string): AbsolutePath => {\n const packageDirectoryPath = packageDirectorySync(cwd ?? process.cwd());\n\n if (packageDirectoryPath?.startsWith(\"/\")) {\n return packageDirectoryPath as AbsolutePath;\n }\n\n throw new Error(`Cannot determine the nearest root of the package for the file: ${cwd}!`);\n};\n\nconst joinPaths = <T extends ReadonlyArray<string>>(paths: T): Join<T, \"/\"> => {\n const joined = join(...paths);\n\n if (joined.startsWith(\"/\")) {\n return joined as Join<T, \"/\">;\n }\n\n throw new TypeError(`Joined path did not return an absolute path.`);\n};\n\nconst getNearestConfigPath = <N extends ConfigFileName = ConfigFileName, A extends AbsolutePath = AbsolutePath>(fileName: N, cwd?: A): ConfigPath<A, N> => {\n const packageRootPath = getNearestPackageRootPath(cwd);\n const configPath = joinPaths<[A, N]>([packageRootPath as A, fileName]);\n\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n if (existsSync(configPath)) {\n return configPath;\n }\n\n throw new Error(`Cannot locate nearest \"${fileName}\" file!`);\n};\n\nexport default getNearestConfigPath;\n"]}
|
|
File without changes
|
|
File without changes
|