@shibanet0/datamitsu-config 0.0.1-alpha-5 → 0.0.1-alpha-7

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.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { cleanPackage } from "../dist/clean-package/index.js";
4
+
5
+ cleanPackage();
package/datamitsu.js CHANGED
@@ -863,7 +863,58 @@ var mapOfApps = {
863
863
 
864
864
  // package.json
865
865
  var name = "@shibanet0/datamitsu-config";
866
- var version = "0.0.1-alpha-5";
866
+ var version = "0.0.1-alpha-7";
867
+ var dependencies = {
868
+ "@antebudimir/eslint-plugin-vanilla-extract": "1.16.0",
869
+ "@commitlint/cli": "20.2.0",
870
+ "@commitlint/config-conventional": "20.2.0",
871
+ "@commitlint/format": "20.2.0",
872
+ "@commitlint/types": "20.2.0",
873
+ "@datamitsu/datamitsu": "0.0.1-alpha-17",
874
+ "@eslint/config-helpers": "0.5.0",
875
+ "@eslint/js": "9.39.2",
876
+ "@prettier/plugin-xml": "3.4.2",
877
+ "@typescript/native-preview": "7.0.0-dev.20251215.1",
878
+ "conventional-changelog-conventionalcommits": "9.1.0",
879
+ eslint: "9.39.2",
880
+ "eslint-config-prettier": "10.1.8",
881
+ "eslint-plugin-array-func": "5.1.0",
882
+ "eslint-plugin-import": "2.32.0",
883
+ "eslint-plugin-json": "4.0.1",
884
+ "eslint-plugin-json-schema-validator": "5.5.0",
885
+ "eslint-plugin-jsx-a11y": "6.10.2",
886
+ "eslint-plugin-n": "17.23.1",
887
+ "eslint-plugin-no-use-extend-native": "0.7.2",
888
+ "eslint-plugin-perfectionist": "4.15.1",
889
+ "eslint-plugin-playwright": "2.4.0",
890
+ "eslint-plugin-promise": "7.2.1",
891
+ "eslint-plugin-react": "7.37.5",
892
+ "eslint-plugin-react-hooks": "7.0.1",
893
+ "eslint-plugin-react-perf": "3.3.3",
894
+ "eslint-plugin-react-prefer-function-component": "5.0.0",
895
+ "eslint-plugin-react-refresh": "0.4.26",
896
+ "eslint-plugin-security": "3.0.1",
897
+ "eslint-plugin-sonarjs": "3.0.5",
898
+ "eslint-plugin-storybook": "10.1.10",
899
+ "eslint-plugin-toml": "0.12.0",
900
+ "eslint-plugin-turbo": "2.6.3",
901
+ "eslint-plugin-unicorn": "62.0.0",
902
+ "eslint-plugin-unused-imports": "4.3.0",
903
+ "eslint-plugin-yaml": "1.1.3",
904
+ "eslint-plugin-yml": "1.19.1",
905
+ knip: "5.75.1",
906
+ prettier: "3.7.4",
907
+ "prettier-plugin-embed": "0.5.0",
908
+ "prettier-plugin-jsdoc": "1.8.0",
909
+ "prettier-plugin-sql": "0.19.2",
910
+ publint: "0.3.16",
911
+ "sort-package-json": "3.6.0",
912
+ syncpack: "14.0.0-alpha.32",
913
+ tsup: "8.5.1",
914
+ tsx: "4.21.0",
915
+ "type-fest": "5.3.1",
916
+ "typescript-eslint": "8.50.0"
917
+ };
867
918
 
868
919
  // src/datamitsu-config/env.ts
869
920
  var env = () => {
@@ -981,6 +1032,24 @@ var ignoreGroups = {
981
1032
  ]
982
1033
  };
983
1034
 
1035
+ // src/datamitsu-config/utils/cleanDependencies.ts
1036
+ var cleanDependencies = (deps) => {
1037
+ if (env().DATAMITSU_DEV_MODE) {
1038
+ return deps;
1039
+ }
1040
+ if (!deps) return;
1041
+ const excludeDependencyNameList = [...Object.keys(dependencies), "typescript"];
1042
+ return Object.entries(deps).reduce(
1043
+ (acc, [name2, version2]) => {
1044
+ if (!excludeDependencyNameList.includes(name2)) {
1045
+ acc[name2] = version2;
1046
+ }
1047
+ return acc;
1048
+ },
1049
+ {}
1050
+ );
1051
+ };
1052
+
984
1053
  // src/datamitsu-config/cmdInit.ts
985
1054
  var init = {
986
1055
  ".dockerignore": {
@@ -1447,40 +1516,42 @@ var init = {
1447
1516
  "package.json": {
1448
1517
  content: ({ existingContent, isRoot }) => {
1449
1518
  const data = JSON.parse(existingContent || "{}");
1450
- return JSON.stringify(
1451
- {
1452
- ...data,
1453
- eslintConfig: void 0,
1454
- prettier: void 0,
1455
- scripts: {
1456
- ...data.scripts,
1457
- ...isRoot ? {
1458
- postinstall: env().DATAMITSU_DEV_MODE ? "pnpm build:lib && pnpm datamitsu init" : "datamitsu init"
1459
- } : {},
1460
- ...env().DATAMITSU_DEV_MODE ? {
1461
- fix: "pnpm datamitsu fix",
1462
- lint: "pnpm datamitsu lint"
1463
- } : {
1464
- fix: "datamitsu fix",
1465
- lint: "datamitsu lint"
1466
- }
1467
- },
1468
- syncpack: void 0,
1469
- type: "module",
1470
- ...typeof data.config === "object" ? {
1471
- config: {
1472
- ...data.config,
1473
- syncpack: void 0
1474
- }
1519
+ const config = {
1520
+ ...data,
1521
+ scripts: {
1522
+ ...data.scripts,
1523
+ ...isRoot ? {
1524
+ postinstall: env().DATAMITSU_DEV_MODE ? "pnpm build:lib && pnpm datamitsu init" : "datamitsu init"
1475
1525
  } : {},
1476
- devDependencies: {
1477
- ...data.devDependencies,
1478
- ...env().DATAMITSU_DEV_MODE ? {} : { [name]: version }
1526
+ ...env().DATAMITSU_DEV_MODE ? {
1527
+ fix: "pnpm datamitsu fix",
1528
+ lint: "pnpm datamitsu lint"
1529
+ } : {
1530
+ fix: "datamitsu fix",
1531
+ lint: "datamitsu lint"
1479
1532
  }
1480
1533
  },
1481
- null,
1482
- 2
1483
- );
1534
+ type: "module",
1535
+ ...typeof data.config === "object" ? {
1536
+ config: {
1537
+ ...data.config,
1538
+ syncpack: void 0
1539
+ }
1540
+ } : {},
1541
+ dependencies: cleanDependencies(data.dependencies),
1542
+ devDependencies: {
1543
+ ...cleanDependencies(data.devDependencies),
1544
+ ...env().DATAMITSU_DEV_MODE ? {} : { [name]: version }
1545
+ },
1546
+ optionalDependencies: cleanDependencies(data.optionalDependencies),
1547
+ peerDependencies: cleanDependencies(data.peerDependencies),
1548
+ ...{
1549
+ eslintConfig: void 0,
1550
+ prettier: void 0,
1551
+ syncpack: void 0
1552
+ }
1553
+ };
1554
+ return JSON.stringify(config, null, 2);
1484
1555
  },
1485
1556
  projectTypes: ["npm-package"]
1486
1557
  },
@@ -1614,11 +1685,12 @@ var prettierGlobs = [
1614
1685
  "**/*.ts",
1615
1686
  "**/*.mts",
1616
1687
  "**/*.cts",
1688
+ "**/*.tsx",
1617
1689
  "**/*.json",
1618
1690
  "**/*.yaml",
1619
1691
  "**/*.md"
1620
1692
  ];
1621
- var eslintGlobs = ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.ts", "**/*.mts", "**/*.cts"];
1693
+ var eslintGlobs = ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.ts", "**/*.mts", "**/*.cts", "**/*.tsx"];
1622
1694
  var toolsConfig = {
1623
1695
  eslint: {
1624
1696
  name: "Eslint",
@@ -0,0 +1,27 @@
1
+ import type { PackageJson } from "type-fest";
2
+ export interface CleanPackageOptions {
3
+ /**
4
+ * Dry run - don't write changes
5
+ * @default false
6
+ */
7
+ dryRun?: boolean;
8
+ /**
9
+ * Fields to remove from package.json
10
+ * @default ["scripts", "devDependencies", "packageManager"]
11
+ */
12
+ fieldsToRemove?: (keyof PackageJson)[];
13
+ /**
14
+ * Path to package.json file
15
+ * @default "package.json"
16
+ */
17
+ packagePath?: string;
18
+ }
19
+ /**
20
+ * Clean package.json by removing specified fields
21
+ * Useful for prepack/prepublishOnly hooks
22
+ */
23
+ export declare const cleanPackage: (options?: CleanPackageOptions) => void;
24
+ /**
25
+ * CLI entry point
26
+ */
27
+ export declare const main: () => void;
@@ -0,0 +1,32 @@
1
+ // src/clean-package/index.ts
2
+ import { readFileSync, writeFileSync } from "fs";
3
+ import { resolve } from "path";
4
+ var DEFAULT_FIELDS_TO_REMOVE = ["scripts", "devDependencies", "packageManager"];
5
+ var cleanPackage = (options = {}) => {
6
+ const { dryRun = false, fieldsToRemove = DEFAULT_FIELDS_TO_REMOVE, packagePath = "package.json" } = options;
7
+ const absolutePath = resolve(process.cwd(), packagePath);
8
+ try {
9
+ const packageJson = JSON.parse(readFileSync(absolutePath, "utf-8"));
10
+ const cleaned = { ...packageJson };
11
+ for (const field of fieldsToRemove) {
12
+ delete cleaned[field];
13
+ }
14
+ if (dryRun) {
15
+ console.log("Dry run - would remove fields:", fieldsToRemove);
16
+ console.log("Cleaned package.json:", JSON.stringify(cleaned, null, 2));
17
+ return;
18
+ }
19
+ writeFileSync(absolutePath, JSON.stringify(cleaned, null, 2) + "\n", "utf-8");
20
+ console.log(`\u2713 Cleaned ${packagePath}, removed fields:`, fieldsToRemove);
21
+ } catch (error) {
22
+ console.error(`Error cleaning package.json:`, error);
23
+ throw error;
24
+ }
25
+ };
26
+ var main = () => {
27
+ cleanPackage();
28
+ };
29
+ export {
30
+ cleanPackage,
31
+ main
32
+ };
@@ -0,0 +1 @@
1
+ export declare const cleanDependencies: (deps: Partial<Record<string, string>> | undefined) => Partial<Record<string, string>> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shibanet0/datamitsu-config",
3
- "version": "0.0.1-alpha-5",
3
+ "version": "0.0.1-alpha-7",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -37,13 +37,19 @@
37
37
  "import": {
38
38
  "types": "./dist/type-fest/index.d.ts"
39
39
  }
40
+ },
41
+ "./clean-package": {
42
+ "import": {
43
+ "types": "./dist/clean-package/index.d.ts",
44
+ "default": "./dist/clean-package/index.js"
45
+ }
40
46
  }
41
47
  },
42
48
  "bin": {
49
+ "clean-package": "bin/clean-package.mjs",
43
50
  "datamitsu": "bin/datamitsu.mjs",
44
51
  "tsc": "bin/tsc.mjs",
45
- "tsx": "bin/tsx.mjs",
46
- "tsx2": "bin/tsx.mjs"
52
+ "tsx": "bin/tsx.mjs"
47
53
  },
48
54
  "files": [
49
55
  "datamitsu.js",
@@ -51,29 +57,13 @@
51
57
  "dist/**",
52
58
  "bin/**"
53
59
  ],
54
- "scripts": {
55
- "build": "pnpm build:lib && tsup && tsgo --emitDeclarationOnly",
56
- "build:datamitsu-config": "tsup --config ./tsup.config.datamitsu.ts && mv dist-datamitsu-config/main.js datamitsu.js",
57
- "build:lib": "pnpm build:lib:datamitsu-types && pnpm build:datamitsu-config",
58
- "build:lib:datamitsu-types": "pnpm build:lib:datamitsu-types:1 && pnpm build:lib:datamitsu-types:2",
59
- "build:lib:datamitsu-types:1": "echo \"// prettier-ignore\" > src/datamitsu-config/datamitsu.d.ts && datamitsu config types >> src/datamitsu-config/datamitsu.d.ts",
60
- "build:lib:datamitsu-types:2": "echo \"// prettier-ignore\" > scripts/datamitsu.d.ts && datamitsu config types >> scripts/datamitsu.d.ts",
61
- "datamitsu": "DATAMITSU_DEV_MODE=true DATAMITSU_PACKAGE_NAME=\"./dist\" bin/datamitsu.mjs --binary-command \"node bin/datamitsu.mjs\"",
62
- "fix": "pnpm datamitsu fix",
63
- "preinstall": "npx only-allow@1.2.2 pnpm",
64
- "postinstall": "pnpm build:lib && pnpm datamitsu init",
65
- "knip": "knip",
66
- "lint": "pnpm datamitsu lint",
67
- "pull": "tsx scripts/pull.ts",
68
- "temp:publish": "npm publish --tag next --access public"
69
- },
70
60
  "dependencies": {
71
61
  "@antebudimir/eslint-plugin-vanilla-extract": "1.16.0",
72
62
  "@commitlint/cli": "20.2.0",
73
63
  "@commitlint/config-conventional": "20.2.0",
74
64
  "@commitlint/format": "20.2.0",
75
65
  "@commitlint/types": "20.2.0",
76
- "@datamitsu/datamitsu": "0.0.1-alpha-13",
66
+ "@datamitsu/datamitsu": "0.0.1-alpha-17",
77
67
  "@eslint/config-helpers": "0.5.0",
78
68
  "@eslint/js": "9.39.2",
79
69
  "@prettier/plugin-xml": "3.4.2",
@@ -117,10 +107,5 @@
117
107
  "tsx": "4.21.0",
118
108
  "type-fest": "5.3.1",
119
109
  "typescript-eslint": "8.50.0"
120
- },
121
- "devDependencies": {
122
- "@octokit/rest": "22.0.1",
123
- "@types/node": "25.0.2"
124
- },
125
- "packageManager": "pnpm@10.20.0"
110
+ }
126
111
  }