@shibanet0/datamitsu-config 0.0.1-alpha-9 → 0.0.1-alpha-10
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/bin/datamitsu.mjs +14 -8
- package/bin/tsc.mjs +8 -4
- package/bin/tsx.mjs +1 -1
- package/datamitsu.js +108 -73
- package/dist/array-func-M6KDQ7DN.js +14 -0
- package/dist/array-func-NPT6GB52.js +14 -0
- package/dist/clean-package/index.js +12 -4
- package/dist/eslint/index.d.ts +1 -0
- package/dist/eslint/index.js +309 -18
- package/dist/eslint/plugins/array-func.d.ts +2 -0
- package/dist/eslint/plugins/import.d.ts +2 -0
- package/dist/eslint/plugins/json-schema-validator.d.ts +2 -0
- package/dist/eslint/plugins/json.d.ts +2 -0
- package/dist/eslint/plugins/jsx-a11y.d.ts +2 -0
- package/dist/eslint/plugins/n.d.ts +2 -0
- package/dist/eslint/plugins/no-use-extend-native.d.ts +2 -0
- package/dist/eslint/plugins/perfectionist copy.d.ts +2 -0
- package/dist/eslint/plugins/playwright.d.ts +2 -0
- package/dist/eslint/plugins/prettier.d.ts +2 -0
- package/dist/eslint/plugins/promise.d.ts +2 -0
- package/dist/eslint/plugins/react copy.d.ts +2 -0
- package/dist/eslint/plugins/react-hooks.d.ts +2 -0
- package/dist/eslint/plugins/react-perf.d.ts +2 -0
- package/dist/eslint/plugins/react-prefer-function-component.d.ts +2 -0
- package/dist/eslint/plugins/react-refresh.d.ts +2 -0
- package/dist/eslint/plugins/react.d.ts +2 -0
- package/dist/eslint/plugins/security.d.ts +2 -0
- package/dist/eslint/plugins/sonarjs.d.ts +2 -0
- package/dist/eslint/plugins/storybook.d.ts +2 -0
- package/dist/eslint/plugins/toml.d.ts +2 -0
- package/dist/eslint/plugins/turbo.d.ts +2 -0
- package/dist/eslint/plugins/unicorn copy.d.ts +2 -0
- package/dist/eslint/plugins/unicorn.d.ts +2 -0
- package/dist/eslint/plugins/unused-imports.d.ts +2 -0
- package/dist/eslint/plugins/vanilla-extract.d.ts +2 -0
- package/dist/eslint/plugins/yml.d.ts +2 -0
- package/dist/json-LWTL4ZNK.js +18 -0
- package/dist/json-ZAIWY2QG.js +18 -0
- package/dist/jsx-a11y-DENBIOMT.js +7 -0
- package/dist/no-use-extend-native-WXT3EZT4.js +7 -0
- package/dist/no-use-extend-native-ZPCF5GPF.js +7 -0
- package/dist/playwright-BGT6YZAD.js +15 -0
- package/dist/playwright-EQJ74ILC.js +15 -0
- package/dist/prettier/index.js +1 -1
- package/dist/prettier-STALF5K5.js +7 -0
- package/dist/prettier-VWVEU6BH.js +7 -0
- package/dist/promise-4UOFB7NK.js +7 -0
- package/dist/promise-GMCQOXN6.js +7 -0
- package/dist/react-SBV4CSZW.js +10 -0
- package/dist/react-hooks-KCD4FRWS.js +7 -0
- package/dist/react-hooks-R6UCTUUG.js +7 -0
- package/dist/react-perf-I32W4SW7.js +7 -0
- package/dist/react-prefer-function-component-ZCGU3TJA.js +7 -0
- package/dist/security-QVOYXU25.js +7 -0
- package/dist/sonarjs-L2LS4QXC.js +16 -0
- package/dist/storybook-HBDSOOCR.js +7 -0
- package/dist/storybook-IFYU76LT.js +7 -0
- package/dist/toml-UYLTOG46.js +7 -0
- package/dist/toml-Y76F5J2F.js +7 -0
- package/dist/turbo-BF4PT2F4.js +7 -0
- package/dist/unicorn-CIVFI3IM.js +17 -0
- package/dist/unused-imports-7PV5NHDW.js +25 -0
- package/dist/unused-imports-PHM72DI2.js +25 -0
- package/dist/vanilla-extract-52HEEDJV.js +11 -0
- package/package.json +2 -2
package/bin/datamitsu.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { spawn } from "child_process";
|
|
4
|
-
import { join } from "path";
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { join } from "node:path";
|
|
5
5
|
|
|
6
6
|
import { getBinaryFilepath } from "./utils.mjs";
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const arguments_ = process.argv.slice(2);
|
|
9
9
|
|
|
10
|
-
if (!
|
|
11
|
-
|
|
10
|
+
if (!arguments_.includes("--binary-command")) {
|
|
11
|
+
arguments_.unshift("--binary-command", "datamitsu");
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const child = spawn(
|
|
@@ -17,7 +17,7 @@ const child = spawn(
|
|
|
17
17
|
getBinaryFilepath("@datamitsu/datamitsu/package.json", "../bin/index.js"),
|
|
18
18
|
"--config",
|
|
19
19
|
join(import.meta.dirname, "../datamitsu.js"),
|
|
20
|
-
...
|
|
20
|
+
...arguments_,
|
|
21
21
|
],
|
|
22
22
|
{
|
|
23
23
|
env: {
|
|
@@ -26,9 +26,15 @@ const child = spawn(
|
|
|
26
26
|
DATAMITSU_APP_ESLINT_BINARY_FILEPATH: getBinaryFilepath("eslint", "../../bin/eslint.js"),
|
|
27
27
|
DATAMITSU_APP_KNIP_BINARY_FILEPATH: getBinaryFilepath("knip", "../../bin/knip.js"),
|
|
28
28
|
DATAMITSU_APP_PRETTIER_BINARY_FILEPATH: getBinaryFilepath("prettier", "../bin/prettier.cjs"),
|
|
29
|
-
DATAMITSU_APP_SORT_PACKAGE_JSON_BINARY_FILEPATH: getBinaryFilepath(
|
|
29
|
+
DATAMITSU_APP_SORT_PACKAGE_JSON_BINARY_FILEPATH: getBinaryFilepath(
|
|
30
|
+
"sort-package-json",
|
|
31
|
+
"../cli.js",
|
|
32
|
+
),
|
|
30
33
|
DATAMITSU_APP_SYNCPACK_BINARY_FILEPATH: getBinaryFilepath("syncpack/index.cjs", ""),
|
|
31
|
-
DATAMITSU_APP_TSC_BINARY_FILEPATH: getBinaryFilepath(
|
|
34
|
+
DATAMITSU_APP_TSC_BINARY_FILEPATH: getBinaryFilepath(
|
|
35
|
+
"@typescript/native-preview/package.json",
|
|
36
|
+
"../bin/tsgo.js",
|
|
37
|
+
),
|
|
32
38
|
DATAMITSU_PACKAGE_NAME: process.env.DATAMITSU_PACKAGE_NAME || "@shibanet0/datamitsu-config",
|
|
33
39
|
},
|
|
34
40
|
stdio: "inherit",
|
package/bin/tsc.mjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { spawn } from "child_process";
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
4
|
|
|
5
5
|
import { getBinaryFilepath } from "./utils.mjs";
|
|
6
6
|
|
|
7
7
|
const args = process.argv.slice(2);
|
|
8
8
|
|
|
9
|
-
const child = spawn(
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const child = spawn(
|
|
10
|
+
"node",
|
|
11
|
+
[getBinaryFilepath("@typescript/native-preview/package.json", "../bin/tsgo.js"), ...args],
|
|
12
|
+
{
|
|
13
|
+
stdio: "inherit",
|
|
14
|
+
},
|
|
15
|
+
);
|
|
12
16
|
|
|
13
17
|
child.on("exit", (code) => {
|
|
14
18
|
if (code !== 0) {
|
package/bin/tsx.mjs
CHANGED
package/datamitsu.js
CHANGED
|
@@ -870,7 +870,7 @@ var dependencies = {
|
|
|
870
870
|
"@commitlint/config-conventional": "20.2.0",
|
|
871
871
|
"@commitlint/format": "20.2.0",
|
|
872
872
|
"@commitlint/types": "20.2.0",
|
|
873
|
-
"@datamitsu/datamitsu": "0.0.1-alpha-
|
|
873
|
+
"@datamitsu/datamitsu": "0.0.1-alpha-22",
|
|
874
874
|
"@eslint/config-helpers": "0.5.0",
|
|
875
875
|
"@eslint/js": "9.39.2",
|
|
876
876
|
"@prettier/plugin-xml": "3.4.2",
|
|
@@ -1038,14 +1038,14 @@ var cleanDependencies = (deps) => {
|
|
|
1038
1038
|
return deps;
|
|
1039
1039
|
}
|
|
1040
1040
|
if (!deps) return;
|
|
1041
|
-
const excludeDependencyNameList = [
|
|
1042
|
-
|
|
1041
|
+
const excludeDependencyNameList = /* @__PURE__ */ new Set([
|
|
1042
|
+
"@trivago/prettier-plugin-sort-imports",
|
|
1043
1043
|
"typescript",
|
|
1044
|
-
|
|
1045
|
-
];
|
|
1044
|
+
...Object.keys(dependencies)
|
|
1045
|
+
]);
|
|
1046
1046
|
return Object.entries(deps).reduce(
|
|
1047
1047
|
(acc, [name2, version2]) => {
|
|
1048
|
-
if (!excludeDependencyNameList.
|
|
1048
|
+
if (!excludeDependencyNameList.has(name2)) {
|
|
1049
1049
|
acc[name2] = version2;
|
|
1050
1050
|
}
|
|
1051
1051
|
return acc;
|
|
@@ -1349,7 +1349,13 @@ var init = {
|
|
|
1349
1349
|
// delete-only configuration - removes deprecated config files without creating new ones
|
|
1350
1350
|
"deprecated-configs": {
|
|
1351
1351
|
deleteOnly: true,
|
|
1352
|
-
otherFileNameList: [
|
|
1352
|
+
otherFileNameList: [
|
|
1353
|
+
".babelrc",
|
|
1354
|
+
".babelrc.js",
|
|
1355
|
+
"babel.config.js",
|
|
1356
|
+
".editorconfig",
|
|
1357
|
+
".editorconfig-checker.json"
|
|
1358
|
+
]
|
|
1353
1359
|
},
|
|
1354
1360
|
"eslint.config.js": {
|
|
1355
1361
|
content: () => {
|
|
@@ -1399,7 +1405,12 @@ var init = {
|
|
|
1399
1405
|
...data
|
|
1400
1406
|
});
|
|
1401
1407
|
},
|
|
1402
|
-
otherFileNameList: [
|
|
1408
|
+
otherFileNameList: [
|
|
1409
|
+
".hadolint.yaml",
|
|
1410
|
+
"hadolint.yaml",
|
|
1411
|
+
".config/hadolint.yaml",
|
|
1412
|
+
".hadolint/hadolint.yaml"
|
|
1413
|
+
],
|
|
1403
1414
|
rootOnly: true
|
|
1404
1415
|
},
|
|
1405
1416
|
"knip.config.js": {
|
|
@@ -1658,6 +1669,10 @@ var projectTypes = {
|
|
|
1658
1669
|
description: "Node.js/npm project",
|
|
1659
1670
|
markers: ["package.json"]
|
|
1660
1671
|
},
|
|
1672
|
+
"typescript-project": {
|
|
1673
|
+
description: "",
|
|
1674
|
+
markers: ["tsconfig.json"]
|
|
1675
|
+
},
|
|
1661
1676
|
"pnpm-package": {
|
|
1662
1677
|
description: "pnpm project",
|
|
1663
1678
|
markers: ["pnpm-lock.yaml"]
|
|
@@ -1676,7 +1691,7 @@ var projectTypes = {
|
|
|
1676
1691
|
var indentSettings = {
|
|
1677
1692
|
typ: {
|
|
1678
1693
|
indentWidth: 2,
|
|
1679
|
-
lineWidth:
|
|
1694
|
+
lineWidth: 100
|
|
1680
1695
|
}
|
|
1681
1696
|
};
|
|
1682
1697
|
|
|
@@ -1694,7 +1709,15 @@ var prettierGlobs = [
|
|
|
1694
1709
|
"**/*.yaml",
|
|
1695
1710
|
"**/*.md"
|
|
1696
1711
|
];
|
|
1697
|
-
var eslintGlobs = [
|
|
1712
|
+
var eslintGlobs = [
|
|
1713
|
+
"**/*.js",
|
|
1714
|
+
"**/*.mjs",
|
|
1715
|
+
"**/*.cjs",
|
|
1716
|
+
"**/*.ts",
|
|
1717
|
+
"**/*.mts",
|
|
1718
|
+
"**/*.cts",
|
|
1719
|
+
"**/*.tsx"
|
|
1720
|
+
];
|
|
1698
1721
|
var toolsConfig = {
|
|
1699
1722
|
eslint: {
|
|
1700
1723
|
name: "Eslint",
|
|
@@ -1709,11 +1732,11 @@ var toolsConfig = {
|
|
|
1709
1732
|
"--quiet",
|
|
1710
1733
|
"--config",
|
|
1711
1734
|
tools.Path.join(facts().cwd, "eslint.config.js"),
|
|
1712
|
-
"{
|
|
1735
|
+
"{files}"
|
|
1713
1736
|
],
|
|
1714
1737
|
command: "eslint",
|
|
1715
1738
|
globs: eslintGlobs,
|
|
1716
|
-
mode: "
|
|
1739
|
+
mode: "batch",
|
|
1717
1740
|
priority: 0
|
|
1718
1741
|
},
|
|
1719
1742
|
lint: {
|
|
@@ -1722,16 +1745,16 @@ var toolsConfig = {
|
|
|
1722
1745
|
"0",
|
|
1723
1746
|
"--report-unused-disable-directives-severity",
|
|
1724
1747
|
"0",
|
|
1725
|
-
"
|
|
1726
|
-
"
|
|
1727
|
-
"{
|
|
1748
|
+
"--config",
|
|
1749
|
+
tools.Path.join(facts().cwd, "eslint.config.js"),
|
|
1750
|
+
"{files}"
|
|
1728
1751
|
],
|
|
1729
|
-
command: "
|
|
1752
|
+
command: "eslint",
|
|
1730
1753
|
globs: eslintGlobs,
|
|
1731
|
-
mode: "
|
|
1754
|
+
mode: "batch"
|
|
1732
1755
|
}
|
|
1733
1756
|
},
|
|
1734
|
-
projectTypes: ["npm-package"]
|
|
1757
|
+
projectTypes: ["npm-package", "typescript-project"]
|
|
1735
1758
|
},
|
|
1736
1759
|
// gitleaks: {
|
|
1737
1760
|
// name: "gitleaks",
|
|
@@ -1745,27 +1768,27 @@ var toolsConfig = {
|
|
|
1745
1768
|
// },
|
|
1746
1769
|
// },
|
|
1747
1770
|
// },
|
|
1748
|
-
"golangci-lint": {
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
},
|
|
1771
|
+
// "golangci-lint": {
|
|
1772
|
+
// name: "golangci-lint - Go Linter",
|
|
1773
|
+
// operations: {
|
|
1774
|
+
// fix: {
|
|
1775
|
+
// args: ["run", "--fix"],
|
|
1776
|
+
// command: "golangci-lint",
|
|
1777
|
+
// globs: ["**/*.go"],
|
|
1778
|
+
// mode: "whole-project",
|
|
1779
|
+
// priority: 1,
|
|
1780
|
+
// rootOnly: true,
|
|
1781
|
+
// },
|
|
1782
|
+
// lint: {
|
|
1783
|
+
// args: ["run"],
|
|
1784
|
+
// command: "golangci-lint",
|
|
1785
|
+
// globs: ["**/*.go"],
|
|
1786
|
+
// mode: "whole-project",
|
|
1787
|
+
// rootOnly: true,
|
|
1788
|
+
// },
|
|
1789
|
+
// },
|
|
1790
|
+
// projectTypes: ["golang-package"],
|
|
1791
|
+
// },
|
|
1769
1792
|
// knip: {
|
|
1770
1793
|
// name: "Knip",
|
|
1771
1794
|
// operations: {
|
|
@@ -1776,26 +1799,38 @@ var toolsConfig = {
|
|
|
1776
1799
|
// mode: "whole-project",
|
|
1777
1800
|
// },
|
|
1778
1801
|
// },
|
|
1779
|
-
// projectTypes: ["npm-package"],
|
|
1802
|
+
// projectTypes: ["npm-package","typescript-project"],
|
|
1780
1803
|
// },
|
|
1781
1804
|
prettier: {
|
|
1782
1805
|
name: "Prettier - Code Formatter",
|
|
1783
1806
|
operations: {
|
|
1784
1807
|
fix: {
|
|
1785
|
-
args: [
|
|
1808
|
+
args: [
|
|
1809
|
+
"-u",
|
|
1810
|
+
"--write",
|
|
1811
|
+
"--config",
|
|
1812
|
+
tools.Path.join(facts().cwd, "prettier.config.js"),
|
|
1813
|
+
"{files}"
|
|
1814
|
+
],
|
|
1786
1815
|
command: "prettier",
|
|
1787
1816
|
globs: prettierGlobs,
|
|
1788
|
-
mode: "
|
|
1817
|
+
mode: "batch",
|
|
1789
1818
|
priority: 1
|
|
1790
1819
|
},
|
|
1791
1820
|
lint: {
|
|
1792
|
-
args: [
|
|
1821
|
+
args: [
|
|
1822
|
+
"-u",
|
|
1823
|
+
"--check",
|
|
1824
|
+
"--config",
|
|
1825
|
+
tools.Path.join(facts().cwd, "prettier.config.js"),
|
|
1826
|
+
"{files}"
|
|
1827
|
+
],
|
|
1793
1828
|
command: "prettier",
|
|
1794
1829
|
globs: prettierGlobs,
|
|
1795
|
-
mode: "
|
|
1830
|
+
mode: "batch"
|
|
1796
1831
|
}
|
|
1797
1832
|
},
|
|
1798
|
-
projectTypes: ["npm-package"]
|
|
1833
|
+
projectTypes: ["npm-package", "typescript-project"]
|
|
1799
1834
|
},
|
|
1800
1835
|
// hadolint: {
|
|
1801
1836
|
// name: "hadolint - Dockerfile Linter",
|
|
@@ -1855,41 +1890,41 @@ var toolsConfig = {
|
|
|
1855
1890
|
priority: 200
|
|
1856
1891
|
}
|
|
1857
1892
|
},
|
|
1858
|
-
projectTypes: ["npm-package"]
|
|
1859
|
-
},
|
|
1860
|
-
syncpack: {
|
|
1861
|
-
name: "syncpack",
|
|
1862
|
-
operations: {
|
|
1863
|
-
fix: {
|
|
1864
|
-
args: ["fix", "--config", tools.Path.join(facts().gitRoot, ".syncpackrc.json")],
|
|
1865
|
-
command: "syncpack",
|
|
1866
|
-
globs: ["**/package.json"],
|
|
1867
|
-
mode: "whole-project",
|
|
1868
|
-
priority: 0
|
|
1869
|
-
},
|
|
1870
|
-
lint: {
|
|
1871
|
-
args: ["lint", "--config", tools.Path.join(facts().gitRoot, ".syncpackrc.json")],
|
|
1872
|
-
command: "syncpack",
|
|
1873
|
-
globs: ["**/package.json"],
|
|
1874
|
-
mode: "whole-project",
|
|
1875
|
-
priority: 0
|
|
1876
|
-
}
|
|
1877
|
-
},
|
|
1878
|
-
projectTypes: ["npm-package"]
|
|
1893
|
+
projectTypes: ["npm-package", "typescript-project"]
|
|
1879
1894
|
},
|
|
1880
|
-
//
|
|
1881
|
-
// name: "
|
|
1895
|
+
// syncpack: {
|
|
1896
|
+
// name: "syncpack",
|
|
1882
1897
|
// operations: {
|
|
1898
|
+
// fix: {
|
|
1899
|
+
// args: ["fix", "--config", tools.Path.join(facts().gitRoot, ".syncpackrc.json")],
|
|
1900
|
+
// command: "syncpack",
|
|
1901
|
+
// globs: ["**/package.json"],
|
|
1902
|
+
// mode: "whole-project",
|
|
1903
|
+
// priority: 0,
|
|
1904
|
+
// },
|
|
1883
1905
|
// lint: {
|
|
1884
|
-
// args: ["--
|
|
1885
|
-
// command: "
|
|
1886
|
-
// globs: ["
|
|
1906
|
+
// args: ["lint", "--config", tools.Path.join(facts().gitRoot, ".syncpackrc.json")],
|
|
1907
|
+
// command: "syncpack",
|
|
1908
|
+
// globs: ["**/package.json"],
|
|
1887
1909
|
// mode: "whole-project",
|
|
1888
|
-
// priority:
|
|
1910
|
+
// priority: 0,
|
|
1889
1911
|
// },
|
|
1890
1912
|
// },
|
|
1891
|
-
// projectTypes: ["npm-package"],
|
|
1913
|
+
// projectTypes: ["npm-package","typescript-project"],
|
|
1892
1914
|
// },
|
|
1915
|
+
tsc: {
|
|
1916
|
+
name: "Tsc",
|
|
1917
|
+
operations: {
|
|
1918
|
+
lint: {
|
|
1919
|
+
args: ["--noEmit"],
|
|
1920
|
+
command: "tsc",
|
|
1921
|
+
globs: ["**/*.d.ts", "**/*.ts", "**/*.mts", "**/*.cts", "**/*.tsx"],
|
|
1922
|
+
mode: "whole-project",
|
|
1923
|
+
priority: 200
|
|
1924
|
+
}
|
|
1925
|
+
},
|
|
1926
|
+
projectTypes: ["typescript-project"]
|
|
1927
|
+
},
|
|
1893
1928
|
// "editorconfig-checker": {
|
|
1894
1929
|
// name: "EditorConfig Checker",
|
|
1895
1930
|
// operations: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/eslint/plugins/array-func.ts
|
|
2
|
+
import "@eslint/config-helpers";
|
|
3
|
+
import arrayFunc from "eslint-plugin-array-func";
|
|
4
|
+
var arrayFuncRules = [
|
|
5
|
+
arrayFunc.configs.recommended,
|
|
6
|
+
{
|
|
7
|
+
rules: {
|
|
8
|
+
"array-func/prefer-array-from": "off"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
];
|
|
12
|
+
export {
|
|
13
|
+
arrayFuncRules
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/eslint/plugins/array-func.ts
|
|
2
|
+
import arrayFunc from "eslint-plugin-array-func";
|
|
3
|
+
import "@eslint/config-helpers";
|
|
4
|
+
var arrayFuncRules = [
|
|
5
|
+
arrayFunc.configs.recommended,
|
|
6
|
+
{
|
|
7
|
+
rules: {
|
|
8
|
+
"array-func/prefer-array-from": "off"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
];
|
|
12
|
+
export {
|
|
13
|
+
arrayFuncRules
|
|
14
|
+
};
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
// src/clean-package/index.ts
|
|
2
2
|
import { readFileSync, writeFileSync } from "fs";
|
|
3
3
|
import { resolve } from "path";
|
|
4
|
-
var DEFAULT_FIELDS_TO_REMOVE = [
|
|
4
|
+
var DEFAULT_FIELDS_TO_REMOVE = [
|
|
5
|
+
"scripts",
|
|
6
|
+
"devDependencies",
|
|
7
|
+
"packageManager"
|
|
8
|
+
];
|
|
5
9
|
var cleanPackage = (options = {}) => {
|
|
6
|
-
const {
|
|
10
|
+
const {
|
|
11
|
+
dryRun = false,
|
|
12
|
+
fieldsToRemove = DEFAULT_FIELDS_TO_REMOVE,
|
|
13
|
+
packagePath = "package.json"
|
|
14
|
+
} = options;
|
|
7
15
|
const absolutePath = resolve(process.cwd(), packagePath);
|
|
8
16
|
try {
|
|
9
|
-
const packageJson = JSON.parse(readFileSync(absolutePath, "
|
|
17
|
+
const packageJson = JSON.parse(readFileSync(absolutePath, "utf8"));
|
|
10
18
|
const cleaned = { ...packageJson };
|
|
11
19
|
for (const field of fieldsToRemove) {
|
|
12
20
|
delete cleaned[field];
|
|
@@ -16,7 +24,7 @@ var cleanPackage = (options = {}) => {
|
|
|
16
24
|
console.log("Cleaned package.json:", JSON.stringify(cleaned, null, 2));
|
|
17
25
|
return;
|
|
18
26
|
}
|
|
19
|
-
writeFileSync(absolutePath, JSON.stringify(cleaned, null, 2) + "\n", "
|
|
27
|
+
writeFileSync(absolutePath, JSON.stringify(cleaned, null, 2) + "\n", "utf8");
|
|
20
28
|
console.log(`\u2713 Cleaned ${packagePath}, removed fields:`, fieldsToRemove);
|
|
21
29
|
} catch (error) {
|
|
22
30
|
console.error(`Error cleaning package.json:`, error);
|
package/dist/eslint/index.d.ts
CHANGED